1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-18 07:45:56 +00:00

[lvgl] Layout improvements (#10149)

Co-authored-by: clydeps <U5yx99dok9>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Clyde Stubbs
2025-11-04 13:39:27 +10:00
committed by GitHub
parent 758ac58343
commit 0b04361fc0
15 changed files with 572 additions and 289 deletions

View File

@@ -1,3 +1,4 @@
import re
from typing import TYPE_CHECKING, Any
import esphome.codegen as cg
@@ -246,6 +247,8 @@ def pixels_or_percent_validator(value):
return ["pixels", "..%"]
if isinstance(value, str) and value.lower().endswith("px"):
value = cv.int_(value[:-2])
if isinstance(value, str) and re.match(r"^lv_pct\((\d+)\)$", value):
return value
value = cv.Any(cv.int_, cv.percentage)(value)
if isinstance(value, int):
return value