sepal_ui.scripts.decorator.switch#

sepal_ui.scripts.decorator.switch(*params, debug=True, on_widgets=[], targets=[])[source]#

Decorator to switch the state of input boolean parameters on class widgets or the class itself.

If on_widgets is defined, it will switch the state of every widget parameter, otherwise it will change the state of the class (self). You can also set two decorators on the same function, one could affect the class and other the widgets.

Parameters:
  • *params – any boolean parameter of a SepalWidget.

  • debug (bool) – Whether trigger or not an Exception if the decorated function fails.

  • on_widgets (List[str]) – List of widget names into the class

  • targets (List[bool]) – list of the target value (value that will be set on switch. default to the inverse of the current state.

Returns:

The return statement of the decorated method

Return type:

Any

New in version 3.0: moved from utils to a dedicated module

Deprecated since version 3.0: use sepal_ui.scripts.decorator.switch instead