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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user