quick frontend (app): added "explicit_close" to deleteWidget, and use it on mucRoomLeftHandler:
This flag can be used by frontends to decide if the widget must be really closed or not (otherwise, it may be interesting to keep a widget in memory to avoir recreating a new one each time that the chat must be displayed).
This commit is contained in:
parent
5fae77187a
commit
9a9adb36cb
2 changed files with 12 additions and 6 deletions
|
|
@ -886,7 +886,8 @@ class QuickApp(object):
|
||||||
room_jid = jid.JID(room_jid_s)
|
room_jid = jid.JID(room_jid_s)
|
||||||
chat_widget = self.widgets.getWidget(quick_chat.QuickChat, room_jid, profile)
|
chat_widget = self.widgets.getWidget(quick_chat.QuickChat, room_jid, profile)
|
||||||
if chat_widget:
|
if chat_widget:
|
||||||
self.widgets.deleteWidget(chat_widget)
|
self.widgets.deleteWidget(
|
||||||
|
chat_widget, all_instances=True, explicit_close=True)
|
||||||
self.contact_lists[profile].removeContact(room_jid)
|
self.contact_lists[profile].removeContact(room_jid)
|
||||||
|
|
||||||
def mucRoomUserChangedNickHandler(self, room_jid_s, old_nick, new_nick, profile):
|
def mucRoomUserChangedNickHandler(self, room_jid_s, old_nick, new_nick, profile):
|
||||||
|
|
|
||||||
|
|
@ -274,11 +274,16 @@ class QuickWidgetsManager(object):
|
||||||
@param widget_to_delete(QuickWidget): widget which need to deleted
|
@param widget_to_delete(QuickWidget): widget which need to deleted
|
||||||
@param *args: extra arguments to pass to onDelete
|
@param *args: extra arguments to pass to onDelete
|
||||||
@param *kwargs: extra keywords arguments to pass to onDelete
|
@param *kwargs: extra keywords arguments to pass to onDelete
|
||||||
the extra arguments are not use by QuickFrontend, it's is up to
|
the extra arguments are not used by QuickFrontend, it's is up to
|
||||||
the frontend to use them or not
|
the frontend to use them or not.
|
||||||
"all_instances" can be used as kwarg, if it evaluate to True, all
|
following extra arguments are well known:
|
||||||
instances of the widget will be deleted (if onDelete is not returning False
|
- "all_instances" can be used as kwarg, if it evaluate to True,
|
||||||
for any of the instance). This arguments is not sent to onDelete methods.
|
all instances of the widget will be deleted (if onDelete is
|
||||||
|
not returning False for any of the instance). This arguments
|
||||||
|
is not sent to onDelete methods.
|
||||||
|
- "explicit_close" is used when the deletion is requested by
|
||||||
|
the user or a leave signal, "all_instances" is usually set at
|
||||||
|
the same time.
|
||||||
"""
|
"""
|
||||||
# TODO: all_instances must be independante kwargs, this is not possible with Python 2
|
# TODO: all_instances must be independante kwargs, this is not possible with Python 2
|
||||||
# but will be with Python 3
|
# but will be with Python 3
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue