# HG changeset patch # User souliane # Date 1423560834 -3600 # Node ID 1f13a837e4b29f297b0fb3502f59b441c65a985f # Parent e9888db0eb0cda2c5feb26a8230d141050b18ab5 quick_frontend (quick_widgets): revert commit 1319 diff -r e9888db0eb0c -r 1f13a837e4b2 frontends/src/quick_frontend/quick_widgets.py --- a/frontends/src/quick_frontend/quick_widgets.py Tue Feb 10 19:08:01 2015 +0100 +++ b/frontends/src/quick_frontend/quick_widgets.py Tue Feb 10 10:33:54 2015 +0100 @@ -105,15 +105,13 @@ if there is neither 'profile' nor 'profiles', None will be used for 'profiles' if 'on_new_widget' is present it can have the following values: C.WIDGET_NEW [default]: self.host.newWidget will be called on widget creation - [callable]: this method will be called instead of self.host.newWidget, - and can return another widget to modify the result of the present method + [callable]: this method will be called instead of self.host.newWidget None: do nothing if 'on_existing_widget' is present it can have the following values: C.WIDGET_KEEP [default]: return the existing widget C.WIDGET_RAISE: raise WidgetAlreadyExistsError C.WIDGET_RECREATE: create a new widget *WITH A NEW HASH* - [callable]: this method will be called with existing widget as argument, - and can return another widget to modify the result of the present method + [callable]: this method will be called with existing widget as argument if 'force_hash' is present, the hash given in value will be used instead of the one returned by class_.getWidgetHash other keys will be used to instanciate class_ if the case happen (e.g. if type_ is present and class_ is a QuickChat subclass, it will be used to create a new QuickChat instance). @@ -171,9 +169,7 @@ if on_new_widget == C.WIDGET_NEW: self.host.newWidget(widget) elif callable(on_new_widget): - result = on_new_widget(widget) - if isinstance(result, QuickWidget): - widget = result + on_new_widget(widget) else: assert on_new_widget is None else: @@ -207,9 +203,7 @@ log.debug(u"Widget already exists, a new one has been recreated with hash {}".format(new_kwargs['force_hash'])) break elif callable(on_existing_widget): - result = on_existing_widget(widget) - if isinstance(result, QuickWidget): - widget = result + on_existing_widget(widget) else: raise exceptions.InternalError("Unexpected on_existing_widget value ({})".format(on_existing_widget))