commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r8216 - in trunk/gnue-forms/src: input uidrivers/_base uidrivers/


From: johannes
Subject: [gnue] r8216 - in trunk/gnue-forms/src: input uidrivers/_base uidrivers/wx26/widgets
Date: Fri, 10 Mar 2006 12:03:24 -0600 (CST)

Author: johannes
Date: 2006-03-10 12:03:23 -0600 (Fri, 10 Mar 2006)
New Revision: 8216

Modified:
   trunk/gnue-forms/src/input/GFKeyMapper.py
   trunk/gnue-forms/src/uidrivers/_base/UserActions.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/button.py
Log:
Don't add up- and down-keys to the menu-items (as hotkeys), but still 
keep them functional through the KeyMapper. This allows controls (like 
dropdowns) on wx.MSW to make use of the normal up/down keys.


Modified: trunk/gnue-forms/src/input/GFKeyMapper.py
===================================================================
--- trunk/gnue-forms/src/input/GFKeyMapper.py   2006-03-08 07:56:59 UTC (rev 
8215)
+++ trunk/gnue-forms/src/input/GFKeyMapper.py   2006-03-10 18:03:23 UTC (rev 
8216)
@@ -60,6 +60,15 @@
     self.__keyTranslations = {}
 
 
+  def getKeyTranslation (self, aKey):
+    """
+    Return the actual key for a given vk.* constant, as it will be used by the
+    UI driver.
+    """
+
+    return self.__keyTranslations.get (aKey)
+
+
   def setUIKeyMap(self, keyset):
     """
     Called by the UI class to setup their required key mappings.

Modified: trunk/gnue-forms/src/uidrivers/_base/UserActions.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/_base/UserActions.py 2006-03-08 07:56:59 UTC 
(rev 8215)
+++ trunk/gnue-forms/src/uidrivers/_base/UserActions.py 2006-03-10 18:03:23 UTC 
(rev 8216)
@@ -74,6 +74,15 @@
       m.update(metamappings)
     else:
       m = _baseKeyMap
+
+    hotKey = self.getHotKeyTuple ()
+    if hotKey:
+      (key, shift, ctrl, meta) = hotKey
+      up   = GFKeyMapper.KeyMapper.getKeyTranslation (GFKeyMapper.vk.UP)
+      down = GFKeyMapper.KeyMapper.getKeyTranslation (GFKeyMapper.vk.DOWN)
+      if not (shift or ctrl or meta) and key in [up, down]:
+        return None
+
     return GFKeyMapper.KeyMapper.getEventKeystrokeRepr(self.event,
         metamappings=m, separator=separator)
 

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/button.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/button.py       2006-03-08 
07:56:59 UTC (rev 8215)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/button.py       2006-03-10 
18:03:23 UTC (rev 8216)
@@ -50,16 +50,23 @@
     size = (self.itemWidth, -1)
 
     newWidget = wx.Button (event.container, -1, self._gfObject.label, pos, 
size)
-    newWidget.Bind (wx.EVT_BUTTON, lambda x: self._gfObject.doFire ())
-    newWidget.Bind (wx.EVT_SET_FOCUS, self.__setFocus)
+    newWidget.Bind (wx.EVT_BUTTON   , self.__on_button)
+    newWidget.Bind (wx.EVT_SET_FOCUS, self.__on_set_focus)
 
     return newWidget
 
 
   # ---------------------------------------------------------------------------
 
-  def __setFocus (self, event):
+  def __on_button (self, event):
+    
+    self._gfObject.doFire ()
 
+
+  # ---------------------------------------------------------------------------
+
+  def __on_set_focus (self, event):
+
     if self._form._currentEntry != self._gfObject:
       self._request ('FOCUS', data = self._gfObject)
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]