Mercurial > libervia-web
changeset 458:1eeed8028199
browser side: rename parameter of getParent / getWidgetPanel from 'verbose' to 'expect'
author | souliane <souliane@mailoo.org> |
---|---|
date | Thu, 29 May 2014 17:49:59 +0200 |
parents | b55bc50756fa |
children | 36f27d1e64b2 |
files | src/browser/base_widget.py src/browser/libervia_main.py |
diffstat | 2 files changed, 10 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/browser/base_widget.py Thu May 29 17:32:32 2014 +0200 +++ b/src/browser/base_widget.py Thu May 29 17:49:59 2014 +0200 @@ -224,14 +224,16 @@ def getDebugName(self): return "%s (%s)" % (self, self.__title.getText()) - def getWidgetsPanel(self, verbose=True): - return self.getParent(WidgetsPanel, verbose) + def getWidgetsPanel(self, expect=True): + return self.getParent(WidgetsPanel, expect) - def getParent(self, class_=None, verbose=True): - """ + def getParent(self, class_=None, expect=True): + """Return the closest ancestor of the specified class. + Note: this method overrides pyjamas.ui.Widget.getParent + @param class_: class of the ancestor to look for or None to return the first parent - @param verbose: set to True to log error messages # FIXME: must be removed + @param expect: set to True if the parent is expected (print a message if not found) @return: the parent/ancestor or None if it has not been found """ current = Widget.getParent(self) @@ -239,7 +241,7 @@ return current # this is the default behavior while current is not None and not isinstance(current, class_): current = Widget.getParent(current) - if current is None and verbose: + if current is None and expect: log.debug("Can't find parent %s for %s" % (class_, self)) return current
--- a/src/browser/libervia_main.py Thu May 29 17:32:32 2014 +0200 +++ b/src/browser/libervia_main.py Thu May 29 17:49:59 2014 +0200 @@ -622,7 +622,7 @@ @return: the existing widget that has been found or None.""" selected_tab = self.tab_panel.getCurrentPanel() for lib_wid in self.libervia_widgets: - parent = lib_wid.getWidgetsPanel(verbose=False) + parent = lib_wid.getWidgetsPanel(expect=False) if parent is None or (ignoreOtherTabs and parent != selected_tab): # do not return a widget that is not in the currently selected tab continue @@ -658,7 +658,7 @@ else: tab = self.addTab(new_tab, lib_wid, False) else: # reuse existing widget - tab = lib_wid.getWidgetsPanel(verbose=False) + tab = lib_wid.getWidgetsPanel(expect=False) if new_tab is None: if tab is not None: tab.removeWidget(lib_wid)