Add dynamic brightness value source support for KC targets, fix subtab selector collision

Extend value source brightness modulation to Key Colors targets (matching LED target support).
Also fix stream subtab CSS selector collision that broke target subtab selection, and use 🔢 emoji
for value source UI elements.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-24 12:42:00 +03:00
parent ef474fe275
commit 8f79b77fe4
10 changed files with 131 additions and 13 deletions

View File

@@ -46,6 +46,7 @@ class KeyColorsSettings:
smoothing: float = 0.3
pattern_template_id: str = ""
brightness: float = 1.0
brightness_value_source_id: str = ""
def to_dict(self) -> dict:
return {
@@ -54,6 +55,7 @@ class KeyColorsSettings:
"smoothing": self.smoothing,
"pattern_template_id": self.pattern_template_id,
"brightness": self.brightness,
"brightness_value_source_id": self.brightness_value_source_id,
}
@classmethod
@@ -64,6 +66,7 @@ class KeyColorsSettings:
smoothing=data.get("smoothing", 0.3),
pattern_template_id=data.get("pattern_template_id", ""),
brightness=data.get("brightness", 1.0),
brightness_value_source_id=data.get("brightness_value_source_id", ""),
)
@@ -82,12 +85,18 @@ class KeyColorsPictureTarget(PictureTarget):
settings=self.settings,
)
def sync_with_manager(self, manager, *, settings_changed: bool, source_changed: bool, device_changed: bool) -> None:
def sync_with_manager(self, manager, *, settings_changed: bool,
source_changed: bool = False,
css_changed: bool = False,
device_changed: bool = False,
brightness_vs_changed: bool = False) -> None:
"""Push changed fields to the processor manager."""
if settings_changed:
manager.update_target_settings(self.id, self.settings)
if source_changed:
manager.update_target_source(self.id, self.picture_source_id)
if brightness_vs_changed:
manager.update_target_brightness_vs(self.id, self.settings.brightness_value_source_id)
def update_fields(self, *, name=None, device_id=None, picture_source_id=None,
settings=None, key_colors_settings=None, description=None,