quick_frontend: minor fixes

This commit is contained in:
Goffi 2015-08-16 01:01:34 +02:00
commit 1170edc400
2 changed files with 6 additions and 5 deletions

View file

@ -29,7 +29,7 @@ try:
# FIXME: to be removed when an acceptable solution is here
unicode('') # XXX: unicode doesn't exist in pyjamas
except (TypeError, AttributeError): # Error raised is not the same depending on pyjsbuild options
unicode = lambda x: str(x)
unicode = str
class QuickChat(quick_widgets.QuickWidget):

View file

@ -134,17 +134,18 @@ class QuickContactList(QuickWidget):
result.setdefault(entity, set()).add(group)
return result
def _gotContacts(self, contacts):
for contact in contacts:
self.host.newContactHandler(*contact, profile=self.profile)
def fill(self):
"""Get all contacts from backend, and fill the widget
Contacts will be cleared before refilling them
"""
self.clearContacts(keep_cache=True)
def gotContacts(contacts):
for contact in contacts:
self.host.newContactHandler(*contact, profile=self.profile)
self.host.bridge.getContacts(self.profile, callback=gotContacts)
self.host.bridge.getContacts(self.profile, callback=self._gotContacts)
def update(self):
"""Update the display when something changed"""