mirror of
https://github.com/esphome/esphome.git
synced 2025-09-06 13:22:19 +01:00
[lvgl] Implement canvas widget (#8504)
This commit is contained in:
@@ -254,11 +254,27 @@ def pixels_or_percent_validator(value):
|
||||
pixels_or_percent = LValidator(pixels_or_percent_validator, uint32, retmapper=literal)
|
||||
|
||||
|
||||
def zoom(value):
|
||||
def pixels_validator(value):
|
||||
if isinstance(value, str) and value.lower().endswith("px"):
|
||||
value = value[:-2]
|
||||
return cv.positive_int(value)
|
||||
|
||||
|
||||
pixels = LValidator(pixels_validator, uint32, retmapper=literal)
|
||||
|
||||
|
||||
def zoom_validator(value):
|
||||
value = cv.float_range(0.1, 10.0)(value)
|
||||
return value
|
||||
|
||||
|
||||
def zoom_retmapper(value):
|
||||
return int(value * 256)
|
||||
|
||||
|
||||
zoom = LValidator(zoom_validator, uint32, retmapper=zoom_retmapper)
|
||||
|
||||
|
||||
def angle(value):
|
||||
"""
|
||||
Validation for an angle in degrees, converted to an integer representing 0.1deg units
|
||||
@@ -286,14 +302,6 @@ def size_validator(value):
|
||||
size = LValidator(size_validator, uint32, retmapper=literal)
|
||||
|
||||
|
||||
def pixels_validator(value):
|
||||
if isinstance(value, str) and value.lower().endswith("px"):
|
||||
return cv.int_(value[:-2])
|
||||
return cv.int_(value)
|
||||
|
||||
|
||||
pixels = LValidator(pixels_validator, uint32, retmapper=literal)
|
||||
|
||||
radius_consts = LvConstant("LV_RADIUS_", "CIRCLE")
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user