yamcs / yamcs-studio

Desktop TM/TC Client for Yamcs
https://docs.yamcs.org/yamcs-studio/
Eclipse Public License 2.0
27 stars 14 forks source link

Passing Macros to Linking Containers #105

Closed lorenzo-gomez-windhover closed 3 years ago

lorenzo-gomez-windhover commented 3 years ago

Hi there,

I'm trying to pass Macros to an instance of an OPI that that is inside a Linking Container. I attempt to do this with the following code:

new_perf_control=WidgetUtil.createWidgetModel("org.csstudio.opibuilder.widgets.linkingContainer")
# TODO: Use the enumeration values from Studio to avoid magical strings
new_perf_control.setPropertyValue("opi_file", "Displays/Core/ES/PerfCollectionControl_ES.opi")
event_macros = DataUtil.createMacrosInput(True)
event_macros.put("TAB", str("TAB_TITLE"))
new_perf_control.setPropertyValue("macros", event_macros)

Specifically, I'd like to use the macro for a trigger PV value on the OPI file at display.getMacroValue("PerfCollectionControlTEMPLATE_OPI").

However, when I instantiate it, it behaves as it if the macro "TAB" does not exist.

This is the setup for the trigger PV Displays/Core/ES/PerfCollectionControl_ES.opi: Screenshot from 2021-04-15 17-11-56

The trigger is for the checkbox that you see selected on the screenshot.

Any thoughts as to why it won't fetch the TAB macro when I instantiate the OPI?

Thanks in advance Lorenzo

fqqb commented 3 years ago

Script Input PVs should properly support macro substitution.

I cannot reproduce your issue, see attached two displays. Can you break these displays? Open macro1.opi, and then click the two buttons in order.

image

displays.zip

lorenzo-gomez-windhover commented 3 years ago

I'm sorry about the confusion. I got it to work a while back, but forgot to update the issue. Thanks!