[orca] Move some keybindings out of the keymaps file and into the script



commit e7acb978447bb00386b9edcfd4ded2fa6d0683b2
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Jun 8 17:46:26 2015 -0400

    Move some keybindings out of the keymaps file and into the script

 src/orca/scripts/toolkits/Gecko/keymaps.py |   15 +-----------
 src/orca/scripts/toolkits/Gecko/script.py  |   34 +++++++++++++++++++++++-----
 2 files changed, 29 insertions(+), 20 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Gecko/keymaps.py b/src/orca/scripts/toolkits/Gecko/keymaps.py
index 933070d..421a65c 100644
--- a/src/orca/scripts/toolkits/Gecko/keymaps.py
+++ b/src/orca/scripts/toolkits/Gecko/keymaps.py
@@ -58,18 +58,5 @@ arrowKeymap = (
 )
 
 commonKeymap = (
-    ("F12", defaultModifierMask, ORCA_MODIFIER_MASK,
-    "toggleCaretNavigationHandler"),
-
-    ("a", defaultModifierMask, ORCA_MODIFIER_MASK, "togglePresentationModeHandler"),
-    ("a", defaultModifierMask, ORCA_MODIFIER_MASK, "enableStickyFocusModeHandler", 2),
-)
-
-desktopKeymap = (
-    ("KP_Multiply", defaultModifierMask, ORCA_MODIFIER_MASK, 
-    "moveToMouseOverHandler"),
-)
-
-laptopKeymap = (
-    ("0", defaultModifierMask, ORCA_MODIFIER_MASK, "moveToMouseOverHandler"),
+    ("F12", defaultModifierMask, ORCA_MODIFIER_MASK, "toggleCaretNavigationHandler"),
 )
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 034c720..0424d5e 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -410,12 +410,6 @@ class Script(default.Script):
 
         keyBindings.load(keymaps.commonKeymap, self.inputEventHandlers)
 
-        if _settingsManager.getSetting('keyboardLayout') == \
-                orca.settings.GENERAL_KEYBOARD_LAYOUT_DESKTOP:
-            keyBindings.load(keymaps.desktopKeymap, self.inputEventHandlers)
-        else:
-            keyBindings.load(keymaps.laptopKeymap, self.inputEventHandlers)
-
         if _settingsManager.getSetting('caretNavigationEnabled'):
             for keyBinding in self.__getArrowBindings().keyBindings:
                 keyBindings.add(keyBinding)
@@ -428,6 +422,34 @@ class Script(default.Script):
         for keyBinding in liveRegionBindings.keyBindings:
             keyBindings.add(keyBinding)
 
+        keyBindings.add(
+            keybindings.KeyBinding(
+                "a",
+                keybindings.defaultModifierMask,
+                keybindings.ORCA_MODIFIER_MASK,
+                self.inputEventHandlers.get("togglePresentationModeHandler")))
+
+        keyBindings.add(
+            keybindings.KeyBinding(
+                "a",
+                keybindings.defaultModifierMask,
+                keybindings.ORCA_MODIFIER_MASK,
+                self.inputEventHandlers.get("enableStickyFocusModeHandler"),
+                2))
+
+        layout = _settingsManager.getSetting('keyboardLayout')
+        if layout == settings.GENERAL_KEYBOARD_LAYOUT_DESKTOP:
+            key = "KP_Multiply"
+        else:
+            key = "0"
+
+        keyBindings.add(
+            keybindings.KeyBinding(
+                key,
+                keybindings.defaultModifierMask,
+                keybindings.ORCA_MODIFIER_MASK,
+                self.inputEventHandlers.get("moveToMouseOverHandler")))
+
         return keyBindings
 
     def getAppPreferencesGUI(self):


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