comparison 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
comparison
equal deleted inserted replaced
263:fe540a6dc14d 264:3e11b5d923e2
730 730
731 for internal use only! 731 for internal use only!
732 """ 732 """
733 assert isinstance(widget, CagouWidget) 733 assert isinstance(widget, CagouWidget)
734 self._visible_widgets.setdefault(widget.__class__, []).append(widget) 734 self._visible_widgets.setdefault(widget.__class__, []).append(widget)
735 widget.onVisible()
735 736
736 def _removeVisibleWidget(self, widget): 737 def _removeVisibleWidget(self, widget):
737 """declare a widget not visible anymore 738 """declare a widget not visible anymore
738 739
739 for internal use only! 740 for internal use only!
740 """ 741 """
741 self._visible_widgets[widget.__class__].remove(widget) 742 self._visible_widgets[widget.__class__].remove(widget)
742 if isinstance(self, quick_widgets.QuickWidget): 743 if isinstance(widget, CagouWidget):
744 widget.onNotVisible()
745 if isinstance(widget, quick_widgets.QuickWidget):
743 self.widgets.deleteWidget(widget) 746 self.widgets.deleteWidget(widget)
744 747
745 def getVisibleList(self, cls): 748 def getVisibleList(self, cls):
746 """get list of visible widgets for a given class 749 """get list of visible widgets for a given class
747 750