Mercurial > libervia-backend
comparison frontends/src/quick_frontend/quick_contact_list.py @ 1430:ba09cd879343
quick frontends (contact list): cache is not cleared anymore on QuickContactList.fill, avoiding the accidental removal of cached values like avatars
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 27 May 2015 19:08:16 +0200 |
parents | 798e5e38516b |
children | 6ce18c4e5708 |
comparison
equal
deleted
inserted
replaced
1429:798e5e38516b | 1430:ba09cd879343 |
---|---|
137 def fill(self): | 137 def fill(self): |
138 """Get all contacts from backend, and fill the widget | 138 """Get all contacts from backend, and fill the widget |
139 | 139 |
140 Contacts will be cleared before refilling them | 140 Contacts will be cleared before refilling them |
141 """ | 141 """ |
142 self.clearContacts() | 142 self.clearContacts(keep_cache=True) |
143 def gotContacts(contacts): | 143 def gotContacts(contacts): |
144 for contact in contacts: | 144 for contact in contacts: |
145 self.host.newContactHandler(*contact, profile=self.profile) | 145 self.host.newContactHandler(*contact, profile=self.profile) |
146 | 146 |
147 self.host.bridge.getContacts(self.profile, callback=gotContacts) | 147 self.host.bridge.getContacts(self.profile, callback=gotContacts) |
257 """ | 257 """ |
258 if special_type is None: | 258 if special_type is None: |
259 return self._special_extras | 259 return self._special_extras |
260 return set([extra for extra in self._special_extras if extra.bare in self.getSpecials(special_type)]) | 260 return set([extra for extra in self._special_extras if extra.bare in self.getSpecials(special_type)]) |
261 | 261 |
262 def clearContacts(self): | 262 def clearContacts(self, keep_cache=False): |
263 """Clear all the contact list""" | 263 """Clear all the contact list |
264 | |
265 @param keep_cache: if True, don't reset the cache | |
266 """ | |
264 self.unselectAll() | 267 self.unselectAll() |
265 self._cache.clear() | 268 if not keep_cache: |
269 self._cache.clear() | |
266 self._groups.clear() | 270 self._groups.clear() |
267 self._specials.clear() | 271 self._specials.clear() |
268 self._special_extras.clear() | 272 self._special_extras.clear() |
269 self._roster.clear() | 273 self._roster.clear() |
270 self._alerts.clear() | 274 self._alerts.clear() |