Преглед на файлове

wxGUI/MapLayersDialog: show only mapsets in search path
(merge https://trac.osgeo.org/grass/changeset/48694 from devbr6)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@48697 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa преди 13 години
родител
ревизия
af19b70756
променени са 2 файла, в които са добавени 17 реда и са изтрити 6 реда
  1. 1 1
      gui/wxpython/gui_modules/gdialogs.py
  2. 16 5
      gui/wxpython/gui_modules/gselect.py

+ 1 - 1
gui/wxpython/gui_modules/gdialogs.py

@@ -977,7 +977,7 @@ class MapLayersDialog(wx.Dialog):
                       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))

+ 16 - 5
gui/wxpython/gui_modules/gselect.py

@@ -906,12 +906,14 @@ class LocationSelect(wx.ComboBox):
 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 @@ class MapsetSelect(wx.ComboBox):
             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 @@ class MapsetSelect(wx.ComboBox):
             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,