From 294e2216a7433812b208e4f9ac0f6e87d0f9e26a Mon Sep 17 00:00:00 2001 From: Ollie Copping Date: Mon, 10 Aug 2026 08:13:50 +0000 Subject: [PATCH] Change Generator update_macros call to just update current macros instead of wiping out old dictionary This would cause issues if extra macros were defined in techui-support.yaml for the screen that weren't a part of the prefix, as they would be cleared. An example of which is for the multipositioner embed screen. --- src/techui_builder/generate.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/techui_builder/generate.py b/src/techui_builder/generate.py index d870914b..863bdc33 100644 --- a/src/techui_builder/generate.py +++ b/src/techui_builder/generate.py @@ -184,6 +184,7 @@ def _allocate_widget( self, screen_mapping: Mapping, component: Entity ) -> EmbeddedDisplay | ActionButton | None | list[EmbeddedDisplay | ActionButton]: component_name, updated_macros = self._update_macros(component) + component.macros.update(updated_macros) # Get relative path to screen file = screen_mapping["file"] @@ -211,7 +212,7 @@ def _allocate_widget( if screen_mapping["suffixes"] is not None: suffix_dict: dict[str, str] = screen_mapping["suffixes"] for suffix_key, suffix in suffix_dict.items(): - updated_macros[suffix_key] = suffix + component.macros[suffix_key] = suffix # If no child label was specified... if self.label_flag is False: @@ -221,7 +222,7 @@ def _allocate_widget( .removeprefix(":") .removesuffix(":") ) - updated_macros["label"] = component_name + component.macros["label"] = component_name except KeyError: pass @@ -236,7 +237,7 @@ def _allocate_widget( height, ) # Add macros to the widgets - for macro, macro_val in updated_macros.items(): + for macro, macro_val in component.macros.items(): new_widget.macro(macro, macro_val) # TODO: Change this to pvi_button @@ -260,7 +261,7 @@ def _allocate_widget( # Add action to action button: to open related display new_widget.action_open_display( - file=str(support_screen_path), target="tab", macros=updated_macros + file=str(support_screen_path), target="tab", macros=component.macros ) # For some reason the version of action buttons is 3.0.0?