Mercurial > libervia-desktop-kivy
comparison cagou/core/cagou_main.py @ 267:896f78760b63
core: fixed crash when calling deleteUnusedWidgetInstances on widgets not inheriting from QuickWidget
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 11 Mar 2019 20:24:04 +0100 |
parents | b3f97729e983 |
children | c4990a7d5dbd |
comparison
equal
deleted
inserted
replaced
266:b3f97729e983 | 267:896f78760b63 |
---|---|
772 @param widget(quick_widgets.QuickWidget): reference widget | 772 @param widget(quick_widgets.QuickWidget): reference widget |
773 other instance of this widget will be deleted if they have no parent | 773 other instance of this widget will be deleted if they have no parent |
774 """ | 774 """ |
775 # FIXME: unused for now | 775 # FIXME: unused for now |
776 to_delete = [] | 776 to_delete = [] |
777 for w in self.widgets.getWidgetInstances(widget): | 777 if isinstance(widget, quick_widgets.QuickWidget): |
778 if w.parent is None and w != widget: | 778 for w in self.widgets.getWidgetInstances(widget): |
779 to_delete.append(w) | 779 if w.parent is None and w != widget: |
780 for w in to_delete: | 780 to_delete.append(w) |
781 log.debug(u"cleaning widget: {wid}".format(wid=w)) | 781 for w in to_delete: |
782 self.widgets.deleteWidget(w) | 782 log.debug(u"cleaning widget: {wid}".format(wid=w)) |
783 self.widgets.deleteWidget(w) | |
783 | 784 |
784 def getOrClone(self, widget): | 785 def getOrClone(self, widget): |
785 """Get a QuickWidget if it has not parent set else clone it | 786 """Get a QuickWidget if it has not parent set else clone it |
786 | 787 |
787 if an other instance of this widget exist without parent, it will be used. | 788 if an other instance of this widget exist without parent, it will be used. |