step 2: add gauge state sizing and animation model
This commit is contained in:
28
src/dpg_gauges/diagnostics.py
Normal file
28
src/dpg_gauges/diagnostics.py
Normal file
@@ -0,0 +1,28 @@
|
||||
"""Diagnostics helpers."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from .state import get_gauge_state
|
||||
from .types import Tag
|
||||
|
||||
|
||||
def get_gauge_debug_state(tag: Tag) -> dict[str, Any]:
|
||||
state = get_gauge_state(tag)
|
||||
return {
|
||||
"tag": state.tag,
|
||||
"gauge_type": state.gauge_type,
|
||||
"target_value": state.target_value,
|
||||
"clamped_value": state.clamped_value,
|
||||
"displayed_value": state.displayed_value,
|
||||
"invalid_value": state.invalid_value,
|
||||
"measured_size": (state.measured_width, state.measured_height),
|
||||
"last_nonzero_size": (state.last_nonzero_width, state.last_nonzero_height),
|
||||
"dirty": state.dirty,
|
||||
"dirty_names": [flag.name for flag in type(state.dirty) if flag in state.dirty],
|
||||
"value_revision": state.value_revision,
|
||||
"config_revision": state.config_revision,
|
||||
"animation_active": state.animation_state.active,
|
||||
"smoothing_active": state.smoothing_state.active,
|
||||
}
|
||||
Reference in New Issue
Block a user