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)
Esempio n. 2
0
 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)
Esempio n. 3
0
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);
Esempio n. 4
0
 def run(self):
     i=0
     while PVUtil.getLong(pvs[2]) ==1:
         Thread.sleep(500)
         timerLabel.setPropertyValue("foreground_color", 
                     ColorFontUtil.YELLOW if i%2==0 else ColorFontUtil.RED)
         i=i+1
     timerLabel.setPropertyValue("foreground_color", ColorFontUtil.BLACK)
Esempio n. 5
0
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)
Esempio n. 6
0
def main():
    # Ampl
    if PVUtil.getLong(pvs[0]) == 1:
        graph = "TopGraph"
        # CAV Ampl
        offset1 = PVUtil.getDouble(pvs[7])
        one = PVUtil.getDouble(pvs[1])
        # FWD Ampl
        offset2 = PVUtil.getDouble(pvs[8])
        two = PVUtil.getDouble(pvs[2])
        # REV Ampl
        offset3 = PVUtil.getDouble(pvs[9])
        three = PVUtil.getDouble(pvs[3])
        
    # Phase
    if PVUtil.getLong(pvs[0]) == 2:
        graph = "BottomGraph"
        # CAV Phase offset and magnitude
        offset1 = PVUtil.getDouble(pvs[10])
        one = PVUtil.getDouble(pvs[4])
        # FWD Phase offset and magnitude
        offset2 = PVUtil.getDouble(pvs[11])
        two = PVUtil.getDouble(pvs[5])
        # REV Phase offset and magnitude
        offset3 = PVUtil.getDouble(pvs[12])
        three = PVUtil.getDouble(pvs[6])

    # Execute the commands only if the button has been pressed
    if PVUtil.getLong(pvs[0]) != 0:
        # Get the graph widget and turn off autoscale
        display.getWidget(graph).setPropertyValue("axis_1_auto_scale", "0")
        display.getWidget(graph).setPropertyValue("axis_2_auto_scale", "0")
        display.getWidget(graph).setPropertyValue("axis_3_auto_scale", "0")

        # Set the max and min values of the y-axis
        display.getWidget(graph).setPropertyValue("axis_1_maximum", one + offset1)
        display.getWidget(graph).setPropertyValue("axis_1_minimum", one - offset1)
        display.getWidget(graph).setPropertyValue("axis_2_maximum", two + offset2)
        display.getWidget(graph).setPropertyValue("axis_2_minimum", two - offset2)
        display.getWidget(graph).setPropertyValue("axis_3_maximum", three + offset3)
        display.getWidget(graph).setPropertyValue("axis_3_minimum", three - offset3)
            
        # Reset the rescale action indicator to 0
        pvs[0].setValue(0)
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)
from org.csstudio.opibuilder.scriptUtil import PVUtil

pvInt0 = PVUtil.getLong(pvs[0])
pvInt1 = PVUtil.getLong(pvs[1])

spectrumPv = pvs[0]
periodPv = pvs[1]
modePv = pvs[2]

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"
Esempio n. 9
0
# PVs:
# pvs[0] - PV to enable/disable the trace, e.g. loc://trace0(1)
# pvs[1] - PV for the index of the trace, e.g. loc://index0(0)
from org.csstudio.opibuilder.scriptUtil import PVUtil

enable = PVUtil.getLong(pvs[0]) > 0
index = PVUtil.getLong(pvs[1])

if "getDataBrowserModel" in dir(widget):
    # For BOY code that uses databrowser3
    model = widget.getDataBrowserModel()
else:
    # For BOY code that uses databrowser2
    model = widget.controller.model

traces = model.getItems()
# On first call, model may not have any traces, yet
if traces.size() > index:
    traces.get(index).setVisible(enable > 0)
Esempio n. 10
0
from org.csstudio.opibuilder.scriptUtil import PVUtil

widgetname = widget.getPropertyValue("pv_name")
nameparts = widgetname.split(":")

pvname = "CB:CB:HV:BOX:%s:%s:%s:InUse" % (nameparts[4],nameparts[5],nameparts[6])

pv = widget.getPVByName("%s" % pvname)

newpvvalue = -1

pvvalue = PVUtil.getLong(pv)

if pvvalue == 0:
    
    newpvvalue = 1
    
elif pvvalue == 1:
    
    newpvvalue = 0

pv = widget.getPVByName("%s" % pvname)

print pv

