[GRASS-SVN] r47296 - in grass/trunk/gui/wxpython: . xml

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 28 11:15:47 EDT 2011


Author: martinl
Date: 2011-07-28 08:15:47 -0700 (Thu, 28 Jul 2011)
New Revision: 47296

Modified:
   grass/trunk/gui/wxpython/wxgui.py
   grass/trunk/gui/wxpython/xml/menudata.xml
Log:
wxGUI: location wizard also accessible from Layer Manager


Modified: grass/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py	2011-07-28 12:33:34 UTC (rev 47295)
+++ grass/trunk/gui/wxpython/wxgui.py	2011-07-28 15:15:47 UTC (rev 47296)
@@ -302,6 +302,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/trunk/gui/wxpython/xml/menudata.xml
===================================================================
--- grass/trunk/gui/wxpython/xml/menudata.xml	2011-07-28 12:33:34 UTC (rev 47295)
+++ grass/trunk/gui/wxpython/xml/menudata.xml	2011-07-28 15:15:47 UTC (rev 47296)
@@ -831,6 +831,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