当前位置: 首页>>代码示例>>Python>>正文


Python scriptUtil.PVUtil类代码示例

本文整理汇总了Python中org.csstudio.opibuilder.scriptUtil.PVUtil的典型用法代码示例。如果您正苦于以下问题:Python PVUtil类的具体用法?Python PVUtil怎么用?Python PVUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PVUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

def main():

    if spectrumPv.isConnected():
        spectrum = PVUtil.getLong(spectrumPv)
        if spectrum is None:
            spectrum = 1
    else:
        spectrum = 1

    if periodPv.isConnected():
        period = PVUtil.getLong(periodPv)
        if period is None:
            period = 1
    else:
        period = 1

    if modePv.isConnected() and PVUtil.getString(modePv).lower() == "counts":
        mode = "YC"
        axis_title = "Counts"
    else:
        mode = "Y"
        axis_title = "Counts/us"
        
    widget.setPropertyValue("trace_0_x_pv","$(P)DAE:SPEC:" + str(period) + ":" + str(spectrum) + ":X")
    widget.setPropertyValue("trace_0_y_pv","$(P)DAE:SPEC:" + str(period) + ":" + str(spectrum) + ":" + mode)
    widget.setPropertyValue("axis_1_axis_title", axis_title)
开发者ID:ISISComputingGroup,项目名称:ibex_gui,代码行数:26,代码来源:spectra_plots_script.py

示例2: get_motor_pvs

def get_motor_pvs():
    """
    Get the PVs containing the names of the motors associated with the specified soft motors
    """
    motor_pvs = []
    
    for name in [PVUtil.getString(pv) for pv in pvs[1:]]:  # pvs[0] is for the number of motors
    
        if is_unexpanded_macro(name) or len(name) == 0:
            motor_pvs.append(None)            
        else:                
            # Associate all PVs with the top-level display for ease. Shouldn't be any conflict
            motor_pvs.append(PVUtil.createPV(display.getMacroValue("P") + name + ":MOTOR", display))
            
    return motor_pvs
开发者ID:ISISComputingGroup,项目名称:ibex_gui,代码行数:15,代码来源:setMotorMacros.py

示例3: update_channels

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)
开发者ID:ISISComputingGroup,项目名称:ibex_gui,代码行数:25,代码来源:UpdateChannels.py

示例4: getWidgetPVDouble

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);
开发者ID:ATNF,项目名称:cs-studio,代码行数:8,代码来源:scan_ui.py

示例5: run

 def run(self):        
     startButton.setEnabled(False)
     stopButton.setEnabled(True)
     resetButton.setEnabled(False)
     bar.setVisible(True)
     hourText.setEnabled(False)
     minText.setEnabled(False)
     secText.setEnabled(False)
     hour = PVUtil.getLong(hourPV)
     min = PVUtil.getLong(minPV)
     sec = PVUtil.getLong(secPV)
     #remember the values to be reset
     resetButton.setVar("hour", hour)
     resetButton.setVar("min",min)
     resetButton.setVar("sec",sec)
     timerLabel.setPropertyValue("foreground_color", ColorFontUtil.BLACK)
     timerLabel.setPropertyValue("text", "Time Left:")
     stopped=False
     total = hour*3600+min*60+sec
     for i in range(total,-1,-1):
         if not display.isActive():
             return
         if PVUtil.getLong(pvs[0])==0:
             stopped = True
             break            
         pvs[1].setValue(100-100*i/total)
         hourPV.setValue(int(i/3600))
         minPV.setValue(int(i%3600/60))
         secPV.setValue(int(i%60))            
         Thread.sleep(1000)
         
     timerLabel.setPropertyValue("foreground_color", ColorFontUtil.RED)
     if stopped:
         timerLabel.setPropertyValue("text", "Interrupted!")
     else:
         timerLabel.setPropertyValue("text", "Time's Up!!!")
         widget.executeAction(0)
         pvs[2].setValue(1)
         Thread(Blink()).start()
     startButton.setEnabled(True)
     stopButton.setEnabled(False)
     resetButton.setEnabled(True)
     bar.setVisible(False)
     hourText.setEnabled(True)
     minText.setEnabled(True)
     secText.setEnabled(True)
开发者ID:ATNF,项目名称:cs-studio,代码行数:46,代码来源:Timer.py

示例6: getWidgetPVString

