WidgetBase

class orion_notebook.widgets.widget_base.AnyType(**kwargs)

Bases: ipywidgets.widgets.widget_description.DescriptionWidget, ipywidgets.widgets.valuewidget.ValueWidget, ipywidgets.widgets.widget_core.CoreWidget

Class to create simple basic widgets that accept data of any type

class orion_notebook.widgets.widget_base.BaseWidget(**kwargs)

Bases: ipywidgets.widgets.interaction.interactive

Base class that wraps the main functionalities of the ipywidgets library

class Status(value)

Bases: enum.Enum

Enum of status of the widget

BUSY = 'busy'
add_input(traitlet: object, visible: bool = False)None

Adds an input traitlet to the widget

Parameters
  • traitlet (object) – The traitlet to be added

  • visible (bool) – Whether the traitlet is to be rendered in the notebook (default False)

add_output(traitlet: object, visible: bool = False)None

Adds an output traitlet to the widget

Parameters
  • traitlet (object) – The traitlet to be added

  • visible (bool) – Whether the traitlet is to be rendered in the notebook (default False)

add_source(widget: orion_notebook.widgets.widget_base.BaseWidget)None

Adds a widget to the list of widgets the current widget is linked to

Parameters

widget (BaseWidget) – Widget that feeds data to the current widget

add_sources(widgets: List[orion_notebook.widgets.widget_base.BaseWidget])

Adds several widgets to the list of widgets the current widget is linked to

Parameters

widgets (List[BaseWidget]) – List of widgets that feed data to the current widget

configure_inputs()None

To be overridden by child classes. Intended for configuring the widget’s input entities

configure_inputs_layout()None

To be overridden by child classes. Intended for configuring the layout of the widget’s inputs

configure_outputs()None

To be overridden by child classes. Intended for configuring the widget’s output entities

property contained_traitlets

Returns the inputs that will be renderer in the notebook

execute(**kwargs: dict)None

To be overridden by child classes. Intended for configuring the widget’s functionality

get_input_value(name: str)Any

Gets the content of the attribute named ‘value’ for a specific input entity

Parameters

name (str) – The name of the input entity which attribute ‘value’ will be retrieved.

Returns

The content of the attribute ‘value’ for the specified input entity

get_loading_icon()

Gets the specific loading icon defined for the widget, if any.

get_output_value(name: str)Any

Gets the content of the attribute named ‘value’ for a specific output entity

Parameters

name (str) – The name of the output entity which attribute ‘value’ will be retrieved.

Returns

The content of the attribute ‘value’ for the specified output entity

get_status_value(name: str)Any

Gets the content of the attribute named ‘value’ for a specific status entity

Parameters

name (str) – the name of the status entity which attribute ‘value’ will be retrieved.

Return value

the content of the attribute ‘value’ for the specified status entity

property inputs_as_dictionary

Builds a dictionary from the input parameters in the form of {‘name’: value}

manage_exception(error)

Manages how the an exception produced on the execution of a widget is shown on the notebook

property outputs_as_dictionary

Builds a dictionary from the output parameters in the form of {‘name’: value}

pin_input(name: str, attr: str = 'value')Tuple[Any, str]

Builds a linkable pin on an attribute of a specific input entity. By default, the attribute is set to ‘value’

Parameters
  • name (str) – Name of the input

  • attr (str) – Name of the attribute of the input entity (default ‘value’)

Returns

The linkable pin on a input

Raises

OrionNotebookException – Output or attribute does not exist for that input entity

pin_output(name: str, attr: str = 'value')Tuple[Any, str]

Builds a linkable pin on an attribute of a specific output entity. By default, the attribute is set to ‘value’

Parameters
  • name (str) – Name of the output

  • attr (str) – Name of the attribute of the output entity (default ‘value’)

Returns

The linkable pin on a output

Raises

OrionNotebookException – Output or attribute does not exist for that output entity

render()None

Renders the widget on the notebook

set_input_value(name: str, value: Any)

Sets the content of the attribute named ‘value’ for a specific input entity.

Parameters
  • name (str) – The name of the input entity to be set

  • value (Any) – The content to be set

Raises

OrionNotebookException – Output or attribute does not exist for that input entity

set_output_value(name: str, value: Any)

Sets the content of the attribute named ‘value’ for a specific output entity.

Parameters
  • name (str) – The name of the output entity to be set

  • value (Any) – The content to be set

Raises

OrionNotebookException – Output or attribute does not exist for that output entity

set_status_value(name: str, value: Any)None

Sets the content of the attribute named ‘value’ for a specific status entity.

Parameters
  • name (str) – the name of the status entity to be set

  • value (Any) – The content to be set

Raises

OrionNotebookException – Output or attribute does not exist for that status entity

trigger_execution(**kwargs: dict)

Triggers the execution of the widget either on input change or manual triggering

static widget_from_single_value(o: Any)Optional[Union[orion_notebook.widgets.widget_base.AnyType, ipywidgets.widgets.widget_date.DatePicker, ipywidgets.widgets.widget_string.Text, ipywidgets.widgets.widget_bool.Checkbox, ipywidgets.widgets.widget_int.IntText, ipywidgets.widgets.widget_float.FloatText]]

Make widgets from single values, which can be used as parameter defaults.

Parameters

o (Any) – Value to make the widget from

Returns

A new Widget from the provided value

Return type

Union[AnyType, Text, DatePicker, Checkbox, IntText, FloatText, None]

class orion_notebook.widgets.widget_base.CompiledWidget(**kwargs)

Bases: orion_notebook.widgets.widget_base.BaseWidget

Class from which any widget that encodes input entities must inherit

class orion_notebook.widgets.widget_base.RuntimeWidget(**kwargs)

Bases: orion_notebook.widgets.widget_base.BaseWidget

Class from which any widget that defines input entities at runtime must inherit

configure_inputs()

Configures each input in the contained traitlets