# HG changeset patch # User Goffi # Date 1548530688 -3600 # Node ID b6e33b35538bcd7c56c609fad202f6281480ba6d # Parent cf61a011f7310de30f2c200067cc486ae0d5f33a core, widgets handler: visible_widgets now keep all CagouWidgets, not only QuickWidgets. visible_quick_widgets can be used if only QuickWidgets are desired. diff -r cf61a011f731 -r b6e33b35538b cagou/core/cagou_main.py --- 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] diff -r cf61a011f731 -r b6e33b35538b cagou/core/widgets_handler.py --- a/cagou/core/widgets_handler.py Sat Jan 26 20:24:48 2019 +0100 +++ b/cagou/core/widgets_handler.py Sat Jan 26 20:24:48 2019 +0100 @@ -323,11 +323,11 @@ self.updateHiddenSlides() def onSlideChange(self, handler, new_slide): - if isinstance(self._former_slide, quick_widgets.QuickWidget): - G.host.removeVisibleWidget(self._former_slide) + if self._former_slide is not None: + G.host._removeVisibleWidget(self._former_slide) self._former_slide = new_slide - if isinstance(new_slide, quick_widgets.QuickWidget): - G.host.addVisibleWidget(new_slide) + if new_slide is not None: + G.host._addVisibleWidget(new_slide) self.updateHiddenSlides() def hiddenList(self, visible_list):