Mercurial > libervia-web
diff src/browser/sat_browser/contact_list.py @ 687:3845a086f0b3
browser_side: update ContactList, Chat, ContactsPanel, ContactBox, ContactLabel to update the display using listeners as it is done in quick_frontend:
- Chat uses presence and avatar listener, remove unecessary methods for MUC and contact states
- contact list doesn't add unecessary ContactBox (e.g for MUC bare entities)
- nick, message alerts are handled directly in ContactLabel
author | souliane <souliane@mailoo.org> |
---|---|
date | Mon, 23 Mar 2015 09:35:46 +0100 |
parents | 9877607c719a |
children | 6fc3ff3936ba |
line wrap: on
line diff
--- a/src/browser/sat_browser/contact_list.py Fri Mar 27 00:15:42 2015 +0100 +++ b/src/browser/sat_browser/contact_list.py Mon Mar 23 09:35:46 2015 +0100 @@ -176,9 +176,6 @@ self._contacts_panel.setList(to_show) - for jid_ in self._alerts: - self._contacts_panel.getContactBox(jid_).setAlert(True) - def remove(self, entity): # FIXME: SimplePanel and QuickContactList both have a 'remove' method QuickContactList.remove(self, entity) @@ -339,10 +336,14 @@ @param hash_: hash of the avatar @param profile: %(doc_profile)s """ - self._contacts_panel.updateAvatar(jid_, self.host.getAvatarURL(jid_)) + box = self._contacts_panel.getContactBox(jid_) + if box: + box.update() def onNickUpdate(self, jid_, new_nick, profile): - self._contacts_panel.updateNick(jid_, new_nick) + box = self._contacts_panel.getContactBox(jid_) + if box: + box.update() def hasVisibleMembers(self, group): """Tell if the given group actually has visible members @@ -352,7 +353,7 @@ """ raise Exception # FIXME: remove this method for jid_ in self.groups[group]: - if self._contacts_panel.getContactBox(jid_).isVisible(): + if self._contacts_panel.updateContactBox(jid_).isVisible(): return True return False @@ -372,7 +373,9 @@ def onPresenceUpdate(self, entity, show, priority, statuses, profile): QuickContactList.onPresenceUpdate(self, entity, show, priority, statuses, profile) - self._contacts_panel.setPresence(entity, show) + box = self._contacts_panel.getContactBox(entity) + if box: # box doesn't exist for MUC bare entity, don't create it + box.update() # def updateVisibility(self, jids, groups): # """Set the widgets visibility for the given contacts and groups