define a 'closed' signal on StretchyOverlay

And return the overlay from show_stretchy_overlay, so you can do things
when the overlay is closed.

Will be used by the help-showing stuff.
This commit is contained in:
Michael Hudson-Doyle 2019-09-05 12:30:03 +12:00
parent caf026fb23
commit ea258973fc
2 changed files with 5 additions and 0 deletions

View File

@ -73,6 +73,8 @@ class StretchyOverlay(urwid.Widget):
_selectable = True
_sizing = frozenset([urwid.BOX])
signals = ['closed']
def __init__(self, bottom_w, stretchy):
self.bottom_w = bottom_w
self.stretchy = stretchy

View File

@ -61,8 +61,11 @@ class BaseView(WidgetWrap):
def show_stretchy_overlay(self, stretchy):
self._w = StretchyOverlay(disabled(self._w), stretchy)
return self._w
def remove_overlay(self):
if isinstance(self._w, StretchyOverlay):
self._w._emit('closed')
# disabled() wraps a widget in two decorations.
self._w = self._w.bottom_w.original_widget.original_widget