Mercurial > libervia-web
comparison browser_side/contact.py @ 370:30d03d9f07e4
browser_side: refactorization of the file tools.py:
- tools.py renamed to html_tools.py
- method setPresenceStyle moved to contact.py
- classes DragLabel and LiberviaDragWidget moved to base_widget.py
- class FilterFileUpload moved to file_tools.py
author | souliane <souliane@mailoo.org> |
---|---|
date | Sun, 23 Feb 2014 17:01:03 +0100 |
parents | ce5b33f499c5 |
children | 564208366dd6 |
comparison
equal
deleted
inserted
replaced
369:678d1739bbf2 | 370:30d03d9f07e4 |
---|---|
27 from jid import JID | 27 from jid import JID |
28 from pyjamas import Window | 28 from pyjamas import Window |
29 from pyjamas import DOM | 29 from pyjamas import DOM |
30 | 30 |
31 from browser_side.base_panels import PopupMenuPanel | 31 from browser_side.base_panels import PopupMenuPanel |
32 from browser_side.base_widget import DragLabel | |
32 from browser_side.panels import ChatPanel, MicroblogPanel, WebPanel, UniBoxPanel | 33 from browser_side.panels import ChatPanel, MicroblogPanel, WebPanel, UniBoxPanel |
33 from browser_side.tools import DragLabel, html_sanitize, setPresenceStyle | 34 from browser_side.tools import html_sanitize |
34 from __pyjamas__ import doc | 35 from __pyjamas__ import doc |
36 | |
37 | |
38 def setPresenceStyle(element, presence, base_style="contact"): | |
39 """ | |
40 Set the CSS style of a contact's element according to its presence. | |
41 @param item: the UI element of the contact | |
42 @param presence: a value in ("", "chat", "away", "dnd", "xa"). | |
43 @param base_style: the base name of the style to apply | |
44 """ | |
45 if not hasattr(element, 'presence_style'): | |
46 element.presence_style = None | |
47 style = '%s-%s' % (base_style, presence or 'connected') | |
48 if style == element.presence_style: | |
49 return | |
50 if element.presence_style is not None: | |
51 element.removeStyleName(element.presence_style) | |
52 element.addStyleName(style) | |
53 element.presence_style = style | |
35 | 54 |
36 | 55 |
37 class GroupLabel(DragLabel, Label, ClickHandler): | 56 class GroupLabel(DragLabel, Label, ClickHandler): |
38 def __init__(self, host, group): | 57 def __init__(self, host, group): |
39 self.group = group | 58 self.group = group |