step 2: add gauge state sizing and animation model

This commit is contained in:
2026-07-02 13:54:58 +02:00
parent 44e4cbd246
commit 34fd60c34e
27 changed files with 1732 additions and 5 deletions

View 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,
}