rename variable, use keysyms in props dialog
authorJosh Blum <josh@joshknows.com>
Fri, 11 Sep 2009 00:38:53 +0000 (17:38 -0700)
committerJosh Blum <josh@joshknows.com>
Fri, 11 Sep 2009 00:38:53 +0000 (17:38 -0700)
grc/gui/Actions.py
grc/gui/PropsDialog.py

index d3d63f293013a00cd050cae1df9578d57d165ac8..cacee22ce120d7529b85a9c836e0b8a0d9ab1673 100644 (file)
@@ -98,7 +98,7 @@ _actions_key_list = (
 )
 
 _actions_key_dict = dict(((key_val, mod_mask), action_name) for action_name, key_val, mod_mask in _actions_key_list)
-_all_mods_mask = reduce(lambda x, y: x | y, [mod_mask for action_name, key_val, mod_mask in _actions_key_list], NO_MODS_MASK)
+_used_mods_mask = reduce(lambda x, y: x | y, [mod_mask for action_name, key_val, mod_mask in _actions_key_list], NO_MODS_MASK)
 def get_action_name_from_key_press(key_val, mod_mask=NO_MODS_MASK):
        """
        Get the action name associated with the key value and mask.
@@ -107,7 +107,7 @@ def get_action_name_from_key_press(key_val, mod_mask=NO_MODS_MASK):
        @param mod_mask the key press mask (shift, ctrl) 0 for none
        @return the action name or blank string
        """
-       mod_mask &= _all_mods_mask #ignore irrelevant modifiers
+       mod_mask &= _used_mods_mask #ignore irrelevant modifiers
        key_val_mod_mask = (key_val, mod_mask)
        try: return _actions_key_dict[key_val_mod_mask]
        except KeyError: return ''
index 29b3c7b40ce129c4f3143286683ae758672f830c..b295ba412330763d924f2d12a0ba03d0eb7dea8e 100644 (file)
@@ -154,8 +154,9 @@ class PropsDialog(gtk.Dialog):
                Call the ok response when enter is pressed.
                @return false to forward the keypress
                """
-               keyname = gtk.gdk.keyval_name(event.keyval)
-               if keyname == 'Return': self.response(gtk.RESPONSE_ACCEPT)
+               if event.keyval == gtk.keysyms.Return:
+                       self.response(gtk.RESPONSE_ACCEPT)
+                       return True #handled here
                return False #forward the keypress
 
        def run(self):