Exemplo n.º 1
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);

from org.csstudio.opibuilder.scriptUtil import PVUtil, ColorFontUtil

'''
pvs[0-19] = CHNL:XXX:READ
pvs[20-39] = CHNL:XXX:DRIFT
pvs[40-59] = CHNL:XXX:TEMP
'''

table = widget.getTable()
color = ColorFontUtil.getColorFromRGB(240, 245, 245)
number_of_channels = 20
temp_pv_index_offset = number_of_channels
drift_pv_index_offset = number_of_channels*2
temp_value_column = 1
drift_value_column = 2
reading_value_column = 3

for i in range(number_of_channels):
    reading = PVUtil.getString(pvs[i])
    temperature = PVUtil.getString(pvs[i + temp_pv_index_offset])
    drift = PVUtil.getString(pvs[i + drift_pv_index_offset])
    row = i+1
    table.setCellText(row, temp_value_column, temperature)
    table.setCellText(row, drift_value_column, drift)
    table.setCellText(row, reading_value_column, reading)

    # Create colour scheme for table
    if row % 2 != 0:
        for col in range(0, 4):
            table.setCellBackground(row, col, color)
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)
Exemplo n.º 4
0
from org.csstudio.opibuilder.scriptUtil import ConsoleUtil
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.opibuilder.scriptUtil import ColorFontUtil
from org.eclipse.jface.dialogs import MessageDialog

#module in the same directory is visible to this script
import WidgetUtil

GREEN = ColorFontUtil.getColorFromRGB(0, 180, 0)
RED = ColorFontUtil.RED

#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)
Exemplo n.º 5
0
from org.csstudio.opibuilder.scriptUtil import ConsoleUtil
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.opibuilder.scriptUtil import ColorFontUtil
from org.eclipse.jface.dialogs import MessageDialog

#module in the same directory is visible to this script
import WidgetUtil

GREEN = ColorFontUtil.getColorFromRGB(0, 180, 0)
RED = ColorFontUtil.RED

#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)