diff browser_side/list_manager.py @ 256:0e7f3944bd27

browser_side: added contact group manager based on ListManager
author souliane <souliane@mailoo.org>
date Sat, 09 Nov 2013 09:39:45 +0100
parents 28d3315a8003
children d3c734669577
line wrap: on
line diff
--- a/browser_side/list_manager.py	Sat Nov 09 15:31:39 2013 +0100
+++ b/browser_side/list_manager.py	Sat Nov 09 09:39:45 2013 +0100
@@ -86,6 +86,7 @@
 
         self.style = {
            "keyItem": "recipientTypeItem",
+           "popupMenuItem": "recipientTypeItem",
            "buttonCell": "recipientButtonCell",
            "dragoverPanel": "dragover-recipientPanel",
            "keyPanel": "recipientPanel",
@@ -110,7 +111,7 @@
     def _addChild(self, entry, title_format):
         """Add a button and FlowPanel for the corresponding map entry."""
         button = Button(title_format % entry["title"])
-        button.addStyleName(self.style["keyItem"])
+        button.setStyleName(self.style["keyItem"])
         if hasattr(entry, "desc"):
             button.setTitle(entry["desc"])
         if not "optional" in entry:
@@ -211,7 +212,7 @@
 
     def registerPopupMenuPanel(self, entries, hide, callback):
         "Register a popup menu panel that will be bound to all contact keys elements."
-        self.popup_menu = panels.PopupMenuPanel(entries=entries, hide=hide, callback=callback, item_style="recipientTypeItem")
+        self.popup_menu = panels.PopupMenuPanel(entries=entries, hide=hide, callback=callback, item_style=self.style["popupMenuItem"])
 
 
 class DragAutoCompleteTextBox(AutoCompleteTextBox, DragWidget, MouseHandler):
@@ -427,6 +428,9 @@
     def setContacts(self, tab):
         """Set the contacts."""
         self.emptyContacts()
+        if isinstance(tab, set):
+            tab = list(tab)
+        tab.sort()
         for contact in tab:
             self.addContact(contact, resetLastTextBox=False)
         self.__resetLastTextBox()