[lvgl] Allow strings to be interpreted as integers (Bugfix) (#7652)

This commit is contained in:
Clyde Stubbs 2024-10-22 14:10:09 +11:00 committed by GitHub
parent 3ac730fb2f
commit 6330177d24
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 6 deletions

View file

@ -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":
if isinstance(value, str) and value.upper() == "SIZE_CONTENT":
return "LV_SIZE_CONTENT"
raise cv.Invalid("must be 'size_content', a percentage or an integer (pixels)")
return pixels_or_percent_validator(value)

View file

@ -422,7 +422,7 @@ lvgl:
id: lv_image
src: cat_image
align: top_left
y: 50
y: "50"
- tileview:
id: tileview_id
scrollbar_mode: active
@ -461,7 +461,7 @@ lvgl:
bg_opa: transp
knob:
radius: 1
width: 4
width: "4"
height: 10%
bg_color: 0x000000
width: 100%