[GRASS-SVN] r54994 - grass/trunk/gui/wxpython/gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Feb 10 08:16:16 PST 2013


Author: annakrat
Date: 2013-02-10 08:16:16 -0800 (Sun, 10 Feb 2013)
New Revision: 54994

Modified:
   grass/trunk/gui/wxpython/gui_core/gselect.py
Log:
wxGUI: attempt to fix map selection widget keyboard navigation

Modified: grass/trunk/gui/wxpython/gui_core/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/gselect.py	2013-02-10 14:57:09 UTC (rev 54993)
+++ grass/trunk/gui/wxpython/gui_core/gselect.py	2013-02-10 16:16:16 UTC (rev 54994)
@@ -98,15 +98,17 @@
                              multiple = multiple, nmaps = nmaps,
                              updateOnPopup = updateOnPopup, onPopup = onPopup,
                              fullyQualified = fullyQualified, extraItems = extraItems)
-        self.GetChildren()[0].Bind(wx.EVT_KEY_UP, self.OnKeyUp)
-     
-    def OnKeyUp(self, event):
-        """!Shows popupwindow if down arrow key is released"""
-        if event.GetKeyCode() == wx.WXK_DOWN and not self.IsPopupShown():
-            self.ShowPopup() 
+        self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
+
+    def OnKeyDown(self, event):
+        """!Open popup and send key events to the tree."""
+        if self.IsPopupShown():
+            self.tcp.OnKeyDown(event)
         else:
+            if event.GetKeyCode() == wx.WXK_DOWN:
+                self.ShowPopup()
             event.Skip()
-        
+
     def SetElementList(self, type, mapsets = None):
         """!Set element list
 
@@ -181,7 +183,6 @@
                                    |wx.TR_LINES_AT_ROOT
                                    |wx.SIMPLE_BORDER
                                    |wx.TR_FULL_ROW_HIGHLIGHT)
-        self.seltree.Bind(wx.EVT_KEY_UP, self.OnKeyUp)
         self.seltree.Bind(wx.EVT_MOTION, self.OnMotion)
         self.seltree.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
         self.seltree.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.mapsetExpanded)
@@ -474,9 +475,8 @@
         data = {'node': node, 'mapset': mapset}
         item = self.seltree.AppendItem(parent, text = value, data = wx.TreeItemData(data))
         return item
-    
-    # able to recieve only wx.EVT_KEY_UP
-    def OnKeyUp(self, event):
+
+    def OnKeyDown(self, event):
         """!Enables to select items using keyboard"""
         
         item = self.seltree.GetSelection()



More information about the grass-commit mailing list