diff src/browser/sat_browser/contact_panel.py @ 660:267761bf7f08 frontends_multi_profiles

browser side (contact list): ContactPanels is used instead of OccupantsList in MUC: - ContactPanels become the generic class for all lists of contacts - OccupantsList will be removed - need to implements specials icons (e.g. for games) in ContactBox - ContactBox now manage a display arguments to set which data we want to display - ContactsPanel.display renamed to setList - ContactBox style can be changed when instaciating parent ContactsPanel - muc_contact CSS class is used for list of MUC occupants Not fully functionnal yet
author Goffi <goffi@goffi.org>
date Fri, 27 Feb 2015 22:53:27 +0100
parents 6d3142b782c3
children 2201ff543a05
line wrap: on
line diff
--- a/src/browser/sat_browser/contact_panel.py	Fri Feb 27 16:05:28 2015 +0100
+++ b/src/browser/sat_browser/contact_panel.py	Fri Feb 27 22:53:27 2015 +0100
@@ -82,7 +82,7 @@
     Special features like popup menu panel or changing the contact states must be done in a sub-class.
     """
 
-    def __init__(self, parent, on_click=None, handle_menu=True):
+    def __init__(self, parent, on_click=None, handle_menu=True, contacts_style=None, contacts_display=C.CONTACT_DEFAULT_DISPLAY):
         """
         @param on_click (callable): click callback (used if ContactBox is created)
         @param handle_menu (bool): if True, bind a popup menu to the avatar (used if ContactBox is created)
@@ -97,8 +97,11 @@
         if on_click is not None:
             self.onClick = on_click
 
-    def display(self, jids):
-        """Display a contact in the list.
+        self.contacts_style=contacts_style
+        self.contacts_display = contacts_display
+
+    def setList(self, jids):
+        """set all contacts in the list in one shot.
 
         @param jids (list[jid.JID]): jids to display (the order is kept)
         @param name (unicode): optional name of the contact
@@ -131,7 +134,7 @@
         try:
             return self._contacts[contact_jid.bare]
         except KeyError:
-            box = contact_widget.ContactBox(self, contact_jid)
+            box = contact_widget.ContactBox(self, contact_jid, style_name=self.contacts_style, display=self.contacts_display)
             self._contacts[contact_jid.bare] = box
             return box