# HG changeset patch # User Goffi # Date 1470610739 -7200 # Node ID c58b522607f426138f6fcaac731e0d2d2b2e7b89 # Parent 790dbc5c4e892e6e3f341e1f431638c555572b10 main: fixed profiles value in _defaultFactory + getPluggedWidgets is now a generator diff -r 790dbc5c4e89 -r c58b522607f4 src/cagou/core/cagou_main.py --- a/src/cagou/core/cagou_main.py Mon Aug 08 00:54:11 2016 +0200 +++ b/src/cagou/core/cagou_main.py Mon Aug 08 00:58:59 2016 +0200 @@ -82,7 +82,7 @@ def _defaultFactory(self, plugin_info, target, profiles): """factory used to create widget instance when PLUGIN_INFO["factory"] is not set""" main_cls = plugin_info['main'] - return self.widgets.getOrCreateWidget(main_cls, target, on_new_widget=None, profiles=profiles) + return self.widgets.getOrCreateWidget(main_cls, target, on_new_widget=None, profiles=iter(self.profiles)) def _import_kv(self): """import all kv files in cagou.kv""" @@ -154,13 +154,10 @@ widgets from this class will be excluded @return (list[dict]): available widgets plugin infos """ - lst = self._plg_wids[:] - if except_cls is not None: - for plugin_info in lst: - if plugin_info['main'] == except_cls: - lst.remove(plugin_info) - break - return lst + for plugin_data in self._plg_wids: + if plugin_data['main'] == except_cls: + continue + yield plugin_data def plugging_profiles(self): self.app.root.change_widgets([WidgetsHandler()])