diff options
author | Sascha Silbe <silbe@activitycentral.com> | 2011-03-12 17:44:09 (GMT) |
---|---|---|
committer | Sascha Silbe <silbe@activitycentral.com> | 2011-03-12 17:44:09 (GMT) |
commit | db56ac4562a9ab10308de0998b56262956f51b64 (patch) | |
tree | e9ea3923a6203538480822593354146c01d1341b /src/jarabe/view/keyhandler.py | |
parent | 8cd75e783fec952497eda68ae06e00323a4c179b (diff) | |
parent | ff47b24c5aa032f830c6f3dc3ae32dfed3c72229 (diff) |
Merge commit 'refs/top-bases/t/bug-1755' into t/bug-1755t/bug-1755
* commit 'refs/top-bases/t/bug-1755': (261 commits)
Fix up style issues introduced by commit 3f8a1e1
Don't set default timezone
Restore setting a language with the command line OLPC #10681
battery frame device: replace HAL with UPower
use ConsoleKit instead of HAL for shutdown/reboot
fix recognition of JEBs outside of data store
Adjust the year in the licence visible in the control panel
Handle activities that cycle through windows dlo#10695
Speaker frame device: pop up palette on left-click instead of toggling mute
recognise translations using pgettext
Remove last few pieces of buddy-icon.jpg handling
fix whitespace error introduced by 4b6a534 (revert of 4a3416b)
Commit from Sugar Labs: Translation System by user RafaelOrtiz.: 374 of 374 messages translated (0 fuzzy).
Intro: Fall back to user name if GECOS real name field is empty
Sugar Ad-hoc icons show in search results when connect/disconnect to AP OLPC #10412
Show busy cursor during session shutdown
Show free space for the Journal in the Journal volumes toolbar (SL#2318)
Fix incorrect logging level for warning about missing GSM configuration
simplify extension loading exception error
Revert "Add cpu and memory resource indicator to frame" as agreed on with erikos. Scheduling for inclusion in 0.94 after potential artwork changes based on feedback from the Design Team.
...
Conflicts:
src/jarabe/util/emulator.py
Diffstat (limited to 'src/jarabe/view/keyhandler.py')
-rw-r--r-- | src/jarabe/view/keyhandler.py | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/src/jarabe/view/keyhandler.py b/src/jarabe/view/keyhandler.py index 8c07975..d79bfe6 100644 --- a/src/jarabe/view/keyhandler.py +++ b/src/jarabe/view/keyhandler.py @@ -17,7 +17,6 @@ import os import logging -import traceback import dbus import gtk @@ -32,39 +31,46 @@ from jarabe.model.shell import ShellModel from jarabe import config from jarabe.journal import journalactivity + _VOLUME_STEP = sound.VOLUME_STEP _VOLUME_MAX = 100 _TABBING_MODIFIER = gtk.gdk.MOD1_MASK + _actions_table = { - 'F1' : 'zoom_mesh', - 'F2' : 'zoom_group', - 'F3' : 'zoom_home', - 'F4' : 'zoom_activity', - 'XF86AudioMute' : 'volume_mute', - 'F11' : 'volume_down', - 'XF86AudioLowerVolume' : 'volume_down', - 'F12' : 'volume_up', - 'XF86AudioRaiseVolume' : 'volume_up', - '<alt>F11' : 'volume_min', - '<alt>F12' : 'volume_max', - '0x93' : 'frame', - '<alt>Tab' : 'next_window', - '<alt><shift>Tab' : 'previous_window', - '<alt>Escape' : 'close_window', - '0xDC' : 'open_search', + 'F1': 'zoom_mesh', + 'F2': 'zoom_group', + 'F3': 'zoom_home', + 'F4': 'zoom_activity', + 'F5': 'open_search', + 'F6': 'frame', + 'XF86AudioMute': 'volume_mute', + 'F11': 'volume_down', + 'XF86AudioLowerVolume': 'volume_down', + 'F12': 'volume_up', + 'XF86AudioRaiseVolume': 'volume_up', + '<alt>F11': 'volume_min', + '<alt>F12': 'volume_max', + '0x93': 'frame', + '<alt>Tab': 'next_window', + '<alt><shift>Tab': 'previous_window', + '<alt>Escape': 'close_window', + '0xDC': 'open_search', # the following are intended for emulator users - '<alt><shift>f' : 'frame', - '<alt><shift>q' : 'quit_emulator', - 'XF86Search' : 'open_search', - '<alt><shift>o' : 'open_search', - '<alt><shift>s' : 'say_text', + '<alt><shift>f': 'frame', + '<alt><shift>q': 'quit_emulator', + 'XF86Search': 'open_search', + '<alt><shift>o': 'open_search', + '<alt><shift>s': 'say_text', } SPEECH_DBUS_SERVICE = 'org.laptop.Speech' SPEECH_DBUS_PATH = '/org/laptop/Speech' SPEECH_DBUS_INTERFACE = 'org.laptop.Speech' +_instance = None + + class KeyHandler(object): def __init__(self, frame): self._frame = frame @@ -93,8 +99,7 @@ class KeyHandler(object): raise ValueError('Key %r is already bound' % key) _actions_table[key] = module except Exception: - logging.error('Exception while loading extension:\n' + \ - traceback.format_exc()) + logging.exception('Exception while loading extension:') self._key_grabber.grab_keys(_actions_table.keys()) @@ -124,11 +129,11 @@ class KeyHandler(object): def _primary_selection_cb(self, clipboard, text, user_data): logging.debug('KeyHandler._primary_selection_cb: %r', text) if text: - self._get_speech_proxy().SayText(text, reply_handler=lambda: None, \ + self._get_speech_proxy().SayText(text, reply_handler=lambda: None, error_handler=self._on_speech_err) def handle_say_text(self, event_time): - clipboard = gtk.clipboard_get(selection="PRIMARY") + clipboard = gtk.clipboard_get(selection='PRIMARY') clipboard.request_text(self._primary_selection_cb) def handle_previous_window(self, event_time): @@ -195,7 +200,7 @@ class KeyHandler(object): if self._tabbing_handler.is_tabbing(): # Only accept window tabbing events, everything else # cancels the tabbing operation. - if not action in ["next_window", "previous_window"]: + if not action in ['next_window', 'previous_window']: self._tabbing_handler.stop(event_time) return True @@ -218,7 +223,7 @@ class KeyHandler(object): return False def _key_released_cb(self, grabber, keycode, state, event_time): - logging.debug('_key_released_cb: %i %i' % (keycode, state)) + logging.debug('_key_released_cb: %i %i', keycode, state) if self._tabbing_handler.is_tabbing(): # We stop tabbing and switch to the new window as soon as the # modifier key is raised again. @@ -228,7 +233,6 @@ class KeyHandler(object): return True return False -_instance = None def setup(frame): global _instance @@ -237,4 +241,3 @@ def setup(frame): del _instance _instance = KeyHandler(frame) - |