Skip to content

Add an option to the 'Open Display' action to not include parent macros - #4046

Open
rjwills28 wants to merge 3 commits into
ControlSystemStudio:masterfrom
rjwills28:open_display_inherit_parent_macro_option
Open

rjwills28 wants to merge 3 commits into
ControlSystemStudio:masterfrom
rjwills28:open_display_inherit_parent_macro_option

Conversation

@rjwills28

Copy link
Copy Markdown
Contributor

History: CS-Studio used to have an option on the Open Display action to inherit parent macros. However, this was not ported to Phoebus as it was deemed unnecessary as no-one could think of a use case where you wouldn't want the parent's macros (see https://github.com/ControlSystemStudio/phoebus/wiki/Display-Builder-Compatibility#macros).

We have found a use case for when you might not want to inherit macros from the parent. Take the example where you have 2 separate parent screens (with different macros defined) and a single child screen (which could represent a motor or something) that both parent1 and parent2 can open:

  • Parent1 opens child1 in a new window.
  • Parent2 then also opens child1.

Expected behavior: Child1 is already open and so you might expect the child1 window to be raised to the top.

Actual behavior: Because both parents have different macros that have been inherited, the URI to open child1 looks different depending on which parent it is open from. In this example the action from parent2 checks if the screen is already open, which returns false as the URI is different.
In this case we need an option to not inherit the parent's macros so that the URI looks the same from both parent1 and parent2

In this PR I have added a check box option 'inherit parent macros' to the Open Display action. The default behavior will remain the same, that is to say that 'inherit parent macros' will be true by default.

I've also added a unit test to check backwards compatibility.

Checklist

  • Testing:

    • The feature has automated tests
    • Tests were run
    • If not, explain how you tested your changes
  • Documentation:

    • The feature is documented
    • The documentation is up to date
    • Release notes:
      • Added an entry if the change is breaking or significant
      • Added an entry when adding a new feature

There are some use cases where the parent macros should not be used for
the screen being opened and so this option has been added.
Default behavior remains the same - i.e. inherit parent macros.

An example case where this is needed: if one child screen is opened from
one parent and the same child screen is opened from another parent then
you end up with 2 of the same screen being opened as the parent screens
have different macros hence the URI is different so Phoebus doesn't
recognise that the screen is already open.
Specifically tests backwards compatibility for the new option for
inheriting parent macros or not.
@sonarqubecloud

sonarqubecloud Bot commented Dec 2, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant