diff cagou/core/widgets_handler.py @ 260:145c29b5f2b5

core: improved getOrClone + use in chat and widgets_handler: - getOrClone is now trying to re-use others instances of a widget if they have no parent, and will create a new widget only if nothing is found - it is now used in widgets_handler's changeWidget - it is now used in Chat factory, on existing widget - new host method deleteUnusedWidgetInstances remove instances without parent. It is used by getOrClone.
author Goffi <goffi@goffi.org>
date Mon, 11 Mar 2019 08:39:43 +0100
parents b6e33b35538b
children fe540a6dc14d
line wrap: on
line diff
--- a/cagou/core/widgets_handler.py	Mon Mar 11 08:39:43 2019 +0100
+++ b/cagou/core/widgets_handler.py	Mon Mar 11 08:39:43 2019 +0100
@@ -318,7 +318,7 @@
             if isinstance(w, quick_widgets.QuickWidget):
                 G.host.widgets.deleteWidget(w)
         self.carousel.clear_widgets()
-        self.carousel.add_widget(new_widget)
+        self.carousel.add_widget(G.host.getOrClone(new_widget))
         self._slides_update_lock = False
         self.updateHiddenSlides()