diff src/browser/sat_browser/contact_list.py @ 909:e8b133b77aa4

browser, server: update to get compatibility with 0.7-dev (not finished): Q&D update to restore compatibility - version changed to 0.7D - contact list has been modified to be compatible with changes, but it doesn't take profit of improvment yet - messageSend partially work, there is a disconnection and an error in console logs when sending a message - message are not received yet
author Goffi <goffi@goffi.org>
date Tue, 09 Aug 2016 01:07:15 +0200
parents f8a7a046ff9c
children 997cf25e785c
line wrap: on
line diff
--- a/src/browser/sat_browser/contact_list.py	Wed Jul 13 22:45:54 2016 +0200
+++ b/src/browser/sat_browser/contact_list.py	Tue Aug 09 01:07:15 2016 +0200
@@ -63,7 +63,10 @@
         VerticalPanel.__init__(self)
         self.setStyleName('groupPanel')
         self._parent = parent
-        self._groups = set()
+
+    @property
+    def _groups(self):
+        return self._parent.contact_list._groups
 
     def add(self, group):
         if group in self._groups:
@@ -99,7 +102,7 @@
         return None
 
     def getGroups(self):
-        return self._groups
+        return set([g for g in self._groups if g is not None])
 
 
 class ContactTitleLabel(libervia_widget.DragLabel, Label, ClickHandler):
@@ -118,8 +121,9 @@
 class ContactList(SimplePanel, QuickContactList):
     """Manage the contacts and groups"""
 
-    def __init__(self, host):
+    def __init__(self, host, target, on_click=None, on_change=None, user_data=None, profiles=None):
         QuickContactList.__init__(self, host, C.PROF_KEY_NONE)
+        self.contact_list = self.host.contact_list
         SimplePanel.__init__(self)
         self.host = host
         self.scroll_panel = ScrollPanel()
@@ -146,6 +150,7 @@
         # FIXME: workaround for a pyjamas issue: calling hash on a class method always return a different value if that method is defined directly within the class (with the "def" keyword)
         self.avatarListener = self.onAvatarUpdate
         host.addListener('avatar', self.avatarListener, [C.PROF_KEY_NONE])
+        self.postInit()
 
     @property
     def profile(self):
@@ -155,13 +160,13 @@
         QuickContactList.onDelete(self)
         self.host.removeListener('avatar', self.avatarListener)
 
-    def update(self):
+    def update(self, entities=None, type_=None, profile=None):
         # XXX: as update is slow, we avoid many updates on profile plugs
         # and do them all at once at the end
-        if not self.host._profile_plugged:
+        if not self.host._profile_plugged:  # FIXME: should not be necessary anymore (done in QuickFrontend)
             return
         ### GROUPS ###
-        _keys = self._groups.keys()
+        _keys = self.contact_list._groups.keys()
         try:
             # XXX: Pyjamas doesn't do the set casting if None is present
             _keys.remove(None)
@@ -177,7 +182,7 @@
             self._group_panel.remove(group)
 
         ### JIDS ###
-        to_show = [jid_ for jid_ in self.roster_entities if self.entityToShow(jid_) and jid_ != self.whoami.bare]
+        to_show = [jid_ for jid_ in self.contact_list.roster if self.contact_list.entityToShow(jid_) and jid_ != self.contact_list.whoami.bare]
         to_show.sort()
 
         self._contacts_panel.setList(to_show)
@@ -197,7 +202,7 @@
         return False
 
     def getGroups(self):
-        return self.groups.keys()
+        return self._group_panel.getGroups()
 
     def onMouseMove(self, sender, x, y):
         pass