[GRASS-SVN] r47297 - in grass/branches/develbranch_6/gui/wxpython: . xml

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 28 11:18:49 EDT 2011


Author: martinl
Date: 2011-07-28 08:18:49 -0700 (Thu, 28 Jul 2011)
New Revision: 47297

Modified:
   grass/branches/develbranch_6/gui/wxpython/wxgui.py
   grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml
Log:
wxGUI: location wizard also accessible from Layer Manager
       (merge r47296 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/wxgui.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/wxgui.py	2011-07-28 15:15:47 UTC (rev 47296)
+++ grass/branches/develbranch_6/gui/wxpython/wxgui.py	2011-07-28 15:18:49 UTC (rev 47297)
@@ -297,6 +297,32 @@
         if self.workspaceFile:
             self.SetTitle(self.baseTitle + " - " +  os.path.basename(self.workspaceFile) + '*')
         
+    def OnLocationWizard(self, event):
+        """!Launch location wizard"""
+        from gui_modules import location_wizard
+        
+        gisdbase = grass.gisenv()['GISDBASE']
+        gWizard = location_wizard.LocationWizard(parent = self,
+                                                 grassdatabase = gisdbase)
+        
+        if gWizard.location !=  None:
+            dlg = wx.MessageDialog(parent = self,
+                                   message = _('Location <%s> created.\n\n'
+                                               'Do you want to switch to the '
+                                               'new location?') % gWizard.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:
+                gcmd.RunCommand("g.gisenv",
+                                set = "LOCATION_NAME=%s" % gWizard.location)
+                gcmd.RunCommand("g.gisenv",
+                                set = "MAPSET=PERMANENT")
+            
+            dlg.Destroy()
+            
     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).

Modified: grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml	2011-07-28 15:15:47 UTC (rev 47296)
+++ grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml	2011-07-28 15:18:49 UTC (rev 47297)
@@ -797,6 +797,13 @@
 	    </menuitem>
 	    <separator />
 	    <menuitem>
+	      <label>Create new location</label>
+	      <help>Launches location wizard to create new GRASS location.</help>
+	      <keywords>location, wizard</keywords>
+              <handler>OnLocationWizard</handler>
+	    </menuitem>
+	    <separator />
+	    <menuitem>
 	      <label>Version</label>
 	      <help>Displays version and copyright information.</help>
 	      <keywords>general,version</keywords>



More information about the grass-commit mailing list