예제 #1
0
def add_line(table, line_opi, power_supply):
    linkingContainer = WidgetUtil.createWidgetModel("org.csstudio.opibuilder.widgets.linkingContainer")   
    linkingContainer.setPropertyValue("opi_file", line_opi)
    linkingContainer.setPropertyValue("resize_behaviour", 1)
    linkingContainer.setPropertyValue("border_style", 0)
    table.addChildToBottom(linkingContainer)
    
    children = linkingContainer.getChildren()
    for w in children:
        if w.getPropertyValue("widget_type") == "Action Button":
            button = w
        elif w.getPropertyValue("widget_type") == "Spinner":
            spinner = w
        elif w.getPropertyValue("widget_type") == "Text Update":
            text_update = w
        elif w.getPropertyValue("widget_type") == "Grouping Container":
            container = w
            led = container.getChildren()[0]  
        

    
    setpoint = subsystem + power_supply.upper() + '-SP'
    readback = subsystem + power_supply.upper() + '-RB'
    
    button.setPropertyValue("text", power_supply.replace("-FAM", ""))
    spinner.setPropertyValue("pv_name", setpoint)
    text_update.setPropertyValue("pv_name", readback)
    led.setPropertyValue("pv_name", '$(power_supply_status)')
    
    macro_inputs = DataUtil.createMacrosInput(True)
    macro_inputs.put("power_supply", power_supply)
    macro_inputs.put("power_supply_sp", setpoint)
    macro_inputs.put("power_supply_rb", readback)
    macro_inputs.put("power_supply_start", 'sim://const("sextupole")')
    linkingContainer.setPropertyValue("macros", macro_inputs)
예제 #2
0
def _add_line(table, line_opi, device):
    linkingContainer = WidgetUtil.createWidgetModel("org.csstudio.opibuilder.widgets.linkingContainer")
    linkingContainer.setPropertyValue("opi_file", line_opi)
    linkingContainer.setPropertyValue("resize_behaviour", 1)
    linkingContainer.setPropertyValue("border_style", 0)
    table.addChildToBottom(linkingContainer)
    children = linkingContainer.getChildren()

    for w in children:
        if w.getPropertyValue("widget_type") == "Grouping Container":
            container = w
            button = container.getChildren()[0]
            led = container.getChildren()[1]

    setpoint = prefix + device.upper() + sufix
    readback = prefix + device.upper() + '-RB'

    button.setPropertyValue("pv_name", setpoint)
    led.setPropertyValue("pv_name", readback)

    macro_inputs = DataUtil.createMacrosInput(True)
    macro_inputs.put("device", device)
    macro_inputs.put("power_supply_sp", setpoint)
    macro_inputs.put("power_supply_rb", readback)
    linkingContainer.setPropertyValue("macros", macro_inputs)
예제 #3
0
def default_node(node,depth,mode='elem',result=None):

    global doElems
    
    if mode == 'init':                                        #if start of node
        index=int(nodeLoader.NodeIndex[node])                   #Get index from dict
        if verbose > 0:                                                 #if verbose
            erange=nodeLoader.ElementRange[index].replace("\'","").split(",")
            if len(erange)>1:
                ConsoleUtil.writeInfo( '  '*depth+"#Node:"+node+"      Erange:  "+erange[0]+" - "+erange[1])      #print the indented node name
        
        if verbose > 1:                                             #if very verbose mode, print record details if any.
            nrnames=nodeLoader.NodeRecordNames[index].split(",")
            nrtypes=nodeLoader.NodeRecordTypes[index].split(",")
            for i in range(len(nrtypes)):
                if nrtypes[i] != "":
                    ConsoleUtil.writeInfo( '  '*depth+"  #NodeRecordName: "+repr(nrnames[i]).ljust(20)+ "#NodeRecordType: "+repr(nrtypes[i]))
            ernames=nodeLoader.ElementRecordNames[index].replace("\'","").split(",")
            ertypes=nodeLoader.ElementRecordTypes[index].replace("\'","").split(",")
            erflags=nodeLoader.ElementRecordFlags[index].replace("\'","").split(",")
            for i in range(len(ertypes)):
                if ertypes[i] != "":
                    ConsoleUtil.writeInfo( '  '*depth+"  #ElementRecordName: "+repr(ernames[i]).ljust(10)+ "#ElementRecordType: "+repr(ertypes[i])+ "  #ElementRecordFlag: "+repr(erflags[i]))

        if len(nodeLoader.ElementNames[index]) >2:
            linkingContainer = WidgetUtil.createWidgetModel("org.csstudio.opibuilder.widgets.linkingContainer") 
            linkingContainer.setPropertyValue("opi_file", opi_node_info)
            linkingContainer.addMacro("P", node)
            linkingContainer.setPropertyValue("resize_behaviour", 1)
            linkingContainer.setPropertyValue("border_style", 0)
            linkingContainer.setPropertyValue("background_color", "OPI_Background")
            widget.addChildToBottom(linkingContainer)

                    
    #elif mode == 'elem':
        #if verbose>0:
        #    ConsoleUtil.writeInfo( '  '*depth+"  #Element: "+node) #print the indented elment name
        #    #return None
        #esel=node.split("_")[len(node.split("_"))-1]
        #linkingContainer = WidgetUtil.createWidgetModel("org.csstudio.opibuilder.widgets.linkingContainer") 
        #linkingContainer.setPropertyValue("opi_file", opi_element)
        #linkingContainer.addMacro("P", node)
        #linkingContainer.addMacro("S", esel)
        #linkingContainer.addMacro("C", str(eCount))
        #linkingContainer.setPropertyValue("resize_behaviour", 1)
        #linkingContainer.setPropertyValue("border_style", 0)
        #widget.addChildToBottom(linkingContainer)
        #ConsoleUtil.writeInfo( '  '*depth+"  #Element: "+node+"   sel: "+esel) #print the indented elment name
            
        
    elif mode == 'end':
        if verbose:
            ConsoleUtil.writeInfo( '  '*depth+"#NodeEnd: "+node)
        
    else:
        return None
