diff 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
line wrap: on
line diff
--- 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)