pv.setValue(newpvvalue)
Esempio n. 11
0
          ((lam * N * 1000.0)**2) / rprime_vls - c0) / (lam * 10000.0)

    E = lam1 / lam

    print "Energy : %f" % E
    print "b2Shadow : %f" % b2
    return (E, b2)


###############################################################################
#
# This section interfaces with the CSS scripting

from org.csstudio.opibuilder.scriptUtil import PVUtil, ConsoleUtil, FileUtil

# read in the N Eref m and CFF values from PVs
# calculate and set the pv representing b2Shadow
this_Cff = PVUtil.getDouble(pvs[0])
this_Eref = PVUtil.getDouble(pvs[1])
this_N = PVUtil.getDouble(pvs[2])
this_m = PVUtil.getLong(pvs[3])
calc_ok = 1
b2s = 0
try:
    b2s = calc_b2Shadow(this_N, this_Eref, this_Cff, this_m)
except Exception, e:
    print "error calculating b2Shadow :", e.message
    calc_ok = 0
pvs[4].setValue(b2s)
pvs[5].setValue(calc_ok)
Esempio n. 12
0
	def run(self):
		#this method must be called in UI thread
		intensityGraph.setROIDataBounds(name, PVUtil.getLong(roiXPV), PVUtil.getLong(roiYPV), PVUtil.getLong(roiWPV),PVUtil.getLong(roiHPV))
Esempio n. 13
0
def set_vpg(n=0):
    if n == 0:  # VPG 1
        return (2, 600, 600, 1, 86.0806992,  83.6096187)
    elif n == 1: # VPG 2
        return (3, 710, 999.755, 1, 86.0921660, 83.6122590)
    elif n == 2: # VPG 3
        return (5, 930, 2000, 1, 86.0883011, 83.6150497)
    else:
        print 'Error, grating no.s are 1-3 only'
        return (5, 930, 2000, 1, 86.0883011, 83.6150497)


###############################################################################
#
# This section interfaces with the CSS scripting

from org.csstudio.opibuilder.scriptUtil import PVUtil, ConsoleUtil, FileUtil

# read in the grating poitioner enum
# set pvs representing the parameters for the vpg
vpg_no = PVUtil.getLong(pvs[0])

Cff, Eref, N, m, grt_off, mirr_off = set_vpg(vpg_no)
print (Cff, Eref, N, m, grt_off, mirr_off)
pvs[1].setValue(Cff)
pvs[2].setValue(Eref)
pvs[3].setValue(N)
pvs[4].setValue(m)
pvs[5].setValue(grt_off)
pvs[6].setValue(mirr_off)
Esempio n. 14
0
from org.csstudio.opibuilder.scriptUtil import PVUtil, WidgetUtil, ConsoleUtil
#select next or previous sibling in nodelist

combo = display.getWidget("Node_Selector_Combo")
nodelist = combo.getPropertyValue("items")

listlen = len(nodelist)
nodefull = PVUtil.getString(pvArray[1])
inc = int(PVUtil.getLong(pvArray[0]))
index = nodelist.index(nodefull)
nodelen = len(nodefull.split("_"))

#ConsoleUtil.writeInfo(nodefull + " inc " + str(inc)+ "  index " + str(index) + " len " + str(listlen))

if not inc == 0:
    index += inc
    if (index >= 0) and (index < listlen):
        node = nodelist[index]
        if len(node.split("_")) == nodelen:
            combo.setPropertyValue("pv_value", node)
            pvArray[1].setValue(node)
            pvArray[0].setValue("0")
Esempio n. 15
0
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.opibuilder.scriptUtil import DataUtil


macroInput = DataUtil.createMacrosInput(True)

boxpv = widget.getPVByName("loc://map_box")
levelpv = widget.getPVByName("loc://map_level")
channelpv = widget.getPVByName("loc://map_channel")

boxvalue = PVUtil.getLong(boxpv)
levelvalue = PVUtil.getLong(levelpv)
channelvalue = PVUtil.getLong(channelpv)

macroInput.put("BOXNO", "%s" % boxvalue)
macroInput.put("LEVELNO", "%s" % levelvalue)
macroInput.put("CHANNELNO", "%s" % channelvalue)
macroInput.put("P", "CB:CB:HV")

print boxvalue

widgetController.setPropertyValue("macros", macroInput)

widgetController.setPropertyValue("opi_file", 
    widgetController.getPropertyValue("opi_file"), True)

Esempio n. 16
0
from org.csstudio.opibuilder.scriptUtil import PVUtil

box = 1

