summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2011-10-16 17:16:08 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2011-10-16 17:16:08 +0100
commita36dce5ef3e95c082b2bfde2b571abe2ab55fee4 (patch)
treecdbfca580a26820d15697ba8ecb2c33bce9234c2 /alot
parent5eb577571562fdda24c43c728c818f5239ee2e16 (diff)
fix poblem with relays in blocking mode
Diffstat (limited to 'alot')
-rw-r--r--alot/ui.py11
-rw-r--r--alot/widgets.py7
2 files changed, 13 insertions, 5 deletions
diff --git a/alot/ui.py b/alot/ui.py
index 28f6652c..fec25500 100644
--- a/alot/ui.py
+++ b/alot/ui.py
@@ -105,15 +105,19 @@ class UI(object):
def keypress(self, key):
self.inputwrap.keypress((150, 20), key)
- def show_as_root_until_keypress(self, w, key, afterwards=None):
+ def show_as_root_until_keypress(self, w, key, relay_rest=True,
+ afterwards=None):
def oe():
self.inputwrap.set_root(self.mainframe)
- self.logger.debug('AFTERWARDS')
+ self.inputwrap.select_cancel_only = False
if callable(afterwards):
self.logger.debug('called')
afterwards()
- helpwrap = widgets.CatchKeyWidgetWrap(w, key, on_catch=oe)
+ self.logger.debug('relay: %s' % relay_rest)
+ helpwrap = widgets.CatchKeyWidgetWrap(w, key, on_catch=oe,
+ relay_rest=relay_rest)
self.inputwrap.set_root(helpwrap)
+ self.inputwrap.select_cancel_only = True
def prompt(self, prefix='>', text=u'', completer=None, tab=0, history=[]):
"""prompt for text input
@@ -377,6 +381,7 @@ class UI(object):
('fixed bottom', 0),
None)
self.show_as_root_until_keypress(overlay, 'cancel',
+ relay_rest=False,
afterwards=clear)
else:
if timeout >= 0:
diff --git a/alot/widgets.py b/alot/widgets.py
index 63e591d1..3f7d975c 100644
--- a/alot/widgets.py
+++ b/alot/widgets.py
@@ -52,18 +52,21 @@ class DialogBox(urwid.WidgetWrap):
class CatchKeyWidgetWrap(urwid.WidgetWrap):
- def __init__(self, widget, key, on_catch):
+ def __init__(self, widget, key, on_catch, relay_rest=True):
urwid.WidgetWrap.__init__(self, widget)
self.key = key
+ self.relay = relay_rest
self.on_catch = on_catch
def selectable(self):
return True
def keypress(self, size, key):
+ logging.debug('CATCH KEY: %s' % key)
+ logging.debug('relay: %s' % self.relay)
if key == self.key:
self.on_catch()
- elif self._w.selectable():
+ elif self._w.selectable() and self.relay:
return self._w.keypress(size, key)