Skip to content

Commit

Permalink
fix: fix elements type-checker issue
Browse files Browse the repository at this point in the history
  • Loading branch information
kmontag committed Aug 19, 2024
1 parent 62f801a commit fca08d0
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions control_surface/elements/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,19 @@
from .sysex import SysexButtonElement, SysexToggleElement

if TYPE_CHECKING:
from typing_extensions import NotRequired

from ..configuration import Configuration

AddSubmatrixKwargs = TypedDict(
"AddSubmatrixKwargs",
{
"rows": NotRequired[Iterable[int]],
"columns": NotRequired[Iterable[int]],
"is_private": NotRequired[bool],
},
)

logger = getLogger(__name__)

LATCH_DELAY = TIMER_DELAY * 2
Expand Down Expand Up @@ -244,7 +255,7 @@ def add_submatrices(
grid: ButtonMatrixElement = getattr(self, grid_submatrix_name)

# Segments.
for segment_name, attrs in {
segment_names_to_attrs: Dict[str, AddSubmatrixKwargs] = {
"top": {"rows": (0, 1)},
"bottom": {"rows": (1, 2)},
"left": {"columns": (0, int(NUM_GRID_COLS * controls_per_key / 2))},
Expand All @@ -254,7 +265,9 @@ def add_submatrices(
NUM_GRID_COLS * controls_per_key,
)
},
}.items():
}

for segment_name, attrs in segment_names_to_attrs.items():
segment_submatrix_name = f"grid_{segment_name}_{category_base_name}"
self.add_submatrix(grid, segment_submatrix_name, **attrs)

Expand Down

0 comments on commit fca08d0

Please sign in to comment.