예제 #4
0
def generateRow(ichan,pv):
  lc = WidgetUtil.createWidgetModel('org.csstudio.opibuilder.widgets.linkingContainer')
  if NOVICE>0: lc.setPropertyValue('opi_file','/CLAS12_Share/apps/caenHvApp/caenhv_channel_novice.opi')
  else:        lc.setPropertyValue('opi_file','/CLAS12_Share/apps/caenHvApp/caenhv_channel.opi')
  #try   { lc.setPropertyValue('resize_behaviour',1) }
  #catch (err) { lc.setPropertyValue('auto_size',true) }
  #    lc.setPropertyValue('resize_behavior',2)
  lc.setPropertyValue('auto_size',True)
  lc.setPropertyValue('zoom_to_fit',False)
  lc.setPropertyValue('border_style',0)
  lc.setPropertyValue('background_color','Header_Background')
  lc.addMacro('C',str(ichan))
  lc.addMacro('P',str(pv))
  widget.addChildToBottom(lc)
예제 #5
0
def add_line(table, line_opi, device):
    linkingContainer = WidgetUtil.createWidgetModel("org.csstudio.opibuilder.widgets.linkingContainer")
    linkingContainer.setPropertyValue("opi_file", line_opi)
    linkingContainer.setPropertyValue("resize_behaviour", 1)
    linkingContainer.setPropertyValue("border_style", 0)
    table.addChildToBottom(linkingContainer)
    children = linkingContainer.getChildren()

    for w in children:
        if w.getPropertyValue("widget_type") == "Boolean Button":
            button = w

    device_pv = prefix + device.upper() + sufix

    button.setPropertyValue("pv_name", device_pv)
예제 #6
0
def _add_line(table, line_opi, device):
    linkingContainer = WidgetUtil.createWidgetModel("org.csstudio.opibuilder.widgets.linkingContainer")
    linkingContainer.setPropertyValue("opi_file", line_opi)
    linkingContainer.setPropertyValue("resize_behaviour", 1)
    linkingContainer.setPropertyValue("border_style", 0)
    table.addChildToBottom(linkingContainer)
    children = linkingContainer.getChildren()

    for w in children:
        if w.getPropertyValue("widget_type") == "Grouping Container":
            container = w
            button = container.getChildren()[0]
            led = container.getChildren()[1]

    corrector = device.upper()
    readback = prefix + device.upper() + rb_sufix

    button.setPropertyValue("name", corrector)
    led.setPropertyValue("pv_name", readback)
예제 #7
0
def generateRow(ichan, pv):
    lc = WidgetUtil.createWidgetModel(
        'org.csstudio.opibuilder.widgets.linkingContainer')
    if NOVICE > 0:
        lc.setPropertyValue(
            'opi_file',
            '/CLAS12_Share/apps/caenHvApp/caenhv_channel_novice.opi')
    else:
        lc.setPropertyValue('opi_file',
                            '/CLAS12_Share/apps/caenHvApp/caenhv_channel.opi')
    #try   { lc.setPropertyValue('resize_behaviour',1) }
    #catch (err) { lc.setPropertyValue('auto_size',true) }
    #    lc.setPropertyValue('resize_behavior',2)
    lc.setPropertyValue('auto_size', True)
    lc.setPropertyValue('zoom_to_fit', False)
    lc.setPropertyValue('border_style', 0)
    lc.setPropertyValue('background_color', 'Header_Background')
    lc.addMacro('C', str(ichan))
    lc.addMacro('P', str(pv))
    widget.addChildToBottom(lc)
