Mercurial > libervia-web
diff browser_side/contact.py @ 230:266e9678eec0
browser_side: added the flag REUSE_EXISTING_LIBERVIA_WIDGETS
- do not create a new chat panel for contacts/groups if a similar one is found in the same tab
- this goes with a modification of the methods to create new panels, especially arguments handling
- improvement of the accepted groups list for MicroblogPanel (remove duplicates and keep sorted)
Details for the new flag:
# Set to true to not create a new LiberviaWidget when a similar one
# already exist (i.e. a chat panel with the same target). Instead
# the existing widget will be eventually removed from its parent
# and added to new WidgetsPanel, or replaced to the expected
# position if the previous and the new parent are the same.
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 08 Oct 2013 13:57:35 +0200 |
parents | 744426c2b699 |
children | a25aa882e09a |
line wrap: on
line diff
--- a/browser_side/contact.py Tue Oct 08 13:48:00 2013 +0200 +++ b/browser_side/contact.py Tue Oct 08 13:57:35 2013 +0200 @@ -44,9 +44,8 @@ self.addClickListener(self) def onClick(self, sender): - new_wid = MicroblogPanel.createGroup(self.host, self.group) - self.host.addWidget(new_wid) - + self.host.getOrCreateLiberviaWidget(MicroblogPanel, self.group) + class ContactLabel(DragLabel, HTML, ClickHandler): def __init__(self, host, jid, name=None): @@ -74,8 +73,8 @@ self._fill() def onClick(self, sender): - new_wid = ChatPanel.createChat(self.host, self.jid) - self.host.addWidget(new_wid) + self.host.getOrCreateLiberviaWidget(ChatPanel, self.jid) + class GroupList(VerticalPanel): @@ -162,8 +161,8 @@ self.addClickListener(self) def onClick(self, sender): - new_wid = MicroblogPanel.createMeta(self.host, None) - self.host.addWidget(new_wid) + self.host.getOrCreateLiberviaWidget(MicroblogPanel, None) + class ContactPanel(SimplePanel): """Manage the contacts and groups"""