step 5: complete first gauge catalogue

This commit is contained in:
2026-07-02 14:47:05 +02:00
parent d638c512e9
commit 1a476bc91d
11 changed files with 594 additions and 16 deletions

View File

@@ -9,8 +9,8 @@ from typing import Any
from .animation import AnimationState, start_animation
from .exceptions import GaugeConfigError, GaugeNotFoundError
from .gauges import GaugeConfig
from .scales import clamp_value, validate_markers, validate_thresholds
from .gauges import CompassGaugeConfig, GaugeConfig
from .scales import clamp_value, compass_heading, validate_markers, validate_thresholds
from .sizing import RequestedSize, SizeState
from .smoothing import SmoothingState
from .themes import GaugeTheme, get_theme
@@ -150,6 +150,8 @@ def clamp_runtime_value(value: GaugeValue, config: GaugeConfig) -> tuple[float |
return None, value is not None
if not math.isfinite(numeric):
return None, True
if isinstance(config, CompassGaugeConfig):
numeric = compass_heading(numeric)
if config.clamp:
return clamp_value(numeric, config.min_value, config.max_value), False
return numeric, False