Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/techui_builder/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,14 @@ def _allocate_widget(
) -> EmbeddedDisplay | ActionButton | None | list[EmbeddedDisplay | ActionButton]:
name, suffix, suffix_label = self._initialise_name_suffix(component)
# Get relative path to screen
scrn_path = self.support_path.joinpath(f"bob/{scrn_mapping['file']}")
logger_.debug(f"Screen path: {scrn_path}")
try:
scrn_path = self.support_path.joinpath(f"bob/{scrn_mapping['file']}")
logger_.debug(f"Screen path: {scrn_path}")

# Path of screen relative to data/ so it knows where to open the file from
data_scrn_path = scrn_path.relative_to(self.synoptic_dir, walk_up=True)
# Path of screen relative to data/ so it knows where to open the file from
data_scrn_path = scrn_path.relative_to(self.synoptic_dir, walk_up=True)
except KeyError:
scrn_path = data_scrn_path = f"$(IOC)/{scrn_mapping['remote_screen']}"

# For Gui Components with multiple components embedded, we add a suffix field
# to the components, and adjust the name and suffix accordingly
Expand Down Expand Up @@ -255,6 +258,7 @@ def _allocate_widget(
target="tab",
macros={
"P": component.P,
"IOC": f"{self.beamline_url}/{component.service_name}",
f"{suffix_label}": suffix,
},
)
Expand All @@ -264,6 +268,7 @@ def _allocate_widget(
target="tab",
macros={
"P": component.P,
"IOC": f"{self.beamline_url}/{component.service_name}",
},
)

Expand Down
3 changes: 2 additions & 1 deletion src/techui_builder/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ class TechUi(BaseModel):


class GuiComponentEntry(BaseModel):
file: BobPath
file: BobPath | None = None
remote_screen: BobPath | None = None
prefix: MacroString
suffix: MacroString | None = None
type: ScreenType
Expand Down
1 change: 1 addition & 0 deletions tests/test_files/widget_related.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<description>Open Display</description>
<macros>
<P>BL01T-MO-IOC-01</P>
<IOC>test_url/bl01t-mo-ioc-01</IOC>
<M>:M</M>
</macros>
<file>techui-support/bob/pmac/pmacController.bob</file>
Expand Down
1 change: 1 addition & 0 deletions tests/test_files/widget_related_no_suffix.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<description>Open Display</description>
<macros>
<P>BL01T-MO-IOC-01</P>
<IOC>test_url/bl01t-mo-ioc-01</IOC>
</macros>
<file>techui-support/bob/pmac/pmacController.bob</file>
<target>tab</target>
Expand Down