# load ST scalar readouts # # P. Mattione April 2015 # from org.csstudio.opibuilder.scriptUtil import PVUtil from org.csstudio.opibuilder.scriptUtil import WidgetUtil from org.csstudio.opibuilder.scriptUtil import ConsoleUtil from org.csstudio.utility.pv import PVFactory from org.csstudio.opibuilder.scriptUtil import ColorFontUtil import re import os import time import sys linkingContainer = [] Arr=[] def main(): Pref= widget.getParent().getMacroValue("pref") #ModuleType = widget.getParent().getMacroValue("scType") #ReadoutType = widget.getParent().getMacroValue("scReadout") #ConsoleUtil.writeInfo("ModuleType = " + str(ModuleType)) #ConsoleUtil.writeInfo("ModuleNumber = " + str(ModuleNumber)) #ConsoleUtil.writeInfo("Upstr/Dounstr = " + str(U_D)) value = PVUtil.getString(pvs[0]) ReadoutType = "scaler_r1" if value == "0.000": widget.setPropertyValue("pv_value", "Readout 1") elif value == "Readout 1" : ReadoutType = "scaler_r1" elif value == "Readout 2" : ReadoutType = "scaler_r2" elif value == "Trigger 1" : ReadoutType = "scaler_t1" elif value == "Trigger 2" : ReadoutType = "scaler_t2" DisplayWidget=widget.getParent().getWidget("SC_Display_Window_1") DisplayWidget.removeAllChildren() linkingContainer.append( WidgetUtil.createWidgetModel("org.csstudio.opibuilder.widgets.linkingContainer") ) linkingContainer[0].setPropertyValue("opi_file", "ST_scaler_graphic.opi") #create linking container linkingContainer[0].setPropertyValue("auto_size", True) linkingContainer[0].setPropertyValue("zoom_to_fit", False) linkingContainer[0].setPropertyValue("border_style", 0) #add macros linkingContainer[0].addMacro("scReadout", ReadoutType) linkingContainer[0].addMacro("scType", "T") DisplayWidget.addChildToBottom(linkingContainer[0]) DisplayWidget.performAutosize() # Change the waveform WaveformDisplayWidget=widget.getParent().getWidget("DiscWaveformContainer") WaveformDisplayWidget.removeAllChildren() linkingContainer.append( WidgetUtil.createWidgetModel("org.csstudio.opibuilder.widgets.linkingContainer") ) linkingContainer[1].setPropertyValue("opi_file", "ST_scaler_wave.opi") #create linking container linkingContainer[1].setPropertyValue("auto_size", True) linkingContainer[1].setPropertyValue("zoom_to_fit", False) linkingContainer[1].setPropertyValue("border_style", 0) #add macros linkingContainer[1].addMacro("scReadout", ReadoutType) linkingContainer[1].addMacro("scType", "T") WaveformDisplayWidget.addChildToBottom(linkingContainer[1]) WaveformDisplayWidget.performAutosize() if __name__ == "__main__": main()