浏览代码

Fixed not creating location in new GISDbase.

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@36316 15284696-431f-4ddb-bdfa-cd5b030d7da7
Michael Barton 16 年之前
父节点
当前提交
002566413c
共有 1 个文件被更改,包括 16 次插入0 次删除
  1. 16 0
      gui/wxpython/gui_modules/location_wizard.py

+ 16 - 0
gui/wxpython/gui_modules/location_wizard.py

@@ -46,6 +46,7 @@ import wx.wizard as wiz
 import gcmd
 import globalvar
 import utils
+import grass
 try:
     import subprocess
 except:
@@ -1850,6 +1851,21 @@ class LocationWizard(wx.Object):
             dlg.ShowModal()
             dlg.Destroy()
             return False
+        
+        # current GISDbase or a new one?
+        current_gdb = grass.gisenv()['GISDBASE']
+        if current_gdb != database:
+            # change to new GISDbase or create new one
+            if os.path.isdir(database) != True:
+                # create new directory
+                os.mkdir(database)
+                
+            # change to new GISDbase directory
+            grass.run_command('g.gisenv', set='GISDBASE=%s' % database)
+            wx.MessageBox(parent=self.wizard,
+                                message=_("You will need to change the default GIS data directory in the GRASS startup screen"),
+                                caption=("Location <%s> will be created in GIS data directory <%s>") % \
+                                    (location,database), style=wx.OK | wx.ICON_ERROR)
 
         if coordsys == "xy":
             success = self.XYCreate()