diff src/browser/libervia_main.py @ 636:86ae737da6f3 frontends_multi_profiles

browser side (widgets management): removed getWidgetsPanel: we use directly getParent which do the same thing + displayWidget now detect hidden widgets (widgets without parent WidgetsPanel)
author Goffi <goffi@goffi.org>
date Mon, 23 Feb 2015 18:44:58 +0100
parents e287a4b431c1
children 7113d40533d6
line wrap: on
line diff
--- a/src/browser/libervia_main.py	Mon Feb 23 18:44:58 2015 +0100
+++ b/src/browser/libervia_main.py	Mon Feb 23 18:44:58 2015 +0100
@@ -620,7 +620,12 @@
         except quick_widgets.WidgetAlreadyExistsError:
             kwargs['on_existing_widget'] = C.WIDGET_KEEP
             wid = self.widgets.getOrCreateWidget(class_, target, *args, **kwargs)
-            if wid.getWidgetsPanel() != self.tab_panel.getCurrentPanel():
+            widgets_panel = wid.getParent(base_widget.WidgetsPanel, expect=False)
+            if widgets_panel is None:
+                # The widget exists but is hidden
+                self.addWidget(wid)
+            elif widgets_panel != self.tab_panel.getCurrentPanel():
+                # the widget is on an other tab, so we add a new one here
                 kwargs['on_existing_widget'] = C.WIDGET_RECREATE
                 wid = self.widgets.getOrCreateWidget(class_, target, *args, **kwargs)
                 self.addWidget(wid)