changeset 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 7a9c7b9f6a28
files src/browser/sat_browser/contact_group.py src/browser/sat_browser/contact_widget.py
diffstat 2 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/sat_browser/contact_group.py	Thu Apr 09 11:40:53 2015 +0200
+++ b/src/browser/sat_browser/contact_group.py	Thu Apr 09 11:46:45 2015 +0200
@@ -188,7 +188,7 @@
         self.toggle.addStyleName("toggleAssignedContacts")
         self.contacts = contact_panel.ContactsPanel(self.host)
         for contact in self.all_contacts:
-            self.contacts.add(contact)
+            self.contacts.updateContactBox(contact)
         panel = VerticalPanel()
         panel.add(self.toggle)
         panel.add(self.contacts)
--- a/src/browser/sat_browser/contact_widget.py	Thu Apr 09 11:40:53 2015 +0200
+++ b/src/browser/sat_browser/contact_widget.py	Thu Apr 09 11:46:45 2015 +0200
@@ -104,6 +104,8 @@
 
         @param url (unicode): avatar URL
         """
+        if not self.items:  # the menu is empty but we've been asked to set an avatar
+            self.addCategory("dummy")
         self.items[0].setHTML('<img src="%s" />' % url)
 
 
@@ -127,10 +129,6 @@
         self.label = ContactLabel(host, self.jid, display=display)
         self.avatar = ContactMenuBar(self, host) if plugin_menu_context else Image()
         self.states = HTML()
-        try:  # FIXME: dirty hack to force using an Image when the menu is actually empty
-            self.avatar.items[0]
-        except IndexError:
-            self.avatar = Image()
         self.add(self.avatar)
         self.add(self.label)
         self.add(self.states)