summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Holland <william.holland@codethink.co.uk>2015-05-30 17:54:43 +0100
committerWilliam Holland <william.holland@codethink.co.uk>2015-05-30 17:54:43 +0100
commit671bea46c4af3bf0a0e6440ccd22993f96c0b944 (patch)
tree73e3d70b1faf1ceaa9e9dba97248a9d9684131ae
parente88131d1cbb3893691a63add84070aa123d30f3e (diff)
downloadkeyboard-python-671bea46c4af3bf0a0e6440ccd22993f96c0b944.tar.bz2
Add smaller tables to replace _table
This will allow for a lookup of a string of many keys being pressed at once
-rw-r--r--keyboardpython/key.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/keyboardpython/key.py b/keyboardpython/key.py
index 3174e55..b0faeb9 100644
--- a/keyboardpython/key.py
+++ b/keyboardpython/key.py
@@ -143,6 +143,43 @@ _table = {
'%s[D' % ESC: Key('Left'),
'%s[C' % ESC: Key('Right'),
}
+_special_chars = {
+ ' ': Key('Space'),
+ ESC : Key('Escape'),
+ Erase : Key('Erase'),
+ NL: Key('Enter'),
+ Tab: Key('Tab'),
+ CR: Key('CR'),
+ vTab: Key('vTab'),
+ Alert: Key('Alert'),
+ Backspace: Key('Backspace'),
+ }
+_escape_brace_codes = {
+ 'A': Key('Up'),
+ 'B': Key('Down'),
+ 'D': Key('Left'),
+ 'C': Key('Right'),
+ '3~': Key('Del'),
+ '2~': Key('Insert'),
+ '5~': Key('PageUp'),
+ '6~': Key('PageDown'),
+ '15~': Key('F5'),
+ '17~': Key('F6'),
+ '18~': Key('F7'),
+ '19~': Key('F8'),
+ '20~': Key('F9'),
+ '21~': Key('F10'),
+ '23~': Key('F11'),
+ '24~': Key('F12'),
+ }
+_escape_O_codes = {
+ 'F': Key('End'),
+ 'H': Key('Home'),
+ 'P': Key('F1'),
+ 'Q': Key('F2'),
+ 'R': Key('F3'),
+ 'S': Key('F4'),
+ }
def _is_alt(code):
''' is this the code of a combination modified by Alt? '''