diff cagou/core/cagou_main.py @ 248:b6e33b35538b

core, widgets handler: visible_widgets now keep all CagouWidgets, not only QuickWidgets. visible_quick_widgets can be used if only QuickWidgets are desired.
author Goffi <goffi@goffi.org>
date Sat, 26 Jan 2019 20:24:48 +0100
parents cf61a011f731
children 5d69e4cab925
line wrap: on
line diff
--- a/cagou/core/cagou_main.py	Sat Jan 26 20:24:48 2019 +0100
+++ b/cagou/core/cagou_main.py	Sat Jan 26 20:24:48 2019 +0100
@@ -687,27 +687,28 @@
 
         wrapper.changeWidget(new)
 
-    def addVisibleWidget(self, widget):
+    def _addVisibleWidget(self, widget):
         """declare a widget visible
 
         for internal use only!
         """
-        assert isinstance(widget, quick_widgets.QuickWidget)
+        assert isinstance(widget, CagouWidget)
         self._visible_widgets.setdefault(widget.__class__, []).append(widget)
 
-    def removeVisibleWidget(self, widget):
+    def _removeVisibleWidget(self, widget):
         """declare a widget not visible anymore
 
         for internal use only!
         """
         self._visible_widgets[widget.__class__].remove(widget)
-        self.widgets.deleteWidget(widget)
+        if isinstance(self, quick_widgets.QuickWidget):
+            self.widgets.deleteWidget(widget)
 
     def getVisibleList(self, cls):
         """get list of visible widgets for a given class
 
-        @param cls(QuickWidget class): type of widgets to get
-        @return (list[QuickWidget class]): visible widgets of this class
+        @param cls(type): type of widgets to get
+        @return (list[type]): visible widgets of this class
         """
         try:
             return self._visible_widgets[cls]