# HG changeset patch # User Goffi # Date 1484516482 -3600 # Node ID cf63e4209643b2e3397a3e4d75aade1c6a5a4a1e # Parent c42aab22c2c0d6847cb66034b2fa802d81ae0779 quick frontend(contact list): added all_iter property to get all cached entities diff -r c42aab22c2c0 -r cf63e4209643 frontends/src/quick_frontend/quick_contact_list.py --- a/frontends/src/quick_frontend/quick_contact_list.py Sun Jan 15 17:51:37 2017 +0100 +++ b/frontends/src/quick_frontend/quick_contact_list.py Sun Jan 15 22:41:22 2017 +0100 @@ -171,6 +171,15 @@ return self._selected @property + def all_iter(self): + """return all know entities in cache as an iterator of tuples + + entities are not sorted + """ + return self._cache.iteritems() + + + @property def items(self): """Return item representation for all visible entities in cache @@ -179,6 +188,7 @@ """ return {jid_:cache for jid_, cache in self._cache.iteritems() if self.entityToShow(jid_)} + def getItem(self, entity): """Return item representation of requested entity @@ -719,6 +729,18 @@ return entities @property + def all_iter(self): + """Return item representation for all entities in cache + + items are unordered + """ + for profile, contact_list in self._clist.iteritems(): + for bare_jid, cache in contact_list.all_iter: + data = cache.copy() + data[C.CONTACT_PROFILE] = profile + yield bare_jid, data + + @property def items(self): """Return item representation for visible entities in cache @@ -731,7 +753,6 @@ data = cache.copy() items[bare_jid] = data data[C.CONTACT_PROFILE] = profile - items.update(contact_list.items) return items @property @@ -901,6 +922,10 @@ handler.register(self) @property + def all_iter(self): + return handler.all_iter + + @property def items(self): return handler.items