Пример #1
0
from org.csstudio.opibuilder.scriptUtil import PVUtil

value = PVUtil.getDouble(pvs[0])

width = 5*value;
oldY=widget.getPropertyValue("y")
oldHeight = widget.getPropertyValue("height");

#module in the same directory is visible to this script
import WidgetUtil
WidgetUtil.setMyBounds(widget, value*10, 200 - width/2, width, width)



Пример #2
0
from org.csstudio.opibuilder.scriptUtil import PVUtil

value = PVUtil.getDouble(pvs[0])

width = 5*value;
oldY=widget.getPropertyValue("y")
oldHeight = widget.getPropertyValue("height");

#module in the same directory is visible to this script
import WidgetUtil
WidgetUtil.setMyBounds(widget, value*40, 500 - width/2, width, width)



Пример #3
0
from org.csstudio.opibuilder.scriptUtil import PVUtil

value = PVUtil.getDouble(pvs[0])

width = 5*value;
oldY=widget.getPropertyValue("y")
oldHeight = widget.getPropertyValue("height");

#module in the same directory is visible to this script
import WidgetUtil
WidgetUtil.setMyBounds(widget, value*10, 200 - width/2, width, width)



Пример #4
0
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.opibuilder.scriptUtil import ColorFontUtil
from org.eclipse.jface.dialogs import MessageDialog
from java.lang import Math



if Math.random() > 0.5:
	color = ColorFontUtil.getColorFromRGB(0,160,0)
	colorName = "green"

else:
	color = ColorFontUtil.RED
	colorName = "red"

import WidgetUtil
WidgetUtil.setBackColor(display, "myIndicator", color)
WidgetUtil.setMyForeColor(widget, color)

MessageDialog.openInformation(
			None, "Dialog from Python Script", "Python says: my color is " + colorName);

Пример #5
0
from org.csstudio.opibuilder.scriptUtil import PVUtil

value = PVUtil.getDouble(pvs[0])

width = 5 * value
oldY = widget.getPropertyValue("y")
oldHeight = widget.getPropertyValue("height")

#module in the same directory is visible to this script
import WidgetUtil
WidgetUtil.setMyBounds(widget, value * 40, 500 - width / 2, width, width)
ATT_array = ["VM1", "VM2", "VM3", "VM4", "VM5", "VM6", "VM7", "ADC"]
GATE_array = ["VM1", "VM2", "VM3", "VM4", "VM5", "VM6", "VM7"]
CONST_array = ["VM1", "VM2", "VM3", "VM4", "VM5", "VM6", "VM7"]
MUX_array = ["VM1", "VM2", "VM3", "VM4", "VM5", "VM6", "VM7"]
SYNC_array = ["MODE", "DELAY", "ON", "OFF"]
AWG_array = [
    "SIN", "TRAF", "TRAR", "TRAC", "FALL", "RIS", "SQON", "SQOFF", "TRIG",
    "OUT"
]
AMP_array = ["MODE", "Q", "GAIN"]
MODEX_array = ["Q", "GAIN", "DETU"]
PIEZO_array = ["GAIN"]

temp = lvl2
if temp == "ATT":
    WidgetUtil.setItems(display, label_name, ATT_array)
elif temp == "GATE":
    WidgetUtil.setItems(display, label_name, GATE_array)
elif temp == "CONSTI" or temp == "CONSTQ":
    WidgetUtil.setItems(display, label_name, CONST_array)
elif temp == "MUX":
    WidgetUtil.setItems(display, label_name, MUX_array)
elif temp == "AWG":
    WidgetUtil.setItems(display, label_name, AWG_array)
elif temp == "SYNC":
    WidgetUtil.setItems(display, label_name, SYNC_array)
elif "MOD" in temp:
    WidgetUtil.setItems(display, label_name, MODEX_array)
elif temp == "AMP":
    WidgetUtil.setItems(display, label_name, AMP_array)
elif (temp == "PIEZO1" or temp == "PIEZO2" or temp == "PIEZOO"):
Пример #7
0
#Name of the flag to show if dialog has been popped up.
flagName = "popped"

labelName = "myLabel"

if widget.getExternalObject(flagName) == None:
    widget.setExternalObject(flagName, 0)
    #Example to write text to BOY Console
    ConsoleUtil.writeInfo("Welcome to Best OPI, Yet (BOY)!")

b = widget.getExternalObject(flagName)

if PVUtil.getDouble(pvs[0]) > PVUtil.getDouble(pvs[1]):
    s = "Temperature is too high!"
    WidgetUtil.setText(display, labelName, s)
    WidgetUtil.setForeColor(display, labelName, RED)
    #If dialog has not been popped up, pop up the dialog
    if b == 0:
        #set popped flag to true
        widget.setExternalObject(flagName, 1)
        MessageDialog.openWarning(None, "Warning",
                                  "The temperature you set is too high!")
else:
    s = "Temperature is normal"
    WidgetUtil.setText(display, "myLabel", s)
    WidgetUtil.setForeColor(display, labelName, GREEN)
    #reset popped flag to false
    if b != 0:
        widget.setExternalObject(flagName, 0)
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.opibuilder.scriptUtil import ColorFontUtil
from org.eclipse.jface.dialogs import MessageDialog
from java.lang import Math

if Math.random() > 0.5:
    color = ColorFontUtil.getColorFromRGB(0, 160, 0)
    colorName = "green"

else:
    color = ColorFontUtil.RED
    colorName = "red"

import WidgetUtil
WidgetUtil.setBackColor(display, "myIndicator", color)
WidgetUtil.setMyForeColor(widget, color)

MessageDialog.openInformation(None, "Dialog from Python Script",
                              "Python says: my color is " + colorName)
Пример #9
0
#Name of the flag to show if dialog has been popped up.
flagName = "popped"

labelName = "myLabel"

if widget.getExternalObject(flagName) == None:
    widget.setExternalObject(flagName, 0)    
    #Example to write text to BOY Console    
    ConsoleUtil.writeInfo("Welcome to Best OPI, Yet (BOY)!")

b = widget.getExternalObject(flagName);

if PVUtil.getDouble(pvs[0]) > PVUtil.getDouble(pvs[1]):  
        s = "Temperature is too high!"
        WidgetUtil.setText(display, labelName, s)
        WidgetUtil.setForeColor(display, labelName, RED)
        #If dialog has not been popped up, pop up the dialog
        if b == 0:
            #set popped flag to true
            widget.setExternalObject(flagName, 1)                   
            MessageDialog.openWarning(
                None, "Warning", "The temperature you set is too high!")        
else:
    s = "Temperature is normal"
    WidgetUtil.setText(display, "myLabel", s)
    WidgetUtil.setForeColor(display, labelName, GREEN)
    #reset popped flag to false
    if b != 0:
        widget.setExternalObject(flagName, 0)