summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Holland <william.holland@codethink.co.uk>2015-06-04 22:08:14 +0100
committerWilliam Holland <william.holland@codethink.co.uk>2015-06-04 22:08:14 +0100
commitc5f2500441c1d93c8a93a2bf1971bd7766b07d00 (patch)
treecf42a0db2cda700d1d5de68dd811c0853dd2649d
parent0ecac2eeb897c9e4bf7913c964e1c8ce643ec629 (diff)
downloadkeyboard-python-c5f2500441c1d93c8a93a2bf1971bd7766b07d00.tar.bz2
Remove old tables
-rw-r--r--keyboardpython/key.py71
1 files changed, 8 insertions, 63 deletions
diff --git a/keyboardpython/key.py b/keyboardpython/key.py
index 074becf..6837044 100644
--- a/keyboardpython/key.py
+++ b/keyboardpython/key.py
@@ -1,11 +1,4 @@
ESC = '\x1b'
-Erase = '\x7f'
-Backspace = '\b'
-Alert = '\a'
-Tab = '\t'
-vTab = '\v'
-NL = '\n'
-CR = '\r'
def _assert_type(thing,_type):
''' if thing is not of type _type raise an exception '''
@@ -111,67 +104,19 @@ class Key:
ALT = Key('Alt')
CTRL = Key('Control')
-def _keyDict(in_dict):
+def _format_key_dict(in_dict):
+ import copy
to_return = {}
for pair in in_dict.items():
for code in pair[1]:
- to_return[code] = KeyCombination(pair[0])
+ if 'Alt' in pair[0]: base = KeyCombination(ALT)
+ else: base = KeyCombination()
+ to_add = KeyCombination(pair[0])
+ combination = copy.deepcopy(base)
+ combination.add_keyCombination(to_add)
+ to_return[code] = combination
return to_return
-_special_chars = {
- ' ': KeyCombination('Space'),
- ESC : KeyCombination('Escape'),
- Erase : KeyCombination('Erase'),
- NL: KeyCombination('Enter'),
- Tab: KeyCombination('Tab'),
- CR: KeyCombination('CR'),
- vTab: KeyCombination('vTab'),
- Alert: KeyCombination('Alert'),
- Backspace: KeyCombination('Backspace'),
- }
-_escape_brace_codes = {
- 'A': KeyCombination('Up'),
- 'B': KeyCombination('Down'),
- 'D': KeyCombination('Left'),
- 'C': KeyCombination('Right'),
- '3~': KeyCombination('Del'),
- '2~': KeyCombination('Insert'),
- '5~': KeyCombination('PageUp'),
- '6~': KeyCombination('PageDown'),
- '15~': KeyCombination('F5'),
- '17~': KeyCombination('F6'),
- '18~': KeyCombination('F7'),
- '19~': KeyCombination('F8'),
- '20~': KeyCombination('F9'),
- '21~': KeyCombination('F10'),
- '23~': KeyCombination('F11'),
- '24~': KeyCombination('F12'),
- '3;3~': KeyCombination('Del',ALT),
- '2;3~': KeyCombination('Insert',ALT),
- '5;3~': KeyCombination('PageUp',ALT),
- '6;3~': KeyCombination('PageDown',ALT),
- '15;3~': KeyCombination('F5',ALT),
- '17;3~': KeyCombination('F6',ALT),
- '18;3~': KeyCombination('F7',ALT),
- '19;3~': KeyCombination('F8',ALT),
- '20;3~': KeyCombination('F9',ALT),
- '21;3~': KeyCombination('F10',ALT),
- '23;3~': KeyCombination('F11',ALT),
- '24;3~': KeyCombination('F12',ALT),
- }
-_escape_O_codes = {
- 'F': KeyCombination('End'),
- 'H': KeyCombination('Home'),
- 'P': KeyCombination('F1'),
- 'Q': KeyCombination('F2'),
- 'R': KeyCombination('F3'),
- 'S': KeyCombination('F4'),
- '1;3P': KeyCombination('F1',ALT),
- '1;3Q': KeyCombination('F2',ALT),
- '1;3R': KeyCombination('F3',ALT),
- '1;3S': KeyCombination('F4',ALT),
- }
-
def _is_alt(code):
''' is this the code of a combination modified by Alt? '''
_assert_type(code,str)