Mercurial > libervia-backend
diff frontends/src/quick_frontend/quick_contact_list.py @ 1332:0f92b6a150ff frontends_multi_profiles
quick_frontend, primitivus: use a listener to update the contact list when receiving a presence
author | souliane <souliane@mailoo.org> |
---|---|
date | Sun, 22 Feb 2015 21:30:20 +0100 |
parents | 7a3a232d4938 |
children | f29beedb33b0 |
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_contact_list.py Sun Feb 22 20:39:33 2015 +0100 +++ b/frontends/src/quick_frontend/quick_contact_list.py Sun Feb 22 21:30:20 2015 +0100 @@ -71,6 +71,10 @@ self.host.bridge.asyncGetParamA(C.SHOW_EMPTY_GROUPS, "General", profile_key=profile, callback=self.showEmptyGroups) self.host.bridge.asyncGetParamA(C.SHOW_OFFLINE_CONTACTS, "General", profile_key=profile, callback=self.showOfflineContacts) + # 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.presenceListener = self.updatePresence + self.host.addListener('presence', self.presenceListener, [profile]) + def __contains__(self, entity): """Check if entity is in contact list @@ -418,3 +422,7 @@ return self.show_resources = show self.update() + + def onDelete(self): + QuickWidget.onDelete(self) + self.host.removeListener('presence', self.presenceListener)