Ticket #863: foo.patch

File foo.patch, 1.7 KB (added by biertie, 15 years ago)
  • src/jarabe/view/keyhandler.py

    diff --git a/src/jarabe/view/keyhandler.py b/src/jarabe/view/keyhandler.py
    index 08856c0..b792247 100644
    a b _actions_table = { 
    5858    'XF86AudioRaiseVolume' : 'volume_up',
    5959    '<alt>F11'             : 'volume_min',
    6060    '<alt>F12'             : 'volume_max',
    61     '0x93'                 : 'frame',
    62     '0xEB'                 : 'rotate',
    6361    '<alt>Tab'             : 'next_window',
    6462    '<alt><shift>Tab'      : 'previous_window',
    6563    '<alt>Escape'          : 'close_window',
    66     '0xDC'                 : 'open_search',
    6764# the following are intended for emulator users
    6865    '<alt><shift>f'        : 'frame',
    6966    '<alt><shift>q'        : 'quit_emulator',
    _actions_table = { 
    7370    '<alt><shift>s'        : 'say_text',
    7471}
    7572
     73_action_table_olpc = {
     74    '0x93'                 : 'frame',
     75    '0xEB'                 : 'rotate',
     76    '0xDC'                 : 'open_search',
     77}
     78
    7679SPEECH_DBUS_SERVICE = 'org.laptop.Speech'
    7780SPEECH_DBUS_PATH = '/org/laptop/Speech'
    7881SPEECH_DBUS_INTERFACE = 'org.laptop.Speech'
    7982
     83def host_is_xo():
     84    # FIXME: that's a loosy way to check for XO, what's the recommended way?
     85    if os.access("/ofw/serial-number", os.R_OK) == 0:
     86        return True
     87    retrun False
     88
    8089class KeyHandler(object):
    8190    def __init__(self, frame):
    8291        self._frame = frame
    class KeyHandler(object): 
    94103
    95104        self._tabbing_handler = TabbingHandler(self._frame, _TABBING_MODIFIER)
    96105
     106        if host_is_xo():
     107                _action_table += _action_table_olpc
     108
    97109        for f in os.listdir(os.path.join(config.ext_path, 'globalkey')):
    98110            if f.endswith('.py') and not f.startswith('__'):
    99111                module_name = f[:-3]