Mercurial > libervia-desktop-kivy
comparison 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 |
comparison
equal
deleted
inserted
replaced
259:4601793b0dee | 260:145c29b5f2b5 |
---|---|
316 if w == current or w == new_widget: | 316 if w == current or w == new_widget: |
317 continue | 317 continue |
318 if isinstance(w, quick_widgets.QuickWidget): | 318 if isinstance(w, quick_widgets.QuickWidget): |
319 G.host.widgets.deleteWidget(w) | 319 G.host.widgets.deleteWidget(w) |
320 self.carousel.clear_widgets() | 320 self.carousel.clear_widgets() |
321 self.carousel.add_widget(new_widget) | 321 self.carousel.add_widget(G.host.getOrClone(new_widget)) |
322 self._slides_update_lock = False | 322 self._slides_update_lock = False |
323 self.updateHiddenSlides() | 323 self.updateHiddenSlides() |
324 | 324 |
325 def onSlideChange(self, handler, new_slide): | 325 def onSlideChange(self, handler, new_slide): |
326 if self._former_slide is not None: | 326 if self._former_slide is not None: |