# load PSC scalar readouts # # P. Mattione November 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") 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("PSC_DISC_Display") DisplayWidget.removeAllChildren() linkingContainer.append( WidgetUtil.createWidgetModel("org.csstudio.opibuilder.widgets.linkingContainer") ) linkingContainer[0].setPropertyValue("opi_file", "PSC_scaler_graphic.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", 82) linkingContainer[0].setPropertyValue("width", 1716) #add macros linkingContainer[0].addMacro("pscReadout", ReadoutType) linkingContainer[0].addMacro("pscType", "T") DisplayWidget.addChildToBottom(linkingContainer[0]) 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[1].setPropertyValue("opi_file", "PSC_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("pscReadout", ReadoutType) linkingContainer[1].addMacro("pscType", "T") WaveformDisplayWidget.addChildToBottom(linkingContainer[1]) WaveformDisplayWidget.performAutosize() if __name__ == "__main__": main()