Mercurial > libervia-web
comparison src/browser/sat_browser/blog.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 | 1c0d5a87c554 |
comparison
equal
deleted
inserted
replaced
606:7af8f4ab3675 | 607:537649f6a2d0 |
---|---|
372 self.comments = {} | 372 self.comments = {} |
373 self.selected_entry = None | 373 self.selected_entry = None |
374 self.vpanel = VerticalPanel() | 374 self.vpanel = VerticalPanel() |
375 self.vpanel.setStyleName('microblogPanel') | 375 self.vpanel.setStyleName('microblogPanel') |
376 self.setWidget(self.vpanel) | 376 self.setWidget(self.vpanel) |
377 host.addListerner('avatar', self.onAvatarUpdate) | |
377 | 378 |
378 def __str__(self): | 379 def __str__(self): |
379 return u"Blog Widget [target: {}, profile: {}]".format(self.target, self.profile) | 380 return u"Blog Widget [target: {}, profile: {}]".format(self.target, self.profile) |
380 | 381 |
381 @property | 382 @property |
382 def target(self): | 383 def target(self): |
383 return tuple(self.accepted_groups) | 384 return tuple(self.accepted_groups) |
385 | |
386 def onDelete(self): | |
387 quick_widgets.QuickWidget.onDelete(self) | |
388 self.host.removeListener('avatar', self.onAvatarUpdate) | |
389 | |
390 def onAvatarUpdate(self, jid_, hash_, profile): | |
391 """Called on avatar update events | |
392 | |
393 @param jid_: jid of the entity with updated avatar | |
394 @param hash_: hash of the avatar | |
395 @param profile: should be C.PROF_KEY_NONE | |
396 """ | |
397 whoami = self.host.profiles[self.profile].whoami.bare | |
398 if self.isJidAccepted(jid_) or jid_.bare == whoami.bare: | |
399 self.updateValue('avatar', jid_, hash_) | |
384 | 400 |
385 def refresh(self): | 401 def refresh(self): |
386 """Refresh the display of this widget. If the unibox is disabled, | 402 """Refresh the display of this widget. If the unibox is disabled, |
387 display the 'New message' button or an empty bubble on top of the panel""" | 403 display the 'New message' button or an empty bubble on top of the panel""" |
388 if hasattr(self, 'new_button'): | 404 if hasattr(self, 'new_button'): |