def prepare_tabledata(self):
        if self.s == None:
            self.tableData = [['', '', '', '', False]]
        else:
            self.tableData = []
            for l in self.s:
                idstr = l[0]
                pvname = l[1]
                # read PV value
                curval = "---"
                restore_flag = l[2]
                try:
                    ipv = PVUtil.createPV(pvname, self.widget)
                    curval = PVUtil.getString(ipv)
                except:
                    restore_flag = False
                if self.savemode:
                    self.tableData.append(
                        [pvname, idstr, curval, restore_flag])
                else:
                    self.tableData.append(
                        [pvname, idstr, curval, '---', restore_flag])

        if self.savemode:
            self.colNames = TABLE_HEADER_SAVEMODE
        else:
            self.colNames = TABLE_HEADER_LOADMODE

        self.dataModel = MyTableModel(self.tableData,
                                      self.colNames,
                                      savemode=self.savemode)
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
     
     if element == -1 and voltage != 0:
         
         message.setPropertyValue("text", "Choose an element.")
                   
     elif voltage == 0 and element != -1:
         
         message.setPropertyValue("text", "Choose a voltage value.") 
         
     elif voltage == 0 and element == -1:
         
         message.setPropertyValue("text", "Choose a voltage value and an element.")
         
     else:
         
         PVUtil.createPV("CB:HV:ELEMENT:%s:set_volt" % (element), widget).setValue(voltage)
                 
 ######################## Element -> File ###########################
 
 if radio_target == "Element" and radio_source == "File":
 
     if element == -1 and filepath != "":
     
         message.setPropertyValue("text", "Choose an element.")
               
     elif filepath == "" and element != -1:
     
         message.setPropertyValue("text", "Choose a filepath.") 
     
     elif filepath == "" and element == -1:
     
Ejemplo n.º 4
0
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.opibuilder.scriptUtil import WidgetUtil
from org.csstudio.opibuilder.scriptUtil import DataUtil
from org.csstudio.opibuilder.scriptUtil import ConsoleUtil

pv_rbv_name = widget.getPropertyValue("pv_name") + "_RBV"
pv_rbv = PVUtil.createPV(pv_rbv_name, widget)

while (True):
    if (pv_rbv.isConnected()):
        pv_rbv_val = PVUtil.getDouble(pv_rbv)
        pv_setter = widget.getPV()
        pv_setter.setValue(pv_rbv_val)
        break
Ejemplo n.º 5
0
from org.csstudio.opibuilder.scriptUtil import ConsoleUtil
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.simplepv import IPVListener


class MyPVListener(IPVListener.Stub):
    def valueChanged(self, pv):
        if pv.getValue().getValue():
            widget.setPropertyValue("visible", True)
        else:
            widget.setPropertyValue("visible", False)


# Set widget invisible so that it will not show up if we fail to connect.
widget.setPropertyValue("visible", False)

# Read script 'arguments' from local String PV.
pv_string = PVUtil.getString(pvs[0])
pv = PVUtil.createPV(pv_string, widget)
pv.addListener(MyPVListener())
Ejemplo n.º 6
0
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")