1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-05 21:02:20 +01:00

[lvgl] Fix: allow full range of styles on dropdown list. (#7552)

This commit is contained in:
Clyde Stubbs
2024-10-07 13:43:41 +11:00
committed by GitHub
parent 03a95ee05f
commit 6a2ed8241e
4 changed files with 58 additions and 2 deletions

View File

@@ -242,6 +242,8 @@ def pixels_or_percent_validator(value):
"""A length in one axis - either a number (pixels) or a percentage"""
if value == SCHEMA_EXTRACT:
return ["pixels", "..%"]
if isinstance(value, str) and value.lower().endswith("px"):
value = cv.int_(value[:-2])
value = cv.Any(cv.int_, cv.percentage)(value)
if isinstance(value, int):
return value