Browse Source

wxGUI: MapsetSelect() only optionally read-only

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@48012 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 years ago
parent
commit
71f54af996
2 changed files with 15 additions and 12 deletions
  1. 5 2
      gui/wxpython/gui_modules/gselect.py
  2. 10 10
      gui/wxpython/gui_modules/menuform.py

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

@@ -905,9 +905,12 @@ 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, **kwargs):
+                 gisdbase = None, location = None, setItems = True, new = False, **kwargs):
+        style = 0
+        if not new:
+            style = wx.CB_READONLY
         super(MapsetSelect, self).__init__(parent, id, size = size, 
-                                           style = wx.CB_READONLY, **kwargs)
+                                           style = style, **kwargs)
         
         self.SetName("MapsetSelect")
         if not gisdbase:

+ 10 - 10
gui/wxpython/gui_modules/menuform.py

@@ -1280,11 +1280,16 @@ class cmdPanel(wx.Panel):
                             win.Bind(wx.EVT_COMBOBOX,     self.OnUpdateSelection)
                             win.Bind(wx.EVT_COMBOBOX,     self.OnSetValue)
                         
-                        elif p.get('prompt', '') ==  'mapset':
+                        elif p.get('prompt', '') == 'mapset':
+                            if p.get('age', 'old') == 'old':
+                                new = False
+                            else:
+                                new = True
                             win = gselect.MapsetSelect(parent = which_panel,
-                                                       value = value)
+                                                       value = value, new = new)
                             win.Bind(wx.EVT_COMBOBOX,     self.OnUpdateSelection)
-                            win.Bind(wx.EVT_COMBOBOX,     self.OnSetValue)
+                            win.Bind(wx.EVT_COMBOBOX,     self.OnSetValue) 
+                            win.Bind(wx.EVT_TEXT,         self.OnSetValue)
                             
                         elif p.get('prompt', '') ==  'dbase':
                             win = gselect.DbaseSelect(parent = which_panel,
@@ -1761,18 +1766,13 @@ class cmdPanel(wx.Panel):
         if not found:
             return
         
-        if name in ('DriverSelect', 'TableSelect',
-                    'LocationSelect', 'MapsetSelect', 'ProjSelect'):
-            porf['value'] = me.GetStringSelection()
-        elif name ==  'GdalSelect':
+        if name ==  'GdalSelect':
             porf['value'] = event.dsn
         elif name ==  'ModelParam':
             porf['parameterized'] = me.IsChecked()
-        elif name ==  'LayerSelect':
-            porf['value'] = me.GetValue()
         else:
             porf['value'] = me.GetValue()
-        
+
         self.OnUpdateValues(event)
         
         event.Skip()