comparison src/browser/sat_browser/contact_list.py @ 607:537649f6a2d0 frontends_multi_profiles

browser side (blog, contact list): use of new listener mechanism to update avatar
author Goffi <goffi@goffi.org>
date Mon, 09 Feb 2015 21:56:30 +0100
parents 7af8f4ab3675
children ea27925ef2a8
comparison
equal deleted inserted replaced
606:7af8f4ab3675 607:537649f6a2d0
333 self.vPanel.add(self._contacts_panel) 333 self.vPanel.add(self._contacts_panel)
334 self.scroll_panel.add(self.vPanel) 334 self.scroll_panel.add(self.vPanel)
335 self.add(self.scroll_panel) 335 self.add(self.scroll_panel)
336 self.setStyleName('contactList') 336 self.setStyleName('contactList')
337 Window.addWindowResizeListener(self) 337 Window.addWindowResizeListener(self)
338 host.addListerner('avatar', self.onAvatarUpdate)
338 339
339 @property 340 @property
340 def profile(self): 341 def profile(self):
341 return C.PROF_KEY_NONE 342 return C.PROF_KEY_NONE
343
344 def onDelete(self):
345 QuickContactList.onDelete(self)
346 self.host.removeListener('avatar', self.onAvatarUpdate)
342 347
343 def update(self): 348 def update(self):
344 ### GROUPS ### 349 ### GROUPS ###
345 _keys = self._groups.keys() 350 _keys = self._groups.keys()
346 try: 351 try:
533 @param jid_s (str): contact jid 538 @param jid_s (str): contact jid
534 @param url (str): image url 539 @param url (str): image url
535 """ 540 """
536 self._contacts_panel.updateAvatar(jid_s, url) 541 self._contacts_panel.updateAvatar(jid_s, url)
537 542
543 def onAvatarUpdate(self, jid_, hash_, profile):
544 """Called on avatar update events
545
546 @param jid_: jid of the entity with updated avatar
547 @param hash_: hash of the avatar
548 @param profile: should be C.PROF_KEY_NONE
549 """
550 self._contacts_panel.updateAvatar(jid_, self.host.getAvatarURL(jid_))
551
538 def hasVisibleMembers(self, group): 552 def hasVisibleMembers(self, group):
539 """Tell if the given group actually has visible members 553 """Tell if the given group actually has visible members
540 554
541 @param group (str): the group to check 555 @param group (str): the group to check
542 @return: boolean 556 @return: boolean