comparison src/browser/sat_browser/contact_list.py @ 637:7113d40533d6 frontends_multi_profiles

merged souliane changes
author Goffi <goffi@goffi.org>
date Mon, 23 Feb 2015 18:47:27 +0100
parents 16a5da120b7f 9092e624bb27
children 63697f082e8a
comparison
equal deleted inserted replaced
636:86ae737da6f3 637:7113d40533d6
356 self.vPanel.add(self._contacts_panel) 356 self.vPanel.add(self._contacts_panel)
357 self.scroll_panel.add(self.vPanel) 357 self.scroll_panel.add(self.vPanel)
358 self.add(self.scroll_panel) 358 self.add(self.scroll_panel)
359 self.setStyleName('contactList') 359 self.setStyleName('contactList')
360 Window.addWindowResizeListener(self) 360 Window.addWindowResizeListener(self)
361 host.addListerner('avatar', self.onAvatarUpdate) 361
362 # 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)
363 self.avatarListener = self.onAvatarUpdate
364 host.addListener('avatar', self.avatarListener, [C.PROF_KEY_NONE])
362 365
363 @property 366 @property
364 def profile(self): 367 def profile(self):
365 return C.PROF_KEY_NONE 368 return C.PROF_KEY_NONE
366 369
367 def onDelete(self): 370 def onDelete(self):
368 QuickContactList.onDelete(self) 371 QuickContactList.onDelete(self)
369 self.host.removeListener('avatar', self.onAvatarUpdate) 372 self.host.removeListener('avatar', self.avatarListener)
370 373
371 def update(self): 374 def update(self):
372 ### GROUPS ### 375 ### GROUPS ###
373 _keys = self._groups.keys() 376 _keys = self._groups.keys()
374 try: 377 try:
475 # if jid_s not in self.connected or priority >= max_priority: 478 # if jid_s not in self.connected or priority >= max_priority:
476 # # case 1: jid not in self.connected means all resources are disconnected, update with 'unavailable' 479 # # case 1: jid not in self.connected means all resources are disconnected, update with 'unavailable'
477 # # case 2: update (or confirm) with the values of the resource which takes precedence 480 # # case 2: update (or confirm) with the values of the resource which takes precedence
478 # self._contacts_panel.setState(jid_s, "availability", availability) 481 # self._contacts_panel.setState(jid_s, "availability", availability)
479 482
480 # # update the connected contacts chooser live
481 # if hasattr(self.host, "room_contacts_chooser") and self.host.room_contacts_chooser is not None:
482 # self.host.room_contacts_chooser.resetContacts()
483
484 # self.updateVisibility([jid_s], self.getContactGroups(jid_s)) 483 # self.updateVisibility([jid_s], self.getContactGroups(jid_s))
485 484
486 def setContactMessageWaiting(self, jid, waiting): 485 def setContactMessageWaiting(self, jid, waiting):
487 """Show a visual indicator that contact has send a message 486 """Show a visual indicator that contact has send a message
488 487
561 @param jid_s (unicode): contact jid 560 @param jid_s (unicode): contact jid
562 @param url (unicode): image url 561 @param url (unicode): image url
563 """ 562 """
564 self._contacts_panel.updateAvatar(jid_s, url) 563 self._contacts_panel.updateAvatar(jid_s, url)
565 564
566 def onAvatarUpdate(self, jid_, hash_, profile): 565 def onAvatarUpdate(self, jid_, hash_):
567 """Called on avatar update events 566 """Called on avatar update events
568 567
569 @param jid_: jid of the entity with updated avatar 568 @param jid_: jid of the entity with updated avatar
570 @param hash_: hash of the avatar 569 @param hash_: hash of the avatar
571 @param profile: should be C.PROF_KEY_NONE
572 """ 570 """
573 self._contacts_panel.updateAvatar(jid_, self.host.getAvatarURL(jid_)) 571 self._contacts_panel.updateAvatar(jid_, self.host.getAvatarURL(jid_))
574 572
575 def hasVisibleMembers(self, group): 573 def hasVisibleMembers(self, group):
576 """Tell if the given group actually has visible members 574 """Tell if the given group actually has visible members