[lvgl] Fix disp_bg_image when image not used;

Allow line points to be updated.
define gradients before use in styles
This commit is contained in:
clydebarrow 2024-11-23 13:14:41 +11:00
parent 03ae6b2c1b
commit b829d9082c
3 changed files with 12 additions and 3 deletions

View file

@ -322,8 +322,8 @@ async def to_code(configs):
await encoders_to_code(lv_component, config, default_group) await encoders_to_code(lv_component, config, default_group)
await keypads_to_code(lv_component, config, default_group) await keypads_to_code(lv_component, config, default_group)
await theme_to_code(config) await theme_to_code(config)
await styles_to_code(config)
await gradients_to_code(config) await gradients_to_code(config)
await styles_to_code(config)
await set_obj_properties(lv_scr_act, config) await set_obj_properties(lv_scr_act, config)
await add_widgets(lv_scr_act, config) await add_widgets(lv_scr_act, config)
await add_pages(lv_component, config) await add_pages(lv_component, config)

View file

@ -341,9 +341,15 @@ FLEX_OBJ_SCHEMA = {
cv.Optional(df.CONF_FLEX_GROW): cv.int_, cv.Optional(df.CONF_FLEX_GROW): cv.int_,
} }
def bg_image_validator(value):
add_lv_use("img", "label")
return lv_image(value)
DISP_BG_SCHEMA = cv.Schema( DISP_BG_SCHEMA = cv.Schema(
{ {
cv.Optional(df.CONF_DISP_BG_IMAGE): lv_image, cv.Optional(df.CONF_DISP_BG_IMAGE): bg_image_validator,
cv.Optional(df.CONF_DISP_BG_COLOR): lv_color, cv.Optional(df.CONF_DISP_BG_COLOR): lv_color,
} }
) )

View file

@ -39,7 +39,10 @@ LINE_SCHEMA = {
class LineType(WidgetType): class LineType(WidgetType):
def __init__(self): def __init__(self):
super().__init__( super().__init__(
CONF_LINE, LvType("lv_line_t"), (CONF_MAIN,), LINE_SCHEMA, modify_schema={} CONF_LINE,
LvType("lv_line_t"),
(CONF_MAIN,),
LINE_SCHEMA,
) )
async def to_code(self, w: Widget, config): async def to_code(self, w: Widget, config):