소스 검색

wxGUI/forms: fix updating dependent widgets with wxPython 3 (merge from trunk, https://trac.osgeo.org/grass/changeset/63173, https://trac.osgeo.org/grass/changeset/63199)

git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@63215 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 10 년 전
부모
커밋
f9fe14d349
1개의 변경된 파일13개의 추가작업 그리고 5개의 파일을 삭제
  1. 13 5
      gui/wxpython/gui_core/forms.py

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

@@ -1216,12 +1216,20 @@ class CmdPanel(wx.Panel):
                         # A gselect.Select is a combobox with two children: a textctl and a popupwindow;
                         # we target the textctl here
                         textWin = selection.GetTextCtrl()
-                        p['wxId'] = [ textWin.GetId(), ]
-                        textWin.Bind(wx.EVT_TEXT, self.OnSetValue)
-                    
+                        if globalvar.CheckWxVersion([3]):
+                            p['wxId'] = [selection.GetId(), ]
+                        else:
+                            p['wxId'] = [textWin.GetId(), ]
+                        if prompt != 'vector':
+                            self.FindWindowById(p['wxId'][0]).Bind(wx.EVT_TEXT, self.OnSetValue)
+
                     if prompt == 'vector':
-                        selection.Bind(wx.EVT_TEXT, self.OnUpdateSelection)
-                        
+                        win = self.FindWindowById(p['wxId'][0])
+                        # handlers should be bound in this order
+                        # OnUpdateSelection depends on calling OnSetValue first which is bad
+                        win.Bind(wx.EVT_TEXT, self.OnUpdateSelection)
+                        win.Bind(wx.EVT_TEXT, self.OnSetValue)
+
                         # if formatSelector and p.get('age', 'old') == 'old':
                         #     # OGR supported (read-only)
                         #     self.hsizer = wx.BoxSizer(wx.HORIZONTAL)