changeset 351:e9d3c3793f94

core (Cagou): "None" can be used in getVisibleList's cls to get all visible widgets
author Goffi <goffi@goffi.org>
date Fri, 17 Jan 2020 18:44:35 +0100
parents 1ac40d3121f6
children 434f770fe55b
files cagou/core/cagou_main.py
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/cagou/core/cagou_main.py	Fri Jan 17 18:44:35 2020 +0100
+++ b/cagou/core/cagou_main.py	Fri Jan 17 18:44:35 2020 +0100
@@ -787,12 +787,19 @@
         """get list of visible widgets for a given class
 
         @param cls(type): type of widgets to get
-        @return (list[type]): visible widgets of this class
+            None to get all visible widgets
+        @return (set[type]): visible widgets of this class
         """
+        if cls is None:
+            ret = set()
+            for widgets in self._visible_widgets.values():
+                for w in widgets:
+                    ret.add(w)
+            return ret
         try:
             return self._visible_widgets[cls]
         except KeyError:
-            return []
+            return set()
 
     def deleteUnusedWidgetInstances(self, widget):
         """Delete instance of this widget without parent