Mercurial > libervia-web
changeset 690:76a67d04c63e
browser_side: improve comments for menus-related methods
author | souliane <souliane@mailoo.org> |
---|---|
date | Thu, 09 Apr 2015 11:40:53 +0200 |
parents | a6adefddcb0a |
children | 16079280a39e |
files | src/browser/sat_browser/base_menu.py src/browser/sat_browser/base_widget.py src/browser/sat_browser/contact_widget.py src/browser/sat_browser/main_panel.py src/browser/sat_browser/menu.py |
diffstat | 5 files changed, 31 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/browser/sat_browser/base_menu.py Thu Apr 02 00:36:08 2015 +0200 +++ b/src/browser/sat_browser/base_menu.py Thu Apr 09 11:40:53 2015 +0200 @@ -105,8 +105,8 @@ """Build the html to be used for displaying a category item. Inheriting classes may overwrite this method. - @param category(quick_menus.MenuCategory): category to add - @return(unicode): HTML to display + @param category (quick_menus.MenuCategory): category to add + @return unicode: HTML to display """ return html_tools.html_sanitize(category.name) @@ -164,7 +164,7 @@ def addCategory(self, category, menu_bar=None, flat=False): """Add a new category. - @param menu_container(quick_menus.MenuCategory): Category to add + @param category (quick_menus.MenuCategory): category to add @param menu_bar (GenericMenuBar): instance to popup as the category sub-menu. """ html = self.getCategoryHTML(category)
--- a/src/browser/sat_browser/base_widget.py Thu Apr 02 00:36:08 2015 +0200 +++ b/src/browser/sat_browser/base_widget.py Thu Apr 09 11:40:53 2015 +0200 @@ -63,4 +63,9 @@ @classmethod def getCategoryHTML(cls, category): + """Build the html to be used for displaying a category item. + + @param category (quick_menus.MenuCategory): category to add + @return unicode: HTML to display + """ return cls.ITEM_TPL % category.icon
--- a/src/browser/sat_browser/contact_widget.py Thu Apr 02 00:36:08 2015 +0200 +++ b/src/browser/sat_browser/contact_widget.py Thu Apr 09 11:40:53 2015 +0200 @@ -84,17 +84,26 @@ class ContactMenuBar(base_widget.WidgetMenuBar): + """WidgetMenuBar displaying the contact's avatar as category.""" def onBrowserEvent(self, event): base_widget.WidgetMenuBar.onBrowserEvent(self, event) event.stopPropagation() # prevent opening the chat dialog @classmethod - def getCategoryHTML(cls, menu_name_i18n, type_): + def getCategoryHTML(cls, category): + """Return the HTML code for displaying contact's avatar. + + @param category (quick_menus.MenuCategory): ignored + @return(unicode): HTML to display + """ return '<img src="%s"/>' % C.DEFAULT_AVATAR_URL def setUrl(self, url): - """Set the URL of the contact avatar.""" + """Set the URL of the contact avatar. + + @param url (unicode): avatar URL + """ self.items[0].setHTML('<img src="%s" />' % url)
--- a/src/browser/sat_browser/main_panel.py Thu Apr 02 00:36:08 2015 +0200 +++ b/src/browser/sat_browser/main_panel.py Thu Apr 09 11:40:53 2015 +0200 @@ -182,8 +182,13 @@ self.host.bridge.call('setStatus', None, presence, self.parent_panel.status_panel.status) @classmethod - def getCategoryHTML(cls, menu_name_i18n, type_): - return menu_name_i18n + def getCategoryHTML(cls, category): + """Build the html to be used for displaying a category item. + + @param category (quick_menus.MenuCategory): category to add + @return unicode: HTML to display + """ + return category class PresenceStatusPanel(HorizontalPanel, ClickHandler):
--- a/src/browser/sat_browser/menu.py Thu Apr 02 00:36:08 2015 +0200 +++ b/src/browser/sat_browser/menu.py Thu Apr 09 11:40:53 2015 +0200 @@ -48,6 +48,11 @@ @classmethod def getCategoryHTML(cls, category): + """Build the html to be used for displaying a category item. + + @param category (quick_menus.MenuCategory): category to add + @return unicode: HTML to display + """ name = html_tools.html_sanitize(category.name) return cls.ITEM_TPL % (category.icon, name) if category.icon is not None else name