Mercurial > libervia-web
diff src/browser/sat_browser/contact_list.py @ 617:5baca9d46c34 frontends_multi_profiles
browser_side: add/improve some docstrings
author | souliane <souliane@mailoo.org> |
---|---|
date | Wed, 11 Feb 2015 11:21:27 +0100 |
parents | 1c0d5a87c554 |
children | 2c41ce0c3b3f 57a651a5b31d |
line wrap: on
line diff
--- a/src/browser/sat_browser/contact_list.py Wed Feb 11 11:18:13 2015 +0100 +++ b/src/browser/sat_browser/contact_list.py Wed Feb 11 11:21:27 2015 +0100 @@ -45,9 +45,10 @@ 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 + + @param presence (unicode): presence is a value in ('', 'chat', 'away', 'dnd', 'xa') + @param base_style (unicode): base classname + @return: unicode """ if not base_style: base_style = "contactLabel" @@ -59,8 +60,8 @@ Set the CSS style of a contact's element according to its presence. @param widget (Widget): the UI element of the contact - @param presence (str): a value in ("", "chat", "away", "dnd", "xa"). - @param base_style (str): the base name of the style to apply + @param presence (unicode): a value in ("", "chat", "away", "dnd", "xa"). + @param base_style (unicode): the base name of the style to apply """ if not hasattr(widget, 'presence_style'): widget.presence_style = None @@ -75,6 +76,11 @@ class GroupLabel(base_widget.DragLabel, Label, ClickHandler): def __init__(self, host, group): + """ + + @param host (SatWebFrontend) + @param group (unicode): group name + """ self.group = group Label.__init__(self, group) # , Element=DOM.createElement('div') self.setStyleName('group') @@ -87,9 +93,9 @@ class ContactLabel(HTML): - def __init__(self, jid, name=None): + def __init__(self, jid_, name=None): HTML.__init__(self) - self.name = name or str(jid) + self.name = name or unicode(jid_) self.waiting = False self.refresh() self.setStyleName('contactLabel') @@ -126,6 +132,14 @@ class ContactBox(VerticalPanel, ClickHandler, base_widget.DragLabel): def __init__(self, host, jid_, name=None, click_listener=None, handle_menu=None): + """ + + @param host (SatWebFrontend) + @param jid_ (jid.JID): contact JID + @param name (unicode): contact alias + @param click_listener (callable): click callback + @param handle_menu (bool): if True, bind a popup menu to the avatar + """ VerticalPanel.__init__(self, StyleName='contactBox', VerticalAlignment='middle') base_widget.DragLabel.__init__(self, jid_, "CONTACT", host) self.jid = jid_ @@ -152,7 +166,7 @@ def updateAvatar(self, url): """Update the avatar. - @param url (str): image url + @param url (unicode): image url """ self.avatar.setUrl(url) @@ -194,7 +208,7 @@ def getGroupBox(self, group): """get the widget of a group - @param group (str): the group + @param group (unicode): the group @return: GroupLabel instance if present, else None""" for wid in self: if isinstance(wid, GroupLabel) and wid.group == group: @@ -226,7 +240,7 @@ """Add a contact to the list. @param jid_ (jid.JID): jid_ of the contact - @param name (str): optional name of the contact + @param name (unicode): optional name of the contact """ assert isinstance(jid_, jid.JID) if jid_ in self.contacts: @@ -269,7 +283,7 @@ """Update the avatar of the given contact @param jid_ (jid.JID): contact jid - @param url (str): image url + @param url (unicode): image url """ try: self.getContactBox(jid_).updateAvatar(url) @@ -286,7 +300,7 @@ def setState(self, jid_, type_, state): """Change the appearance of the contact, according to the state @param jid_ (jid.JID): jid.JID which need to change state - @param type_ (str): one of "availability", "messageWaiting" + @param type_ (unicode): one of "availability", "messageWaiting" @param state: - for messageWaiting type: True if message are waiting @@ -431,7 +445,7 @@ # def setConnected(self, jid_s, resource, availability, priority, statuses): # """Set connection status - # @param jid_s (str): JID userhost as unicode + # @param jid_s (unicode): JID userhost as unicode # """ # if availability == 'unavailable': # if jid_s in self.connected: @@ -538,8 +552,8 @@ def updateAvatar(self, jid_s, url): """Update the avatar of the given contact - @param jid_s (str): contact jid - @param url (str): image url + @param jid_s (unicode): contact jid + @param url (unicode): image url """ self._contacts_panel.updateAvatar(jid_s, url) @@ -555,7 +569,7 @@ def hasVisibleMembers(self, group): """Tell if the given group actually has visible members - @param group (str): the group to check + @param group (unicode): the group to check @return: boolean """ for jid_ in self.groups[group]: @@ -586,8 +600,8 @@ # def updateVisibility(self, jids, groups): # """Set the widgets visibility for the given contacts and groups - # @param jids (list[str]): list of JID - # @param groups (list[str]): list of groups + # @param jids (list[unicode]): list of JID + # @param groups (list[unicode]): list of groups # """ # for jid_s in jids: # try: