瀏覽代碼

wxGUI: disable read-only MapsetSelect (related to https://trac.osgeo.org/grass/changeset/58618)
@todo: fix MapsetSelect to allow read-only mode


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

Martin Landa 11 年之前
父節點
當前提交
9baefa4058
共有 3 個文件被更改,包括 16 次插入8 次删除
  1. 2 1
      gui/wxpython/gui_core/dialogs.py
  2. 8 5
      gui/wxpython/gui_core/forms.py
  3. 6 2
      gui/wxpython/gui_core/gselect.py

+ 2 - 1
gui/wxpython/gui_core/dialogs.py

@@ -1354,8 +1354,9 @@ class MapLayersDialogBase(wx.Dialog):
         
         bodySizer.AddGrowableCol(1)
         bodySizer.AddGrowableRow(3)
+        
         # bindings
-        self.mapset.Bind(wx.EVT_COMBOBOX, self.OnChangeParams)
+        self.mapset.Bind(wx.EVT_TEXT, self.OnChangeParams)
         self.layers.Bind(wx.EVT_RIGHT_DOWN, self.OnMenu)
         self.filter.Bind(wx.EVT_TEXT, self.OnFilter)
         self.toggle.Bind(wx.EVT_CHECKBOX, self.OnToggle)

+ 8 - 5
gui/wxpython/gui_core/forms.py

@@ -1362,8 +1362,9 @@ class CmdPanel(wx.Panel):
                                                        param = p,
                                                        multiple =  p.get('multiple', False))
                         
-                            # A gselect.ColumnSelect is a combobox with two children: a textctl and a popupwindow;
-                            # we target the textctl here
+                            # A gselect.ColumnSelect is a combobox
+                            # with two children: a textctl and a
+                            # popupwindow; we target the textctl here
                             textWin = win.GetTextCtrl()
                             p['wxId'] = [ textWin.GetId(), ]
                             
@@ -1385,9 +1386,11 @@ class CmdPanel(wx.Panel):
                             win = gselect.MapsetSelect(parent = which_panel,
                                                        value = value, new = new,
                                                        multiple = p.get('multiple', False))
-                            win.Bind(wx.EVT_COMBOBOX,     self.OnUpdateSelection)
-                            win.Bind(wx.EVT_COMBOBOX,     self.OnSetValue) 
-                            win.Bind(wx.EVT_TEXT,         self.OnSetValue)
+                            textWin = win.GetTextCtrl()
+                            p['wxId'] = [ textWin.GetId(), ]
+                            
+                            textWin.Bind(wx.EVT_TEXT, self.OnSetValue)
+                            win.Bind(wx.EVT_TEXT, self.OnUpdateSelection)
                             
                         elif prompt == 'dbase':
                             win = gselect.DbaseSelect(parent = which_panel,

+ 6 - 2
gui/wxpython/gui_core/gselect.py

@@ -159,6 +159,9 @@ class VectorSelect(Select):
 
 class ListCtrlComboPopup(wx.combo.ComboPopup):
     """!Create a list ComboBox using TreeCtrl with hidden root.
+
+    @todo: use event.EventObject instead of hardcoding (see forms.py)
+    https://groups.google.com/forum/#!topic/wxpython-users/pRz6bi0k0XY
     """    
     # overridden ComboPopup methods
     def Init(self):
@@ -1072,8 +1075,9 @@ class MapsetSelect(wx.combo.ComboCtrl):
                  gisdbase = None, location = None, setItems = True,
                  searchPath = False, new = False, skipCurrent = False, multiple = False, **kwargs):
         style = 0
-        if not new and not multiple:
-            style = wx.CB_READONLY
+        ### disabled, read-only widget has no TextCtrl children (TODO: rewrite)
+        ### if not new and not multiple:
+        ###     style = wx.CB_READONLY
         
         wx.combo.ComboCtrl.__init__(self, parent, id, size = size, 
                                     style = style, **kwargs)