# Load embedded display for each entry in config file # # pvs[0]: Config file # pvs[1]: File to embed # pvs[2]: width # pvs[3]: height from org.csstudio.display.builder.model import WidgetFactory from org.csstudio.display.builder.model.macros import Macros from org.csstudio.display.builder.model.persist import XMLUtil from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil # logger = ScriptUtil.getLogger() config_file = PVUtil.getString(pvs[0]) embed = PVUtil.getString(pvs[1]) width = PVUtil.getInt(pvs[2]) height = PVUtil.getInt(pvs[3]) # PMT000 root = ScriptUtil.readXMLFile(widget, config_file) i = 0 for group in XMLUtil.getChildElements(root, "Group"): # logger.info("-- Embed %d---" % i) macros = Macros() for macro_node in XMLUtil.getChildElements(group): name = macro_node.getNodeName() value = XMLUtil.getString(macro_node) # logger.info("%s = %s" % (name, str(value))) macros.add(name, value) embedded = WidgetFactory.getInstance().getWidgetDescriptor('embedded').createWidget() embedded.setPropertyValue('y', i*height) embedded.setPropertyValue('width', width) embedded.setPropertyValue('height', height) embedded.setPropertyValue('file', embed) embedded.setPropertyValue('macros', macros) widget.runtimeChildren().addChild(embedded) i += 1 widget.setPropertyValue('width', width) widget.setPropertyValue('height', height * i)