# HG changeset patch # User souliane # Date 1428572453 -7200 # Node ID 76a67d04c63e8696527b7eb0edd3069b5494cd66 # Parent a6adefddcb0ad03a99e3ef612124fa5f3fac7be4 browser_side: improve comments for menus-related methods diff -r a6adefddcb0a -r 76a67d04c63e src/browser/sat_browser/base_menu.py --- 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) diff -r a6adefddcb0a -r 76a67d04c63e src/browser/sat_browser/base_widget.py --- 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 diff -r a6adefddcb0a -r 76a67d04c63e src/browser/sat_browser/contact_widget.py --- 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 '' % 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('' % url) diff -r a6adefddcb0a -r 76a67d04c63e src/browser/sat_browser/main_panel.py --- 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): diff -r a6adefddcb0a -r 76a67d04c63e src/browser/sat_browser/menu.py --- 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