diff options
author | Florent Le Coz <louiz@louiz.org> | 2011-07-03 02:06:40 +0200 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2011-07-03 02:06:40 +0200 |
commit | a99257ad9a2b0dc6a1190e6ca87863a7ec1973ea (patch) | |
tree | 50d02dd2d74de01b03afa27eb3e0fa6e0d01a7ed /src | |
parent | 13f885fb74593b6c50174f9bbb7dd279fc344239 (diff) | |
download | poezio-a99257ad9a2b0dc6a1190e6ca87863a7ec1973ea.tar.gz poezio-a99257ad9a2b0dc6a1190e6ca87863a7ec1973ea.tar.bz2 poezio-a99257ad9a2b0dc6a1190e6ca87863a7ec1973ea.tar.xz poezio-a99257ad9a2b0dc6a1190e6ca87863a7ec1973ea.zip |
Key bindings \o/
Diffstat (limited to 'src')
-rw-r--r-- | src/common.py | 8 | ||||
-rw-r--r-- | src/core.py | 3 | ||||
-rw-r--r-- | src/tabs.py | 5 |
3 files changed, 10 insertions, 6 deletions
diff --git a/src/common.py b/src/common.py index 9435dab5..0bc93c8d 100644 --- a/src/common.py +++ b/src/common.py @@ -42,6 +42,8 @@ import curses import time import shlex +from config import config + ROOM_STATE_NONE = 11 ROOM_STATE_CURRENT = 10 ROOM_STATE_PRIVATE = 15 @@ -211,3 +213,9 @@ def curses_color_pair(color): if color < 0: return curses.color_pair(-color) | curses.A_BOLD return curses.color_pair(color) + +def replace_key_with_bound(key): + if config.has_option('bindings', key): + return config.get(key, key, 'bindings') + else: + return key diff --git a/src/core.py b/src/core.py index 52b783bb..671834e4 100644 --- a/src/core.py +++ b/src/core.py @@ -677,7 +677,8 @@ class Core(object): """ # curses.ungetch(0) # FIXME while self.running: - char_list = self.read_keyboard() + char_list = [common.replace_key_with_bound(key)\ + for key in self.read_keyboard()] # Special case for M-x where x is a number if len(char_list) == 1: char = char_list[0] diff --git a/src/tabs.py b/src/tabs.py index 28ebd60d..8d4e6447 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -395,7 +395,6 @@ class MucTab(ChatTab): self.ignores = [] # set of Users # keys self.key_func['^I'] = self.completion - self.key_func['M-i'] = self.completion self.key_func['M-u'] = self.scroll_user_list_down self.key_func['M-y'] = self.scroll_user_list_up # commands @@ -979,7 +978,6 @@ class PrivateTab(ChatTab): self.input = windows.MessageInput() # keys self.key_func['^I'] = self.completion - self.key_func['M-i'] = self.completion # commands self.commands['unquery'] = (self.command_unquery, _("Usage: /unquery\nUnquery: close the tab"), None) self.commands['part'] = (self.command_unquery, _("Usage: /part\Part: close the tab"), None) @@ -1123,7 +1121,6 @@ class RosterInfoTab(Tab): self.input = self.default_help_message self.set_color_state(theme.COLOR_TAB_NORMAL) self.key_func['^I'] = self.completion - self.key_func['M-i'] = self.completion self.key_func[' '] = self.on_space self.key_func["/"] = self.on_slash self.key_func["KEY_UP"] = self.move_cursor_up @@ -1470,7 +1467,6 @@ class ConversationTab(ChatTab): self.input = windows.MessageInput() # keys self.key_func['^I'] = self.completion - self.key_func['M-i'] = self.completion # commands self.commands['unquery'] = (self.command_unquery, _("Usage: /unquery\nUnquery: close the tab"), None) self.commands['part'] = (self.command_unquery, _("Usage: /part\Part: close the tab"), None) @@ -1602,7 +1598,6 @@ class MucListTab(Tab): self.key_func["KEY_DOWN"] = self.listview.move_cursor_down self.key_func["KEY_UP"] = self.listview.move_cursor_up self.key_func['^I'] = self.completion - self.key_func['M-i'] = self.completion self.key_func["/"] = self.on_slash self.key_func['j'] = self.join_selected self.key_func['J'] = self.join_selected_no_focus |