while box < 20:

    level = 0

    while level < 5:

        channel = 0

        while channel < 8:

            getpv = widget.getPVByName("CB:CB:HV:BOX:%s:%s:%s:WriteInUse" %
                                       (box, level, channel))
            newvalue = PVUtil.getLong(getpv)
            print newvalue
            newvalue = int(newvalue)
            setpv = widget.getPVByName("CB:CB:HV:BOX:%s:%s:%s:InUse" %
                                       (box, level, channel))
            setpv.setValue(newvalue)

            channel += 1

        level += 1

    box += 1
Esempio n. 17
0
from org.csstudio.opibuilder.scriptUtil import PVUtil,WidgetUtil,ConsoleUtil
#select next or previous sibling in nodelist

combo    = display.getWidget("Node_Selector_Combo")
nodelist = combo.getPropertyValue("items")


listlen  = len(nodelist)
nodefull = PVUtil.getString(pvArray[1])
inc      = int(PVUtil.getLong(pvArray[0]))
index    = nodelist.index(nodefull)
nodelen  = len(nodefull.split("_"))

#ConsoleUtil.writeInfo(nodefull + " inc " + str(inc)+ "  index " + str(index) + " len " + str(listlen))

if not inc == 0:
    index   += inc
    if (index >=0) and (index < listlen):
        node = nodelist[index]
        if len(node.split("_")) == nodelen:
               combo.setPropertyValue("pv_value",node )   
               pvArray[1].setValue(node)
               pvArray[0].setValue("0")

        


        
Esempio n. 18
0
#   binary.  All paths will be relative to this location.

# Originally this was a shell script, but I changed it to a Python script
#   because it made path finding much easier.  I can tell CSS BOY to
#   execute from $(user.dir), which is where css was executed

# Get the file save duration time as a variable
# This is run from ops/cavCtl/css/CSS_EPICS/
p = subprocess.Popen(["../../sdds/caget_v2", "-t", "LLRF4:FILE0:FileDurTime"], stdout=subprocess.PIPE, cwd=css_dir)
wait = p.communicate()[0]

# Add 2 seconds to the total wait time and sleep for that time
time.sleep(float(wait) + 2)

# Get the local welch values
welch1 = str(PVUtil.getLong(display.getWidget("welch1").getPV()))
welch2 = str(PVUtil.getLong(display.getWidget("welch2").getPV()))

# Get the absolute path of the plotPSD script
# This is run from the css/CSS_EPICS directory
plotpath = os.path.normpath(os.path.join(css_dir, "../../sdds/plotPSD"))

# Get the data file path as a string
p = subprocess.Popen(
    ["../../sdds/caget_v2", "-St", "LLRF4:FILE0:FullFileName_RBV"], stdout=subprocess.PIPE, cwd=css_dir
)
filepath = p.communicate()[0]  # Get the output of the above command
# If this PV is given a relative path, then the IOC treats it relative to the
#    location where the IOC was started.  I can't get this info, so I can't
#    handle relative paths.  Only absolute paths work
# filepath = os.path.abspath(filepath)
Esempio n. 19
0
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.opibuilder.scriptUtil import DataUtil


macroInput = DataUtil.createMacrosInput(True)

elementpv = widget.getPVByName("loc://map_element")

elementvalue = PVUtil.getLong(elementpv)

macroInput.put("ELEMENTNO", "%s" % elementvalue)
macroInput.put("P", "CB:CB:HV")

widgetController.setPropertyValue("macros", macroInput)

widgetController.setPropertyValue("opi_file", 
    widgetController.getPropertyValue("opi_file"), True)

Esempio n. 20
0
#5 local_NBINSX
#6 $(P)_DATA.NELM
#7 $(P)_XTITLE
#8 local_XTITLE
#9 $(P)_YTITLE
#10 local_YTITLE
#11 local TRACETYPE

init = widget.getPropertyValue("border_width")  #misuse this as an init flag

if init == 0:  #if not already initialised
    xmin = PVUtil.getDouble(pvArray[0])  #get all the PVs
    lxmin = PVUtil.getDouble(pvArray[1])
    xmax = PVUtil.getDouble(pvArray[2])
    lxmax = PVUtil.getDouble(pvArray[3])
    nbinsx = PVUtil.getLong(pvArray[4])
    lnbinsx = PVUtil.getLong(pvArray[5])
    nelm = PVUtil.getLong(pvArray[6])
    xt = PVUtil.getStringArray(pvArray[7])
    lxt = PVUtil.getString(pvArray[8])
    yt = PVUtil.getStringArray(pvArray[9])
    lyt = PVUtil.getString(pvArray[10])
    trace = PVUtil.getLong(pvArray[11])

    xt = list(map(int, xt))  #convert the waveforms into strings - ugly!
    xtstr = "".join([chr(c) for c in xt])
    yt = list(map(int, yt))
    ytstr = "".join([chr(c) for c in yt])

    #in all cases we let the local PVs (from MACROS) override those from the ioc,
