diff options
author | William Holland <william.holland@codethink.co.uk> | 2015-05-30 19:26:04 +0100 |
---|---|---|
committer | William Holland <william.holland@codethink.co.uk> | 2015-05-30 19:26:04 +0100 |
commit | afec4b60bfda22c22d71c1e9f26b2d19930ad208 (patch) | |
tree | eb9806296fc7b9e9e9ebcf1a0a1692acba114cd4 /keyboardpython | |
parent | 08fe514529e73c1a20e870de65bf76096a008be0 (diff) | |
download | keyboard-python-afec4b60bfda22c22d71c1e9f26b2d19930ad208.tar.bz2 |
Move adding keys to to_return to end
This removes a few lines of code
Diffstat (limited to 'keyboardpython')
-rw-r--r-- | keyboardpython/key.py | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/keyboardpython/key.py b/keyboardpython/key.py index aebc7d5..8795cd4 100644 --- a/keyboardpython/key.py +++ b/keyboardpython/key.py @@ -195,27 +195,23 @@ def parse_code(code): if char == ESC: if not _code: key = _special_chars[ESC] - to_return.add_key(key) - break + return KeyCombination(key) char = _code.pop(0) if char == '[': _code, key_comb = match_start_in_table(_code, _escape_brace_codes) - to_return.add_keyCombination(key_comb) elif char == 'O': _code, key_comb = match_start_in_table(_code, _escape_O_codes) - to_return.add_keyCombination(key_comb) else: - to_return.add_key(ALT) + key_comb = KeyCombination(ALT) elif char.isalnum(): - to_return.add_key(Key(char)) + key_comb = KeyCombination(Key(char)) elif _is_ctrl_alpha(char): key_comb = _get_ctrl_alpha(char) - to_return.add_keyCombination(key_comb) elif char in _special_chars.keys(): - key = _special_chars[char] - to_return.add_key(key) + key_comb = KeyCombination(_special_chars[char]) else: - to_return.add_key(Key(char)) + key_comb = KeyCombination(Key(char)) + to_return.add_keyCombination(key_comb) return to_return |