Mercurial > libervia-web
diff src/browser/sat_browser/contact_widget.py @ 684:e876f493dccc
browser_side: follow changes made on quick_frontend for chat states and MUC symbols + minor fixes following the refactorisation:
- some MUC handlers are no more needed, the presence handler is enough
- move the chat states logic to quick_frontend
- display MUC games symbols
- remove classes contact_list.ContactsPanel, contact_panel.Occupant and contact_panel.OccupantsList
- move buildPresenceStyle and setPresenceStyle to html_tools
- fixes games menu callback
author | souliane <souliane@mailoo.org> |
---|---|
date | Wed, 18 Mar 2015 10:17:04 +0100 |
parents | 849ffb24d5bf |
children | 9877607c719a |
line wrap: on
line diff
--- a/src/browser/sat_browser/contact_widget.py Thu Mar 19 20:41:46 2015 +0100 +++ b/src/browser/sat_browser/contact_widget.py Wed Mar 18 10:17:04 2015 +0100 @@ -74,7 +74,7 @@ if contact_raw: break if not contact_raw: - log.error(u"Counld not find a contact display for jid {jid} (display: {display})".format(jid=self.jid, display=self.display)) + log.error(u"Could not find a contact display for jid {jid} (display: {display})".format(jid=self.jid, display=self.display)) contact_raw = "UNNAMED" contact_html = html_tools.html_sanitize(contact_raw) html = "%(alert)s%(contact)s" % {'alert': alert_html, @@ -132,6 +132,7 @@ self.jid = jid_ self.label = ContactLabel(host, self.jid, display=display) self.avatar = ContactMenuBar(self, host) if plugin_menu_context else Image() + self.states = HTML("") try: # FIXME: dirty hack to force using an Image when the menu is actually empty self.avatar.items[0] except IndexError: @@ -139,12 +140,14 @@ self.updateAvatar(host.getAvatarURL(self.jid.bare)) self.add(self.avatar) self.add(self.label) + self.add(self.states) self.addClickListener(self) def setAlert(self, alert): - """Show a visual indicator + """Show a visual indicator. - @param alert: True if alert indicator show be shown""" + @param alert (bool): True if alert indicator show be shown + """ self.label.setAlert(alert) def updateAvatar(self, url): @@ -159,7 +162,14 @@ @param new_nick (unicode): new nickname to use """ - self.label.updateNick(new_nick) + self.label.updateNick(html_tools.html_sanitize(new_nick)) + + def updateStates(self, states): + """Update the states. + + @param states (dict{unicode: unicode}): new states + """ + self.states.setHTML(u''.join(states.values())) def onClick(self, sender): try: