本文整理汇总了Python中org.csstudio.opibuilder.scriptUtil.PVUtil.getDouble方法的典型用法代码示例。如果您正苦于以下问题:Python PVUtil.getDouble方法的具体用法?Python PVUtil.getDouble怎么用?Python PVUtil.getDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.csstudio.opibuilder.scriptUtil.PVUtil
的用法示例。
在下文中一共展示了PVUtil.getDouble方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_channels
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getDouble [as 别名]
def update_channels(this_display, this_pvs):
"""
Updates the channels available on the summary maintenance page
Args:
this_display: The display that has called this script. Used to control modification of global CSS variables
this_pvs: PVs passed to the script by CSS. Used to control modification of global CSS variables
Returns:
None
"""
# Loop through the channels, and if selected add them to the list
actioned = PVUtil.getDouble(this_pvs[0]) == 1
if actioned:
# Generate the list of included channel names
channel_names = list()
for crate, slot, channel in get_available_channels(this_pvs[1:1 + get_max_crates(this_display)], this_display):
channel_name = get_channel_pv_name(crate, slot, channel)
if this_display.getWidget(channel_name).getChild('Include').getValue() == 1:
channel_names.append(channel_name)
# Create a PV value based on the channel names
new_pv_value = " ".join(channel_names)
this_display.getWidget('update').getPV().setValue(new_pv_value)
示例2: getWidgetPVDouble
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getDouble [as 别名]
def getWidgetPVDouble(display, widget):
"""Fetch value of a widget's PV
@param display BOY Display
@param widget Widget name
@return Value of that PV as double
"""
pv = display.getWidget(widget).getPV()
return PVUtil.getDouble(pv);
示例3: get_pvs
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getDouble [as 别名]
def get_pvs(self):
self.north = PVUtil.getDouble(pvs[0])
self.south = PVUtil.getDouble(pvs[1])
self.east = PVUtil.getDouble(pvs[2])
self.west = PVUtil.getDouble(pvs[3])
self.max_y = PVUtil.getDouble(pvs[4])
self.max_x = PVUtil.getDouble(pvs[5])
示例4: copy_pvs
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getDouble [as 别名]
def copy_pvs(this_display, this_pvs):
"""
Copies PVs
Args:
this_display: The display that has called this script. Used to control modification of global CSS variables
this_pvs: PVs passed to the script by CSS. Used to control modification of global CSS variables
List of PVs, first one is the trigger, then in pairs which copy to their partner.
E.g: ["trigger", "PVA-source", "PVA-target", "PVB-source", "PVB-target", "PVC-source", "PVC-target", ]
Returns:
None
"""
# Make sure this has been triggered, then reset the trigger
actioned = PVUtil.getDouble(this_pvs[0]) == 1
this_pvs[0].setValue(0)
if actioned:
these_pvs = iter(this_pvs)
# Skip the trigger PV
these_pvs.next()
# Iterate through PVs, copying every other PV to the next one
for value in these_pvs:
these_pvs.next().setValue(PVUtil.getDouble(value))
示例5: run
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getDouble [as 别名]
def run(self):
while display.isActive():
scan_id = long(display.getVar("LatestPointScanID"))
if scan_id > 0:
scanInfo = client.getScanInfo(scan_id)
statusLabel.setPropertyValue("text", scanInfo.getState().toString())
if scanInfo.getState().isActive():
scanNameLabel.setPropertyValue("text", scanInfo.getName())
commandLabel.setPropertyValue("text", scanInfo.getCurrentCommand())
progressBar.setPropertyValue("pv_value", scanInfo.getPercentage()/100.0)
# Mark scanned points as green
for i in range(table.getRowCount()):
xpos=float(table.getCellText(i, 1))
ypos=float(table.getCellText(i, 2))
if (xpos == PVUtil.getDouble(pvs[1]) and ypos==PVUtil.getDouble(pvs[2])
and scanInfo.getPercentage() >= i*100.0/table.getRowCount()): #To make sure the matched position is set from this scan
Display.getDefault().asyncExec(SetRowColor(i, ColorFontUtil.GREEN))
elif scanInfo.getState().isDone():
display.setVar("LatestPointScanID", -1)
else:
scanNameLabel.setPropertyValue("text", "None")
commandLabel.setPropertyValue("text", "")
progressBar.setPropertyValue("pv_value", 0)
Thread.sleep(1000)
示例6: run
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getDouble [as 别名]
def run(self):
while display.isActive():
scanInfos = client.server.getScanInfos()
findActive = False
markedDone = False
for scanInfo in scanInfos:
if scanInfo.getId() == long(display.getVar("LatestPointScanID")):
statusLabel.setPropertyValue("text", scanInfo.getState().toString())
if scanInfo.getState().isDone():
#mark table to dark gray if it is done.
if scanInfo.getId() == long(display.getVar("LatestPointScanID")) and not markedDone :
for i in range(table.getRowCount()):
Display.getDefault().asyncExec(SetRowColor(i, ColorFontUtil.DARK_GRAY))
markedDone=True
continue
if scanInfo.getState().isActive():
scanNameLabel.setPropertyValue("text", scanInfo.getName())
commandLabel.setPropertyValue("text", scanInfo.getCurrentCommand())
progressBar.setPropertyValue("pv_value", scanInfo.getPercentage()/100.0)
#Mark scanned points as green
if scanInfo.getId() == long(display.getVar("LatestPointScanID")):
markedDone=False
for i in range(table.getRowCount()):
xpos=float(table.getCellText(i, 1))
ypos=float(table.getCellText(i, 2))
if (xpos == PVUtil.getDouble(pvs[1]) and ypos==PVUtil.getDouble(pvs[2])
and scanInfo.getPercentage() >= i*100.0/table.getRowCount()): #To make sure the matched position is set from this scan
Display.getDefault().asyncExec(SetRowColor(i, ColorFontUtil.GREEN))
findActive=True
if not findActive:
scanNameLabel.setPropertyValue("text", "None")
commandLabel.setPropertyValue("text", "")
progressBar.setPropertyValue("pv_value", 0)
Thread.sleep(200)
示例7:
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getDouble [as 别名]
from org.csstudio.opibuilder.scriptUtil import PVUtil, ScriptUtil, DataUtil
from org.eclipse.ui import PlatformUI
## Get PV
error_type = PVUtil.getDouble(pvArray[0])
## Get Widgets
error_window = display.getWidget("Window")
error = error_window.getWidget("Error Type")
error_cause_1 = error_window.getWidget("Error Cause 1")
error_cause_2 = error_window.getWidget("Error Cause 2")
## Set Error Text
if error_type == 1:
error.setPropertyValue("text", "Matrix measurent request could not be processed.")
error_cause_1.setPropertyValue("text", "Automatic correction is running.")
elif error_type == 2:
error.setPropertyValue("text", "Number of samples could not be set.")
error_cause_1.setPropertyValue("text", "Value out of range. Maximun value is 100.")
elif error_type == 3:
error.setPropertyValue("text", "Orbit average could not be calculated.")
error_cause_1.setPropertyValue("text", "Orbit was not correctly read.")
elif error_type == 4:
error.setPropertyValue("text", "Matrix could not be set.")
error_cause_1.setPropertyValue("text", "Automatic correction is running.")
error_cause_2.setPropertyValue("text", "Variables are being update.")
elif error_type == 5:
error.setPropertyValue("text", "Reference orbit could not be set.")
error_cause_1.setPropertyValue("text", "Automatic correction is running.")
error_cause_2.setPropertyValue("text", "Variables are being update.")
elif error_type == 6:
示例8: int
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getDouble [as 别名]
from org.csstudio.opibuilder.scriptUtil import PVUtil, ConsoleUtil
pv = widget.getPV()
current_value = int(PVUtil.getDouble(pv))
if current_value == 0:
pv.setValue(1)
else:
pv.setValue(0)
示例9: int
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getDouble [as 别名]
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.opibuilder.scriptUtil import ConsoleUtil
from time import sleep
remote_pv = widget.getPV();
setpoint_pv = PVUtil.createPV(widget.getPropertyValue("pv_name")+":SP", widget)
current_value = int(PVUtil.getDouble(remote_pv))
for _ in range(10):
if remote_pv.isConnected() and setpoint_pv.isConnected():
setpoint_pv.setValue(1 if current_value==0 else 0)
break
else:
sleep(0.1)
else:
ConsoleUtil.writeError("Error: Unable to connect to rate PVs")
示例10:
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getDouble [as 别名]
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)
示例11:
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getDouble [as 别名]
from org.csstudio.opibuilder.scriptUtil import PVUtil
op1=PVUtil.getDouble(pvs[0])
op2=PVUtil.getDouble(pvs[1])
operator = PVUtil.getString(pvs[2])
resultPV=pvs[3]
if operator=="+":
resultPV.setValue(op1 + op2)
elif operator=="-":
resultPV.setValue(op1 - op2)
elif operator=="*":
resultPV.setValue(op1 * op2)
elif operator=="/":
resultPV.setValue(op1 / op2)
示例12:
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getDouble [as 别名]
from org.csstudio.opibuilder.scriptUtil import PVUtil
from java.lang import System
from org.eclipse.jface.dialogs import MessageDialog
ok = PVUtil.getDouble(pvs[0])
if ok ==1:
userName = System.getProperty("UserName")
password = System.getProperty("Password")
if userName=="admin" and password == "123456":
widget.setPropertyValue("visible", True)
else:
MessageDialog.openError(None, "Error",
"The user name or password is wrong!")
pvs[0].setValue(0)
示例13: str
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getDouble [as 别名]
# Used by plot in EdgeScan.opi to update local waveform PVs
# that are used to display edge markers
#
# pvs[0]: Location of edge
# pvs[1]: Height of edge
# pvs[2]: Width of edge
# pvs[3]: 'x' waveform for edge marker
# pvs[4]: 'y' waveform for edge markers
# pvs[5]: 'x' waveform for left edge marker
# pvs[6]: 'x' waveform for right edge marker
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.eclipse.jface.dialogs import MessageDialog
from jarray import array
x = PVUtil.getDouble(pvs[0])
h = PVUtil.getDouble(pvs[1])
# Show half of full-widths-half-height on each side of center
hw = PVUtil.getDouble(pvs[2]) / 2
# MessageDialog.openWarning(None, "Debug", "Set %s = %s" % (pvs[2].getName(), str(x)) )
pvs[3].setValue(array([ x, x ], 'd'))
pvs[4].setValue(array([ 0, h ], 'd'))
pvs[5].setValue(array([ x-hw, x-hw ], 'd'))
pvs[6].setValue(array([ x+hw, x+hw ], 'd'))
示例14: int
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getDouble [as 别名]
from org.csstudio.opibuilder.scriptUtil import PVUtil,WidgetUtil,ConsoleUtil
ch = int(PVUtil.getDouble(pvArray[0]))
desc = widget.getPropertyValue("tooltip")
#ConsoleUtil.writeInfo(desc)
currhv = -1
if len(desc) > 2:
ConsoleUtil.writeInfo(desc)
currhv = int(desc[desc.find("HVChan")+7:])
ConsoleUtil.writeInfo("Currhv = " + str(currhv) )
if currhv < 0:
hv="1"
else:
hv = PVUtil.getString(pvArray[1])
if (int(hv) != currhv):
widget.removeAllChildren() #clean the area first
linkingContainer = WidgetUtil.createWidgetModel("org.csstudio.opibuilder.widgets.linkingContainer")
linkingContainer.setPropertyValue("opi_file", "chan8.opi")
linkingContainer.addMacro("ID", str(ch).zfill(3))
#linkingContainer.addMacro("ID", ch)
linkingContainer.addMacro("HV", str(hv.zfill(2)))
linkingContainer.setPropertyValue("resize_behaviour", 1)
linkingContainer.setPropertyValue("border_style", 0)
widget.addChild(linkingContainer)
widget.setPropertyValue("tooltip","ChanHV " + hv)
示例15:
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getDouble [as 别名]
from org.csstudio.opibuilder.scriptUtil import PVUtil, ScriptUtil, DataUtil
from org.eclipse.ui import PlatformUI
## Set OPI File
opi_file = "error/error_window.opi"
## Open OPI
if PVUtil.getDouble(pvArray[0]) != 0:
ScriptUtil.openOPI(widget, opi_file, 2, None)