Show More
@@ -46,15 +46,20 b' class Keymap(dict):' | |||
|
46 | 46 | else: |
|
47 | 47 | dict.__setitem__(self, key, command) |
|
48 | 48 | |
|
49 | def register(self, command, *keys): | |
|
50 | for key in keys: | |
|
51 | self[key] = command | |
|
52 | ||
|
53 | 49 | def __getitem__(self, key): |
|
54 | 50 | if isinstance(key, str): |
|
55 | 51 | key = ord(key) |
|
56 | 52 | return dict.__getitem__(self, key) |
|
57 | 53 | |
|
54 | def __detitem__(self, key): | |
|
55 | if isinstance(key, str): | |
|
56 | key = ord(key) | |
|
57 | dict.__detitem__(self, key) | |
|
58 | ||
|
59 | def register(self, command, *keys): | |
|
60 | for key in keys: | |
|
61 | self[key] = command | |
|
62 | ||
|
58 | 63 | def get(self, key, default=None): |
|
59 | 64 | if isinstance(key, str): |
|
60 | 65 | key = ord(key) |
General Comments 0
You need to be logged in to leave comments.
Login now