Mercurial > libervia-web
comparison src/browser/sat_browser/contact_list.py @ 640:75715f5c95e3 frontends_multi_profiles
browser side(contact list): added nick listener
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 24 Feb 2015 16:49:07 +0100 |
parents | 8da4735a3c81 |
children | f5145881723a |
comparison
equal
deleted
inserted
replaced
639:8da4735a3c81 | 640:75715f5c95e3 |
---|---|
110 contact_html = html_tools.html_sanitize(self.nick or unicode(self.jid)) | 110 contact_html = html_tools.html_sanitize(self.nick or unicode(self.jid)) |
111 html = "%(alert)s%(contact)s" % {'alert': alert_html, | 111 html = "%(alert)s%(contact)s" % {'alert': alert_html, |
112 'contact': contact_html} | 112 'contact': contact_html} |
113 self.setHTML(html) | 113 self.setHTML(html) |
114 | 114 |
115 def updateNick(self, new_nick): | |
116 """Change the current nick | |
117 | |
118 @param new_nick(unicode): new nick to use | |
119 """ | |
120 self.nick = new_nick | |
121 self.refresh() | |
122 | |
115 def setAlert(self, alert): | 123 def setAlert(self, alert): |
116 """Show a visual indicator | 124 """Show a visual indicator |
117 | 125 |
118 @param alert: True if alert must be shown | 126 @param alert: True if alert must be shown |
119 """ | 127 """ |
168 """Update the avatar. | 176 """Update the avatar. |
169 | 177 |
170 @param url (unicode): image url | 178 @param url (unicode): image url |
171 """ | 179 """ |
172 self.avatar.setUrl(url) | 180 self.avatar.setUrl(url) |
181 | |
182 def updateNick(self, new_nick): | |
183 """Update the nickname. | |
184 | |
185 @param new_nick (unicode): new nickname to use | |
186 """ | |
187 self.label.updateNick(new_nick) | |
173 | 188 |
174 def onClick(self, sender): | 189 def onClick(self, sender): |
175 try: | 190 try: |
176 self.parent.onClick(self.jid) | 191 self.parent.onClick(self.jid) |
177 except AttributeError: | 192 except AttributeError: |
291 @param jid_ (jid.JID): contact jid | 306 @param jid_ (jid.JID): contact jid |
292 @param url (unicode): image url | 307 @param url (unicode): image url |
293 """ | 308 """ |
294 try: | 309 try: |
295 self.getContactBox(jid_).updateAvatar(url) | 310 self.getContactBox(jid_).updateAvatar(url) |
311 except TypeError: | |
312 pass | |
313 | |
314 def updateNick(self, jid_, new_nick): | |
315 """Update the avatar of the given contact | |
316 | |
317 @param jid_ (jid.JID): contact jid | |
318 @param new_nick (unicode): new nick of the contact | |
319 """ | |
320 try: | |
321 self.getContactBox(jid_).updateNick(new_nick) | |
296 except TypeError: | 322 except TypeError: |
297 pass | 323 pass |
298 | 324 |
299 | 325 |
300 class ContactsPanel(BaseContactsPanel): | 326 class ContactsPanel(BaseContactsPanel): |
552 jids = self.getGroupData(sender.group, "jids") | 578 jids = self.getGroupData(sender.group, "jids") |
553 for contact in self._contacts_panel: | 579 for contact in self._contacts_panel: |
554 if contact.jid in jids: | 580 if contact.jid in jids: |
555 contact.label.removeStyleName("selected") | 581 contact.label.removeStyleName("selected") |
556 | 582 |
557 def updateAvatar(self, jid_s, url): | |
558 """Update the avatar of the given contact | |
559 | |
560 @param jid_s (unicode): contact jid | |
561 @param url (unicode): image url | |
562 """ | |
563 self._contacts_panel.updateAvatar(jid_s, url) | |
564 | |
565 def onAvatarUpdate(self, jid_, hash_, profile): | 583 def onAvatarUpdate(self, jid_, hash_, profile): |
566 """Called on avatar update events | 584 """Called on avatar update events |
567 | 585 |
568 @param jid_: jid of the entity with updated avatar | 586 @param jid_: jid of the entity with updated avatar |
569 @param hash_: hash of the avatar | 587 @param hash_: hash of the avatar |
570 @param profile: %(doc_profile)s | 588 @param profile: %(doc_profile)s |
571 """ | 589 """ |
572 self._contacts_panel.updateAvatar(jid_, self.host.getAvatarURL(jid_)) | 590 self._contacts_panel.updateAvatar(jid_, self.host.getAvatarURL(jid_)) |
591 | |
592 def onNickUpdate(self, jid_, new_nick, profile): | |
593 self._contacts_panel.updateNick(jid_, new_nick) | |
573 | 594 |
574 def hasVisibleMembers(self, group): | 595 def hasVisibleMembers(self, group): |
575 """Tell if the given group actually has visible members | 596 """Tell if the given group actually has visible members |
576 | 597 |
577 @param group (unicode): the group to check | 598 @param group (unicode): the group to check |