#!/usr/bin/env python # load PS scalar readouts # # P. Mattione October 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") ArmString = PVUtil.getString(pvs[0]) if ArmString == "0.000": ArmString = "Left Arm (Side A)" widget.setPropertyValue("pv_value", ArmString) # ConsoleUtil.writeInfo("ARM: ArmString = " + ArmString) Arm = "A" if ArmString == "Left Arm (Side A)" : Arm = "A" else : Arm = "B" ################################################# Update arm ################################################ #Get Widget WidgetName = "PS_Display" DisplayWidget = widget.getParent().getWidget(WidgetName) DisplayWidget.removeAllChildren() linkingContainer.append( WidgetUtil.createWidgetModel("org.csstudio.opibuilder.widgets.linkingContainer") ) linkingContainer[0].setPropertyValue("opi_file", "PS_scaler_graphic.opi") #create linking container linkingContainer[0].setPropertyValue("height",354) linkingContainer[0].setPropertyValue("width", 1769) linkingContainer[0].setPropertyValue("auto_size", False) linkingContainer[0].setPropertyValue("zoom_to_fit", False) linkingContainer[0].setPropertyValue("border_style", 0) #add macros linkingContainer[0].addMacro("psArm", Arm) linkingContainer[0].addMacro("psReadout", "scaler_r1") DisplayWidget.addChildToBottom(linkingContainer[0]) DisplayWidget.performAutosize() #Set whether Layer4 Widget is visible # Layer4Widget = DisplayWidget.getWidget("Layer4") # if ModuleType == "T": # Layer4Widget.setPropertyValue("visible", False) # else: # Layer4Widget.setPropertyValue("visible", True) if __name__ == "__main__": main()