73 lines
1.7 KiB
Python
73 lines
1.7 KiB
Python
"""Public API wrappers for logical gauge state."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from . import widget as _widget
|
|
from .gauges import GaugeConfig
|
|
from .state import (
|
|
configure_gauges,
|
|
delete_runtime_gauge,
|
|
get_runtime_value,
|
|
set_runtime_markers,
|
|
set_runtime_show,
|
|
set_runtime_thresholds,
|
|
set_runtime_value,
|
|
update_runtime_gauge,
|
|
)
|
|
from .types import GaugeMarker, GaugeValue, Tag, ThresholdBand
|
|
|
|
|
|
def configure(**config: Any) -> None:
|
|
configure_gauges(**config)
|
|
|
|
|
|
analog_gauge = _widget.analog_gauge
|
|
digital_gauge = _widget.digital_gauge
|
|
bar_gauge = _widget.bar_gauge
|
|
level_gauge = _widget.level_gauge
|
|
status_light = _widget.status_light
|
|
segmented_gauge = _widget.segmented_gauge
|
|
compass_gauge = _widget.compass_gauge
|
|
thermometer_gauge = _widget.thermometer_gauge
|
|
battery_gauge = _widget.battery_gauge
|
|
multi_value_gauge = _widget.multi_value_gauge
|
|
gauge_panel = _widget.gauge_panel
|
|
gauge_grid = _widget.gauge_grid
|
|
|
|
|
|
def set_value(tag: Tag, value: GaugeValue) -> None:
|
|
set_runtime_value(tag, value)
|
|
|
|
|
|
def get_value(tag: Tag) -> GaugeValue:
|
|
return get_runtime_value(tag)
|
|
|
|
|
|
def update_gauge(tag: Tag, **config: Any) -> None:
|
|
update_runtime_gauge(tag, **config)
|
|
|
|
|
|
def configure_gauge(tag: Tag, **config: Any) -> None:
|
|
update_runtime_gauge(tag, **config)
|
|
|
|
|
|
def set_thresholds(tag: Tag, thresholds: list[ThresholdBand] | tuple[ThresholdBand, ...]) -> None:
|
|
set_runtime_thresholds(tag, thresholds)
|
|
|
|
|
|
def set_markers(tag: Tag, markers: list[GaugeMarker] | tuple[GaugeMarker, ...]) -> None:
|
|
set_runtime_markers(tag, markers)
|
|
|
|
|
|
def set_show(tag: Tag, show: bool) -> None:
|
|
set_runtime_show(tag, show)
|
|
|
|
|
|
def delete_gauge(tag: Tag) -> None:
|
|
delete_runtime_gauge(tag)
|
|
|
|
|
|
__all_configs__ = (GaugeConfig,)
|