[GRASS-SVN] r48697 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Oct 9 17:50:17 EDT 2011
Author: martinl
Date: 2011-10-09 14:50:17 -0700 (Sun, 09 Oct 2011)
New Revision: 48697
Modified:
grass/trunk/gui/wxpython/gui_modules/gdialogs.py
grass/trunk/gui/wxpython/gui_modules/gselect.py
Log:
wxGUI/MapLayersDialog: show only mapsets in search path
(merge r48694 from devbr6)
Modified: grass/trunk/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gdialogs.py 2011-10-09 21:48:44 UTC (rev 48696)
+++ grass/trunk/gui/wxpython/gui_modules/gdialogs.py 2011-10-09 21:50:17 UTC (rev 48697)
@@ -977,7 +977,7 @@
flag = wx.ALIGN_CENTER_VERTICAL,
pos = (1,0))
- self.mapset = gselect.MapsetSelect(parent = self)
+ self.mapset = gselect.MapsetSelect(parent = self, searchPath = True)
self.mapset.SetStringSelection(grass.gisenv()['MAPSET'])
bodySizer.Add(item = self.mapset,
pos = (1,1), span = (1, 2))
Modified: grass/trunk/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gselect.py 2011-10-09 21:48:44 UTC (rev 48696)
+++ grass/trunk/gui/wxpython/gui_modules/gselect.py 2011-10-09 21:50:17 UTC (rev 48697)
@@ -906,12 +906,14 @@
class MapsetSelect(wx.ComboBox):
"""!Widget for selecting GRASS mapset"""
def __init__(self, parent, id = wx.ID_ANY, size = globalvar.DIALOG_COMBOBOX_SIZE,
- gisdbase = None, location = None, setItems = True, new = False, **kwargs):
+ gisdbase = None, location = None, setItems = True,
+ searchPath = False, new = False, **kwargs):
style = 0
if not new:
style = wx.CB_READONLY
super(MapsetSelect, self).__init__(parent, id, size = size,
style = style, **kwargs)
+ self.searchPath = searchPath
self.SetName("MapsetSelect")
if not gisdbase:
@@ -925,8 +927,8 @@
self.location = location
if setItems:
- self.SetItems(utils.GetListOfMapsets(self.gisdbase, self.location, selectable = False)) # selectable
-
+ self.SetItems(self._getMapsets())
+
def UpdateItems(self, location, dbase = None):
"""!Update list of mapsets for given location
@@ -937,10 +939,19 @@
self.gisdbase = dbase
self.location = location
if location:
- self.SetItems(utils.GetListOfMapsets(self.gisdbase, self.location, selectable = False))
+ self.SetItems(self._getMapsets())
else:
self.SetItems([])
+
+ def _getMapsets(self):
+ if self.searchPath:
+ return gcmd.RunCommand('g.mapsets',
+ read = True,
+ flags = 'p',
+ fs = 'newline').splitlines()
+ return utils.GetListOfMapsets(self.gisdbase, self.location, selectable = False)
+
class SubGroupSelect(wx.ComboBox):
"""!Widget for selecting subgroups"""
def __init__(self, parent, id = wx.ID_ANY, size = globalvar.DIALOG_GSELECT_SIZE,
More information about the grass-commit
mailing list