Browse Source

use MapsetSelect

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@39179 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 15 years ago
parent
commit
d579aab06f
2 changed files with 5 additions and 8 deletions
  1. 1 4
      gui/wxpython/gui_modules/gdialogs.py
  2. 4 4
      gui/wxpython/gui_modules/gselect.py

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

@@ -779,10 +779,7 @@ class LoadMapLayersDialog(wx.Dialog):
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       pos=(1,0))
 
-        self.mapset = wx.ComboBox(parent=self, id=wx.ID_ANY,
-                                  style=wx.CB_SIMPLE | wx.CB_READONLY,
-                                  choices=utils.ListOfMapsets(),
-                                  size=(250,-1))
+        self.mapset = gselect.MapsetSelect(parent = self)
         self.mapset.SetStringSelection(grass.gisenv()['MAPSET'])
         bodySizer.Add(item=self.mapset,
                       pos=(1,1), span=(1, 2))

+ 4 - 4
gui/wxpython/gui_modules/gselect.py

@@ -50,14 +50,13 @@ class Select(wx.combo.ComboCtrl):
         self.GetChildren()[0].type = type
         
         self.tcp = TreeCtrlComboPopup()
-
         self.SetPopupControl(self.tcp)
         self.SetPopupExtents(0,100)
         if type:
             self.tcp.SetData(type = type, mapsets = mapsets,
                              exclude = exclude, multiple = multiple,
                              updateOnPopup = updateOnPopup)
-
+        
     def SetElementList(self, type, mapsets = None, exclude = []):
         """!Set element list
 
@@ -690,7 +689,7 @@ 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, **kwargs):
+                 gisdbase = None, location = None, setItems = True, **kwargs):
         super(MapsetSelect, self).__init__(parent, id, size = size, 
                                            style = wx.CB_READONLY, **kwargs)
         
@@ -706,4 +705,5 @@ class MapsetSelect(wx.ComboBox):
         else:
             self.location = location
         
-        self.SetItems(utils.GetListOfMapsets(self.gisdbase, self.location, selectable = True)) # selectable
+        if setItems:
+            self.SetItems(utils.GetListOfMapsets(self.gisdbase, self.location, selectable = True)) # selectable