Esempio n. 21
0
            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)

if PVUtil.getLong(pvs[0])==1:
	thread =Thread(Timer());
	thread.start()
Esempio n. 22
0
 def run(self):
     #this method must be called in UI thread
     intensityGraph.setROIDataBounds(name, PVUtil.getLong(roiXPV),
                                     PVUtil.getLong(roiYPV),
                                     PVUtil.getLong(roiWPV),
                                     PVUtil.getLong(roiHPV))
Esempio n. 23
0
        f= open(file, "w")        
        
        box = 1        
        
        while box < 20:
            
            level = 0
            
            while level < 5:
                
                channel = 0
                
                while channel < 8:
                    
                    voltage_pv = widget.getPVByName("CB:CB:HV:BOX:%s:%s:%s:LatestSetVolt" % (box, level, channel))
                    voltage = PVUtil.getLong(voltage_pv)
                    f.write("%s %s %s %s\n" % (box, level, channel, voltage))
                    
                    channel+=1
                    
                level+=1
                
            box+=1
            
        f.close()
        
        filename_pv.setValue("")
        filepath_pv.setValue("")
        
if save_load_option == "Save channel usage configuration":
    
Esempio n. 24
0
from org.csstudio.opibuilder.scriptUtil import PVUtil,WidgetUtil,ConsoleUtil
import nodeLoader
from java.util import Arrays

#This is the code to update the list of items in combo widget to chose a node
#in the CLAS EPICS tree. 
#It is triggered by selection of a new node using the local PV loc://$(DID)_NODE
#It makes the item list of all the ancestors, the node, and the subnodes

nodeLoader.readTree()                        #make sure the node tree is made

nodefull = PVUtil.getString(pvArray[0])      #Full name of the node Eg. B_SYS_HV_ECAL_SEC1
nodetot  = PVUtil.getLong(pvArray[1])        #Total no of nodes clicked on
topnode  = widget.getMacroValue("TOP")       #Name of the top node  Eg. B_SYS_HV
ntop     = len(topnode.split("_"))           #Work out the no of levels in the top node (eg. 3 here)

if nodefull.find(topnode) < 0:               #if topnode not in fullnode
    nodefull=topnode                         #set to topnode

nlist    = nodefull.split("_")               #Split the full nodename into a list
node     = topnode                           #Start off the node that this combo will display
       
itemlist = []                                #start off the itemlist

if nodefull == topnode:
    parent = topnode
    itemlist.append(topnode)                    #Append to the item list
else:
    for t in range(ntop,len(nlist)):             #Construct it's node name
        itemlist.append(node)                    #Append to the item list
        parent = node
Esempio n. 25
0
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.opibuilder.scriptUtil import DataUtil


macroInput = DataUtil.createMacrosInput(True)

boxpv = widget.getPVByName("loc://monitor_box")

boxnumber = PVUtil.getLong(boxpv)

macroInput.put("BOXNO", "%s" % boxnumber)
macroInput.put("BOX", "BOX:%s" % boxnumber)
macroInput.put("P", "CB:CB:HV")

widgetController.setPropertyValue("macros", macroInput)

widgetController.setPropertyValue("opi_file", 
    widgetController.getPropertyValue("opi_file"), True)

Esempio n. 26
0
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.opibuilder.scriptUtil import DataUtil

macroInput = DataUtil.createMacrosInput(True)

boxpv = display.getWidget("monitor_box_container").getPVByName(
    "loc://monitor_box")
channelpv = widget.getPVByName("loc://monitor_channel(\"\")")

boxnumber = PVUtil.getLong(boxpv)
channel = PVUtil.getString(channelpv)

#macroInput.put("BOXNO", "%s" % boxnumber)
macroInput.put("BOX", "BOX:%s" % boxnumber)
macroInput.put("CHANNEL", "%s" % channel)
#macroInput.put("P", "CB:CB:HV")

widgetController.setPropertyValue("macros", macroInput)

