Mercurial > libervia-web
diff src/browser/sat_browser/contact.py @ 510:db3436c85fb1
browser_side: the status menu is now based on GenericMenuBar instead of PopupMenuPanel
author | souliane <souliane@mailoo.org> |
---|---|
date | Thu, 21 Aug 2014 16:44:39 +0200 |
parents | 60be99de3808 |
children | 3d8e8f693576 |
line wrap: on
line diff
--- a/src/browser/sat_browser/contact.py Thu Aug 21 16:18:51 2014 +0200 +++ b/src/browser/sat_browser/contact.py Thu Aug 21 16:44:39 2014 +0200 @@ -39,7 +39,18 @@ import html_tools -def setPresenceStyle(widget, presence, base_style="contactLabel"): +def buildPresenceStyle(presence, base_style=None): + """Return the CSS classname to be used for displaying the given presence information. + @param presence (str): presence is a value in ('', 'chat', 'away', 'dnd', 'xa') + @param base_style (str): base classname + @return: str + """ + if not base_style: + base_style = "contactLabel" + return '%s-%s' % (base_style, presence or 'connected') + + +def setPresenceStyle(widget, presence, base_style=None): """ Set the CSS style of a contact's element according to its presence. @@ -49,7 +60,7 @@ """ if not hasattr(widget, 'presence_style'): widget.presence_style = None - style = '%s-%s' % (base_style, presence or 'connected') + style = buildPresenceStyle(presence, base_style) if style == widget.presence_style: return if widget.presence_style is not None: