comparison cagou/plugins/plugin_wid_chat.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 ff1efdeff53f
children a579eda31f4f
comparison
equal deleted inserted replaced
259:4601793b0dee 260:145c29b5f2b5
379 if len(profiles) > 1: 379 if len(profiles) > 1:
380 raise NotImplementedError(u"Multi-profiles is not available yet for chat") 380 raise NotImplementedError(u"Multi-profiles is not available yet for chat")
381 if target is None: 381 if target is None:
382 target = G.host.profiles[profiles[0]].whoami 382 target = G.host.profiles[profiles[0]].whoami
383 return G.host.widgets.getOrCreateWidget(cls, target, on_new_widget=None, 383 return G.host.widgets.getOrCreateWidget(cls, target, on_new_widget=None,
384 on_existing_widget=C.WIDGET_RECREATE, 384 on_existing_widget=G.host.getOrClone,
385 profiles=profiles) 385 profiles=profiles)
386 386
387 ## header ## 387 ## header ##
388 388
389 def changeWidget(self, jid_): 389 def changeWidget(self, jid_):