mirror of
https://github.com/esphome/esphome.git
synced 2025-09-06 05:12:21 +01:00
[lvgl] Allow strings to be interpreted as integers (Bugfix) (#7652)
This commit is contained in:
@@ -274,10 +274,8 @@ def size_validator(value):
|
||||
return ["SIZE_CONTENT", "number of pixels", "percentage"]
|
||||
if isinstance(value, str) and value.lower().endswith("px"):
|
||||
value = cv.int_(value[:-2])
|
||||
if isinstance(value, str) and not value.endswith("%"):
|
||||
if value.upper() == "SIZE_CONTENT":
|
||||
return "LV_SIZE_CONTENT"
|
||||
raise cv.Invalid("must be 'size_content', a percentage or an integer (pixels)")
|
||||
if isinstance(value, str) and value.upper() == "SIZE_CONTENT":
|
||||
return "LV_SIZE_CONTENT"
|
||||
return pixels_or_percent_validator(value)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user