diff cagou/core/cagou_main.py @ 264:3e11b5d923e2

core: call new methods onVisible and onNotVisible when a widget is displayed or hidden + fixed a deletion bug on _removeVisibleWidget
author Goffi <goffi@goffi.org>
date Mon, 11 Mar 2019 08:39:43 +0100
parents 825e8c91b703
children 805c4103dac5
line wrap: on
line diff
--- a/cagou/core/cagou_main.py	Mon Mar 11 08:39:43 2019 +0100
+++ b/cagou/core/cagou_main.py	Mon Mar 11 08:39:43 2019 +0100
@@ -732,6 +732,7 @@
         """
         assert isinstance(widget, CagouWidget)
         self._visible_widgets.setdefault(widget.__class__, []).append(widget)
+        widget.onVisible()
 
     def _removeVisibleWidget(self, widget):
         """declare a widget not visible anymore
@@ -739,7 +740,9 @@
         for internal use only!
         """
         self._visible_widgets[widget.__class__].remove(widget)
-        if isinstance(self, quick_widgets.QuickWidget):
+        if isinstance(widget, CagouWidget):
+            widget.onNotVisible()
+        if isinstance(widget, quick_widgets.QuickWidget):
             self.widgets.deleteWidget(widget)
 
     def getVisibleList(self, cls):