# HG changeset patch # User Goffi # Date 1579283075 -3600 # Node ID 1ac40d3121f63f2d31fbb34038062f840efef14d # Parent 33244f944bd8b0bd4fb2fe3d5917557a76c81584 core (Cagou): "new" arg can be None in switchWidget, in which case default widget is used. diff -r 33244f944bd8 -r 1ac40d3121f6 cagou/core/cagou_main.py --- a/cagou/core/cagou_main.py Fri Jan 17 18:44:35 2020 +0100 +++ b/cagou/core/cagou_main.py Fri Jan 17 18:44:35 2020 +0100 @@ -727,15 +727,19 @@ if isinstance(widget, quick_chat.QuickChat) and widget.type == C.CHAT_GROUP: self.addNote("", _("room {} has been joined").format(widget.target)) - def switchWidget(self, old, new): + def switchWidget(self, old, new=None): """Replace old widget by new one - old(CagouWidgetn None): CagouWidget instance or a child + old(CagouWidget, None): CagouWidget instance or a child None to select automatically widget to switch new(CagouWidget): new widget instance + None to use default widget """ if old is None: old = self.getWidgetToSwitch() + if new is None: + factory = self.default_wid['factory'] + new = factory(self.default_wid, None, profiles=old.profiles) to_change = None if isinstance(old, CagouWidget): to_change = old