[GRASS-SVN] r48694 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Oct 9 17:35:07 EDT 2011


Author: martinl
Date: 2011-10-09 14:35:07 -0700 (Sun, 09 Oct 2011)
New Revision: 48694

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py
Log:
wxGUI/MapLayersDialog: show only mapsets in search path


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py	2011-10-09 21:17:00 UTC (rev 48693)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py	2011-10-09 21:35:07 UTC (rev 48694)
@@ -922,7 +922,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/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py	2011-10-09 21:17:00 UTC (rev 48693)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py	2011-10-09 21:35:07 UTC (rev 48694)
@@ -891,9 +891,11 @@
 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, **kwargs):
+                 gisdbase = None, location = None, setItems = True,
+                 searchPath = False, **kwargs):
         super(MapsetSelect, self).__init__(parent, id, size = size, 
                                            style = wx.CB_READONLY, **kwargs)
+        self.searchPath = searchPath
         
         self.SetName("MapsetSelect")
         if not gisdbase:
@@ -907,8 +909,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
 
@@ -919,10 +921,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