# HG changeset patch # User Goffi # Date 1547995592 -3600 # Node ID 19ab67e28822c5c940fcbdaafadabb43146b0577 # Parent d350f4571d8248893b23c85aa7a30785bdd2f9fa quick frontends: visible_widgets can now keep any kind of widget, new visible_quick_widgets only iters on QuickWidgets diff -r d350f4571d82 -r 19ab67e28822 sat_frontends/quick_frontend/quick_app.py --- 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 ):