Status
elva.widgets.status
Textual
widgets for building a status bar.
Classes:
-
StatusBar
–Main container of status widgets.
-
FeatureStatus
–Button indicating the status of a feature.
-
ComponentStatus
–Button indicating the status of a component.
StatusBar
Bases: Grid
Main container of status widgets.
FeatureStatus(params, *args, config=None, rename=None, **kwargs)
Bases: Button
Button indicating the status of a feature.
Parameters:
-
params
(list[str]
) –list of configuration parameters associated with this feature.
-
config
(None | dict[str, Any]
, default:None
) –mapping of configuration parameters to their values.
-
rename
(None | dict[str, str]
, default:None
) –mapping of old parameter names to new parameter names.
-
args
(tuple
, default:()
) –positional arguments passed to
Button
. -
kwargs
(dict
, default:{}
) –keyword arguments passed to
Button
.
Methods:
-
trim
–Trim and rename a given config with respect to the feature's configuration parameters.
-
update
–Update the internal configuration parameter mapping.
-
apply
–Hook called on mounting the widget and on configuration update.
-
on_mount
–Hook called on mounting the widget.
Attributes:
-
params
(list[str]
) –List of configuration parameters associated with this feature.
-
rename
(None | dict[str, str]
) –Mapping of old parameter names to new parameter names.
-
config
(None | dict[str, Any]
) –Mapping of configuration parameters to their values.
-
is_ready
(bool
) –Flag whether the feature is ready or not.
Source code in src/elva/widgets/status.py
params = params
instance-attribute
List of configuration parameters associated with this feature.
rename = rename
instance-attribute
Mapping of old parameter names to new parameter names.
config = self.trim(config)
instance-attribute
Mapping of configuration parameters to their values.
is_ready
property
Flag whether the feature is ready or not.
It is supposed to hold the logic for determining the current status of the feature.
This property is defined as a no-op and supposed to be implemented in the inheriting class.
Returns:
-
bool
–True
if the feature is ready, elseFalse
.
trim(config)
Trim and rename a given config with respect to the feature's configuration parameters.
Parameters:
Returns:
Source code in src/elva/widgets/status.py
update(config)
Update the internal configuration parameter mapping.
The given configuration gets trimmed, renamed and replaces the currently stored configuration if different.
Parameters:
Source code in src/elva/widgets/status.py
apply()
Hook called on mounting the widget and on configuration update.
It is supposed to hold the logic for a change in configuration parameters.
This method is defined as a no-op and supposed to be implemented in the inheriting class.
Source code in src/elva/widgets/status.py
ComponentStatus(yobject, params, *args, **kwargs)
Bases: FeatureStatus
Button indicating the status of a component.
Parameters:
-
yobject
(Doc | Text | Array | Map
) –instance of the Y object being used by the internal component.
-
params
(list[str]
) –list of configuration parameters associated with this component.
-
args
(tuple
, default:()
) –positional arguments passed to
FeatureStatus
. -
kwargs
(dict
, default:{}
) –keyword arguments passed to
FeatureStatus
.
Methods:
-
apply
–Hook called on mounting the widget and on configuration update.
-
on_button_pressed
–Hook called on a pressed button event.
Attributes:
-
component
(Component
) –Instance of the component represented by this widget.
-
control
(Component
) –Alias for
component
. -
yobject
(Doc | Text | Array | Map
) –Instance of the Y object being used by the internal component.
Source code in src/elva/widgets/status.py
component
instance-attribute
Instance of the component represented by this widget.
control
instance-attribute
Alias for component
.
yobject = yobject
instance-attribute
Instance of the Y object being used by the internal component.
apply()
Hook called on mounting the widget and on configuration update.
This method starts the component if ready, else the component gets cancelled.
Source code in src/elva/widgets/status.py
on_button_pressed(message)
Hook called on a pressed button event.
Basically, it toggles to component's running state.
Parameters:
-
message
(Message
) –the message holding information about the pressed button event.