Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 386 lines (340 sloc) 11.8 KB
<?xml version="1.0" encoding="UTF-8"?>
<display version="2.0.0">
<name>ramps</name>
<macros>
<P>CRYVISIL</P>
<R>TC09</R>
</macros>
<width>750</width>
<height>400</height>
<scripts>
<script file="EmbeddedPy">
<text><![CDATA[# Embedded python script
from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil
print 'Hello'
# widget.setPropertyValue('text', PVUtil.getString(pvs[0]))
ramp_nr = PVUtil.createPV("loc://ramp_nr",10)
ramp_nr = PVUtil.getLong(ramp_nr)
]]></text>
<pv_name>loc://selection</pv_name>
</script>
</scripts>
<widget type="rectangle" version="2.0.0">
<name>Rectangle</name>
<x>430</x>
<y>60</y>
<width>230</width>
<height>210</height>
<line_width>0</line_width>
<background_color>
<color red="80" green="174" blue="255">
</color>
</background_color>
</widget>
<widget type="action_button" version="3.0.0">
<name>Action Button</name>
<actions execute_as_one="true">
<action type="execute">
<script file="EmbeddedPy">
<text><![CDATA[# Embedded python script
from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil
print 'append new button'
# widget.setPropertyValue('text', PVUtil.getString(pvs[0]))
profilePV = PVUtil.createPV("CRYVISIL:TC09:PROFILES",50)
# get the whole profile, extract selected ramp via selection number
ramp_array = PVUtil.getString(profilePV).split(";")
if len(ramp_array) == 1 and ramp_array[0] == "":
ramp_size = 0
else:
ramp_size = len(ramp_array)
# forward selected ramp to editor
ramp_nr = PVUtil.createPV("loc://ramp_nr<VLong>", 10)
PVUtil.writePV("loc://ramp_nr<VLong>", ramp_size, 50)]]></text>
</script>
<description>make new</description>
</action>
<action type="open_display">
<file>rampconfig.bob</file>
<macros>
<P>$(P)</P>
<R>$(R)</R>
</macros>
<target>window</target>
<description>open editor</description>
</action>
</actions>
<text>Append new step</text>
<x>450</x>
<y>110</y>
<width>190</width>
<tooltip>$(actions)</tooltip>
</widget>
<widget type="action_button" version="3.0.0">
<name>Action Button_1</name>
<actions execute_as_one="true">
<action type="execute">
<script file="EmbeddedPy">
<text><![CDATA[# Embedded python script
from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil
print 'Hello'
# widget.setPropertyValue('text', PVUtil.getString(pvs[0]))
profilePV = PVUtil.createPV("CRYVISIL:TC09:PROFILES",10)
selectionPV = PVUtil.createPV("loc://selection<VTable>", 10)
# get row number from selection PV, split until only index is left
selection = int(PVUtil.getString(selectionPV).split(",")[0].split(" ")[1])
# get the whole profile, extract selected ramp via selection number
ramp = PVUtil.getString(profilePV).split(";")[selection].split(",")
# forward selected ramp to editor
ramp_nr = PVUtil.createPV("loc://ramp_nr<VLong>", 10)
PVUtil.writePV("loc://ramp_nr<VLong>", selection, 50)
# put all parameters into EDIT PVs, for editor
PVUtil.writePV("CRYVISIL:TC09:EDIT:RAMP-TYPE", int(ramp[0]), 50)
PVUtil.writePV("CRYVISIL:TC09:EDIT:TARGET", float(ramp[1]), 50)
PVUtil.writePV("CRYVISIL:TC09:EDIT:STOP", float(ramp[2]), 50)
PVUtil.writePV("CRYVISIL:TC09:EDIT:LOOP-PROPORTIONAL", float(ramp[3]), 50)
PVUtil.writePV("CRYVISIL:TC09:EDIT:LOOP-INTEGRAL", float(ramp[4]), 50)
PVUtil.writePV("CRYVISIL:TC09:EDIT:LOOP-DIFFERENTIAL", float(ramp[5]), 50)
PVUtil.writePV("CRYVISIL:TC09:EDIT:TIME-CONST", int(ramp[6]), 50)
PVUtil.writePV("CRYVISIL:TC09:EDIT:SAMPLES", int(ramp[7]), 50)]]></text>
</script>
<description>Execute Script</description>
</action>
<action type="open_display">
<file>rampconfig.bob</file>
<macros>
<P>$(P)</P>
<R>$(R)</R>
</macros>
<target>window</target>
<description>Open Ramp config</description>
</action>
</actions>
<text>Edit selected</text>
<x>450</x>
<y>70</y>
<width>190</width>
<tooltip>$(actions)</tooltip>
</widget>
<widget type="action_button" version="3.0.0">
<name>Action Button_2</name>
<actions>
<action type="execute">
<script file="EmbeddedPy">
<text><![CDATA[# Embedded python script
from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil
print 'Hello'
# widget.setPropertyValue('text', PVUtil.getString(pvs[0]))
profilePV = PVUtil.createPV("CRYVISIL:TC09:PROFILES",50)
selectionPV = PVUtil.createPV("loc://selection<VTable>", 10)
# get row number from selection PV, split until only index is left
selection = int(PVUtil.getString(selectionPV).split(",")[0].split(" ")[1])
# get the whole profile, extract selected ramp via selection number
profile = PVUtil.getString(profilePV).split(";")
active_entry = profile.pop(selection)
profile.insert(selection - 1, active_entry)
PVUtil.writePV("CRYVISIL:TC09:PROFILES", ";".join(profile), 50)
# Locate the table widget by name
table = ScriptUtil.findWidgetByName(widget, "ramp_table")
# Select row 0, col 0, row 1, col 2
table.setSelection([ selection - 1, 0 ])]]></text>
</script>
<description>move entry one up</description>
</action>
</actions>
<text>UP</text>
<x>450</x>
<y>150</y>
<width>90</width>
<tooltip>$(actions)</tooltip>
</widget>
<widget type="action_button" version="3.0.0">
<name>Action Button_3</name>
<actions>
<action type="execute">
<script file="EmbeddedPy">
<text><![CDATA[# Embedded python script
from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil
print 'Hello'
# widget.setPropertyValue('text', PVUtil.getString(pvs[0]))
profilePV = PVUtil.createPV("CRYVISIL:TC09:PROFILES",50)
selectionPV = PVUtil.createPV("loc://selection<VTable>", 10)
# get row number from selection PV, split until only index is left
selection = int(PVUtil.getString(selectionPV).split(",")[0].split(" ")[1])
# get the whole profile, extract selected ramp via selection number
profile = PVUtil.getString(profilePV).split(";")
del profile[selection]
PVUtil.writePV("CRYVISIL:TC09:PROFILES", ";".join(profile), 50)]]></text>
</script>
<description>delete</description>
</action>
</actions>
<text>Remove selected</text>
<x>450</x>
<y>190</y>
<width>190</width>
<tooltip>$(actions)</tooltip>
</widget>
<widget type="table" version="2.0.0">
<name>ramp_table</name>
<x>20</x>
<y>60</y>
<width>400</width>
<height>210</height>
<columns>
<column>
<name>No.</name>
<width>50</width>
<editable>false</editable>
</column>
<column>
<name>Type</name>
<width>150</width>
<editable>false</editable>
</column>
<column>
<name>Parameter</name>
<width>100</width>
<editable>false</editable>
</column>
<column>
<name>Stop</name>
<width>100</width>
<editable>false</editable>
</column>
</columns>
<scripts>
<script file="EmbeddedPy">
<text><![CDATA[# Embedded python script
from org.csstudio.display.builder.runtime.script import PVUtil, ValueUtil
print "TABLE SCRIPT"
target = pvs[0]
input = pvs[1]
typemapping = ["preheater", "flash", "flash slow start", "const rate fuzzy",
"const temp", "const rate poly", "const rate file", "const rate pid", "const temp pid"]
data = []
for index, ramp in enumerate(PVUtil.getString(input).split(";")):
subrow = ramp.split(",")
row = [ str(index), typemapping[int(subrow[0])], "%.2f"%float(subrow[1]), "%.2f"%float(subrow[2]) ]
data.append(row)
# Create matrix (2D array) of strings
#data = []
#for pv in inputs:
# row = [ pv.getName(), PVUtil.getString(pv) ]
# data.append(row)
table = ValueUtil.createStringTableFromRows([ "No.", "Type", "Target", "Stop" ], data)
widget.setPropertyValue("value", table)
]]></text>
<pv_name>loc://ramps&lt;VTable&gt;</pv_name>
<pv_name>$(P):$(R):PROFILES</pv_name>
</script>
</scripts>
<editable>false</editable>
<row_selection_mode>true</row_selection_mode>
<selection_pv>loc://selection&lt;VTable&gt;(0)</selection_pv>
</widget>
<widget type="action_button" version="3.0.0">
<name>Action Button_4</name>
<actions>
<action type="execute">
<script file="EmbeddedPy">
<text><![CDATA[# Embedded python script
from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil
print 'Hello'
# widget.setPropertyValue('text', PVUtil.getString(pvs[0]))
profilePV = PVUtil.createPV("CRYVISIL:TC09:PROFILES",50)
selectionPV = PVUtil.createPV("loc://selection<VTable>", 10)
# get row number from selection PV, split until only index is left
selection = int(PVUtil.getString(selectionPV).split(",")[0].split(" ")[1])
# get the whole profile, extract selected ramp via selection number
profile = PVUtil.getString(profilePV).split(";")
active_entry = profile.pop(selection)
profile.insert(selection + 1, active_entry)
PVUtil.writePV("CRYVISIL:TC09:PROFILES", ";".join(profile), 50)
# Locate the table widget by name
table = ScriptUtil.findWidgetByName(widget, "ramp_table")
# Select row 0, col 0, row 1, col 2
table.setSelection([ selection + 1, 0 ])]]></text>
</script>
<description>move one down</description>
</action>
</actions>
<text>DOWN</text>
<x>550</x>
<y>150</y>
<width>90</width>
<tooltip>$(actions)</tooltip>
</widget>
<widget type="action_button" version="3.0.0">
<name>Action Button_5</name>
<actions>
<action type="execute">
<script file="EmbeddedPy">
<text><![CDATA[# Embedded python script
from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil
from org.csstudio.display.builder.model.properties import WidgetColor
print 'Hello'
# widget.setPropertyValue('text', PVUtil.getString(pvs[0]))
profilePV = PVUtil.createPV("CRYVISIL:TC09:ALL-PROFILES",50)
actualprofilePV = PVUtil.createPV("CRYVISIL:TC09:PROFILES",50)
selectionPV = PVUtil.createPV("loc://profile_nr<VLong>", 10)
profilenamePV = PVUtil.createPV("loc://profilename<VString>",50)
selection = PVUtil.getLong(selectionPV)
actualprofile = PVUtil.getString(actualprofilePV)
profilename = PVUtil.getString(profilenamePV)
# get the whole profile, extract selected ramp via selection number
profile = PVUtil.getString(profilePV).split("#")
try:
profile[selection] = profilename + "?" + actualprofile
except IndexError:
profile.append(profilename + "?" + actualprofile)
PVUtil.writePV("CRYVISIL:TC09:ALL-PROFILES", "#".join(profile), 50)
widget.setPropertyValue('background_color', WidgetColor(0, 255, 0, 255))
]]></text>
</script>
<description>Save</description>
</action>
</actions>
<x>450</x>
<y>230</y>
<width>190</width>
<tooltip>$(actions)</tooltip>
</widget>
<widget type="textentry" version="3.0.0">
<name>Text Entry</name>
<pv_name>loc://profilename&lt;VString&gt;</pv_name>
<x>500</x>
<y>20</y>
<width>160</width>
<height>30</height>
<background_color>
<color red="51" green="194" blue="255">
</color>
</background_color>
</widget>
<widget type="label" version="2.0.0">
<name>Label</name>
<text>Control Parameter</text>
<x>20</x>
<y>20</y>
<width>320</width>
<height>30</height>
<font>
<font family="Liberation Sans" style="REGULAR" size="20.0">
</font>
</font>
<vertical_alignment>1</vertical_alignment>
</widget>
<widget type="label" version="2.0.0">
<name>Label_1</name>
<text>Name:</text>
<x>430</x>
<y>20</y>
<width>60</width>
<height>30</height>
<font>
<font family="Liberation Sans" style="REGULAR" size="20.0">
</font>
</font>
<vertical_alignment>1</vertical_alignment>
</widget>
</display>