Mercurial > libervia-desktop-kivy
comparison 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 |
comparison
equal
deleted
inserted
replaced
247:cf61a011f731 | 248:b6e33b35538b |
---|---|
685 if wrapper is None: | 685 if wrapper is None: |
686 raise exceptions.InternalError(u"no wrapper found") | 686 raise exceptions.InternalError(u"no wrapper found") |
687 | 687 |
688 wrapper.changeWidget(new) | 688 wrapper.changeWidget(new) |
689 | 689 |
690 def addVisibleWidget(self, widget): | 690 def _addVisibleWidget(self, widget): |
691 """declare a widget visible | 691 """declare a widget visible |
692 | 692 |
693 for internal use only! | 693 for internal use only! |
694 """ | 694 """ |
695 assert isinstance(widget, quick_widgets.QuickWidget) | 695 assert isinstance(widget, CagouWidget) |
696 self._visible_widgets.setdefault(widget.__class__, []).append(widget) | 696 self._visible_widgets.setdefault(widget.__class__, []).append(widget) |
697 | 697 |
698 def removeVisibleWidget(self, widget): | 698 def _removeVisibleWidget(self, widget): |
699 """declare a widget not visible anymore | 699 """declare a widget not visible anymore |
700 | 700 |
701 for internal use only! | 701 for internal use only! |
702 """ | 702 """ |
703 self._visible_widgets[widget.__class__].remove(widget) | 703 self._visible_widgets[widget.__class__].remove(widget) |
704 self.widgets.deleteWidget(widget) | 704 if isinstance(self, quick_widgets.QuickWidget): |
705 self.widgets.deleteWidget(widget) | |
705 | 706 |
706 def getVisibleList(self, cls): | 707 def getVisibleList(self, cls): |
707 """get list of visible widgets for a given class | 708 """get list of visible widgets for a given class |
708 | 709 |
709 @param cls(QuickWidget class): type of widgets to get | 710 @param cls(type): type of widgets to get |
710 @return (list[QuickWidget class]): visible widgets of this class | 711 @return (list[type]): visible widgets of this class |
711 """ | 712 """ |
712 try: | 713 try: |
713 return self._visible_widgets[cls] | 714 return self._visible_widgets[cls] |
714 except KeyError: | 715 except KeyError: |
715 return [] | 716 return [] |