changeset 631:e287a4b431c1 frontends_multi_profiles

browser side (libervia main): implemented visible_widgets property
author Goffi <goffi@goffi.org>
date Mon, 23 Feb 2015 18:20:04 +0100
parents 71abccd8d228
children c2abadf31afb
files src/browser/libervia_main.py
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/libervia_main.py	Mon Feb 23 18:16:07 2015 +0100
+++ b/src/browser/libervia_main.py	Mon Feb 23 18:20:04 2015 +0100
@@ -26,7 +26,7 @@
 ###
 
 from sat_frontends.quick_frontend.quick_app import QuickApp
-from sat_frontends.quick_frontend.quick_widgets import WidgetAlreadyExistsError
+from sat_frontends.quick_frontend import quick_widgets
 
 from sat_frontends.tools.misc import InputHistory
 from sat_frontends.tools import strings
@@ -113,6 +113,11 @@
         return self.contact_lists[C.PROF_KEY_NONE]
 
     @property
+    def visible_widgets(self):
+        widgets_panel = self.tab_panel.getCurrentPanel()
+        return [wid for wid in widgets_panel.widgets if isinstance(wid, quick_widgets.QuickWidget)]
+
+    @property
     def base_location(self):
         """Return absolute base url of this Libervia instance"""
         url = Window.getLocation().getHref()
@@ -584,8 +589,8 @@
         something, a new widget is always created, otherwise we look for an
         existing widget and re-use it if it's in the current tab.
 
-        @arg class_(class): see sat_frontends.quick_frontend.quick_widgets.getOrCreateWidget
-        @arg target: see sat_frontends.quick_frontend.quick_widgets.getOrCreateWidget
+        @arg class_(class): see quick_widgets.getOrCreateWidget
+        @arg target: see quick_widgets.getOrCreateWidget
         @arg dropped(bool): if True, assume the widget has been dropped
         @arg new_tab(unicode): if not None, it holds the name of a new tab to
             open for the widget. If None, use the default behavior.
@@ -612,7 +617,7 @@
         kwargs['on_existing_widget'] = C.WIDGET_RAISE
         try:
             wid = self.widgets.getOrCreateWidget(class_, target, *args, **kwargs)
-        except WidgetAlreadyExistsError:
+        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():