Mercurial > libervia-web
diff src/browser/sat_browser/base_widget.py @ 559:77372641e05d
browser_side (plugin OTR): display the correct icons on opening the window + auto-open on accepted invitation
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 23 Sep 2014 13:57:36 +0200 |
parents | d02335553b5d |
children | b07f0fe2763a |
line wrap: on
line diff
--- a/src/browser/sat_browser/base_widget.py Tue Sep 23 11:48:57 2014 +0200 +++ b/src/browser/sat_browser/base_widget.py Tue Sep 23 13:57:36 2014 +0200 @@ -229,11 +229,11 @@ class LiberviaWidget(DropCell, VerticalPanel, ClickHandler): """Libervia's widget which can replace itself with a dropped widget on DnD""" - def __init__(self, host, title='', info='', selectable=False): + def __init__(self, host, title='', info=None, selectable=False): """Init the widget @param host (SatWebFrontend): SatWebFrontend instance @param title (str): title shown in the header of the widget - @param info (str): info shown in the header of the widget + @param info (str, callable): info shown in the header of the widget @param selectable (bool): True is widget can be selected by user""" VerticalPanel.__init__(self) DropCell.__init__(self, host) @@ -244,8 +244,13 @@ self.__close_button_id = HTMLPanel.createUniqueId() self.__title = Label(title) self.__title.setStyleName('widgetHeader_title') - if info: - self.__info = HTML(info) + if info is not None: + if isinstance(info, str): + self.__info = HTML(info) + else: # the info will be set by a callback + assert(callable(info)) + self.__info = HTML() + info(self.__info.setHTML) self.__info.setStyleName('widgetHeader_info') else: self.__info = None @@ -394,7 +399,7 @@ @param text: text of the new title""" try: self.__info.setHTML(text) - except AttributeError: + except TypeError: log.error("LiberviaWidget.setInfo: info widget has not been initialized!") def isSelectable(self):