1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-05 19:33:47 +01:00

[lvgl] Revise code generation to allow early widget creation (#7611)

This commit is contained in:
Clyde Stubbs
2024-10-17 13:20:19 +11:00
committed by GitHub
parent f490585f66
commit 8bbe4efded
10 changed files with 155 additions and 132 deletions

View File

@@ -183,17 +183,11 @@ class LvContext(LambdaContext):
super().__init__(parameters=self.args)
self.lv_component = lv_component
async def add_init_lambda(self):
if self.code_list:
cg.add(self.lv_component.add_init_lambda(await self.get_lambda()))
LvContext.added_lambda_count += 1
async def __aexit__(self, exc_type, exc_val, exc_tb):
await super().__aexit__(exc_type, exc_val, exc_tb)
await self.add_init_lambda()
def add(self, expression: Union[Expression, Statement]):
self.code_list.append(self.indented_statement(expression))
cg.add(expression)
return expression
def __call__(self, *args):