-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update widget macro with text entry #556
Comments
Use the latest version of CS-Studio (https://controlssoftware.sns.ornl.gov/css_phoebus/, https://github.com/ControlSystemStudio/phoebus).
For general info about compatibility, see https://github.com/ControlSystemStudio/phoebus/wiki/Display-Builder-Compatibility |
Thank you! Is the embedded folder in the org.csstudio.display.builder repository? Or where can I find it? I still wonder about the a.bob and b.bob files, and how the macro values "Value 2" and "Value 1" can be implemented. In the image below, the AI-sim-top.bob is displayed, with embedded display AI-SIM.bob. The user input comes from the text entry as the local PV through loc://GersemiAIdevNam. In this case, I suppose "M" in the example above corresponds to "AI2Macro". But what should "Value 1" and "Value 2" be? Always loc://GersemiAIdevNam? Regarding the "file" part, should I set a.bob always to be AI-SIM.bob or AI-sim-top.bob? Or how would the applied example script above update what comes from the text entry, such that the widgets inside AI-SIM.bob understand that the parent macro "AI2Macro" has been updated? |
You can install the examples from the latest CS-Studio via Example Display from the menu Applications, Display, Examples. In the outer, container display, you can have some text input widget with
There are, however, a few concerns: Second, anything related to scripts will change (as you noticed). |
Thank you, now it works for all systems with a generic script! The operator is only supposed to enter the device name and all the PV values are displayed below, so that should also be fine. |
Hi!
In a pop-up in .bob menu from the main system called Gersemi, there is an embedded display with text update templates showing various statuses and values of a wanted device determined by the user. For this purpose, I have created a text entry where one enters the process variable name of the wanted device in the system that becomes a local variable through loc://GersemiAIdevNam. I would like the macro "AI2Macro" to be the prefix (determined from user input) that then makes the text update templates show the status, e.g. $(AI2Macro):sRdV. The problem is that when this local PV is turned into a macro, the widgets (the text updates) don't seem to notice that the user has updated this PV. In runtime mode, the embedded display has indeed a macro "AI2Macro" that is exactly equal to the user input, so that seems to work. The following attached python script below is what I use:
from org.csstudio.display.builder.runtime.script import PVUtil
GersemiAIdevNam = PVUtil.getString(pvs[0])
widget.getPropertyValue("macros").add("AI2Macro", GersemiAIdevNam)
However, the other widgets in the embedded display don't seem to notice this updated macro. In the old .opi version of the menu, this JavaScript was used:
importPackage(Packages.org.csstudio.opibuilder.scriptUtil);
var macroInput = DataUtil.createMacrosInput(true);
var GersemiAIdevNam = PVUtil.getString(pvArray[0]);
macroInput.put("AI2Macro", GersemiAIdevNam);
widgetController.setPropertyValue("macros", macroInput);
Strangly enough, the display builder in CS Studio does not seem to import packages properly in JavaScript, so that's why I used python for the .bob version. In Python, the "import DataUtil" does not seem to work either. Do you have any idea of how to make other widgets understand that there is this new updated PV from the text entry user input? Thanks in advance for your help!
Best wishes,
sailew
The text was updated successfully, but these errors were encountered: