# Script used during developing. Allows to read from an XML file and overwrite a linking container widget with new information. # Orlando Soto, February 2014. from org.csstudio.opibuilder.scriptUtil import PVUtil, FileUtil, WidgetUtil option = int(PVUtil.getDouble(pvs[0])) filePath = "scripts/LEDmacro_file.xml" #root is a JDOM Element root = FileUtil.loadXMLFile(filePath, widget) #LED types leds = root.getChildren() widget.removeAllChildren() #create linking container linkingContainer = WidgetUtil.createWidgetModel("org.csstudio.opibuilder.widgets.linkingContainer") linkingContainer.setPropertyValue("opi_file", "FCAL_LEDChannel.opi") linkingContainer.setPropertyValue("auto_size", True) linkingContainer.setPropertyValue("zoom_to_fit", False) linkingContainer.setPropertyValue("x", 0) linkingContainer.setPropertyValue("border_style", 0) #add macros macros = leds.get(option).getChildren() for i in range(macros.size()): macro = macros.get(i) linkingContainer.addMacro(macro.getName(), macro.getValue()) #add linking container to widget widget.addChildToBottom(linkingContainer)