Skip to content

Commit

Permalink
feat: Add 'u' alias for QMK key width field
Browse files Browse the repository at this point in the history
  • Loading branch information
caksoylar committed Aug 19, 2024
1 parent 061feef commit 3995b00
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion keymap_drawer/keymap.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from collections import defaultdict
from functools import partial
from itertools import chain
from typing import Iterable, Literal, Callable
from typing import Callable, Iterable, Literal

from pydantic import BaseModel, Field, field_validator, model_serializer, model_validator

Expand Down
6 changes: 3 additions & 3 deletions keymap_drawer/physical_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import yaml
from platformdirs import user_cache_dir
from pydantic import BaseModel, field_validator, model_validator
from pydantic import BaseModel, Field, field_validator, model_validator

from .config import DrawConfig

Expand Down Expand Up @@ -397,12 +397,12 @@ def generate(self, key_w: float, key_h: float, split_gap: float) -> PhysicalLayo
class QmkLayout(BaseModel):
"""Generator for layouts given by QMK's info.json format."""

class QmkKey(BaseModel):
class QmkKey(BaseModel, populate_by_name=True):
"""Model representing each key in QMK's layout definition."""

x: float # coordinates of top-left corner
y: float
w: float = 1.0
w: float = Field(default=1.0, validation_alias="u")
h: float = 1.0
r: float = 0 # assume CW rotation around rx, ry (defaults to x, y), after translation to x, y
rx: float | None = None
Expand Down

0 comments on commit 3995b00

Please sign in to comment.