comparison src/browser/sat_browser/contact_widget.py @ 691:16079280a39e

browser_side: minor fixes for ContactMenuBar and ContactGroupManager
author souliane <souliane@mailoo.org>
date Thu, 09 Apr 2015 11:46:45 +0200
parents 76a67d04c63e
children 1d60fa4d25a4
comparison
equal deleted inserted replaced
690:76a67d04c63e 691:16079280a39e
102 def setUrl(self, url): 102 def setUrl(self, url):
103 """Set the URL of the contact avatar. 103 """Set the URL of the contact avatar.
104 104
105 @param url (unicode): avatar URL 105 @param url (unicode): avatar URL
106 """ 106 """
107 if not self.items: # the menu is empty but we've been asked to set an avatar
108 self.addCategory("dummy")
107 self.items[0].setHTML('<img src="%s" />' % url) 109 self.items[0].setHTML('<img src="%s" />' % url)
108 110
109 111
110 class ContactBox(VerticalPanel, ClickHandler, libervia_widget.DragLabel): 112 class ContactBox(VerticalPanel, ClickHandler, libervia_widget.DragLabel):
111 113
125 libervia_widget.DragLabel.__init__(self, jid_, "CONTACT", host) 127 libervia_widget.DragLabel.__init__(self, jid_, "CONTACT", host)
126 self.jid = jid_ 128 self.jid = jid_
127 self.label = ContactLabel(host, self.jid, display=display) 129 self.label = ContactLabel(host, self.jid, display=display)
128 self.avatar = ContactMenuBar(self, host) if plugin_menu_context else Image() 130 self.avatar = ContactMenuBar(self, host) if plugin_menu_context else Image()
129 self.states = HTML() 131 self.states = HTML()
130 try: # FIXME: dirty hack to force using an Image when the menu is actually empty
131 self.avatar.items[0]
132 except IndexError:
133 self.avatar = Image()
134 self.add(self.avatar) 132 self.add(self.avatar)
135 self.add(self.label) 133 self.add(self.label)
136 self.add(self.states) 134 self.add(self.states)
137 self.update() 135 self.update()
138 self.addClickListener(self) 136 self.addClickListener(self)