Mercurial > libervia-backend
diff frontends/src/quick_frontend/quick_widgets.py @ 2007:19b9d3f8a6c7
plugin XEP-0085, quick_frontends, primitivus: chat states are working again
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 17 Jul 2016 16:47:33 +0200 |
parents | b5ef9b2b995e |
children | 666b42c957b5 |
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_widgets.py Fri Jul 15 22:13:09 2016 +0200 +++ b/frontends/src/quick_frontend/quick_widgets.py Sun Jul 17 16:47:33 2016 +0200 @@ -79,19 +79,22 @@ raise exceptions.InternalError("There is not class registered for {}".format(class_)) return cls - def getWidgets(self, class_): - """Get all subclassed widgets + def getWidgets(self, class_, profiles=None): + """Get all subclassed widgets instances @param class_: subclass of QuickWidget, same parameter as used in [getOrCreateWidget] + @param profiles(iterable, None): if not None, filter on instances linked to these profiles @return: iterator on widgets """ class_ = self.getRealClass(class_) try: widgets_map = self._widgets[class_.__name__] except KeyError: - return iter([]) + return else: - return widgets_map.itervalues() + for w in widgets_map.itervalues(): + if profiles is None or w.profiles.intersection(profiles): + yield w def getWidget(self, class_, target=None, profiles=None): """Get a widget without creating it if it doesn't exist.