def getWidgetPVString(display, widget):
    """Fetch value of a widget's PV
       @param display BOY Display
       @param widget Widget name
       @return Value of that PV as string
    """
    pv = display.getWidget(widget).getPV()
    return str(PVUtil.getString(pv))
开发者ID:ATNF,项目名称:cs-studio,代码行数:8,代码来源:scan_ui.py

示例7: getWidgetPVLong

def getWidgetPVLong(display, widget):
    """Fetch value of a widget's PV
       @param display BOY Display
       @param widget Widget name
       @return Value of that PV as long
    """
    pv = display.getWidget(widget).getPV()
    return PVUtil.getLong(pv);
开发者ID:ATNF,项目名称:cs-studio,代码行数:8,代码来源:scan_ui.py

示例8: get_pv_value

def get_pv_value(pv, max_wait=1.0):
    """
    Gets the value of a PV as a string. Returns None if no value available
    """
    steps = 100
    for i in range(steps):
        try:
            return PVUtil.getString(pv)
        except:
            sleep(max_wait/steps)
    return None
开发者ID:ISISComputingGroup,项目名称:ibex_gui,代码行数:11,代码来源:setMotorMacros.py

示例9: main

def main():
	# Get current PV value
	curr = PVUtil.getLong(get_pv)
	# If currently 0, then set to 1
	if curr == 0:
		print "Setting to 1"
		set_pv.setValue(1)
	# If currently 1, then set to 0
	if curr == 1:
		print "Setting to 0"
		set_pv.setValue(0)
开发者ID:xanderdunn,项目名称:argonne-atlas-boy-opi,代码行数:11,代码来源:save_toggle.py

示例10: get_pvs

    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])
开发者ID:ISISComputingGroup,项目名称:ibex_gui,代码行数:8,代码来源:blades_script.py

示例11: run

 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)
开发者ID:Desy-extern,项目名称:cs-studio,代码行数:36,代码来源:3_TableScan_UpdateCurrentScanInfo.py

示例12: run

 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)
开发者ID:ATNF,项目名称:cs-studio,代码行数:24,代码来源:3_TableScan_UpdateCurrentScanInfo.py

示例13: copy_pvs

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))
开发者ID:ISISComputingGroup,项目名称:ibex_gui,代码行数:24,代码来源:CopyPVs.py

示例14:

from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.eclipse.jface.dialogs import MessageDialog

#filePath = display.getWidget("Text Input").getValue()

#MessageDialog.openInformation(
#            None, "Dialog from Hdf5 Script", "HDF5File says: The File is " + filePath);
##############################################################3





fileName = display.getWidget("Text Input").getValue()


PVUtil.writePV("vs://CODES/test/input",fileName)
PVUtil.writePV("vs://CODES/test/inputtrg",1)








MessageDialog.openInformation(
            None, "Dialog from Hdf5 Script", "HDF5File says: The File is " + fileName);
开发者ID:housoso,项目名称:hdf5Utest,代码行数:28,代码来源:loadtxt.py

示例15: add_header

from org.csstudio.opibuilder.scriptUtil import PVUtil, WidgetUtil, DataUtil

def add_header(table, header_opi):
    linkingContainer = WidgetUtil.createWidgetModel("org.csstudio.opibuilder.widgets.linkingContainer")
    linkingContainer.setPropertyValue("opi_file", header_opi)
    linkingContainer.setPropertyValue("resize_behaviour", 1)
    linkingContainer.setPropertyValue("border_style", 0)
    table.addChildToBottom(linkingContainer)

device_type = PVUtil.getString(pvs[0]).lower()
if device_type == 'bpm':
    left_header_opi = "table/selection_table_bpm.opi"
elif device_type == 'ch':
    left_header_opi = "table/selection_table_ch.opi"
elif device_type == 'cv':
    left_header_opi = "table/selection_table_cv.opi"
up_header_opi = "table/selection_table_up_header.opi"
low_header_opi = "table/selection_table_low_header.opi"

table_container = display.getWidget("table_container")

if device_type is None:
    table_container.setPropertyValue("visible", False)

else:
    add_header(table_container, up_header_opi)
    add_header(table_container, left_header_opi)
    add_header(table_container, low_header_opi)
开发者ID:lnls-fac,项目名称:hla,代码行数:28,代码来源:write_selection_header.py


注:本文中的org.csstudio.opibuilder.scriptUtil.PVUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。