diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2011-10-05 22:29:56 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2011-10-05 22:29:56 +0100 |
commit | 1a88e868617593007c13966e46331e619b2e8611 (patch) | |
tree | 98e9d031c25e8f541c65c8baa415f73d3ee6782a /alot | |
parent | c7696ec5c6bdc6130c962bd14ba56b18fae461a3 (diff) |
get rid of urwids command_map
Diffstat (limited to 'alot')
-rw-r--r-- | alot/ui.py | 1 | ||||
-rw-r--r-- | alot/widgets.py | 16 |
2 files changed, 6 insertions, 11 deletions
@@ -17,7 +17,6 @@ along with notmuch. If not, see <http://www.gnu.org/licenses/>. Copyright (C) 2011 Patrick Totzke <patricktotzke@gmail.com> """ import urwid -from urwid.command_map import command_map from twisted.internet import reactor, defer from settings import config diff --git a/alot/widgets.py b/alot/widgets.py index 7bb250fe..231e5128 100644 --- a/alot/widgets.py +++ b/alot/widgets.py @@ -18,7 +18,6 @@ Copyright (C) 2011 Patrick Totzke <patricktotzke@gmail.com> """ import email import urwid -from urwid.command_map import command_map import logging from settings import config @@ -184,10 +183,9 @@ class ChoiceWidget(urwid.Text): return True def keypress(self, size, key): - cmd = command_map[key] - if cmd == 'select' and self.select != None: + if key == 'select' and self.select != None: self.callback(self.select) - elif cmd == 'cancel' and self.cancel != None: + elif key == 'cancel' and self.cancel != None: self.callback(self.cancel) elif key in self.choices: self.callback(self.choices[key]) @@ -210,17 +208,15 @@ class CompleteEdit(urwid.Edit): urwid.Edit.__init__(self, edit_text=edit_text, **kwargs) def keypress(self, size, key): - cmd = command_map[key] # if we tabcomplete - logging.debug((key, cmd)) - if cmd in ['next selectable', 'prev selectable'] and self.completer: + if key in ['tab', 'shift tab'] and self.completer: # if not already in completion mode if not self.completions: self.completions = [(self.edit_text, self.edit_pos)] + \ self.completer.complete(self.edit_text, self.edit_pos) self.focus_in_clist = 1 else: # otherwise tab through results - if cmd == 'next selectable': + if key == 'tab': self.focus_in_clist += 1 else: self.focus_in_clist -= 1 @@ -244,9 +240,9 @@ class CompleteEdit(urwid.Edit): else: self.historypos = (self.historypos - 1) % len(self.history) self.set_edit_text(self.history[self.historypos]) - elif cmd == 'select': + elif key == 'select': self.on_exit(self.edit_text) - elif cmd == 'cancel': + elif key == 'cancel': self.on_exit(None) else: result = urwid.Edit.keypress(self, size, key) |