Browse Source

wxGUI/gselect: try to catch different key events, it's unclear which events are emitted from which part of the widget, on the same version of Ubuntu and wxPython, I get different behavior

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@63287 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 10 years ago
parent
commit
4eb3975dc3
1 changed files with 9 additions and 3 deletions
  1. 9 3
      gui/wxpython/gui_core/gselect.py

+ 9 - 3
gui/wxpython/gui_core/gselect.py

@@ -110,9 +110,15 @@ class Select(wx.combo.ComboCtrl):
 
     def OnKeyDown(self, event):
         """Open popup and send key events to the tree."""
-        if event.GetKeyCode() == wx.WXK_DOWN:
-            self.ShowPopup()
-        event.Skip()
+        if self.IsPopupShown():
+            # on some configurations we get key down, with some only key up
+            # so we are trying to catch either key up or down
+            # this mess shouldn't be necessary with wxPython 3
+            self.tcp.OnKeyUp(event)
+        else:
+            if event.GetKeyCode() == wx.WXK_DOWN:
+                self.ShowPopup()
+            event.Skip()
 
     def SetElementList(self, type, mapsets = None):
         """Set element list