예제 #8
0
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)
예제 #9
0
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)
예제 #10
0
from org.csstudio.opibuilder.scriptUtil import PVUtil, WidgetUtil

if widget.getVar('FirstTime') == None:
    widget.setVar('FirstTime', True)
else:
    selection_type = PVUtil.getString(pvs[0])
    #opi_name = "%s.opi"%selection_type
    opi_name = "selection.opi"
    widget.removeAllChildren()
    linkingContainer = WidgetUtil.createWidgetModel("org.csstudio.opibuilder.widgets.linkingContainer")
    linkingContainer.setPropertyValue("name", "linking_container")   
    linkingContainer.setPropertyValue("opi_file", opi_name)
    linkingContainer.setPropertyValue("resize_behaviour", 1)
    linkingContainer.setPropertyValue("border_style", 5)
    widget.addChildToBottom(linkingContainer)
    widget.performAutosize()
예제 #11
0
def default_node(node, depth, mode='elem', result=None):

    global doElems

    if mode == 'init':  #if start of node
        index = int(nodeLoader.NodeIndex[node])  #Get index from dict
        if verbose > 0:  #if verbose
            erange = nodeLoader.ElementRange[index].replace("\'",
                                                            "").split(",")
            if len(erange) > 1:
                ConsoleUtil.writeInfo('  ' * depth + "#Node:" + node +
                                      "      Erange:  " + erange[0] + " - " +
                                      erange[1])  #print the indented node name

        if verbose > 1:  #if very verbose mode, print record details if any.
            nrnames = nodeLoader.NodeRecordNames[index].split(",")
            nrtypes = nodeLoader.NodeRecordTypes[index].split(",")
            for i in range(len(nrtypes)):
                if nrtypes[i] != "":
                    ConsoleUtil.writeInfo('  ' * depth +
                                          "  #NodeRecordName: " +
                                          repr(nrnames[i]).ljust(20) +
                                          "#NodeRecordType: " +
                                          repr(nrtypes[i]))
            ernames = nodeLoader.ElementRecordNames[index].replace(
                "\'", "").split(",")
            ertypes = nodeLoader.ElementRecordTypes[index].replace(
                "\'", "").split(",")
            erflags = nodeLoader.ElementRecordFlags[index].replace(
                "\'", "").split(",")
            for i in range(len(ertypes)):
                if ertypes[i] != "":
                    ConsoleUtil.writeInfo('  ' * depth +
                                          "  #ElementRecordName: " +
                                          repr(ernames[i]).ljust(10) +
                                          "#ElementRecordType: " +
                                          repr(ertypes[i]) +
                                          "  #ElementRecordFlag: " +
                                          repr(erflags[i]))

        if len(nodeLoader.ElementNames[index]) > 2:
            linkingContainer = WidgetUtil.createWidgetModel(
                "org.csstudio.opibuilder.widgets.linkingContainer")
            linkingContainer.setPropertyValue("opi_file", opi_node_info)
            linkingContainer.addMacro("P", node)
            linkingContainer.setPropertyValue("resize_behaviour", 1)
            linkingContainer.setPropertyValue("border_style", 0)
            linkingContainer.setPropertyValue("background_color",
                                              "OPI_Background")
            widget.addChildToBottom(linkingContainer)

    #elif mode == 'elem':
    #if verbose>0:
    #    ConsoleUtil.writeInfo( '  '*depth+"  #Element: "+node) #print the indented elment name
    #    #return None
    #esel=node.split("_")[len(node.split("_"))-1]
    #linkingContainer = WidgetUtil.createWidgetModel("org.csstudio.opibuilder.widgets.linkingContainer")
    #linkingContainer.setPropertyValue("opi_file", opi_element)
    #linkingContainer.addMacro("P", node)
    #linkingContainer.addMacro("S", esel)
    #linkingContainer.addMacro("C", str(eCount))
    #linkingContainer.setPropertyValue("resize_behaviour", 1)
    #linkingContainer.setPropertyValue("border_style", 0)
    #widget.addChildToBottom(linkingContainer)
    #ConsoleUtil.writeInfo( '  '*depth+"  #Element: "+node+"   sel: "+esel) #print the indented elment name

    elif mode == 'end':
        if verbose:
            ConsoleUtil.writeInfo('  ' * depth + "#NodeEnd: " + node)

    else:
        return None