[orca/new-settings] Cause keybindings to be actually used and displayed correctly in the prefs dialog.
- From: Alejandro Leiva <aleiva src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/new-settings] Cause keybindings to be actually used and displayed correctly in the prefs dialog.
- Date: Wed, 27 Oct 2010 14:26:34 +0000 (UTC)
commit 111c015d40b1ba8f872917f177166a8d185327e0
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date: Wed Oct 27 09:51:51 2010 -0400
Cause keybindings to be actually used and displayed correctly in the prefs dialog.
src/orca/settings.py | 5 ++++-
src/orca/settings_manager.py | 29 +++++++++++++++++++++++++++++
2 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/src/orca/settings.py b/src/orca/settings.py
index 4481cc7..cc55d9e 100644
--- a/src/orca/settings.py
+++ b/src/orca/settings.py
@@ -1047,7 +1047,10 @@ def setGKSUGrabDisabled(disable):
# Allow for the customization of key bindings.
#
def overrideKeyBindings(script, keyBindings):
- return keyBindings
+ from settings_manager import SettingsManager
+ _settingsManager = SettingsManager()
+
+ return _settingsManager.overrideKeyBindings(script, keyBindings)
# Allow for user customization of pronunciations.
#
diff --git a/src/orca/settings_manager.py b/src/orca/settings_manager.py
index ae7eb0d..7672641 100644
--- a/src/orca/settings_manager.py
+++ b/src/orca/settings_manager.py
@@ -30,6 +30,8 @@ __license__ = "LGPL"
import settings
import os
+from keybindings import KeyBinding, KeyBindings
+
class SettingsManager():
"""Settings backend manager. This class manages orca user's settings
using different backends"""
@@ -292,6 +294,33 @@ class SettingsManager():
self.profilePronunciations,
self.profileKeybindings)
+ def _adjustBindingTupleValues(self, bindingTuple):
+ """Converts the values of bindingTuple into KeyBinding-ready values."""
+
+ keysym, mask, mods, clicks = bindingTuple
+ if not keysym:
+ bindingTuple = ('', 0, 0, 0)
+ else:
+ bindingTuple = (keysym, int(mask), int(mods), int(clicks))
+
+ return bindingTuple
+
+ def overrideKeyBindings(self, script, scriptKeyBindings):
+ keybindingsSettings = self.getKeybindings(self.profile)
+ for handlerString, bindingTuples in keybindingsSettings.items():
+ handler = script.inputEventHandlers.get(handlerString)
+ if not handler:
+ continue
+
+ scriptKeyBindings.removeByHandler(handler)
+ for bindingTuple in bindingTuples:
+ bindingTuple = self._adjustBindingTupleValues(bindingTuple)
+ keysym, mask, mods, clicks = bindingTuple
+ newBinding = KeyBinding(keysym, mask, mods, handler, clicks)
+ scriptKeyBindings.add(newBinding)
+
+ return scriptKeyBindings
+
def isClassic(self):
"""Is the backend the classic one?
If the current backend is the classic one it will return True"""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]