# load CTOF scalar readouts # # Hovanes Egiyan May 2022 # 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") value = PVUtil.getString(pvs[0]) ReadoutType = "scaler_r1" DisplayString = "Discriminator: Readout 1 Scalers" if value == "0.000": widget.setPropertyValue("pv_value", "Disc: Readout 1") elif value == "Readout 1" : ReadoutType = "scaler_r1" DisplayString = "Discriminator: Readout 1 Scalers" elif value == "Readout 2" : ReadoutType = "scaler_r2" DisplayString = "Discriminator: Readout 2 Scalers" elif value == "Trigger 1" : ReadoutType = "scaler_t1" DisplayString = "Discriminator: Trigger 1 Scalers" elif value == "Trigger 2" : ReadoutType = "scaler_t2" DisplayString = "Discriminator: Trigger 2 Scalers" ################################################ Update columns ################################################ DisplayWidget=widget.getParent().getWidget("CTOF_DISC_UP") DisplayWidget.removeAllChildren() linkingContainer.append( WidgetUtil.createWidgetModel("org.csstudio.opibuilder.widgets.linkingContainer") ) linkingContainer[0].setPropertyValue("opi_file", "CTOF_side.opi") #create linking container linkingContainer[0].setPropertyValue("auto_size", False) linkingContainer[0].setPropertyValue("zoom_to_fit", False) linkingContainer[0].setPropertyValue("border_style", 0) linkingContainer[0].setPropertyValue("height", 87) linkingContainer[0].setPropertyValue("width", 535) #add macros linkingContainer[0].addMacro("ctofSide", "UP") linkingContainer[0].addMacro("ctofReadout", ReadoutType) linkingContainer[0].addMacro("ctofType", "D") DisplayWidget.addChildToBottom(linkingContainer[0]) DisplayWidget.performAutosize() DisplayWidget=widget.getParent().getWidget("CTOF_DISC_DW") DisplayWidget.removeAllChildren() linkingContainer.append( WidgetUtil.createWidgetModel("org.csstudio.opibuilder.widgets.linkingContainer") ) linkingContainer[1].setPropertyValue("opi_file", "CTOF_side.opi") #create linking container linkingContainer[1].setPropertyValue("auto_size", False) linkingContainer[1].setPropertyValue("zoom_to_fit", False) linkingContainer[1].setPropertyValue("border_style", 0) linkingContainer[1].setPropertyValue("height", 87) linkingContainer[1].setPropertyValue("width", 535) #add macros linkingContainer[1].addMacro("ctofSide", "DW") linkingContainer[1].addMacro("ctofReadout", ReadoutType) linkingContainer[1].addMacro("ctofType", "D") DisplayWidget.addChildToBottom(linkingContainer[1]) DisplayWidget.performAutosize() ################################################ Update Waveform ################################################ WaveformLabelWidget=widget.getParent().getWidget("DiscWaveformLabel") WaveformLabelWidget.setPropertyValue("text", DisplayString) WaveformDisplayWidget=widget.getParent().getWidget("DiscWaveformContainer") WaveformDisplayWidget.removeAllChildren() linkingContainer.append( WidgetUtil.createWidgetModel("org.csstudio.opibuilder.widgets.linkingContainer") ) linkingContainer[2].setPropertyValue("opi_file", "CTOF_scaler_wave.opi") #create linking container linkingContainer[2].setPropertyValue("auto_size", True) linkingContainer[2].setPropertyValue("zoom_to_fit", False) linkingContainer[2].setPropertyValue("border_style", 0) #add macros linkingContainer[2].addMacro("ctofReadout", ReadoutType) linkingContainer[2].addMacro("ctofType", "D") WaveformDisplayWidget.addChildToBottom(linkingContainer[2]) WaveformDisplayWidget.performAutosize() if __name__ == "__main__": main()