mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	[lvgl] Fix msgbox content (#7912)
This commit is contained in:
		| @@ -29,7 +29,7 @@ from ..lvcode import ( | |||||||
| ) | ) | ||||||
| from ..schemas import STYLE_SCHEMA, STYLED_TEXT_SCHEMA, container_schema, part_schema | from ..schemas import STYLE_SCHEMA, STYLED_TEXT_SCHEMA, container_schema, part_schema | ||||||
| from ..types import LV_EVENT, char_ptr, lv_obj_t | from ..types import LV_EVENT, char_ptr, lv_obj_t | ||||||
| from . import Widget, set_obj_properties | from . import Widget, add_widgets, set_obj_properties | ||||||
| from .button import button_spec | from .button import button_spec | ||||||
| from .buttonmatrix import ( | from .buttonmatrix import ( | ||||||
|     BUTTONMATRIX_BUTTON_SCHEMA, |     BUTTONMATRIX_BUTTON_SCHEMA, | ||||||
| @@ -119,6 +119,7 @@ async def msgbox_to_code(top_layer, conf): | |||||||
|         button_style = {CONF_ITEMS: button_style} |         button_style = {CONF_ITEMS: button_style} | ||||||
|         await set_obj_properties(buttonmatrix_widget, button_style) |         await set_obj_properties(buttonmatrix_widget, button_style) | ||||||
|     await set_obj_properties(msgbox_widget, conf) |     await set_obj_properties(msgbox_widget, conf) | ||||||
|  |     await add_widgets(msgbox_widget, conf) | ||||||
|     async with LambdaContext(EVENT_ARG, where=messagebox_id) as close_action: |     async with LambdaContext(EVENT_ARG, where=messagebox_id) as close_action: | ||||||
|         outer_widget.add_flag("LV_OBJ_FLAG_HIDDEN") |         outer_widget.add_flag("LV_OBJ_FLAG_HIDDEN") | ||||||
|     if close_button: |     if close_button: | ||||||
|   | |||||||
| @@ -109,6 +109,10 @@ lvgl: | |||||||
|       close_button: true |       close_button: true | ||||||
|       title: Messagebox |       title: Messagebox | ||||||
|       bg_color: 0xffff |       bg_color: 0xffff | ||||||
|  |       widgets: | ||||||
|  |         - label: | ||||||
|  |             text: Hello Msgbox | ||||||
|  |             id: msgbox_label | ||||||
|       body: |       body: | ||||||
|         text: This is a sample messagebox |         text: This is a sample messagebox | ||||||
|         bg_color: 0x808080 |         bg_color: 0x808080 | ||||||
| @@ -137,6 +141,9 @@ lvgl: | |||||||
|         - lvgl.widget.focus: mark |         - lvgl.widget.focus: mark | ||||||
|         - lvgl.widget.redraw: hello_label |         - lvgl.widget.redraw: hello_label | ||||||
|         - lvgl.widget.redraw: |         - lvgl.widget.redraw: | ||||||
|  |         - lvgl.label.update: | ||||||
|  |             id: msgbox_label | ||||||
|  |             text: Unloaded | ||||||
|       on_all_events: |       on_all_events: | ||||||
|         logger.log: |         logger.log: | ||||||
|           format: "Event %s" |           format: "Event %s" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user