comparison src/browser/sat_browser/contact_list.py @ 624:9092e624bb27 frontends_multi_profiles

browser_side: fixes various issues
author souliane <souliane@mailoo.org>
date Sun, 22 Feb 2015 21:51:20 +0100
parents 2c41ce0c3b3f
children 7113d40533d6
comparison
equal deleted inserted replaced
623:4f7550a083b4 624:9092e624bb27
350 self.vPanel.add(self._contacts_panel) 350 self.vPanel.add(self._contacts_panel)
351 self.scroll_panel.add(self.vPanel) 351 self.scroll_panel.add(self.vPanel)
352 self.add(self.scroll_panel) 352 self.add(self.scroll_panel)
353 self.setStyleName('contactList') 353 self.setStyleName('contactList')
354 Window.addWindowResizeListener(self) 354 Window.addWindowResizeListener(self)
355 host.addListener('avatar', self.onAvatarUpdate) 355
356 # FIXME: workaround for a pyjamas issue: calling hash on a class method always return a different value if that method is defined directly within the class (with the "def" keyword)
357 self.avatarListener = self.onAvatarUpdate
358 host.addListener('avatar', self.avatarListener, [C.PROF_KEY_NONE])
356 359
357 @property 360 @property
358 def profile(self): 361 def profile(self):
359 return C.PROF_KEY_NONE 362 return C.PROF_KEY_NONE
360 363
361 def onDelete(self): 364 def onDelete(self):
362 QuickContactList.onDelete(self) 365 QuickContactList.onDelete(self)
363 self.host.removeListener('avatar', self.onAvatarUpdate) 366 self.host.removeListener('avatar', self.avatarListener)
364 367
365 def update(self): 368 def update(self):
366 ### GROUPS ### 369 ### GROUPS ###
367 _keys = self._groups.keys() 370 _keys = self._groups.keys()
368 try: 371 try:
471 # if jid_s not in self.connected or priority >= max_priority: 474 # if jid_s not in self.connected or priority >= max_priority:
472 # # case 1: jid not in self.connected means all resources are disconnected, update with 'unavailable' 475 # # case 1: jid not in self.connected means all resources are disconnected, update with 'unavailable'
473 # # case 2: update (or confirm) with the values of the resource which takes precedence 476 # # case 2: update (or confirm) with the values of the resource which takes precedence
474 # self._contacts_panel.setState(jid_s, "availability", availability) 477 # self._contacts_panel.setState(jid_s, "availability", availability)
475 478
476 # # update the connected contacts chooser live
477 # if hasattr(self.host, "room_contacts_chooser") and self.host.room_contacts_chooser is not None:
478 # self.host.room_contacts_chooser.resetContacts()
479
480 # self.updateVisibility([jid_s], self.getContactGroups(jid_s)) 479 # self.updateVisibility([jid_s], self.getContactGroups(jid_s))
481 480
482 def setContactMessageWaiting(self, jid, waiting): 481 def setContactMessageWaiting(self, jid, waiting):
483 """Show an visual indicator that contact has send a message 482 """Show an visual indicator that contact has send a message
484 @param jid: jid of the contact 483 @param jid: jid of the contact
555 @param jid_s (unicode): contact jid 554 @param jid_s (unicode): contact jid
556 @param url (unicode): image url 555 @param url (unicode): image url
557 """ 556 """
558 self._contacts_panel.updateAvatar(jid_s, url) 557 self._contacts_panel.updateAvatar(jid_s, url)
559 558
560 def onAvatarUpdate(self, jid_, hash_, profile): 559 def onAvatarUpdate(self, jid_, hash_):
561 """Called on avatar update events 560 """Called on avatar update events
562 561
563 @param jid_: jid of the entity with updated avatar 562 @param jid_: jid of the entity with updated avatar
564 @param hash_: hash of the avatar 563 @param hash_: hash of the avatar
565 @param profile: should be C.PROF_KEY_NONE
566 """ 564 """
567 self._contacts_panel.updateAvatar(jid_, self.host.getAvatarURL(jid_)) 565 self._contacts_panel.updateAvatar(jid_, self.host.getAvatarURL(jid_))
568 566
569 def hasVisibleMembers(self, group): 567 def hasVisibleMembers(self, group):
570 """Tell if the given group actually has visible members 568 """Tell if the given group actually has visible members