summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2011-10-16 17:01:22 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2011-10-16 17:01:22 +0100
commit16b530270c7b4f2f85df05f9b224a14a4e62d624 (patch)
tree68df85ca642e6a59c27a61392117f09f7eed4c04
parentb4943f3e0b88a95691ed5d83e79d3c12ce6084d4 (diff)
fix blocking notification
-rw-r--r--alot/ui.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/alot/ui.py b/alot/ui.py
index 01828c96..28f6652c 100644
--- a/alot/ui.py
+++ b/alot/ui.py
@@ -105,9 +105,13 @@ class UI(object):
def keypress(self, key):
self.inputwrap.keypress((150, 20), key)
- def show_as_root_until_keypress(self, w, key):
+ def show_as_root_until_keypress(self, w, key, afterwards=None):
def oe():
self.inputwrap.set_root(self.mainframe)
+ self.logger.debug('AFTERWARDS')
+ if callable(afterwards):
+ self.logger.debug('called')
+ afterwards()
helpwrap = widgets.CatchKeyWidgetWrap(w, key, on_catch=oe)
self.inputwrap.set_root(helpwrap)
@@ -298,8 +302,8 @@ class UI(object):
assert msg_position in ['left', 'above']
d = defer.Deferred() # create return deferred
-
oldroot = self.inputwrap.get_root()
+
def select_or_cancel(text):
self.inputwrap.set_root(oldroot)
self.inputwrap.select_cancel_only = False
@@ -364,11 +368,16 @@ class UI(object):
def clear(*args):
self.clear_notify(msgs)
- # TODO: replace this with temporarily wrapping self.mainframe
- # in a ui.show_root_until_keypress..
if block:
- self.mainloop.screen.get_input()
- clear()
+ # put "cancel to continue" widget as overlay on main widget
+ txt = urwid.Text('(cancel continues)')
+ overlay = urwid.Overlay(txt, self.mainframe,
+ ('fixed left', 0),
+ ('fixed right', 0),
+ ('fixed bottom', 0),
+ None)
+ self.show_as_root_until_keypress(overlay, 'cancel',
+ afterwards=clear)
else:
if timeout >= 0:
if timeout == 0: