shyft.dashboard.base.selector_model

Functions

processing_wrapper(loading_function)

Classes

BasicSelector(presenter[, logger])

The most basic implementation of SelectorModelBase which simply sends the new selected value when it is changed.

SelectorModelBase(presenter[, logger])

Abstract base class for a composable selector.

TextInputModelBase(presenter[, logger])

Abstract base class for a text input.

shyft.dashboard.base.selector_model.processing_wrapper(loading_function)[source]
class shyft.dashboard.base.selector_model.SelectorModelBase(presenter: SelectorPresenter, logger=None)[source]

Bases: object

Abstract base class for a composable selector.

The selector needs a presenter (the view controller) as input argument. In __init__ will be automatically connected to the on_change port.

The on change port is the only abstract method which is required to set. This function receives a List of str, which are the selected values in the view of the presenter. Even for a single select this will be a list, then containing a single value.

To populate the presenter with options, use the public methods of the presenter: E.g.:

>>>    self.presenter.set_selector_options(['a', 'b', 'c'], callback=False, sort=True,
>>>                                                sort_reverse=False, selector_values=None)

In this manner it is also possible to set a value in the view from the backend: E.g.:

>>>    self.presenter.set_selector_value(value='a', callback=False)

Note that when a value is already selected, and one sets the selection again, bokeh won’t trigger a callback

(see also example for custom selector model)

__init__(presenter: SelectorPresenter, logger=None)[source]
abstract on_change_selected(new_values: List[str]) None[source]
class shyft.dashboard.base.selector_model.BasicSelector(presenter: SelectorPresenter, logger=None)[source]

Bases: SelectorModelBase

The most basic implementation of SelectorModelBase which simply sends the new selected value when it is changed.

__init__(presenter: SelectorPresenter, logger=None)[source]
on_change_selected(new_values: List[str]) None[source]
class shyft.dashboard.base.selector_model.TextInputModelBase(presenter: TextInputPresenter, logger=None)[source]

Bases: object

Abstract base class for a text input.

The text input needs a presenter (the view controller) as input argument. In __init__ will be automatically connected to the on_change port.

The on change port is the only abstract method which is required to set. This function receives a string, which is typed in by the user in the view of the presenter.

__init__(presenter: TextInputPresenter, logger=None)[source]

Constructor.

Parameters:
  • presenter – a TextInputPresenter object

  • logger – a logger

abstract on_change_text_input(new_values: List[str]) None[source]