-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdials.py
More file actions
46 lines (32 loc) · 1.62 KB
/
dials.py
File metadata and controls
46 lines (32 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from __future__ import annotations
from typing import Literal
from streamdeck.models.events.base import EventBase
from streamdeck.models.events.common import (
BasePayload,
ContextualEventMixin,
CoordinatesPayloadMixin,
DeviceSpecificEventMixin,
EncoderControllerType,
)
## Payload models used in the below DialDown, DialRotate, and DialUp events
class EncoderPayload(BasePayload[EncoderControllerType], CoordinatesPayloadMixin):
"""Contextualized information for a DialDown or DialUp event."""
class DialRotatePayload(EncoderPayload):
"""Contextualized information for a DialRotate event."""
pressed: bool
"""Determines whether the dial was pressed whilst the rotation occurred."""
ticks: int
"""Number of ticks the dial was rotated; this can be a positive (clockwise) or negative (counter-clockwise) number."""
## Event models for DialDown, DialRotate, and DialUp events
class DialDown(EventBase[Literal["dialDown"]], ContextualEventMixin, DeviceSpecificEventMixin):
"""Occurs when the user presses a dial (Stream Deck +)."""
payload: EncoderPayload
"""Contextualized information for this event."""
class DialRotate(EventBase[Literal["dialRotate"]], ContextualEventMixin, DeviceSpecificEventMixin):
"""Occurs when the user rotates a dial (Stream Deck +)."""
payload: DialRotatePayload
"""Contextualized information for this event."""
class DialUp(EventBase[Literal["dialUp"]], ContextualEventMixin, DeviceSpecificEventMixin):
"""Occurs when the user releases a pressed dial (Stream Deck +)."""
payload: EncoderPayload
"""Contextualized information for this event."""