-
Notifications
You must be signed in to change notification settings - Fork 0
/
nt_table.bob
83 lines (82 loc) · 2.19 KB
/
nt_table.bob
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?xml version="1.0" encoding="UTF-8"?>
<display version="2.0.0">
<name>Display</name>
<widget type="table" version="2.0.0">
<name>Table</name>
<pv_name>pva://QSRV:TABLE</pv_name>
<x>5</x>
<y>5</y>
<width>420</width>
<height>200</height>
<columns>
<column>
<name>Enum</name>
<width>100</width>
<editable>true</editable>
<options>
<option>ZERO</option>
<option>ONE</option>
<option>MANY</option>
</options>
</column>
<column>
<name>Check Box</name>
<width>100</width>
<editable>true</editable>
<options>
<option>false</option>
<option>true</option>
</options>
</column>
<column>
<name>String</name>
<width>100</width>
<editable>true</editable>
</column>
<column>
<name>Float 64</name>
<width>100</width>
<editable>true</editable>
</column>
</columns>
</widget>
<widget type="action_button" version="3.0.0">
<name>Action Button_1</name>
<actions>
<action type="execute">
<script file="EmbeddedPy">
<text><![CDATA[from org.csstudio.display.builder.runtime.script import ScriptUtil
from org.epics.pva.data import PVAStructure, PVAStringArray, PVAIntArray, PVADoubleArray
table = ScriptUtil.findWidgetByName(widget, "Table")
data = table.getValue()
pv = ScriptUtil.getPrimaryPV(table)
cols = [
PVAStringArray("col0", [row[0] for row in data]),
PVAIntArray("col1", 0, [row[1] == "true" for row in data]),
PVAStringArray("col2", [row[2] for row in data]),
PVADoubleArray("col3", [float(row[3]) for row in data]),
]
pv.write(PVAStructure("", "", cols))
]]></text>
</script>
<description>Execute Script</description>
</action>
</actions>
<text>Submit</text>
<x>310</x>
<y>220</y>
<width>110</width>
<height>43</height>
<tooltip>$(actions)</tooltip>
</widget>
<widget type="choice" version="2.0.0">
<name>Choice Button</name>
<pv_name>QSRV:TABLE:EDITABLE</pv_name>
<x>160</x>
<y>220</y>
<items>
<item>Item 1</item>
<item>Item 2</item>
</items>
</widget>
</display>