comparison 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
comparison
equal deleted inserted replaced
229:e632f77c4219 230:266e9678eec0
42 DragLabel.__init__(self, group, "GROUP") 42 DragLabel.__init__(self, group, "GROUP")
43 ClickHandler.__init__(self) 43 ClickHandler.__init__(self)
44 self.addClickListener(self) 44 self.addClickListener(self)
45 45
46 def onClick(self, sender): 46 def onClick(self, sender):
47 new_wid = MicroblogPanel.createGroup(self.host, self.group) 47 self.host.getOrCreateLiberviaWidget(MicroblogPanel, self.group)
48 self.host.addWidget(new_wid) 48
49
50 49
51 class ContactLabel(DragLabel, HTML, ClickHandler): 50 class ContactLabel(DragLabel, HTML, ClickHandler):
52 def __init__(self, host, jid, name=None): 51 def __init__(self, host, jid, name=None):
53 HTML.__init__(self) 52 HTML.__init__(self)
54 self.host = host 53 self.host = host
72 @param waiting: True if message are waiting""" 71 @param waiting: True if message are waiting"""
73 self.waiting = waiting 72 self.waiting = waiting
74 self._fill() 73 self._fill()
75 74
76 def onClick(self, sender): 75 def onClick(self, sender):
77 new_wid = ChatPanel.createChat(self.host, self.jid) 76 self.host.getOrCreateLiberviaWidget(ChatPanel, self.jid)
78 self.host.addWidget(new_wid) 77
79 78
80 class GroupList(VerticalPanel): 79 class GroupList(VerticalPanel):
81 80
82 def __init__(self, parent): 81 def __init__(self, parent):
83 VerticalPanel.__init__(self) 82 VerticalPanel.__init__(self)
160 DragLabel.__init__(self, text, "CONTACT_TITLE") 159 DragLabel.__init__(self, text, "CONTACT_TITLE")
161 ClickHandler.__init__(self) 160 ClickHandler.__init__(self)
162 self.addClickListener(self) 161 self.addClickListener(self)
163 162
164 def onClick(self, sender): 163 def onClick(self, sender):
165 new_wid = MicroblogPanel.createMeta(self.host, None) 164 self.host.getOrCreateLiberviaWidget(MicroblogPanel, None)
166 self.host.addWidget(new_wid) 165
167 166
168 class ContactPanel(SimplePanel): 167 class ContactPanel(SimplePanel):
169 """Manage the contacts and groups""" 168 """Manage the contacts and groups"""
170 169
171 def __init__(self, host): 170 def __init__(self, host):