changeset 2790:19ab67e28822

quick frontends: visible_widgets can now keep any kind of widget, new visible_quick_widgets only iters on QuickWidgets
author Goffi <goffi@goffi.org>
date Sun, 20 Jan 2019 15:46:32 +0100
parents d350f4571d82
children 034c88e9cd93
files sat_frontends/quick_frontend/quick_app.py
diffstat 1 files changed, 18 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/sat_frontends/quick_frontend/quick_app.py	Sat Jan 19 23:27:59 2019 +0100
+++ b/sat_frontends/quick_frontend/quick_app.py	Sun Jan 20 15:46:32 2019 +0100
@@ -306,10 +306,8 @@
         else:
             self.options = None
 
-        # widgets
-        self.selected_widget = (
-            None
-        )  # widget currently selected (must be filled by frontend)
+        # widget currently selected (must be filled by frontend)
+        self.selected_widget = None
 
         # listeners
         self._listeners = {}  # key: listener type ("avatar", "selected", etc),
@@ -407,12 +405,26 @@
 
     @property
     def visible_widgets(self):
-        """widgets currently visible (must be implemented by frontend)
+        """Widgets currently visible
 
-        @return (iter[QuickWidget]): iterable on visible widgets
+        This must be implemented by frontend
+        @return (iter[object]): iterable on visible widgets
+            widgets can be QuickWidgets or not
         """
         raise NotImplementedError
 
+    @property
+    def visible_quick_widgets(self):
+        """QuickWidgets currently visible
+
+        This generator iterate only on QuickWidgets, discarding other kinds of
+        widget the frontend may have.
+        @return (iter[object]): iterable on visible widgets
+        """
+        for w in self.visisble_widgets:
+            if isinstance(w, quick_widgets.QuickWidget):
+                return w
+
     def registerSignal(
         self, function_name, handler=None, iface="core", with_profile=True
     ):