widgetController.setPropertyValue(
    "opi_file", widgetController.getPropertyValue("opi_file"), True)
#!/bin/python

# Description: Automatically turn on or off the frequency offset
#    based on the frequency offset value

from org.csstudio.opibuilder.scriptUtil import PVUtil

# pvs[0] = $(TS)$(LLRF):DRV0:sel2_phstep_ao
# pvs[1] = $(TS)$(LLRF):DRV0:sel2_dds_bo

# Get the scalar value
val = PVUtil.getLong(pvs[0])

# Set the boolean value based on this:
if val != 0:
    pvs[1].setValue(1)  # Turn it on
elif val == 0:
    pvs[1].setValue(0)  # Turn it off
Esempio n. 28
0
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.opibuilder.scriptUtil import DataUtil


macroInput = DataUtil.createMacrosInput(True)

pvvalue = widget.getPVByName("loc://channel_in_use")


boxnumber = PVUtil.getLong(pvvalue)

macroInput.put("BOXNO", "%s" % boxnumber)
macroInput.put("BOX", "BOX:%s" % boxnumber)
macroInput.put("P", "CB:CB:HV")

widgetController.setPropertyValue("macros", macroInput)

widgetController.setPropertyValue("opi_file", 
    widgetController.getPropertyValue("opi_file"), True)

from org.csstudio.opibuilder.scriptUtil import PVUtil

box = 1

while box < 20:
    
    level = 0
    
    while level < 5:
        
        channel = 0
    
        while channel < 8:          

            getpv = widget.getPVByName("CB:CB:HV:BOX:%s:%s:%s:WriteInUse" % (box, level, channel))
            newvalue = PVUtil.getLong(getpv)
            print newvalue
            newvalue = int(newvalue)
            setpv = widget.getPVByName("CB:CB:HV:BOX:%s:%s:%s:InUse" % (box, level, channel))
            setpv.setValue(newvalue)
            
            channel+=1
            
        level+=1
        
    box+=1
            
            

Esempio n. 30
0
from org.csstudio.opibuilder.scriptUtil import PVUtil, WidgetUtil, ConsoleUtil
import nodeLoader
from java.util import Arrays

#This is the code to update the list of items in combo widget to chose a node
#in the CLAS EPICS tree.
#It is triggered by selection of a new node using the local PV loc://$(DID)_NODE
#It makes the item list of all the ancestors, the node, and the subnodes

nodeLoader.readTree()  #make sure the node tree is made

nodefull = PVUtil.getString(
    pvArray[0])  #Full name of the node Eg. B_SYS_HV_ECAL_SEC1
nodetot = PVUtil.getLong(pvArray[1])  #Total no of nodes clicked on
topnode = widget.getMacroValue("TOP")  #Name of the top node  Eg. B_SYS_HV
ntop = len(topnode.split(
    "_"))  #Work out the no of levels in the top node (eg. 3 here)

if nodefull.find(topnode) < 0:  #if topnode not in fullnode
    nodefull = topnode  #set to topnode

nlist = nodefull.split("_")  #Split the full nodename into a list
node = topnode  #Start off the node that this combo will display

itemlist = []  #start off the itemlist

if nodefull == topnode:
    parent = topnode
    itemlist.append(topnode)  #Append to the item list
else:
    for t in range(ntop, len(nlist)):  #Construct it's node name
Esempio n. 31
0
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.opibuilder.scriptUtil import DataUtil

macroInput = DataUtil.createMacrosInput(True)

pvvalue = widget.getPVByName("loc://channel_in_use")

boxnumber = PVUtil.getLong(pvvalue)

macroInput.put("BOXNO", "%s" % boxnumber)
macroInput.put("BOX", "BOX:%s" % boxnumber)
macroInput.put("P", "CB:CB:HV")

widgetController.setPropertyValue("macros", macroInput)

widgetController.setPropertyValue(
    "opi_file", widgetController.getPropertyValue("opi_file"), True)
Esempio n. 32
0
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.opibuilder.scriptUtil import DataUtil

macroInput = DataUtil.createMacrosInput(True)

elementpv = widget.getPVByName("loc://map_element")

elementvalue = PVUtil.getLong(elementpv)

macroInput.put("ELEMENTNO", "%s" % elementvalue)
macroInput.put("P", "CB:CB:HV")

widgetController.setPropertyValue("macros", macroInput)

widgetController.setPropertyValue(
    "opi_file", widgetController.getPropertyValue("opi_file"), True)