examples: add ClockKey DUI package and ClockController#382
Merged
Conversation
Adds an analog clock key controller that drives the hour_hand and minute_hand transform bindings from the system clock via a 1Hz tick task. Angles are written through set_range over a 0--360 degree domain matching the manifest. The controller is not yet attached to any screen.
Updates ClockController to drive the new second_hand transform binding at 6 deg/sec alongside the existing hour and minute hands, sharing the same 0--360 degree set_range mapping. Wires the clock onto key 0 of the Main screen, shifting favourites and scenes onto the remaining keys. Adds a separate KeyController lifecycle list on StreamDeckApp so the clock participates in the uniform on_attach/on_detach flow across reconnects.
Adds passive INFO-level loggers for the four manifest input events on the ClockKey so the wiring can be verified on a live device. The handlers are observers only and do not mutate any binding.
| if task is not None and not task.done(): | ||
| task.cancel() | ||
| with contextlib.suppress(asyncio.CancelledError): | ||
| await task |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a new analog clock example to the streamdeck demo.
Changes
examples/ClockKey.dui-- analog clock face with three transform-bound hands (hour_hand,minute_hand,second_hand), each mapped to a 0-360 degree rotation.ClockController(KeyController)inexamples/streamdeck.py:set_range(min_val=0, max_val=360)matching the manifest mapping.asynciotask started inon_attachand cancelled inon_detach(safe across reconnect cycles).press,release,click,holdevents at INFO for live-device verification.StreamDeckAppwiring:self._key_controllers: list[KeyController]soKeyController-derived controllers share the same uniformon_attach/on_detachlifecycle as cards._build_main_screenreserves key 0 for the clock, then lays favourites and scenes on the remaining keys (fixes a previous off-by-one in the favourite slot range).Verification
ruff checkclean.mypy: no new errors (same 23 pre-existing errors as onmain, all related to theCardController/KeyController'Any base class' pattern shared by every controller in the file).pytest tests/ --cov=deux --cov-fail-under=95: 1983 passed, coverage 95.61%.