shyft.dashboard.base.gate_presenter

This module contains the GatePresenter

Gates are used to control the signal flow of Sender to its Receiver.

This is very useful whenever we want to only send data to a widget whenever the user e.g.:

  • opens a tab

  • clicks on a button

  • triggers a selection

If different inputs, then the selectors for the gates, the GatePresenter ties the GateModel and the GateView together:

GatePresenter(GateView, GateModel) See also ref::gate_presenter.

The information flow is: GateView -> GatePresenter -> GateModel

Whenever the user triggers a GateView, a signal (open/close) is send to the GatePresenter. The GatePresenter triggers the GateModel. The Gate model connects/disconnects its ports.

Classes

GatePresenter(view, gates[, logger])

class shyft.dashboard.base.gate_presenter.GatePresenter(view: Button | Tabs | RadioButtonGroup | RadioGroup | CheckboxGroup | CheckboxButtonGroup | Toggle, gates: List[SingleGate | AggregatedGate], logger: LoggerBox | None = None)[source]

Bases: object

__init__(view: Button | Tabs | RadioButtonGroup | RadioGroup | CheckboxGroup | CheckboxButtonGroup | Toggle, gates: List[SingleGate | AggregatedGate], logger: LoggerBox | None = None) None[source]

Connect a view to gates, i.e. if view is clicked or activated a gate will be opened or closed

Current views are:

Button, Tabs, RadioButtonGroup, RadioGroup, CheckboxGroup, CheckboxButtonGroup, Toggle

Behavior

  • Button: on_click will open and close all gates

  • Toggle: toggled button will open all gates, enabled toggle will close all gates

NB: For the following views: same amount of gates and Tab-panels/Buttons/Checkboxes are required

  • Tabs: The active tab will open the gate with the index in the gates list, all others closed

  • RadioGroup, RadioButtonGroup: The active radio button will open with the index in the gates list, all others closed

  • CheckboxGroup, CheckboxButtonGroup: The checked boxes will open gates with the indices in the gates list, all will be others closed

param view:

view to connect gates to

param gates:

gates to be triggered by view selection

param logger:

logger to use