فهرست منبع

wxGUI/LM: fix OnLocationWizard
(merge https://trac.osgeo.org/grass/changeset/49878 from devbr6)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@49879 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 13 سال پیش
والد
کامیت
134a1fdaf5
1فایلهای تغییر یافته به همراه15 افزوده شده و 11 حذف شده
  1. 15 11
      gui/wxpython/lmgr/frame.py

+ 15 - 11
gui/wxpython/lmgr/frame.py

@@ -310,28 +310,32 @@ class GMFrame(wx.Frame):
         """!Launch location wizard"""
         from location_wizard.wizard import LocationWizard
         
-        gisdbase = grass.gisenv()['GISDBASE']
         gWizard = LocationWizard(parent = self,
-                                 grassdatabase = gisdbase)
+                                 grassdatabase = grass.gisenv()['GISDBASE'])
+        location = gWizard.location
         
-        if gWizard.location !=  None:
+        if location !=  None:
             dlg = wx.MessageDialog(parent = self,
                                    message = _('Location <%s> created.\n\n'
                                                'Do you want to switch to the '
-                                               'new location?') % gWizard.location,
+                                               'new location?') % location,
                                    caption=_("Switch to new location?"),
                                    style = wx.YES_NO | wx.NO_DEFAULT |
                                    wx.ICON_QUESTION | wx.CENTRE)
             
             ret = dlg.ShowModal()
-            if ret == wx.ID_YES:
-                RunCommand("g.gisenv",
-                           set = "LOCATION_NAME=%s" % gWizard.location)
-                RunCommand("g.gisenv",
-                           set = "MAPSET=PERMANENT")
-            
             dlg.Destroy()
-            
+            if ret == wx.ID_YES:
+                if RunCommand('g.mapset', parent = self,
+                              location = location,
+                              mapset = 'PERMANENT') != 0:
+                    return
+                
+                GMessage(parent = self,
+                         message = _("Current location is <%(loc)s>.\n"
+                                     "Current mapset is <%(mapset)s>.") % \
+                             { 'loc' : location, 'mapset' : 'PERMANENT' })
+        
     def OnSettingsChanged(self, event):
         """!Here can be functions which have to be called after EVT_SETTINGS_CHANGED. 
         Now only set copying of selected text to clipboard (in goutput).