core: fixed handling of button callback in popups:

Button use themselve as callback, and this was causing troubles in the removePopUp method.
This patch work around this by considering a Button widget in the same way as None (we
never use Button directly in popups).

fix 183
This commit is contained in:
Goffi 2019-07-19 23:04:35 +02:00
commit d2064fc175

View file

@ -595,7 +595,9 @@ class PrimitivusApp(QuickApp, InputHistory):
@param widget(None, urwid.Widget): if not None remove this popup from front or queue
"""
# TODO: refactor popup management in a cleaner way
if widget is not None:
# buttons' callback use themselve as first argument, and we never use
# a Button directly in a popup, so we consider urwid.Button as None
if widget is not None and not isinstance(widget, urwid.Button):
if isinstance(self.loop.widget, urwid.Overlay):
current_popup = self.loop.widget.top_w
if not current_popup == widget: