[GRASS-SVN] r48528 - in grass/trunk/gui/wxpython: . xml
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Sep 28 06:34:17 EDT 2011
Author: martinl
Date: 2011-09-28 03:34:16 -0700 (Wed, 28 Sep 2011)
New Revision: 48528
Modified:
grass/trunk/gui/wxpython/wxgui.py
grass/trunk/gui/wxpython/xml/menudata.xml
Log:
wxGUI: handler for creating new mapset
Modified: grass/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py 2011-09-28 10:11:30 UTC (rev 48527)
+++ grass/trunk/gui/wxpython/wxgui.py 2011-09-28 10:34:16 UTC (rev 48528)
@@ -636,21 +636,45 @@
{ 'loc' : location, 'mapset' : mapset },
caption = _("Info"), style = wx.OK | wx.ICON_INFORMATION | wx.CENTRE)
+ def OnCreateMapset(self, event):
+ """!Create new mapset"""
+ dlg = wx.TextEntryDialog(parent = self,
+ message = _('Enter name for new mapset:'),
+ caption = _('Create new mapset'))
+
+ if dlg.ShowModal() == wx.ID_OK:
+ mapset = dlg.GetValue()
+ if not mapset:
+ gcmd.GError(parent = self,
+ message = _("No mapset provided. Operation canceled."))
+ return
+
+ ret = gcmd.RunCommand('g.mapset',
+ parent = self,
+ flags = 'c',
+ mapset = mapset)
+ if ret == 0:
+ gcmd.GMessage(parent = self,
+ message = _("Current mapset is <%s>.") % mapset)
+
def OnChangeMapset(self, event):
"""Change current mapset"""
dlg = gdialogs.MapsetDialog(parent = self)
+
if dlg.ShowModal() == wx.ID_OK:
mapset = dlg.GetMapset()
- if mapset:
- if gcmd.RunCommand("g.gisenv",
- set = "MAPSET=%s" % mapset) != 0:
- wx.MessageBox(parent = self,
- message = _("Unable to switch to mapset <%s>.") % mapset,
- caption = _("Error"), style = wx.OK | wx.ICON_ERROR | wx.CENTRE)
- else:
- wx.MessageBox(parent = self,
- message = _("Current mapset is <%s>.") % mapset,
- caption = _("Info"), style = wx.OK | wx.ICON_INFORMATION | wx.CENTRE)
+ if not mapset:
+ gcmd.GError(parent = self,
+ message = _("No mapset provided. Operation canceled."))
+ return
+
+ ret = gcmd.RunCommand('g.mapset',
+ parent = self,
+ mapset = mapset)
+
+ if ret == 0:
+ gcmd.GMessage(parent = self,
+ message = _("Current mapset is <%s>.") % mapset)
def OnNewVector(self, event):
"""!Create new vector map layer"""
Modified: grass/trunk/gui/wxpython/xml/menudata.xml
===================================================================
--- grass/trunk/gui/wxpython/xml/menudata.xml 2011-09-28 10:11:30 UTC (rev 48527)
+++ grass/trunk/gui/wxpython/xml/menudata.xml 2011-09-28 10:34:16 UTC (rev 48528)
@@ -820,11 +820,13 @@
<menuitem>
<label>Change location and mapset</label>
<help>Change current location and mapset.</help>
+ <keywords>general,location,current</keywords>
<handler>OnChangeLocation</handler>
</menuitem>
<menuitem>
<label>Change mapset</label>
<help>Change current mapset.</help>
+ <keywords>general,mapset,current</keywords>
<handler>OnChangeMapset</handler>
</menuitem>
<separator />
@@ -846,9 +848,15 @@
<menuitem>
<label>Create new location</label>
<help>Launches location wizard to create new GRASS location.</help>
- <keywords>location, wizard</keywords>
+ <keywords>general,location,wizard</keywords>
<handler>OnLocationWizard</handler>
</menuitem>
+ <menuitem>
+ <label>Create new mapset</label>
+ <help>Creates new mapset in the current location, changes current mapset.</help>
+ <keywords>general,mapset,create</keywords>
+ <handler>OnCreateMapset</handler>
+ </menuitem>
<separator />
<menuitem>
<label>Version</label>
More information about the grass-commit
mailing list