diff options
author | mazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-30 05:43:14 +0000 |
---|---|---|
committer | mazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-30 05:43:14 +0000 |
commit | cab4919e802b732c29c2f2aa323f533da181b477 (patch) | |
tree | 293f171a2cd6e48adb41f708e44a9a2db3168888 /tools/gen_keyboard_overlay_data | |
parent | 3dbaadf5b025968c3cd8a1595757abd5483e9c7a (diff) | |
download | chromium_src-cab4919e802b732c29c2f2aa323f533da181b477.zip chromium_src-cab4919e802b732c29c2f2aa323f533da181b477.tar.gz chromium_src-cab4919e802b732c29c2f2aa323f533da181b477.tar.bz2 |
Change the separator of the keyboard overlay data to allow labels containing spaces.
BUG=chromium-os:13047
TEST=manually on the netbook
Review URL: http://codereview.chromium.org/6708107
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79794 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/gen_keyboard_overlay_data')
-rwxr-xr-x | tools/gen_keyboard_overlay_data/gen_keyboard_overlay_data.py | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/tools/gen_keyboard_overlay_data/gen_keyboard_overlay_data.py b/tools/gen_keyboard_overlay_data/gen_keyboard_overlay_data.py index 1fbde76..6757363 100755 --- a/tools/gen_keyboard_overlay_data/gen_keyboard_overlay_data.py +++ b/tools/gen_keyboard_overlay_data/gen_keyboard_overlay_data.py @@ -102,30 +102,19 @@ def ToKeys(hotkey): """Converts the action value to shortcut keys used from JavaScript. Examples: - 'Ctrl - 9' => '9 CTRL' - 'Ctrl - Shift - Tab' => 'tab CTRL SHIFT' + 'Ctrl - 9' => '9<>CTRL' + 'Ctrl - Shift - Tab' => 'tab<>CTRL<>SHIFT' """ - values = hotkey.split(' ') - modifiers = [] - keycode = -1 - for i, value in enumerate(values): - if i == len(values) - 1: - pass - elif value == 'Shift': - modifiers.append('SHIFT') - elif value == 'Ctrl': - modifiers.append('CTRL') - elif value == 'Alt': - modifiers.append('ALT') - if value == '-' and i == len(values) - 2: - continue - modifiers.sort() - keycode = value.lower().rstrip() + values = hotkey.split(' - ') + modifiers = sorted(value.upper() for value in values + if value in ['Shift', 'Ctrl', 'Alt']) + keycode = [value.lower() for value in values + if value not in ['Shift', 'Ctrl', 'Alt']] # The keys which are highlighted even without modifier keys. base_keys = ['backspace', 'power'] - if not modifiers and keycode not in base_keys: + if not modifiers and (keycode and keycode[0] not in base_keys): return None - return ' '.join([keycode] + modifiers) + return '<>'.join(keycode + modifiers) def ParseOptions(): |