From 86b4d076c288ef3082d22dd4c1e044f4a834ee74 Mon Sep 17 00:00:00 2001
From: arek <arek.gorzawski@ess.eu>
Date: Sat, 30 Oct 2021 12:07:17 +0200
Subject: [PATCH 01/18] - buttons colour update - loaded table text widget size
 changed - PVname updated for the upload script. followed changes in IOC 0.6.0

---
 10-Top/beamprod.bob | 35 +++++++++++++++++++++++------------
 1 file changed, 23 insertions(+), 12 deletions(-)

diff --git a/10-Top/beamprod.bob b/10-Top/beamprod.bob
index 9409321a..683968a7 100644
--- a/10-Top/beamprod.bob
+++ b/10-Top/beamprod.bob
@@ -284,8 +284,8 @@ PVUtil.writePV(pvToWrite.getName(), PVUtil.getString(pvToRead), 5000)
           <widget type="fileselector" version="2.0.0">
             <name>File Selector_NewTT</name>
             <pv_name>loc://pathNewFile("")</pv_name>
-            <x>956</x>
-            <y>268</y>
+            <x>955</x>
+            <y>259</y>
             <width>170</width>
             <height>30</height>
             <actions>
@@ -297,6 +297,7 @@ PVUtil.writePV(pvToWrite.getName(), PVUtil.getString(pvToRead), 5000)
 print "=======> File Conversion <========"
 pvToRead = ScriptUtil.getPVByName(widget, "loc://pathNewFile")
 fullFilePath = PVUtil.getString(pvToRead)
+fileName = fullFilePath.split("/")[-1]
 if 'csv' in fullFilePath:
 	headerArray = []
 	headerL = 0
@@ -313,15 +314,18 @@ if 'csv' in fullFilePath:
 			else:
 				data.extend(row)
 				lines = rowIndx
-	print "=======>  File converted to: <========"
+	#print "=======>  File converted to: <========"
+	#print fullFilePath
+	#print fileName
 	#print headerL 
 	#print lines
 	#print headerArray
 	#print data
 	print "=======>   PV WRITE <========"
 	# Write PVs and trigger the processing
-	PVUtil.writePV("BPROD:Ops:TTMetaHeaderL", headerL, 5000)
+	PVUtil.writePV("BPROD:Ops:TTMetaHeaderLght", headerL, 5000)
 	PVUtil.writePV("BPROD:Ops:TTMetaNbLines", lines, 5000)
+	PVUtil.writePV("BPROD:Ops:TTMetaFileName", fileName, 5000)
 	from jarray import array
 	from java.lang import String
 	PVUtil.writePV("BPROD:Ops:TTMetaHeader", array(headerArray, String), 1000)
@@ -357,12 +361,13 @@ print "=======> File Conversion  DONE<========"]]></text>
             <y>159</y>
             <width>171</width>
             <height>30</height>
+            <enabled>false</enabled>
           </widget>
           <widget type="label" version="2.0.0">
             <name>Label_15</name>
-            <text>Source File</text>
-            <x>968</x>
-            <y>244</y>
+            <text>Select file to upload</text>
+            <x>961</x>
+            <y>231</y>
             <width>139</width>
             <horizontal_alignment>1</horizontal_alignment>
           </widget>
@@ -373,6 +378,7 @@ print "=======> File Conversion  DONE<========"]]></text>
             <y>93</y>
             <width>171</width>
             <height>30</height>
+            <enabled>false</enabled>
           </widget>
           <widget type="textupdate" version="2.0.0">
             <name>Text Update_9</name>
@@ -630,7 +636,7 @@ except Exception:
       <pv_name>$(PP):ScTableDir-RB</pv_name>
       <x>75</x>
       <y>49</y>
-      <width>252</width>
+      <width>312</width>
       <height>30</height>
     </widget>
     <widget type="textupdate" version="2.0.0">
@@ -638,7 +644,7 @@ except Exception:
       <pv_name>$(PP):ScTable-RB</pv_name>
       <x>75</x>
       <y>12</y>
-      <width>252</width>
+      <width>312</width>
       <height>30</height>
       <font>
         <font family="Source Sans Pro" style="BOLD" size="16.0">
@@ -666,6 +672,7 @@ except Exception:
       <pv_name>${PP}:ScTable-Sts</pv_name>
       <x>227</x>
       <y>86</y>
+      <width>160</width>
       <height>30</height>
       <actions>
       </actions>
@@ -914,10 +921,10 @@ PVUtil.writePV("BPROD:Ops:TTToLoad", "null.csv", 5000)]]></text>
       <font name="Default Bold" family="Source Sans Pro" style="BOLD" size="16.0">
       </font>
     </font>
-    <background_color>
+    <foreground_color>
       <color name="STOP" red="222" green="33" blue="22">
       </color>
-    </background_color>
+    </foreground_color>
     <tooltip>$(actions)</tooltip>
   </widget>
   <widget type="bool_button" version="2.0.0">
@@ -929,10 +936,14 @@ PVUtil.writePV("BPROD:Ops:TTToLoad", "null.csv", 5000)]]></text>
     <height>103</height>
     <off_label>Enable
  Beam ON</off_label>
+    <off_color>
+      <color name="Button_Background" red="236" green="236" blue="236">
+      </color>
+    </off_color>
     <on_label>Set
  Beam OFF</on_label>
     <on_color>
-      <color name="RED-BORDER" red="150" green="8" blue="16">
+      <color name="PRIMARY" red="0" green="148" blue="202">
       </color>
     </on_color>
     <show_led>false</show_led>
-- 
GitLab


From 7d9628984e8a6b79e47616de8a8e25232f5f74c2 Mon Sep 17 00:00:00 2001
From: arek <arek.gorzawski@ess.eu>
Date: Sat, 30 Oct 2021 14:04:37 +0200
Subject: [PATCH 02/18] Full BeamOFF (mode/destination/table reset) moved to
 the IOC (0.6.0)

---
 10-Top/beamprod.bob | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/10-Top/beamprod.bob b/10-Top/beamprod.bob
index 683968a7..071b3e92 100644
--- a/10-Top/beamprod.bob
+++ b/10-Top/beamprod.bob
@@ -902,13 +902,14 @@ else:
           <text><![CDATA[# Embedded python script
 from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil
 
+PVUtil.writePV("BPROD:Ops:BProdStop", "0", 5000)
 
 #TODO move this writes to the BeamProd IOC
-PVUtil.writePV("TD-M:Ctrl-SCE-1:BState-Sel", "0", 5000)
-PVUtil.writePV("BPROD:Ops:BState", "0", 5000)
-PVUtil.writePV("BPROD:Ops:BMode", "0", 5000)
-PVUtil.writePV("BPROD:Ops:BDestination", "0", 5000)
-PVUtil.writePV("BPROD:Ops:TTToLoad", "null.csv", 5000)]]></text>
+#PVUtil.writePV("TD-M:Ctrl-SCE-1:BState-Sel", "0", 5000)
+#PVUtil.writePV("BPROD:Ops:BState", "0", 5000)
+#PVUtil.writePV("BPROD:Ops:BMode", "0", 5000)
+#PVUtil.writePV("BPROD:Ops:BDestination", "0", 5000)
+#PVUtil.writePV("BPROD:Ops:TTToLoad", "null.csv", 5000)]]></text>
         </script>
         <description>ABORT BEAM and load no events</description>
       </action>
-- 
GitLab


From bead6097ae0afe9ee4b9c0389fc252103e5d7099 Mon Sep 17 00:00:00 2001
From: arek <arek.gorzawski@ess.eu>
Date: Tue, 2 Nov 2021 18:18:14 +0100
Subject: [PATCH 03/18] Rearranged groups.

---
 10-Top/beamprod.bob | 850 ++++++++++++++++++++++++++------------------
 1 file changed, 497 insertions(+), 353 deletions(-)

diff --git a/10-Top/beamprod.bob b/10-Top/beamprod.bob
index 071b3e92..ac4d08f2 100644
--- a/10-Top/beamprod.bob
+++ b/10-Top/beamprod.bob
@@ -215,37 +215,6 @@ PVUtil.writePV(pvToWrite.getName(), PVUtil.getString(pvToRead), 5000)
             </scripts>
             <tooltip>$(actions)</tooltip>
           </widget>
-          <widget type="group" version="2.0.0">
-            <name>SCE Active Source</name>
-            <x>23</x>
-            <y>48</y>
-            <width>611</width>
-            <height>82</height>
-            <font>
-              <font family="Source Sans Pro" style="BOLD" size="16.0">
-              </font>
-            </font>
-            <widget type="combo" version="2.0.0">
-              <name>Combo Box</name>
-              <pv_name>$(P):$(R):TTSource</pv_name>
-              <x>295</x>
-              <y>6</y>
-              <width>258</width>
-              <enabled>false</enabled>
-            </widget>
-            <widget type="textupdate" version="2.0.0">
-              <name>Text Update_4</name>
-              <pv_name>$(PP):ScTableDir-SP</pv_name>
-              <x>7</x>
-              <y>7</y>
-              <width>270</width>
-              <height>30</height>
-              <font>
-                <font family="Source Sans Pro" style="BOLD" size="16.0">
-                </font>
-              </font>
-            </widget>
-          </widget>
           <widget type="rectangle" version="2.0.0">
             <name>BGGrey01-titlebar_1</name>
             <x>936</x>
@@ -396,6 +365,44 @@ print "=======> File Conversion  DONE<========"]]></text>
             <width>139</width>
             <horizontal_alignment>1</horizontal_alignment>
           </widget>
+          <widget type="rectangle" version="2.0.0">
+            <name>MGGrey03-background_15</name>
+            <x>21</x>
+            <y>53</y>
+            <width>607</width>
+            <height>71</height>
+            <line_width>2</line_width>
+            <line_color>
+              <color name="GROUP-BORDER" red="150" green="155" blue="151">
+              </color>
+            </line_color>
+            <background_color>
+              <color name="GROUP-BACKGROUND" red="200" green="205" blue="201">
+              </color>
+            </background_color>
+            <corner_width>10</corner_width>
+            <corner_height>10</corner_height>
+          </widget>
+          <widget type="textupdate" version="2.0.0">
+            <name>Text Update_4</name>
+            <pv_name>$(PP):ScTableDir-SP</pv_name>
+            <x>51</x>
+            <y>75</y>
+            <width>270</width>
+            <height>30</height>
+            <font>
+              <font family="Source Sans Pro" style="BOLD" size="16.0">
+              </font>
+            </font>
+          </widget>
+          <widget type="combo" version="2.0.0">
+            <name>Combo Box</name>
+            <pv_name>$(P):$(R):TTSource</pv_name>
+            <x>339</x>
+            <y>74</y>
+            <width>258</width>
+            <enabled>false</enabled>
+          </widget>
         </children>
       </tab>
       <tab>
@@ -621,113 +628,124 @@ except Exception:
     <direction>1</direction>
     <tab_height>40</tab_height>
   </widget>
-  <widget type="group" version="2.0.0">
-    <name>Loaded Table:</name>
-    <x>64</x>
-    <y>272</y>
-    <width>446</width>
-    <height>158</height>
-    <font>
-      <font family="Source Sans Pro" style="BOLD" size="18.0">
-      </font>
-    </font>
-    <widget type="textupdate" version="2.0.0">
-      <name>Text Update_3</name>
-      <pv_name>$(PP):ScTableDir-RB</pv_name>
-      <x>75</x>
-      <y>49</y>
-      <width>312</width>
-      <height>30</height>
-    </widget>
-    <widget type="textupdate" version="2.0.0">
-      <name>ActualLoadedTT</name>
-      <pv_name>$(PP):ScTable-RB</pv_name>
-      <x>75</x>
-      <y>12</y>
-      <width>312</width>
-      <height>30</height>
-      <font>
-        <font family="Source Sans Pro" style="BOLD" size="16.0">
-        </font>
-      </font>
-      <show_units>false</show_units>
-    </widget>
-    <widget type="label" version="2.0.0">
-      <name>Label_10</name>
-      <text>Name:</text>
-      <y>12</y>
-      <width>70</width>
-      <height>30</height>
-    </widget>
-    <widget type="label" version="2.0.0">
-      <name>Label_12</name>
-      <text>Source:</text>
-      <x>1</x>
-      <y>50</y>
-      <width>70</width>
-      <height>30</height>
-    </widget>
-    <widget type="textupdate" version="2.0.0">
-      <name>Text Update_10</name>
-      <pv_name>${PP}:ScTable-Sts</pv_name>
-      <x>227</x>
-      <y>86</y>
-      <width>160</width>
-      <height>30</height>
-      <actions>
-      </actions>
-      <scripts>
+  <widget type="action_button" version="3.0.0">
+    <name>STOPBeam</name>
+    <actions>
+      <action type="execute">
         <script file="EmbeddedPy">
-          <text><![CDATA[from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil
-def toggle(widgetName, state, property="enabled"):
-    widgetToToggle = ScriptUtil.findWidgetByName(widget, widgetName)
-    widgetToToggle.setPropertyValue(property, state)
+          <text><![CDATA[# Embedded python script
+from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil
 
-if PVUtil.getString(pvs[0]) == "RUNNING":
-    toggle("Table_Arr_solid", True, "visible")
-else:
-    toggle("Table_Arr_solid", False, "visible")]]></text>
-          <pv_name>$(PP):ScTable-Sts</pv_name>
+PVUtil.writePV("BPROD:Ops:BProdStop", "0", 5000)
+
+#TODO move this writes to the BeamProd IOC
+#PVUtil.writePV("TD-M:Ctrl-SCE-1:BState-Sel", "0", 5000)
+#PVUtil.writePV("BPROD:Ops:BState", "0", 5000)
+#PVUtil.writePV("BPROD:Ops:BMode", "0", 5000)
+#PVUtil.writePV("BPROD:Ops:BDestination", "0", 5000)
+#PVUtil.writePV("BPROD:Ops:TTToLoad", "null.csv", 5000)]]></text>
         </script>
-      </scripts>
-    </widget>
-    <widget type="label" version="2.0.0">
-      <name>Label</name>
-      <text>Loaded Table State:</text>
-      <x>1</x>
-      <y>86</y>
-      <width>148</width>
-      <height>30</height>
-    </widget>
+        <description>ABORT BEAM and load no events</description>
+      </action>
+    </actions>
+    <x>1070</x>
+    <y>216</y>
+    <width>102</width>
+    <height>103</height>
+    <font>
+      <font name="Default Bold" family="Source Sans Pro" style="BOLD" size="16.0">
+      </font>
+    </font>
+    <foreground_color>
+      <color name="STOP" red="222" green="33" blue="22">
+      </color>
+    </foreground_color>
+    <tooltip>$(actions)</tooltip>
   </widget>
-  <widget type="group" version="2.0.0">
-    <name>Mode &amp; Destination</name>
-    <x>64</x>
-    <y>120</y>
-    <width>446</width>
-    <height>139</height>
+  <widget type="symbol" version="2.0.0">
+    <name>Mode_Arr_base</name>
+    <symbols>
+      <symbol>../99-Shared/BeamProd/arrow.png</symbol>
+    </symbols>
+    <x>643</x>
+    <y>134</y>
+  </widget>
+  <widget type="symbol" version="2.0.0">
+    <name>Mode_Arr_solid</name>
+    <symbols>
+      <symbol>../99-Shared/BeamProd/arrow-solid.png</symbol>
+    </symbols>
+    <x>641</x>
+    <y>134</y>
+    <visible>false</visible>
+  </widget>
+  <widget type="symbol" version="2.0.0">
+    <name>Table_Arr_base</name>
+    <symbols>
+      <symbol>../99-Shared/BeamProd/arrow.png</symbol>
+    </symbols>
+    <x>643</x>
+    <y>302</y>
+  </widget>
+  <widget type="symbol" version="2.0.0">
+    <name>Table_Arr_solid</name>
+    <symbols>
+      <symbol>../99-Shared/BeamProd/arrow-solid.png</symbol>
+    </symbols>
+    <x>641</x>
+    <y>302</y>
+    <visible>false</visible>
+  </widget>
+  <widget type="rectangle" version="2.0.0">
+    <name>MGGrey03-background_11</name>
+    <x>69</x>
+    <y>104</y>
+    <width>572</width>
+    <height>156</height>
+    <line_width>2</line_width>
+    <line_color>
+      <color name="GROUP-BORDER" red="150" green="155" blue="151">
+      </color>
+    </line_color>
+    <background_color>
+      <color name="GROUP-BACKGROUND" red="200" green="205" blue="201">
+      </color>
+    </background_color>
+    <corner_width>10</corner_width>
+    <corner_height>10</corner_height>
+  </widget>
+  <widget type="label" version="2.0.0">
+    <name>MGGrey03-title_27</name>
+    <text>Mode &amp; Destination</text>
+    <x>78</x>
+    <y>104</y>
+    <width>439</width>
+    <height>40</height>
     <font>
-      <font family="Source Sans Pro" style="BOLD" size="18.0">
+      <font family="Source Sans Pro" style="BOLD" size="20.0">
       </font>
     </font>
-    <widget type="rectangle" version="2.0.0">
-      <name>NotAllowedCombination</name>
-      <x>9</x>
-      <y>3</y>
-      <width>390</width>
-      <height>100</height>
-      <visible>false</visible>
-      <line_color>
-        <color name="MACHINE-PROTECTION-BORDER" red="120" green="59" blue="85">
-        </color>
-      </line_color>
-      <background_color>
-        <color red="196" green="96" blue="140" alpha="153">
-        </color>
-      </background_color>
-      <scripts>
-        <script file="EmbeddedPy">
-          <text><![CDATA[# Embedded python script
+    <horizontal_alignment>1</horizontal_alignment>
+    <vertical_alignment>1</vertical_alignment>
+  </widget>
+  <widget type="rectangle" version="2.0.0">
+    <name>NotAllowedCombination</name>
+    <x>94</x>
+    <y>138</y>
+    <width>389</width>
+    <height>116</height>
+    <visible>false</visible>
+    <line_color>
+      <color name="MACHINE-PROTECTION-BORDER" red="120" green="59" blue="85">
+      </color>
+    </line_color>
+    <background_color>
+      <color red="196" green="96" blue="140" alpha="153">
+      </color>
+    </background_color>
+    <scripts>
+      <script file="EmbeddedPy">
+        <text><![CDATA[# Embedded python script
 from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil
 #print 'Hello'
 if PVUtil.getString(pvs[0]) == '1':
@@ -735,59 +753,59 @@ if PVUtil.getString(pvs[0]) == '1':
 else:
     widget.setPropertyValue('visible', True)
 ]]></text>
-          <pv_name>$(P):$(R):AllowedBModeBDst</pv_name>
-        </script>
-      </scripts>
-    </widget>
-    <widget type="label" version="2.0.0">
-      <name>Label_2</name>
-      <text>Proton Beam Mode</text>
-      <x>21</x>
-      <y>6</y>
-      <width>170</width>
-    </widget>
-    <widget type="label" version="2.0.0">
-      <name>Label_3</name>
-      <text>Proton Beam Destination</text>
-      <x>216</x>
-      <y>6</y>
-      <width>170</width>
-    </widget>
-    <widget type="textupdate" version="2.0.0">
-      <name>ActualPBMode</name>
-      <pv_name>$(PP):BMod-Sel</pv_name>
-      <x>14</x>
-      <y>30</y>
-      <width>168</width>
-      <height>30</height>
-      <font>
-        <font family="Source Sans Pro" style="BOLD" size="16.0">
-        </font>
+        <pv_name>$(P):$(R):AllowedBModeBDst</pv_name>
+      </script>
+    </scripts>
+  </widget>
+  <widget type="label" version="2.0.0">
+    <name>Label_2</name>
+    <text>Proton Beam Mode</text>
+    <x>109</x>
+    <y>145</y>
+    <width>170</width>
+  </widget>
+  <widget type="label" version="2.0.0">
+    <name>Label_3</name>
+    <text>Proton Beam Destination</text>
+    <x>304</x>
+    <y>145</y>
+    <width>170</width>
+  </widget>
+  <widget type="textupdate" version="2.0.0">
+    <name>ActualPBMode</name>
+    <pv_name>$(PP):BMod-Sel</pv_name>
+    <x>102</x>
+    <y>172</y>
+    <width>168</width>
+    <height>30</height>
+    <font>
+      <font family="Source Sans Pro" style="BOLD" size="16.0">
       </font>
-    </widget>
-    <widget type="textupdate" version="2.0.0">
-      <name>ActualPBDestination</name>
-      <pv_name>$(PP):BDest-Sel</pv_name>
-      <x>217</x>
-      <y>30</y>
-      <width>168</width>
-      <height>30</height>
-      <font>
-        <font family="Source Sans Pro" style="BOLD" size="16.0">
-        </font>
+    </font>
+  </widget>
+  <widget type="textupdate" version="2.0.0">
+    <name>ActualPBDestination</name>
+    <pv_name>$(PP):BDest-Sel</pv_name>
+    <x>305</x>
+    <y>172</y>
+    <width>168</width>
+    <height>30</height>
+    <font>
+      <font family="Source Sans Pro" style="BOLD" size="16.0">
       </font>
-    </widget>
-    <widget type="combo" version="2.0.0">
-      <name>selectPBMode</name>
-      <pv_name>$(P):$(R):BMode</pv_name>
-      <x>13</x>
-      <y>66</y>
-      <width>170</width>
-      <actions>
-      </actions>
-      <scripts>
-        <script file="EmbeddedPy">
-          <text><![CDATA[# Embedded python script
+    </font>
+  </widget>
+  <widget type="combo" version="2.0.0">
+    <name>selectPBMode</name>
+    <pv_name>$(P):$(R):BMode</pv_name>
+    <x>101</x>
+    <y>210</y>
+    <width>170</width>
+    <actions>
+    </actions>
+    <scripts>
+      <script file="EmbeddedPy">
+        <text><![CDATA[# Embedded python script
 from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil
 
 def toggle(widgetName, state, property="enabled"):
@@ -798,150 +816,327 @@ if PVUtil.getString(pvs[0]) != "No Beam":
     toggle("Mode_Arr_solid", True, "visible")
 else:
     toggle("Mode_Arr_solid", False, "visible")]]></text>
-          <pv_name>$(P):$(R):BMode</pv_name>
-        </script>
-      </scripts>
-    </widget>
-    <widget type="combo" version="2.0.0">
-      <name>selectPBDestination</name>
-      <pv_name>$(P):$(R):BDestination</pv_name>
-      <x>217</x>
-      <y>66</y>
-      <width>170</width>
-    </widget>
+        <pv_name>$(P):$(R):BMode</pv_name>
+      </script>
+    </scripts>
+  </widget>
+  <widget type="combo" version="2.0.0">
+    <name>selectPBDestination</name>
+    <pv_name>$(P):$(R):BDestination</pv_name>
+    <x>305</x>
+    <y>210</y>
+    <width>170</width>
+  </widget>
+  <widget type="rectangle" version="2.0.0">
+    <name>MGGrey03-background_12</name>
+    <x>69</x>
+    <y>274</y>
+    <width>574</width>
+    <height>155</height>
+    <line_width>2</line_width>
+    <line_color>
+      <color name="GROUP-BORDER" red="150" green="155" blue="151">
+      </color>
+    </line_color>
+    <background_color>
+      <color name="GROUP-BACKGROUND" red="200" green="205" blue="201">
+      </color>
+    </background_color>
+    <corner_width>10</corner_width>
+    <corner_height>10</corner_height>
   </widget>
-  <widget type="group" version="2.0.0">
-    <name>Timing Engine</name>
-    <x>750</x>
-    <y>120</y>
-    <height>310</height>
+  <widget type="label" version="2.0.0">
+    <name>MGGrey03-title_28</name>
+    <text>Loaded Table</text>
+    <x>78</x>
+    <y>274</y>
+    <width>440</width>
+    <height>40</height>
     <font>
-      <font family="Source Sans Pro" style="BOLD" size="18.0">
+      <font family="Source Sans Pro" style="BOLD" size="20.0">
       </font>
     </font>
-    <widget type="label" version="2.0.0">
-      <name>Label_20</name>
-      <text>Expected Beam Presence</text>
-      <x>92</x>
-      <y>12</y>
-      <width>170</width>
-    </widget>
-    <widget type="textupdate" version="2.0.0">
-      <name>Text Update_11</name>
-      <pv_name>${PP}:BState-Sts</pv_name>
-      <x>2</x>
-      <y>40</y>
-      <width>98</width>
-      <height>30</height>
-      <font>
-        <font family="Source Sans Pro" style="BOLD" size="16.0">
-        </font>
+    <horizontal_alignment>1</horizontal_alignment>
+    <vertical_alignment>1</vertical_alignment>
+  </widget>
+  <widget type="textupdate" version="2.0.0">
+    <name>Text Update_3</name>
+    <pv_name>$(PP):ScTableDir-RB</pv_name>
+    <x>144</x>
+    <y>323</y>
+    <width>345</width>
+    <height>30</height>
+  </widget>
+  <widget type="textupdate" version="2.0.0">
+    <name>ActualLoadedTT</name>
+    <pv_name>$(PP):ScTable-RB</pv_name>
+    <x>143</x>
+    <y>367</y>
+    <width>345</width>
+    <height>30</height>
+    <font>
+      <font family="Source Sans Pro" style="BOLD" size="16.0">
       </font>
-    </widget>
-    <widget type="textupdate" version="2.0.0">
-      <name>Text Update_12</name>
-      <pv_name>${PP}:BPresent-Sts</pv_name>
-      <x>164</x>
-      <y>40</y>
-      <width>81</width>
-      <height>30</height>
-      <font>
-        <font family="Source Sans Pro" style="BOLD" size="18.0">
-        </font>
+    </font>
+    <show_units>false</show_units>
+  </widget>
+  <widget type="label" version="2.0.0">
+    <name>Label_10</name>
+    <text>Name:</text>
+    <x>86</x>
+    <y>367</y>
+    <width>70</width>
+    <height>30</height>
+  </widget>
+  <widget type="label" version="2.0.0">
+    <name>Label_12</name>
+    <text>Source:</text>
+    <x>87</x>
+    <y>324</y>
+    <width>70</width>
+    <height>30</height>
+  </widget>
+  <widget type="textupdate" version="2.0.0">
+    <name>Text Update_10</name>
+    <pv_name>${PP}:ScTable-Sts</pv_name>
+    <x>503</x>
+    <y>367</y>
+    <width>120</width>
+    <height>30</height>
+    <font>
+      <font family="Source Sans Pro" style="BOLD" size="16.0">
       </font>
-    </widget>
-    <widget type="label" version="2.0.0">
-      <name>Label_19</name>
-      <text>Status </text>
-      <y>13</y>
-      <width>164</width>
-      <height>30</height>
-    </widget>
-    <widget type="label" version="2.0.0">
-      <name>Label_8</name>
-      <text>Nb. of cycles executed while BeamON:</text>
-      <y>99</y>
-      <width>275</width>
-      <height>30</height>
-      <tooltip>With magnetron events enabled.</tooltip>
-    </widget>
-    <widget type="textupdate" version="2.0.0">
-      <name>Text Update</name>
-      <pv_name>${PP}:CycleOnCnt</pv_name>
-      <y>129</y>
-      <height>30</height>
-      <font>
-        <font family="Source Sans Pro" style="BOLD" size="16.0">
-        </font>
+    </font>
+    <actions>
+    </actions>
+    <scripts>
+      <script file="EmbeddedPy">
+        <text><![CDATA[from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil
+def toggle(widgetName, state, property="enabled"):
+    widgetToToggle = ScriptUtil.findWidgetByName(widget, widgetName)
+    widgetToToggle.setPropertyValue(property, state)
+
+if PVUtil.getString(pvs[0]) == "RUNNING":
+    toggle("Table_Arr_solid", True, "visible")
+else:
+    toggle("Table_Arr_solid", False, "visible")]]></text>
+        <pv_name>$(PP):ScTable-Sts</pv_name>
+      </script>
+    </scripts>
+  </widget>
+  <widget type="label" version="2.0.0">
+    <name>Label</name>
+    <text>Loaded Table State:</text>
+    <x>145</x>
+    <y>990</y>
+    <width>148</width>
+    <height>30</height>
+  </widget>
+  <widget type="rectangle" version="2.0.0">
+    <name>MGGrey03-background_13</name>
+    <x>743</x>
+    <y>105</y>
+    <width>306</width>
+    <height>265</height>
+    <line_width>2</line_width>
+    <line_color>
+      <color name="GROUP-BORDER" red="150" green="155" blue="151">
+      </color>
+    </line_color>
+    <background_color>
+      <color name="GROUP-BACKGROUND" red="200" green="205" blue="201">
+      </color>
+    </background_color>
+    <corner_width>10</corner_width>
+    <corner_height>10</corner_height>
+  </widget>
+  <widget type="label" version="2.0.0">
+    <name>MGGrey03-title_29</name>
+    <text>Timimng Engine</text>
+    <x>743</x>
+    <y>105</y>
+    <width>306</width>
+    <height>40</height>
+    <font>
+      <font family="Source Sans Pro" style="BOLD" size="20.0">
       </font>
-    </widget>
-    <widget type="label" version="2.0.0">
-      <name>Label_18</name>
-      <text>Cycle ID of the last pulse with Beam ON</text>
-      <y>159</y>
-      <width>275</width>
-      <height>30</height>
-      <tooltip>With magnetron events enabled.</tooltip>
-    </widget>
-    <widget type="textupdate" version="2.0.0">
-      <name>Text Update_1</name>
-      <pv_name>${PP}:LastBeamOnCycleId</pv_name>
-      <y>189</y>
-      <height>30</height>
-      <font>
-        <font family="Source Sans Pro" style="BOLD" size="16.0">
-        </font>
+    </font>
+    <horizontal_alignment>1</horizontal_alignment>
+    <vertical_alignment>1</vertical_alignment>
+  </widget>
+  <widget type="label" version="2.0.0">
+    <name>Label_20</name>
+    <text>Expected Beam Presence</text>
+    <x>852</x>
+    <y>155</y>
+    <width>170</width>
+  </widget>
+  <widget type="textupdate" version="2.0.0">
+    <name>Text Update_11</name>
+    <pv_name>${PP}:BState-Sts</pv_name>
+    <x>762</x>
+    <y>183</y>
+    <width>98</width>
+    <height>30</height>
+    <font>
+      <font family="Source Sans Pro" style="BOLD" size="16.0">
       </font>
-    </widget>
+    </font>
   </widget>
-  <widget type="action_button" version="3.0.0">
-    <name>STOPBeam</name>
-    <actions>
-      <action type="execute">
-        <script file="EmbeddedPy">
-          <text><![CDATA[# Embedded python script
-from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil
-
-PVUtil.writePV("BPROD:Ops:BProdStop", "0", 5000)
-
-#TODO move this writes to the BeamProd IOC
-#PVUtil.writePV("TD-M:Ctrl-SCE-1:BState-Sel", "0", 5000)
-#PVUtil.writePV("BPROD:Ops:BState", "0", 5000)
-#PVUtil.writePV("BPROD:Ops:BMode", "0", 5000)
-#PVUtil.writePV("BPROD:Ops:BDestination", "0", 5000)
-#PVUtil.writePV("BPROD:Ops:TTToLoad", "null.csv", 5000)]]></text>
-        </script>
-        <description>ABORT BEAM and load no events</description>
-      </action>
-    </actions>
-    <x>1070</x>
-    <y>216</y>
-    <width>102</width>
-    <height>103</height>
+  <widget type="textupdate" version="2.0.0">
+    <name>Text Update_12</name>
+    <pv_name>${PP}:BPresent-Sts</pv_name>
+    <x>924</x>
+    <y>183</y>
+    <width>81</width>
+    <height>30</height>
     <font>
-      <font name="Default Bold" family="Source Sans Pro" style="BOLD" size="16.0">
+      <font family="Source Sans Pro" style="BOLD" size="18.0">
       </font>
     </font>
-    <foreground_color>
-      <color name="STOP" red="222" green="33" blue="22">
+  </widget>
+  <widget type="label" version="2.0.0">
+    <name>Label_19</name>
+    <text>Status </text>
+    <x>760</x>
+    <y>156</y>
+    <width>164</width>
+    <height>30</height>
+  </widget>
+  <widget type="label" version="2.0.0">
+    <name>Label_8</name>
+    <text>Nb. of cycles executed while BeamON:</text>
+    <x>760</x>
+    <y>224</y>
+    <width>275</width>
+    <height>30</height>
+    <tooltip>With magnetron events enabled.</tooltip>
+  </widget>
+  <widget type="textupdate" version="2.0.0">
+    <name>Text Update</name>
+    <pv_name>${PP}:CycleOnCnt</pv_name>
+    <x>760</x>
+    <y>254</y>
+    <height>30</height>
+    <font>
+      <font family="Source Sans Pro" style="BOLD" size="16.0">
+      </font>
+    </font>
+  </widget>
+  <widget type="label" version="2.0.0">
+    <name>Label_18</name>
+    <text>Cycle ID of the last pulse with Beam ON</text>
+    <x>760</x>
+    <y>284</y>
+    <width>275</width>
+    <height>30</height>
+    <tooltip>With magnetron events enabled.</tooltip>
+  </widget>
+  <widget type="textupdate" version="2.0.0">
+    <name>Text Update_1</name>
+    <pv_name>${PP}:LastBeamOnCycleId</pv_name>
+    <x>760</x>
+    <y>314</y>
+    <height>30</height>
+    <font>
+      <font family="Source Sans Pro" style="BOLD" size="16.0">
+      </font>
+    </font>
+  </widget>
+  <widget type="rectangle" version="2.0.0">
+    <name>MGGrey03-background_14</name>
+    <x>743</x>
+    <y>381</y>
+    <width>308</width>
+    <height>50</height>
+    <line_width>2</line_width>
+    <line_color>
+      <color name="GROUP-BORDER" red="150" green="155" blue="151">
       </color>
-    </foreground_color>
-    <tooltip>$(actions)</tooltip>
+    </line_color>
+    <background_color>
+      <color name="GROUP-BACKGROUND" red="200" green="205" blue="201">
+      </color>
+    </background_color>
+    <corner_width>10</corner_width>
+    <corner_height>10</corner_height>
+  </widget>
+  <widget type="led" version="2.0.0">
+    <name>LED_1</name>
+    <pv_name>FBIS::beam_permit_ok</pv_name>
+    <x>770</x>
+    <y>393</y>
+    <width>30</width>
+    <height>30</height>
+    <off_color>
+      <color name="SECONDARY" red="202" green="0" blue="0">
+      </color>
+    </off_color>
+    <square>true</square>
+  </widget>
+  <widget type="label" version="2.0.0">
+    <name>MGGrey03-title_30</name>
+    <text>FBIS Global Beam Permit</text>
+    <x>812</x>
+    <y>381</y>
+    <width>212</width>
+    <height>50</height>
+    <font>
+      <font family="Source Sans Pro" style="BOLD" size="18.0">
+      </font>
+    </font>
+    <horizontal_alignment>1</horizontal_alignment>
+    <vertical_alignment>1</vertical_alignment>
+  </widget>
+  <widget type="rectangle" version="2.0.0">
+    <name>BGGrey01-titlebar_4</name>
+    <x>503</x>
+    <y>203</y>
+    <width>157</width>
+    <height>134</height>
+    <line_width>2</line_width>
+    <line_color>
+      <color name="GROUP-BORDER" red="150" green="155" blue="151">
+      </color>
+    </line_color>
+    <background_color>
+      <color name="GROUP-BORDER" red="150" green="155" blue="151">
+      </color>
+    </background_color>
+    <corner_width>10</corner_width>
+    <corner_height>10</corner_height>
+  </widget>
+  <widget type="symbol" version="2.0.0">
+    <name>BeamON_Arr_base</name>
+    <symbols>
+      <symbol>../99-Shared/BeamProd/arrow.png</symbol>
+    </symbols>
+    <x>643</x>
+    <y>216</y>
+  </widget>
+  <widget type="symbol" version="2.0.0">
+    <name>BeamON_Arr_solid</name>
+    <symbols>
+      <symbol>../99-Shared/BeamProd/arrow-solid.png</symbol>
+    </symbols>
+    <x>641</x>
+    <y>216</y>
+    <visible>false</visible>
   </widget>
   <widget type="bool_button" version="2.0.0">
     <name>Boolean Button</name>
     <pv_name>$(P):$(R):BState</pv_name>
-    <x>531</x>
-    <y>216</y>
+    <x>520</x>
+    <y>218</y>
     <width>110</width>
     <height>103</height>
-    <off_label>Enable
+    <off_label>Switch
  Beam ON</off_label>
     <off_color>
       <color name="Button_Background" red="236" green="236" blue="236">
       </color>
     </off_color>
-    <on_label>Set
+    <on_label>Switch
  Beam OFF</on_label>
     <on_color>
       <color name="PRIMARY" red="0" green="148" blue="202">
@@ -977,55 +1172,4 @@ else:
       </script>
     </scripts>
   </widget>
-  <widget type="symbol" version="2.0.0">
-    <name>Mode_Arr_base</name>
-    <symbols>
-      <symbol>../99-Shared/BeamProd/arrow.png</symbol>
-    </symbols>
-    <x>643</x>
-    <y>104</y>
-  </widget>
-  <widget type="symbol" version="2.0.0">
-    <name>Mode_Arr_solid</name>
-    <symbols>
-      <symbol>../99-Shared/BeamProd/arrow-solid.png</symbol>
-    </symbols>
-    <x>641</x>
-    <y>104</y>
-    <visible>false</visible>
-  </widget>
-  <widget type="symbol" version="2.0.0">
-    <name>Table_Arr_base</name>
-    <symbols>
-      <symbol>../99-Shared/BeamProd/arrow.png</symbol>
-    </symbols>
-    <x>643</x>
-    <y>332</y>
-  </widget>
-  <widget type="symbol" version="2.0.0">
-    <name>Table_Arr_solid</name>
-    <symbols>
-      <symbol>../99-Shared/BeamProd/arrow-solid.png</symbol>
-    </symbols>
-    <x>641</x>
-    <y>332</y>
-    <visible>false</visible>
-  </widget>
-  <widget type="symbol" version="2.0.0">
-    <name>BeamON_Arr_base</name>
-    <symbols>
-      <symbol>../99-Shared/BeamProd/arrow.png</symbol>
-    </symbols>
-    <x>643</x>
-    <y>216</y>
-  </widget>
-  <widget type="symbol" version="2.0.0">
-    <name>BeamON_Arr_solid</name>
-    <symbols>
-      <symbol>../99-Shared/BeamProd/arrow-solid.png</symbol>
-    </symbols>
-    <x>641</x>
-    <y>216</y>
-    <visible>false</visible>
-  </widget>
 </display>
-- 
GitLab


From 9726183107e7d5ba321aadc7f30bd44f86b91ab8 Mon Sep 17 00:00:00 2001
From: arek <arek.gorzawski@ess.eu>
Date: Tue, 2 Nov 2021 20:39:34 +0100
Subject: [PATCH 04/18] Typos fix

---
 10-Top/beamprod.bob                  | 12 ++++++------
 99-Shared/Beam_OLC/em_intCurrent.bob |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/10-Top/beamprod.bob b/10-Top/beamprod.bob
index ac4d08f2..ba04764b 100644
--- a/10-Top/beamprod.bob
+++ b/10-Top/beamprod.bob
@@ -605,16 +605,16 @@ except Exception:
           <widget type="embedded" version="2.0.0">
             <name>Embedded Display_1</name>
             <file>../99-Shared/Beam_OLC/em_SafetyLimits.bob</file>
-            <x>28</x>
-            <y>58</y>
+            <x>44</x>
+            <y>59</y>
             <width>457</width>
             <height>310</height>
           </widget>
           <widget type="embedded" version="2.0.0">
             <name>Embedded Display</name>
             <file>../99-Shared/Beam_OLC/em_intCurrent.bob</file>
-            <x>470</x>
-            <y>58</y>
+            <x>548</x>
+            <y>59</y>
             <width>446</width>
             <height>261</height>
           </widget>
@@ -899,7 +899,7 @@ else:
   <widget type="textupdate" version="2.0.0">
     <name>Text Update_10</name>
     <pv_name>${PP}:ScTable-Sts</pv_name>
-    <x>503</x>
+    <x>502</x>
     <y>367</y>
     <width>120</width>
     <height>30</height>
@@ -952,7 +952,7 @@ else:
   </widget>
   <widget type="label" version="2.0.0">
     <name>MGGrey03-title_29</name>
-    <text>Timimng Engine</text>
+    <text>Timing Engine</text>
     <x>743</x>
     <y>105</y>
     <width>306</width>
diff --git a/99-Shared/Beam_OLC/em_intCurrent.bob b/99-Shared/Beam_OLC/em_intCurrent.bob
index ae0bdec0..88f6796e 100755
--- a/99-Shared/Beam_OLC/em_intCurrent.bob
+++ b/99-Shared/Beam_OLC/em_intCurrent.bob
@@ -22,7 +22,7 @@
   <widget type="label" version="2.0.0">
     <name>BGGrey02-title_45</name>
     <class>HEADER2</class>
-    <text>Used Integrated Currents</text>
+    <text>Integrated Beam Current Budget Used</text>
     <width>430</width>
     <height>50</height>
     <font use_class="true">
-- 
GitLab


From 2f13f357b700ad23da1e6aa17fff5174651f987c Mon Sep 17 00:00:00 2001
From: arek <arek.gorzawski@ess.eu>
Date: Tue, 2 Nov 2021 20:44:14 +0100
Subject: [PATCH 05/18] forgotten old label - deleted

---
 10-Top/beamprod.bob | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/10-Top/beamprod.bob b/10-Top/beamprod.bob
index ba04764b..7d73929c 100644
--- a/10-Top/beamprod.bob
+++ b/10-Top/beamprod.bob
@@ -924,14 +924,6 @@ else:
       </script>
     </scripts>
   </widget>
-  <widget type="label" version="2.0.0">
-    <name>Label</name>
-    <text>Loaded Table State:</text>
-    <x>145</x>
-    <y>990</y>
-    <width>148</width>
-    <height>30</height>
-  </widget>
   <widget type="rectangle" version="2.0.0">
     <name>MGGrey03-background_13</name>
     <x>743</x>
-- 
GitLab


From bf0cc4d9ef41192059dfd21bd180c572a611f102 Mon Sep 17 00:00:00 2001
From: arek <arek.gorzawski@ess.eu>
Date: Fri, 12 Nov 2021 21:20:59 +0100
Subject: [PATCH 06/18] magnetron ON/OFF button added

---
 10-Top/beamprod.bob | 45 ++++++++++++++++++++++++++++++++++++---------
 1 file changed, 36 insertions(+), 9 deletions(-)

diff --git a/10-Top/beamprod.bob b/10-Top/beamprod.bob
index 7d73929c..e8aa01f7 100644
--- a/10-Top/beamprod.bob
+++ b/10-Top/beamprod.bob
@@ -16,7 +16,7 @@
     <x>40</x>
     <y>74</y>
     <width>1152</width>
-    <height>376</height>
+    <height>436</height>
     <line_width>2</line_width>
     <line_color>
       <color name="GROUP-BORDER" red="150" green="155" blue="151">
@@ -621,8 +621,8 @@ except Exception:
         </children>
       </tab>
     </tabs>
-    <x>10</x>
-    <y>459</y>
+    <x>9</x>
+    <y>520</y>
     <width>1210</width>
     <height>420</height>
     <direction>1</direction>
@@ -832,7 +832,7 @@ else:
     <x>69</x>
     <y>274</y>
     <width>574</width>
-    <height>155</height>
+    <height>216</height>
     <line_width>2</line_width>
     <line_color>
       <color name="GROUP-BORDER" red="150" green="155" blue="151">
@@ -997,7 +997,7 @@ else:
   </widget>
   <widget type="label" version="2.0.0">
     <name>Label_8</name>
-    <text>Nb. of cycles executed while BeamON:</text>
+    <text>Nb. of cycles executed while Beam ON:</text>
     <x>760</x>
     <y>224</y>
     <width>275</width>
@@ -1008,7 +1008,7 @@ else:
     <name>Text Update</name>
     <pv_name>${PP}:CycleOnCnt</pv_name>
     <x>760</x>
-    <y>254</y>
+    <y>252</y>
     <height>30</height>
     <font>
       <font family="Source Sans Pro" style="BOLD" size="16.0">
@@ -1019,7 +1019,7 @@ else:
     <name>Label_18</name>
     <text>Cycle ID of the last pulse with Beam ON</text>
     <x>760</x>
-    <y>284</y>
+    <y>287</y>
     <width>275</width>
     <height>30</height>
     <tooltip>With magnetron events enabled.</tooltip>
@@ -1057,7 +1057,7 @@ else:
     <name>LED_1</name>
     <pv_name>FBIS::beam_permit_ok</pv_name>
     <x>770</x>
-    <y>393</y>
+    <y>392</y>
     <width>30</width>
     <height>30</height>
     <off_color>
@@ -1070,7 +1070,7 @@ else:
     <name>MGGrey03-title_30</name>
     <text>FBIS Global Beam Permit</text>
     <x>812</x>
-    <y>381</y>
+    <y>380</y>
     <width>212</width>
     <height>50</height>
     <font>
@@ -1164,4 +1164,31 @@ else:
       </script>
     </scripts>
   </widget>
+  <widget type="rectangle" version="2.0.0">
+    <name>MGGrey03-background_16</name>
+    <x>743</x>
+    <y>440</y>
+    <width>308</width>
+    <height>50</height>
+    <line_width>2</line_width>
+    <line_color>
+      <color name="GROUP-BORDER" red="150" green="155" blue="151">
+      </color>
+    </line_color>
+    <background_color>
+      <color name="GROUP-BACKGROUND" red="200" green="205" blue="201">
+      </color>
+    </background_color>
+    <corner_width>10</corner_width>
+    <corner_height>10</corner_height>
+  </widget>
+  <widget type="bool_button" version="2.0.0">
+    <name>Boolean Button_1</name>
+    <pv_name>ISrc-CS:ISS-Magtr-01:Mw-S</pv_name>
+    <x>782</x>
+    <y>450</y>
+    <width>225</width>
+    <off_label>Magnetron</off_label>
+    <on_label>Magnetron</on_label>
+  </widget>
 </display>
-- 
GitLab


From 9da1f484f9c4c1dc6051aa21fd66bb45a75895a9 Mon Sep 17 00:00:00 2001
From: arek <arek.gorzawski@ess.eu>
Date: Fri, 12 Nov 2021 21:27:56 +0100
Subject: [PATCH 07/18] Fixed the colors and the indicators

---
 10-Top/beamprod.bob | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/10-Top/beamprod.bob b/10-Top/beamprod.bob
index e8aa01f7..44b9e6bf 100644
--- a/10-Top/beamprod.bob
+++ b/10-Top/beamprod.bob
@@ -1125,13 +1125,13 @@ else:
     <off_label>Switch
  Beam ON</off_label>
     <off_color>
-      <color name="Button_Background" red="236" green="236" blue="236">
+      <color name="OFF" red="90" green="110" blue="90">
       </color>
     </off_color>
     <on_label>Switch
  Beam OFF</on_label>
     <on_color>
-      <color name="PRIMARY" red="0" green="148" blue="202">
+      <color name="On" red="70" green="255" blue="70">
       </color>
     </on_color>
     <show_led>false</show_led>
@@ -1185,10 +1185,27 @@ else:
   <widget type="bool_button" version="2.0.0">
     <name>Boolean Button_1</name>
     <pv_name>ISrc-CS:ISS-Magtr-01:Mw-S</pv_name>
-    <x>782</x>
+    <x>812</x>
     <y>450</y>
-    <width>225</width>
+    <width>195</width>
     <off_label>Magnetron</off_label>
     <on_label>Magnetron</on_label>
+    <font>
+      <font family="Source Sans Pro" style="BOLD" size="16.0">
+      </font>
+    </font>
+  </widget>
+  <widget type="led" version="2.0.0">
+    <name>LED_2</name>
+    <pv_name>ISrc-CS:ISS-Magtr-01:Mw-S</pv_name>
+    <x>770</x>
+    <y>450</y>
+    <width>30</width>
+    <height>30</height>
+    <off_color>
+      <color name="OFF" red="90" green="110" blue="90">
+      </color>
+    </off_color>
+    <square>true</square>
   </widget>
 </display>
-- 
GitLab


From 104f3d62f326f78921cb848e7eae7421345e7082 Mon Sep 17 00:00:00 2001
From: arek <arek.gorzawski@ess.eu>
Date: Fri, 12 Nov 2021 21:40:45 +0100
Subject: [PATCH 08/18] timing status indicator

---
 10-Top/beamprod.bob | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/10-Top/beamprod.bob b/10-Top/beamprod.bob
index 44b9e6bf..cfb9b1f5 100644
--- a/10-Top/beamprod.bob
+++ b/10-Top/beamprod.bob
@@ -959,14 +959,14 @@ else:
   <widget type="label" version="2.0.0">
     <name>Label_20</name>
     <text>Expected Beam Presence</text>
-    <x>852</x>
+    <x>863</x>
     <y>155</y>
     <width>170</width>
   </widget>
   <widget type="textupdate" version="2.0.0">
     <name>Text Update_11</name>
     <pv_name>${PP}:BState-Sts</pv_name>
-    <x>762</x>
+    <x>764</x>
     <y>183</y>
     <width>98</width>
     <height>30</height>
@@ -978,7 +978,7 @@ else:
   <widget type="textupdate" version="2.0.0">
     <name>Text Update_12</name>
     <pv_name>${PP}:BPresent-Sts</pv_name>
-    <x>924</x>
+    <x>938</x>
     <y>183</y>
     <width>81</width>
     <height>30</height>
@@ -990,7 +990,7 @@ else:
   <widget type="label" version="2.0.0">
     <name>Label_19</name>
     <text>Status </text>
-    <x>760</x>
+    <x>784</x>
     <y>156</y>
     <width>164</width>
     <height>30</height>
@@ -1007,8 +1007,8 @@ else:
   <widget type="textupdate" version="2.0.0">
     <name>Text Update</name>
     <pv_name>${PP}:CycleOnCnt</pv_name>
-    <x>760</x>
-    <y>252</y>
+    <x>920</x>
+    <y>254</y>
     <height>30</height>
     <font>
       <font family="Source Sans Pro" style="BOLD" size="16.0">
@@ -1027,8 +1027,8 @@ else:
   <widget type="textupdate" version="2.0.0">
     <name>Text Update_1</name>
     <pv_name>${PP}:LastBeamOnCycleId</pv_name>
-    <x>760</x>
-    <y>314</y>
+    <x>920</x>
+    <y>317</y>
     <height>30</height>
     <font>
       <font family="Source Sans Pro" style="BOLD" size="16.0">
@@ -1190,6 +1190,7 @@ else:
     <width>195</width>
     <off_label>Magnetron</off_label>
     <on_label>Magnetron</on_label>
+    <show_led>false</show_led>
     <font>
       <font family="Source Sans Pro" style="BOLD" size="16.0">
       </font>
@@ -1208,4 +1209,17 @@ else:
     </off_color>
     <square>true</square>
   </widget>
+  <widget type="led" version="2.0.0">
+    <name>LED_3</name>
+    <pv_name>${PP}:BState-Sts</pv_name>
+    <x>770</x>
+    <y>117</y>
+    <width>30</width>
+    <height>30</height>
+    <off_color>
+      <color name="OFF" red="90" green="110" blue="90">
+      </color>
+    </off_color>
+    <square>true</square>
+  </widget>
 </display>
-- 
GitLab


From 83ba2ee81bf4dd67acb8390e559fca4360a45176 Mon Sep 17 00:00:00 2001
From: arek <arek.gorzawski@ess.eu>
Date: Sat, 13 Nov 2021 17:31:52 +0100
Subject: [PATCH 09/18] - re-aranged tabs - added events readout - hide debug

---
 10-Top/beamprod.bob | 700 +++++++++++++++++++++++++-------------------
 1 file changed, 405 insertions(+), 295 deletions(-)

diff --git a/10-Top/beamprod.bob b/10-Top/beamprod.bob
index cfb9b1f5..313d7227 100644
--- a/10-Top/beamprod.bob
+++ b/10-Top/beamprod.bob
@@ -10,11 +10,11 @@
   </macros>
   <x>20</x>
   <width>1230</width>
-  <height>890</height>
+  <height>970</height>
   <widget type="rectangle" version="2.0.0">
     <name>BGGrey01-titlebar_3</name>
-    <x>40</x>
-    <y>74</y>
+    <x>26</x>
+    <y>73</y>
     <width>1152</width>
     <height>436</height>
     <line_width>2</line_width>
@@ -66,8 +66,8 @@
   <widget type="label" version="2.0.0">
     <name>ActiveSetupTitle</name>
     <text>Active Setup</text>
-    <x>69</x>
-    <y>74</y>
+    <x>55</x>
+    <y>73</y>
     <width>1100</width>
     <height>30</height>
     <font>
@@ -89,9 +89,10 @@
         <children>
           <widget type="rectangle" version="2.0.0">
             <name>BGGrey01-titlebar</name>
+            <x>12</x>
             <y>8</y>
             <width>922</width>
-            <height>400</height>
+            <height>410</height>
             <line_width>2</line_width>
             <line_color>
               <color name="GROUP-BORDER" red="150" green="155" blue="151">
@@ -107,7 +108,7 @@
           <widget type="label" version="2.0.0">
             <name>BGGrey01-title</name>
             <text>Available Timing Tables</text>
-            <x>18</x>
+            <x>30</x>
             <y>13</y>
             <width>890</width>
             <height>30</height>
@@ -124,14 +125,18 @@
           </widget>
           <widget type="polygon" version="2.0.0">
             <name>Polygon</name>
-            <x>1038</x>
-            <y>44</y>
-            <width>1</width>
-            <height>1</height>
+            <x>-193</x>
+            <y>-442</y>
+            <width>193</width>
+            <height>442</height>
+            <points>
+              <point x="0.0" y="0.0">
+              </point>
+            </points>
           </widget>
           <widget type="table" version="2.0.0">
             <name>tt_names</name>
-            <x>23</x>
+            <x>35</x>
             <y>136</y>
             <width>880</width>
             <height>262</height>
@@ -195,7 +200,7 @@ PVUtil.writePV(pvToWrite.getName(), PVUtil.getString(pvToRead), 5000)
                 <description>Load table from selected</description>
               </action>
             </actions>
-            <x>653</x>
+            <x>665</x>
             <y>62</y>
             <width>247</width>
             <height>55</height>
@@ -217,7 +222,7 @@ PVUtil.writePV(pvToWrite.getName(), PVUtil.getString(pvToRead), 5000)
           </widget>
           <widget type="rectangle" version="2.0.0">
             <name>BGGrey01-titlebar_1</name>
-            <x>936</x>
+            <x>948</x>
             <y>8</y>
             <width>215</width>
             <height>400</height>
@@ -236,7 +241,7 @@ PVUtil.writePV(pvToWrite.getName(), PVUtil.getString(pvToRead), 5000)
           <widget type="label" version="2.0.0">
             <name>BGGrey01-title_1</name>
             <text>Add New Table</text>
-            <x>952</x>
+            <x>964</x>
             <y>22</y>
             <width>190</width>
             <font>
@@ -253,7 +258,7 @@ PVUtil.writePV(pvToWrite.getName(), PVUtil.getString(pvToRead), 5000)
           <widget type="fileselector" version="2.0.0">
             <name>File Selector_NewTT</name>
             <pv_name>loc://pathNewFile("")</pv_name>
-            <x>955</x>
+            <x>967</x>
             <y>259</y>
             <width>170</width>
             <height>30</height>
@@ -310,7 +315,7 @@ print "=======> File Conversion  DONE<========"]]></text>
           <widget type="label" version="2.0.0">
             <name>Label_13</name>
             <text>Target Beam Mode</text>
-            <x>980</x>
+            <x>992</x>
             <y>66</y>
             <width>129</width>
             <horizontal_alignment>1</horizontal_alignment>
@@ -318,7 +323,7 @@ print "=======> File Conversion  DONE<========"]]></text>
           <widget type="label" version="2.0.0">
             <name>Label_14</name>
             <text>File Name Comment</text>
-            <x>978</x>
+            <x>990</x>
             <y>134</y>
             <width>139</width>
             <horizontal_alignment>1</horizontal_alignment>
@@ -326,7 +331,7 @@ print "=======> File Conversion  DONE<========"]]></text>
           <widget type="textentry" version="3.0.0">
             <name>Text Entry</name>
             <pv_name>$(P):$(R):TTMetaFileName</pv_name>
-            <x>956</x>
+            <x>968</x>
             <y>159</y>
             <width>171</width>
             <height>30</height>
@@ -335,7 +340,7 @@ print "=======> File Conversion  DONE<========"]]></text>
           <widget type="label" version="2.0.0">
             <name>Label_15</name>
             <text>Select file to upload</text>
-            <x>961</x>
+            <x>973</x>
             <y>231</y>
             <width>139</width>
             <horizontal_alignment>1</horizontal_alignment>
@@ -343,7 +348,7 @@ print "=======> File Conversion  DONE<========"]]></text>
           <widget type="textentry" version="3.0.0">
             <name>Text Entry_1</name>
             <pv_name>$(P):$(R):TTMetaBeamMode</pv_name>
-            <x>956</x>
+            <x>968</x>
             <y>93</y>
             <width>171</width>
             <height>30</height>
@@ -352,7 +357,7 @@ print "=======> File Conversion  DONE<========"]]></text>
           <widget type="textupdate" version="2.0.0">
             <name>Text Update_9</name>
             <pv_name>$(P):$(R):TTSaveStatus</pv_name>
-            <x>956</x>
+            <x>968</x>
             <y>332</y>
             <width>170</width>
             <height>30</height>
@@ -360,14 +365,14 @@ print "=======> File Conversion  DONE<========"]]></text>
           <widget type="label" version="2.0.0">
             <name>Label_21</name>
             <text>Upload status:</text>
-            <x>968</x>
+            <x>980</x>
             <y>307</y>
             <width>139</width>
             <horizontal_alignment>1</horizontal_alignment>
           </widget>
           <widget type="rectangle" version="2.0.0">
             <name>MGGrey03-background_15</name>
-            <x>21</x>
+            <x>33</x>
             <y>53</y>
             <width>607</width>
             <height>71</height>
@@ -383,176 +388,64 @@ print "=======> File Conversion  DONE<========"]]></text>
             <corner_width>10</corner_width>
             <corner_height>10</corner_height>
           </widget>
-          <widget type="textupdate" version="2.0.0">
-            <name>Text Update_4</name>
-            <pv_name>$(PP):ScTableDir-SP</pv_name>
-            <x>51</x>
-            <y>75</y>
-            <width>270</width>
+          <widget type="label" version="2.0.0">
+            <name>Label_17</name>
+            <text>Timing Tables source</text>
+            <x>76</x>
+            <y>74</y>
+            <width>170</width>
             <height>30</height>
             <font>
-              <font family="Source Sans Pro" style="BOLD" size="16.0">
+              <font family="Source Sans Pro" style="BOLD" size="18.0">
               </font>
             </font>
           </widget>
-          <widget type="combo" version="2.0.0">
-            <name>Combo Box</name>
-            <pv_name>$(P):$(R):TTSource</pv_name>
-            <x>339</x>
-            <y>74</y>
-            <width>258</width>
-            <enabled>false</enabled>
+          <widget type="textentry" version="3.0.0">
+            <name>Text Entry_2</name>
+            <pv_name>$(PP):ScTableDir-SP</pv_name>
+            <x>270</x>
+            <y>75</y>
+            <width>309</width>
+            <height>30</height>
           </widget>
         </children>
       </tab>
       <tab>
-        <name>Debug</name>
+        <name>Active Timing Table</name>
         <children>
-          <widget type="group" version="2.0.0">
-            <name>For debugging, To HIDE for OPS, IMPORTANT NOT TO DELETE!</name>
-            <x>19</x>
-            <y>36</y>
-            <width>691</width>
-            <height>150</height>
-            <foreground_color>
-              <color name="TEXT" red="25" green="25" blue="25">
+          <widget type="rectangle" version="2.0.0">
+            <name>BGGrey01-titlebar_5</name>
+            <x>13</x>
+            <y>7</y>
+            <width>1154</width>
+            <height>390</height>
+            <line_width>2</line_width>
+            <line_color>
+              <color name="GROUP-BORDER" red="150" green="155" blue="151">
               </color>
-            </foreground_color>
-            <widget type="textupdate" version="2.0.0">
-              <name>selectedRowProcessed</name>
-              <pv_name>loc://processedvalue</pv_name>
-              <x>193</x>
-              <y>32</y>
-              <width>430</width>
-              <scripts>
-                <script file="EmbeddedPy">
-                  <text><![CDATA[# Process the seleceted row in the table and update the local PV with the actual content
-# Based on the initial proof of concept from Georg
-# TODO find a nicer way to get value part not that ugly index find and /split...
-
-from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil
-try:
-    stringTagToLookFor = "Name: "  #TODO this is related with the table header, should not be!
-    index = PVUtil.getString(pvs[0]).find(stringTagToLookFor)
-    index = index + len(stringTagToLookFor)
-    pvValue = PVUtil.getString(pvs[0])[index:].split(',')[0]
-    pvs[1].setValue(pvValue)
-except Exception:
-    pvs[1].setValue('UNDEFINED')]]></text>
-                  <pv_name>loc://value</pv_name>
-                  <pv_name trigger="false">loc://processedvalue</pv_name>
-                </script>
-              </scripts>
-            </widget>
-            <widget type="textupdate" version="2.0.0">
-              <name>RawFilesArray</name>
-              <pv_name>$(PP):ScTables-I</pv_name>
-              <x>193</x>
-              <y>54</y>
-              <width>430</width>
-            </widget>
-            <widget type="textupdate" version="2.0.0">
-              <name>selectedRowRaw</name>
-              <pv_name>loc://value</pv_name>
-              <x>193</x>
-              <y>9</y>
-              <width>430</width>
-            </widget>
-            <widget type="label" version="2.0.0">
-              <name>Label_4</name>
-              <text>Original PV with file names</text>
-              <x>3</x>
-              <y>54</y>
-              <width>197</width>
-            </widget>
-            <widget type="label" version="2.0.0">
-              <name>Label_5</name>
-              <text>Selected table element</text>
-              <x>13</x>
-              <y>9</y>
-              <width>170</width>
-            </widget>
-            <widget type="label" version="2.0.0">
-              <name>Label_6</name>
-              <text>Script processed value</text>
-              <x>13</x>
-              <y>29</y>
-              <width>187</width>
-            </widget>
-            <widget type="label" version="2.0.0">
-              <name>Label_7</name>
-              <text>Selected NEW table file</text>
-              <x>11</x>
-              <y>91</y>
-              <width>170</width>
-            </widget>
-            <widget type="textupdate" version="2.0.0">
-              <name>selectedRowRaw_1</name>
-              <pv_name>loc://pathNewFile</pv_name>
-              <x>191</x>
-              <y>91</y>
-              <width>430</width>
-            </widget>
-          </widget>
-          <widget type="textupdate" version="2.0.0">
-            <name>Text Update_5</name>
-            <pv_name>${PP}:SwVer-I</pv_name>
-            <x>256</x>
-            <y>358</y>
-            <width>115</width>
-            <font>
-              <font family="Source Sans Pro" style="BOLD" size="12.0">
-              </font>
-            </font>
-          </widget>
-          <widget type="label" version="2.0.0">
-            <name>Label_9</name>
-            <text>SCE engine version:</text>
-            <x>107</x>
-            <y>358</y>
-            <width>112</width>
-            <height>22</height>
-            <font>
-              <font family="Source Sans Pro" style="REGULAR" size="12.0">
-              </font>
-            </font>
-          </widget>
-          <widget type="label" version="2.0.0">
-            <name>Label_16</name>
-            <text>BeamProduction version:</text>
-            <x>106</x>
-            <y>328</y>
-            <width>150</width>
-            <font>
-              <font family="Source Sans Pro" style="REGULAR" size="12.0">
-              </font>
-            </font>
-          </widget>
-          <widget type="textupdate" version="2.0.0">
-            <name>Text Update_7</name>
-            <pv_name>$(P):$(R):Ver</pv_name>
-            <x>256</x>
-            <y>328</y>
-            <width>114</width>
-            <font>
-              <font family="Source Sans Pro" style="REGULAR" size="12.0">
-              </font>
-            </font>
+            </line_color>
+            <background_color>
+              <color name="GROUP-BORDER" red="150" green="155" blue="151">
+              </color>
+            </background_color>
+            <corner_width>10</corner_width>
+            <corner_height>10</corner_height>
           </widget>
           <widget type="led" version="2.0.0">
             <name>LED</name>
             <pv_name>$(PP):BState-Sel</pv_name>
             <bit>0</bit>
-            <x>221</x>
-            <y>268</y>
+            <x>222</x>
+            <y>26</y>
             <width>27</width>
             <height>28</height>
+            <square>true</square>
           </widget>
           <widget type="label" version="2.0.0">
             <name>Label_11</name>
             <text>Beam Production:</text>
-            <x>51</x>
-            <y>268</y>
+            <x>52</x>
+            <y>26</y>
             <width>170</width>
             <height>30</height>
             <font>
@@ -560,25 +453,84 @@ except Exception:
               </font>
             </font>
           </widget>
-          <widget type="textentry" version="3.0.0">
-            <name>Text Entry_2</name>
-            <pv_name>$(PP):ScTableDir-SP</pv_name>
-            <x>252</x>
-            <y>218</y>
-            <width>309</width>
-            <height>30</height>
+          <widget type="xyplot" version="2.0.0">
+            <name>X/Y Plot_1</name>
+            <x>39</x>
+            <y>148</y>
+            <width>1097</width>
+            <height>210</height>
+            <x_axis>
+              <title>event positon within the pulse[us]</title>
+              <autoscale>false</autoscale>
+              <log_scale>false</log_scale>
+              <minimum>0.0</minimum>
+              <maximum>70000.0</maximum>
+              <show_grid>false</show_grid>
+              <title_font>
+                <font family="Source Sans Pro" style="REGULAR" size="16.0">
+                </font>
+              </title_font>
+              <scale_font>
+                <font name="Default" family="Source Sans Pro" style="REGULAR" size="16.0">
+                </font>
+              </scale_font>
+              <visible>true</visible>
+            </x_axis>
+            <y_axes>
+              <y_axis>
+                <title>[arb.units]</title>
+                <autoscale>false</autoscale>
+                <log_scale>false</log_scale>
+                <minimum>0.0</minimum>
+                <maximum>2.0</maximum>
+                <show_grid>false</show_grid>
+                <title_font>
+                  <font name="Default Bold" family="Source Sans Pro" style="BOLD" size="16.0">
+                  </font>
+                </title_font>
+                <scale_font>
+                  <font name="Default" family="Source Sans Pro" style="REGULAR" size="16.0">
+                  </font>
+                </scale_font>
+                <visible>true</visible>
+              </y_axis>
+            </y_axes>
+            <traces>
+              <trace>
+                <name>$(traces[0].y_pv)</name>
+                <x_pv>loc://eventTimestamps</x_pv>
+                <y_pv>loc://eventMagnitude</y_pv>
+                <err_pv></err_pv>
+                <axis>0</axis>
+                <trace_type>2</trace_type>
+                <color>
+                  <color red="0" green="0" blue="255">
+                  </color>
+                </color>
+                <line_width>1</line_width>
+                <line_style>0</line_style>
+                <point_type>1</point_type>
+                <point_size>10</point_size>
+                <visible>true</visible>
+              </trace>
+            </traces>
           </widget>
           <widget type="label" version="2.0.0">
-            <name>Label_17</name>
-            <text>Timing Tables source</text>
-            <x>58</x>
-            <y>218</y>
-            <width>170</width>
+            <name>Label_23</name>
+            <text>TS</text>
+            <x>52</x>
+            <y>88</y>
+            <width>70</width>
             <height>30</height>
-            <font>
-              <font family="Source Sans Pro" style="BOLD" size="18.0">
-              </font>
-            </font>
+          </widget>
+          <widget type="textupdate" version="2.0.0">
+            <name>ActiveEvents_1</name>
+            <pv_name>loc://eventTimestamps</pv_name>
+            <x>109</x>
+            <y>88</y>
+            <width>479</width>
+            <height>30</height>
+            <show_units>false</show_units>
           </widget>
         </children>
       </tab>
@@ -621,11 +573,10 @@ except Exception:
         </children>
       </tab>
     </tabs>
-    <x>9</x>
-    <y>520</y>
-    <width>1210</width>
-    <height>420</height>
-    <direction>1</direction>
+    <x>11</x>
+    <y>510</y>
+    <width>1195</width>
+    <height>450</height>
     <tab_height>40</tab_height>
   </widget>
   <widget type="action_button" version="3.0.0">
@@ -648,8 +599,8 @@ PVUtil.writePV("BPROD:Ops:BProdStop", "0", 5000)
         <description>ABORT BEAM and load no events</description>
       </action>
     </actions>
-    <x>1070</x>
-    <y>216</y>
+    <x>1056</x>
+    <y>215</y>
     <width>102</width>
     <height>103</height>
     <font>
@@ -667,16 +618,16 @@ PVUtil.writePV("BPROD:Ops:BProdStop", "0", 5000)
     <symbols>
       <symbol>../99-Shared/BeamProd/arrow.png</symbol>
     </symbols>
-    <x>643</x>
-    <y>134</y>
+    <x>629</x>
+    <y>133</y>
   </widget>
   <widget type="symbol" version="2.0.0">
     <name>Mode_Arr_solid</name>
     <symbols>
       <symbol>../99-Shared/BeamProd/arrow-solid.png</symbol>
     </symbols>
-    <x>641</x>
-    <y>134</y>
+    <x>627</x>
+    <y>133</y>
     <visible>false</visible>
   </widget>
   <widget type="symbol" version="2.0.0">
@@ -684,22 +635,22 @@ PVUtil.writePV("BPROD:Ops:BProdStop", "0", 5000)
     <symbols>
       <symbol>../99-Shared/BeamProd/arrow.png</symbol>
     </symbols>
-    <x>643</x>
-    <y>302</y>
+    <x>629</x>
+    <y>301</y>
   </widget>
   <widget type="symbol" version="2.0.0">
     <name>Table_Arr_solid</name>
     <symbols>
       <symbol>../99-Shared/BeamProd/arrow-solid.png</symbol>
     </symbols>
-    <x>641</x>
-    <y>302</y>
+    <x>627</x>
+    <y>301</y>
     <visible>false</visible>
   </widget>
   <widget type="rectangle" version="2.0.0">
     <name>MGGrey03-background_11</name>
-    <x>69</x>
-    <y>104</y>
+    <x>55</x>
+    <y>103</y>
     <width>572</width>
     <height>156</height>
     <line_width>2</line_width>
@@ -717,8 +668,8 @@ PVUtil.writePV("BPROD:Ops:BProdStop", "0", 5000)
   <widget type="label" version="2.0.0">
     <name>MGGrey03-title_27</name>
     <text>Mode &amp; Destination</text>
-    <x>78</x>
-    <y>104</y>
+    <x>64</x>
+    <y>103</y>
     <width>439</width>
     <height>40</height>
     <font>
@@ -730,8 +681,8 @@ PVUtil.writePV("BPROD:Ops:BProdStop", "0", 5000)
   </widget>
   <widget type="rectangle" version="2.0.0">
     <name>NotAllowedCombination</name>
-    <x>94</x>
-    <y>138</y>
+    <x>80</x>
+    <y>137</y>
     <width>389</width>
     <height>116</height>
     <visible>false</visible>
@@ -760,22 +711,22 @@ else:
   <widget type="label" version="2.0.0">
     <name>Label_2</name>
     <text>Proton Beam Mode</text>
-    <x>109</x>
-    <y>145</y>
+    <x>95</x>
+    <y>144</y>
     <width>170</width>
   </widget>
   <widget type="label" version="2.0.0">
     <name>Label_3</name>
     <text>Proton Beam Destination</text>
-    <x>304</x>
-    <y>145</y>
+    <x>290</x>
+    <y>144</y>
     <width>170</width>
   </widget>
   <widget type="textupdate" version="2.0.0">
     <name>ActualPBMode</name>
     <pv_name>$(PP):BMod-Sel</pv_name>
-    <x>102</x>
-    <y>172</y>
+    <x>88</x>
+    <y>171</y>
     <width>168</width>
     <height>30</height>
     <font>
@@ -786,8 +737,8 @@ else:
   <widget type="textupdate" version="2.0.0">
     <name>ActualPBDestination</name>
     <pv_name>$(PP):BDest-Sel</pv_name>
-    <x>305</x>
-    <y>172</y>
+    <x>291</x>
+    <y>171</y>
     <width>168</width>
     <height>30</height>
     <font>
@@ -798,8 +749,8 @@ else:
   <widget type="combo" version="2.0.0">
     <name>selectPBMode</name>
     <pv_name>$(P):$(R):BMode</pv_name>
-    <x>101</x>
-    <y>210</y>
+    <x>87</x>
+    <y>209</y>
     <width>170</width>
     <actions>
     </actions>
@@ -823,14 +774,14 @@ else:
   <widget type="combo" version="2.0.0">
     <name>selectPBDestination</name>
     <pv_name>$(P):$(R):BDestination</pv_name>
-    <x>305</x>
-    <y>210</y>
+    <x>291</x>
+    <y>209</y>
     <width>170</width>
   </widget>
   <widget type="rectangle" version="2.0.0">
     <name>MGGrey03-background_12</name>
-    <x>69</x>
-    <y>274</y>
+    <x>55</x>
+    <y>273</y>
     <width>574</width>
     <height>216</height>
     <line_width>2</line_width>
@@ -848,8 +799,8 @@ else:
   <widget type="label" version="2.0.0">
     <name>MGGrey03-title_28</name>
     <text>Loaded Table</text>
-    <x>78</x>
-    <y>274</y>
+    <x>64</x>
+    <y>273</y>
     <width>440</width>
     <height>40</height>
     <font>
@@ -862,16 +813,16 @@ else:
   <widget type="textupdate" version="2.0.0">
     <name>Text Update_3</name>
     <pv_name>$(PP):ScTableDir-RB</pv_name>
-    <x>144</x>
-    <y>323</y>
+    <x>130</x>
+    <y>322</y>
     <width>345</width>
     <height>30</height>
   </widget>
   <widget type="textupdate" version="2.0.0">
     <name>ActualLoadedTT</name>
     <pv_name>$(PP):ScTable-RB</pv_name>
-    <x>143</x>
-    <y>367</y>
+    <x>129</x>
+    <y>361</y>
     <width>345</width>
     <height>30</height>
     <font>
@@ -883,24 +834,24 @@ else:
   <widget type="label" version="2.0.0">
     <name>Label_10</name>
     <text>Name:</text>
-    <x>86</x>
-    <y>367</y>
+    <x>72</x>
+    <y>361</y>
     <width>70</width>
     <height>30</height>
   </widget>
   <widget type="label" version="2.0.0">
     <name>Label_12</name>
     <text>Source:</text>
-    <x>87</x>
-    <y>324</y>
+    <x>73</x>
+    <y>323</y>
     <width>70</width>
     <height>30</height>
   </widget>
   <widget type="textupdate" version="2.0.0">
     <name>Text Update_10</name>
     <pv_name>${PP}:ScTable-Sts</pv_name>
-    <x>502</x>
-    <y>367</y>
+    <x>488</x>
+    <y>361</y>
     <width>120</width>
     <height>30</height>
     <font>
@@ -926,8 +877,8 @@ else:
   </widget>
   <widget type="rectangle" version="2.0.0">
     <name>MGGrey03-background_13</name>
-    <x>743</x>
-    <y>105</y>
+    <x>729</x>
+    <y>104</y>
     <width>306</width>
     <height>265</height>
     <line_width>2</line_width>
@@ -945,8 +896,8 @@ else:
   <widget type="label" version="2.0.0">
     <name>MGGrey03-title_29</name>
     <text>Timing Engine</text>
-    <x>743</x>
-    <y>105</y>
+    <x>729</x>
+    <y>104</y>
     <width>306</width>
     <height>40</height>
     <font>
@@ -959,15 +910,15 @@ else:
   <widget type="label" version="2.0.0">
     <name>Label_20</name>
     <text>Expected Beam Presence</text>
-    <x>863</x>
-    <y>155</y>
+    <x>849</x>
+    <y>154</y>
     <width>170</width>
   </widget>
   <widget type="textupdate" version="2.0.0">
     <name>Text Update_11</name>
     <pv_name>${PP}:BState-Sts</pv_name>
-    <x>764</x>
-    <y>183</y>
+    <x>750</x>
+    <y>182</y>
     <width>98</width>
     <height>30</height>
     <font>
@@ -978,8 +929,8 @@ else:
   <widget type="textupdate" version="2.0.0">
     <name>Text Update_12</name>
     <pv_name>${PP}:BPresent-Sts</pv_name>
-    <x>938</x>
-    <y>183</y>
+    <x>924</x>
+    <y>182</y>
     <width>81</width>
     <height>30</height>
     <font>
@@ -990,16 +941,16 @@ else:
   <widget type="label" version="2.0.0">
     <name>Label_19</name>
     <text>Status </text>
-    <x>784</x>
-    <y>156</y>
+    <x>770</x>
+    <y>155</y>
     <width>164</width>
     <height>30</height>
   </widget>
   <widget type="label" version="2.0.0">
     <name>Label_8</name>
     <text>Nb. of cycles executed while Beam ON:</text>
-    <x>760</x>
-    <y>224</y>
+    <x>746</x>
+    <y>223</y>
     <width>275</width>
     <height>30</height>
     <tooltip>With magnetron events enabled.</tooltip>
@@ -1007,28 +958,8 @@ else:
   <widget type="textupdate" version="2.0.0">
     <name>Text Update</name>
     <pv_name>${PP}:CycleOnCnt</pv_name>
-    <x>920</x>
-    <y>254</y>
-    <height>30</height>
-    <font>
-      <font family="Source Sans Pro" style="BOLD" size="16.0">
-      </font>
-    </font>
-  </widget>
-  <widget type="label" version="2.0.0">
-    <name>Label_18</name>
-    <text>Cycle ID of the last pulse with Beam ON</text>
-    <x>760</x>
-    <y>287</y>
-    <width>275</width>
-    <height>30</height>
-    <tooltip>With magnetron events enabled.</tooltip>
-  </widget>
-  <widget type="textupdate" version="2.0.0">
-    <name>Text Update_1</name>
-    <pv_name>${PP}:LastBeamOnCycleId</pv_name>
-    <x>920</x>
-    <y>317</y>
+    <x>906</x>
+    <y>253</y>
     <height>30</height>
     <font>
       <font family="Source Sans Pro" style="BOLD" size="16.0">
@@ -1037,8 +968,8 @@ else:
   </widget>
   <widget type="rectangle" version="2.0.0">
     <name>MGGrey03-background_14</name>
-    <x>743</x>
-    <y>381</y>
+    <x>729</x>
+    <y>380</y>
     <width>308</width>
     <height>50</height>
     <line_width>2</line_width>
@@ -1056,8 +987,8 @@ else:
   <widget type="led" version="2.0.0">
     <name>LED_1</name>
     <pv_name>FBIS::beam_permit_ok</pv_name>
-    <x>770</x>
-    <y>392</y>
+    <x>756</x>
+    <y>391</y>
     <width>30</width>
     <height>30</height>
     <off_color>
@@ -1069,8 +1000,8 @@ else:
   <widget type="label" version="2.0.0">
     <name>MGGrey03-title_30</name>
     <text>FBIS Global Beam Permit</text>
-    <x>812</x>
-    <y>380</y>
+    <x>798</x>
+    <y>379</y>
     <width>212</width>
     <height>50</height>
     <font>
@@ -1082,8 +1013,8 @@ else:
   </widget>
   <widget type="rectangle" version="2.0.0">
     <name>BGGrey01-titlebar_4</name>
-    <x>503</x>
-    <y>203</y>
+    <x>489</x>
+    <y>202</y>
     <width>157</width>
     <height>134</height>
     <line_width>2</line_width>
@@ -1103,23 +1034,23 @@ else:
     <symbols>
       <symbol>../99-Shared/BeamProd/arrow.png</symbol>
     </symbols>
-    <x>643</x>
-    <y>216</y>
+    <x>629</x>
+    <y>215</y>
   </widget>
   <widget type="symbol" version="2.0.0">
     <name>BeamON_Arr_solid</name>
     <symbols>
       <symbol>../99-Shared/BeamProd/arrow-solid.png</symbol>
     </symbols>
-    <x>641</x>
-    <y>216</y>
+    <x>627</x>
+    <y>215</y>
     <visible>false</visible>
   </widget>
   <widget type="bool_button" version="2.0.0">
     <name>Boolean Button</name>
     <pv_name>$(P):$(R):BState</pv_name>
-    <x>520</x>
-    <y>218</y>
+    <x>506</x>
+    <y>217</y>
     <width>110</width>
     <height>103</height>
     <off_label>Switch
@@ -1131,7 +1062,7 @@ else:
     <on_label>Switch
  Beam OFF</on_label>
     <on_color>
-      <color name="On" red="70" green="255" blue="70">
+      <color name="Button_Background" red="236" green="236" blue="236">
       </color>
     </on_color>
     <show_led>false</show_led>
@@ -1166,8 +1097,8 @@ else:
   </widget>
   <widget type="rectangle" version="2.0.0">
     <name>MGGrey03-background_16</name>
-    <x>743</x>
-    <y>440</y>
+    <x>729</x>
+    <y>439</y>
     <width>308</width>
     <height>50</height>
     <line_width>2</line_width>
@@ -1185,12 +1116,15 @@ else:
   <widget type="bool_button" version="2.0.0">
     <name>Boolean Button_1</name>
     <pv_name>ISrc-CS:ISS-Magtr-01:Mw-S</pv_name>
-    <x>812</x>
-    <y>450</y>
+    <x>798</x>
+    <y>449</y>
     <width>195</width>
     <off_label>Magnetron</off_label>
+    <off_color>
+      <color name="OFF" red="90" green="110" blue="90">
+      </color>
+    </off_color>
     <on_label>Magnetron</on_label>
-    <show_led>false</show_led>
     <font>
       <font family="Source Sans Pro" style="BOLD" size="16.0">
       </font>
@@ -1199,8 +1133,8 @@ else:
   <widget type="led" version="2.0.0">
     <name>LED_2</name>
     <pv_name>ISrc-CS:ISS-Magtr-01:Mw-S</pv_name>
-    <x>770</x>
-    <y>450</y>
+    <x>756</x>
+    <y>449</y>
     <width>30</width>
     <height>30</height>
     <off_color>
@@ -1212,8 +1146,8 @@ else:
   <widget type="led" version="2.0.0">
     <name>LED_3</name>
     <pv_name>${PP}:BState-Sts</pv_name>
-    <x>770</x>
-    <y>117</y>
+    <x>756</x>
+    <y>116</y>
     <width>30</width>
     <height>30</height>
     <off_color>
@@ -1222,4 +1156,180 @@ else:
     </off_color>
     <square>true</square>
   </widget>
+  <widget type="textupdate" version="2.0.0">
+    <name>ActiveEvents</name>
+    <pv_name>loc://eventStrings</pv_name>
+    <x>129</x>
+    <y>445</y>
+    <width>479</width>
+    <height>30</height>
+    <show_units>false</show_units>
+    <scripts>
+      <script file="EmbeddedPy">
+        <text><![CDATA[
+from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil
+from jarray import array
+from java.lang import String, Double
+
+# TODO after finding stable version, move to BeamProd IOC
+events = {
+   6: "LebtCpOff",
+   7: "LebtCpOn",
+   8: "MebtCpHead",
+   9: "MebtCpTail",
+  10: "IonMagSt",
+  11: "IonMagEnd",
+  12: "BPulseSt",
+  13: "BPulseEnd",
+  15: "RFSt",
+  17: "CEnd",
+  18: "BIAcqSt",
+  19: "BIAcqEnd",
+  60: "F0Hz5",
+  122:"F1Hz",
+  61: "F2Hz",
+  62: "F3Hz5",
+  63: "F7Hz",
+}
+# these are usually max 15/20 elements waveforms, there is no performance issue on that...
+x = PVUtil.getDoubleArray(pvs[0])
+eventTs = x[::2]
+eventCode = [int(i) for i in x[1::2]]
+eventsConverted = [ events.get(i, str(i)) for i in  eventCode ]
+PVUtil.writePV("loc://eventStrings", array(eventsConverted, String), 1000)
+PVUtil.writePV("loc://eventTimestamps", eventTs, 1000)
+PVUtil.writePV("loc://eventMagnitude", [1.0 for i in eventTs], 1000)]]></text>
+        <pv_name>$(PP):Sequence</pv_name>
+      </script>
+    </scripts>
+  </widget>
+  <widget type="label" version="2.0.0">
+    <name>Label_22</name>
+    <text>Events:</text>
+    <x>72</x>
+    <y>445</y>
+    <width>70</width>
+    <height>30</height>
+  </widget>
+  <widget type="group" version="2.0.0">
+    <name>For debugging, To HIDE for OPS, IMPORTANT NOT TO DELETE!</name>
+    <x>1190</x>
+    <y>334</y>
+    <width>690</width>
+    <height>152</height>
+    <visible>false</visible>
+    <foreground_color>
+      <color name="TEXT" red="25" green="25" blue="25">
+      </color>
+    </foreground_color>
+    <widget type="textupdate" version="2.0.0">
+      <name>selectedRowProcessed</name>
+      <pv_name>loc://processedvalue</pv_name>
+      <x>193</x>
+      <y>32</y>
+      <width>430</width>
+      <scripts>
+        <script file="EmbeddedPy">
+          <text><![CDATA[# Process the seleceted row in the table and update the local PV with the actual content
+# Based on the initial proof of concept from Georg
+# TODO find a nicer way to get value part not that ugly index find and /split...
+
+from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil
+try:
+    stringTagToLookFor = "Name: "  #TODO this is related with the table header, should not be!
+    index = PVUtil.getString(pvs[0]).find(stringTagToLookFor)
+    index = index + len(stringTagToLookFor)
+    pvValue = PVUtil.getString(pvs[0])[index:].split(',')[0]
+    pvs[1].setValue(pvValue)
+except Exception:
+    pvs[1].setValue('UNDEFINED')]]></text>
+          <pv_name>loc://value</pv_name>
+          <pv_name trigger="false">loc://processedvalue</pv_name>
+        </script>
+      </scripts>
+    </widget>
+    <widget type="textupdate" version="2.0.0">
+      <name>RawFilesArray</name>
+      <pv_name>$(PP):ScTables-I</pv_name>
+      <x>193</x>
+      <y>54</y>
+      <width>430</width>
+    </widget>
+    <widget type="textupdate" version="2.0.0">
+      <name>selectedRowRaw</name>
+      <pv_name>loc://value</pv_name>
+      <x>193</x>
+      <y>9</y>
+      <width>430</width>
+    </widget>
+    <widget type="label" version="2.0.0">
+      <name>Label_4</name>
+      <text>Original PV with file names</text>
+      <x>3</x>
+      <y>54</y>
+      <width>197</width>
+    </widget>
+    <widget type="label" version="2.0.0">
+      <name>Label_5</name>
+      <text>Selected table element</text>
+      <x>13</x>
+      <y>9</y>
+      <width>170</width>
+    </widget>
+    <widget type="label" version="2.0.0">
+      <name>Label_6</name>
+      <text>Script processed value</text>
+      <x>13</x>
+      <y>29</y>
+      <width>187</width>
+    </widget>
+    <widget type="label" version="2.0.0">
+      <name>Label_7</name>
+      <text>Selected NEW table file</text>
+      <x>11</x>
+      <y>91</y>
+      <width>170</width>
+    </widget>
+    <widget type="textupdate" version="2.0.0">
+      <name>selectedRowRaw_1</name>
+      <pv_name>loc://pathNewFile</pv_name>
+      <x>191</x>
+      <y>91</y>
+      <width>430</width>
+    </widget>
+  </widget>
+  <widget type="textupdate" version="2.0.0">
+    <name>Text Update_7</name>
+    <pv_name>$(P):$(R):Ver</pv_name>
+    <x>300</x>
+    <y>23</y>
+    <width>40</width>
+    <font>
+      <font family="Source Sans Pro" style="REGULAR" size="12.0">
+      </font>
+    </font>
+  </widget>
+  <widget type="label" version="2.0.0">
+    <name>Label_9</name>
+    <text>SCE engine version:</text>
+    <x>748</x>
+    <y>334</y>
+    <width>112</width>
+    <height>22</height>
+    <font>
+      <font family="Source Sans Pro" style="REGULAR" size="12.0">
+      </font>
+    </font>
+  </widget>
+  <widget type="textupdate" version="2.0.0">
+    <name>Text Update_5</name>
+    <pv_name>${PP}:SwVer-I</pv_name>
+    <x>897</x>
+    <y>334</y>
+    <width>115</width>
+    <font>
+      <font family="Source Sans Pro" style="BOLD" size="12.0">
+      </font>
+    </font>
+  </widget>
 </display>
-- 
GitLab


From d3c99b4b80bc610578c77aff6940f23b1225625a Mon Sep 17 00:00:00 2001
From: arek <arek.gorzawski@ess.eu>
Date: Sat, 13 Nov 2021 19:56:33 +0100
Subject: [PATCH 10/18] fixed flickering by binding the update to 'BeamPresece
 in TD-M'

---
 10-Top/beamprod.bob | 106 ++++++++++++++++++++++++++------------------
 1 file changed, 62 insertions(+), 44 deletions(-)

diff --git a/10-Top/beamprod.bob b/10-Top/beamprod.bob
index 313d7227..64a3a2d6 100644
--- a/10-Top/beamprod.bob
+++ b/10-Top/beamprod.bob
@@ -125,8 +125,6 @@
           </widget>
           <widget type="polygon" version="2.0.0">
             <name>Polygon</name>
-            <x>-193</x>
-            <y>-442</y>
             <width>193</width>
             <height>442</height>
             <points>
@@ -499,7 +497,7 @@ print "=======> File Conversion  DONE<========"]]></text>
               <trace>
                 <name>$(traces[0].y_pv)</name>
                 <x_pv>loc://eventTimestamps</x_pv>
-                <y_pv>loc://eventMagnitude</y_pv>
+                <y_pv>loc://eventSignature</y_pv>
                 <err_pv></err_pv>
                 <axis>0</axis>
                 <trace_type>2</trace_type>
@@ -517,21 +515,38 @@ print "=======> File Conversion  DONE<========"]]></text>
           </widget>
           <widget type="label" version="2.0.0">
             <name>Label_23</name>
-            <text>TS</text>
-            <x>52</x>
-            <y>88</y>
-            <width>70</width>
+            <text>TimeStamps</text>
+            <x>27</x>
+            <y>98</y>
+            <width>89</width>
             <height>30</height>
           </widget>
           <widget type="textupdate" version="2.0.0">
             <name>ActiveEvents_1</name>
             <pv_name>loc://eventTimestamps</pv_name>
-            <x>109</x>
-            <y>88</y>
-            <width>479</width>
+            <x>129</x>
+            <y>98</y>
+            <width>726</width>
             <height>30</height>
             <show_units>false</show_units>
           </widget>
+          <widget type="textupdate" version="2.0.0">
+            <name>ActiveEvents_2</name>
+            <pv_name>loc://eventStrings</pv_name>
+            <x>129</x>
+            <y>58</y>
+            <width>726</width>
+            <height>30</height>
+            <show_units>false</show_units>
+          </widget>
+          <widget type="label" version="2.0.0">
+            <name>Label_24</name>
+            <text>Names</text>
+            <x>63</x>
+            <y>58</y>
+            <width>70</width>
+            <height>30</height>
+          </widget>
         </children>
       </tab>
       <tab>
@@ -577,6 +592,7 @@ print "=======> File Conversion  DONE<========"]]></text>
     <y>510</y>
     <width>1195</width>
     <height>450</height>
+    <active_tab>1</active_tab>
     <tab_height>40</tab_height>
   </widget>
   <widget type="action_button" version="3.0.0">
@@ -1159,9 +1175,9 @@ else:
   <widget type="textupdate" version="2.0.0">
     <name>ActiveEvents</name>
     <pv_name>loc://eventStrings</pv_name>
-    <x>129</x>
+    <x>72</x>
     <y>445</y>
-    <width>479</width>
+    <width>536</width>
     <height>30</height>
     <show_units>false</show_units>
     <scripts>
@@ -1171,44 +1187,46 @@ from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil
 from jarray import array
 from java.lang import String, Double
 
-# TODO after finding stable version, move to BeamProd IOC
-events = {
-   6: "LebtCpOff",
-   7: "LebtCpOn",
-   8: "MebtCpHead",
-   9: "MebtCpTail",
-  10: "IonMagSt",
-  11: "IonMagEnd",
-  12: "BPulseSt",
-  13: "BPulseEnd",
-  15: "RFSt",
-  17: "CEnd",
-  18: "BIAcqSt",
-  19: "BIAcqEnd",
-  60: "F0Hz5",
-  122:"F1Hz",
-  61: "F2Hz",
-  62: "F3Hz5",
-  63: "F7Hz",
-}
-# these are usually max 15/20 elements waveforms, there is no performance issue on that...
-x = PVUtil.getDoubleArray(pvs[0])
-eventTs = x[::2]
-eventCode = [int(i) for i in x[1::2]]
-eventsConverted = [ events.get(i, str(i)) for i in  eventCode ]
-PVUtil.writePV("loc://eventStrings", array(eventsConverted, String), 1000)
-PVUtil.writePV("loc://eventTimestamps", eventTs, 1000)
-PVUtil.writePV("loc://eventMagnitude", [1.0 for i in eventTs], 1000)]]></text>
-        <pv_name>$(PP):Sequence</pv_name>
+if PVUtil.getString(pvs[1]) == 'ON':
+	# TODO after finding stable version, move to BeamProd IOC
+	events = {
+	   6: "LebtCpOff",
+	   7: "LebtCpOn",
+	   8: "MebtCpHead",
+	   9: "MebtCpTail",
+	  10: "IonMagSt",
+	  11: "IonMagEnd",
+	  12: "BPulseSt",
+	  13: "BPulseEnd",
+	  15: "RFSt",
+	  17: "CEnd",
+	  18: "BIAcqSt",
+	  19: "BIAcqEnd",
+	  60: "F0Hz5",
+	  122:"F1Hz",
+	  61: "F2Hz",
+	  62: "F3Hz5",
+	  63: "F7Hz",
+	}
+	# these are usually max 15/20 elements waveforms, there is no performance issue on that...
+	x = PVUtil.getDoubleArray(pvs[0])
+	eventTs = x[::2]
+	eventCode = [int(i) for i in x[1::2]]
+	eventsConverted = [ events.get(i, str(i)) for i in  eventCode ]
+	PVUtil.writePV("loc://eventStrings", array(eventsConverted, String), 1000)
+	PVUtil.writePV("loc://eventTimestamps", eventTs, 1000)
+	PVUtil.writePV("loc://eventSignature", [1.0 for i in eventTs], 1000)]]></text>
+        <pv_name trigger="false">$(PP):Sequence</pv_name>
+        <pv_name>${PP}:BPresent-Sts</pv_name>
       </script>
     </scripts>
   </widget>
   <widget type="label" version="2.0.0">
     <name>Label_22</name>
-    <text>Events:</text>
+    <text>Recognized events played on expected Beam Presence ON:</text>
     <x>72</x>
-    <y>445</y>
-    <width>70</width>
+    <y>417</y>
+    <width>402</width>
     <height>30</height>
   </widget>
   <widget type="group" version="2.0.0">
-- 
GitLab


From 73070abc862c96e9c1e610d3e445a7cf3bac6fe8 Mon Sep 17 00:00:00 2001
From: arek <arek.gorzawski@ess.eu>
Date: Sat, 13 Nov 2021 20:34:36 +0100
Subject: [PATCH 11/18] cleanup for the script, layout boost.

---
 10-Top/beamprod.bob | 245 ++++++++++++++++++++++++++++----------------
 1 file changed, 155 insertions(+), 90 deletions(-)

diff --git a/10-Top/beamprod.bob b/10-Top/beamprod.bob
index 64a3a2d6..ccb4a47b 100644
--- a/10-Top/beamprod.bob
+++ b/10-Top/beamprod.bob
@@ -416,7 +416,7 @@ print "=======> File Conversion  DONE<========"]]></text>
             <x>13</x>
             <y>7</y>
             <width>1154</width>
-            <height>390</height>
+            <height>411</height>
             <line_width>2</line_width>
             <line_color>
               <color name="GROUP-BORDER" red="150" green="155" blue="151">
@@ -433,8 +433,8 @@ print "=======> File Conversion  DONE<========"]]></text>
             <name>LED</name>
             <pv_name>$(PP):BState-Sel</pv_name>
             <bit>0</bit>
-            <x>222</x>
-            <y>26</y>
+            <x>1101</x>
+            <y>56</y>
             <width>27</width>
             <height>28</height>
             <square>true</square>
@@ -442,8 +442,8 @@ print "=======> File Conversion  DONE<========"]]></text>
           <widget type="label" version="2.0.0">
             <name>Label_11</name>
             <text>Beam Production:</text>
-            <x>52</x>
-            <y>26</y>
+            <x>931</x>
+            <y>56</y>
             <width>170</width>
             <height>30</height>
             <font>
@@ -456,13 +456,61 @@ print "=======> File Conversion  DONE<========"]]></text>
             <x>39</x>
             <y>148</y>
             <width>1097</width>
-            <height>210</height>
+            <height>240</height>
+            <scripts>
+              <script file="EmbeddedPy">
+                <text><![CDATA[
+from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil
+from jarray import array
+from java.lang import String, Double
+
+if PVUtil.getString(pvs[1]) == 'ON':
+	# TODO after finding stable version, move to BeamProd IOC
+	events = {
+	   6: "LebtCpOff",
+	   7: "LebtCpOn",
+	   8: "MebtCpHead",
+	   9: "MebtCpTail",
+	  10: "IonMagSt",
+	  11: "IonMagEnd",
+	  12: "BPulseSt",
+	  13: "BPulseEnd",
+	  15: "RFSt",
+	  17: "CEnd",
+	  18: "BIAcqSt",
+	  19: "BIAcqEnd",
+	  60: "F0Hz5",
+	  122:"F1Hz",
+	  61: "F2Hz",
+	  62: "F3Hz5",
+	  63: "F7Hz",
+	}
+	# these are usually max 15/20 elements waveforms, there is no performance issue on that...
+	x = PVUtil.getDoubleArray(pvs[0])
+	eventTs = x[::2]
+	eventCode = [int(i) for i in x[1::2]]
+	eventsConverted = [ events.get(i, str(i)) for i in  eventCode ]
+	forCalc = {}
+	for one in zip(eventsConverted, eventTs):
+		forCalc[one[0]]=one[1]
+
+	PVUtil.writePV("loc://eventStrings", array(eventsConverted, String), 1000)
+	PVUtil.writePV("loc://eventTimestamps", eventTs, 1000)
+	PVUtil.writePV("loc://eventSignature", [1.0 for i in eventTs], 1000)
+
+	PVUtil.writePV("loc://eventMagnetron", [forCalc.get('IonMagSt',-999), forCalc.get('IonMagEnd',-999)], 1000)
+	PVUtil.writePV("loc://eventLebtCh", [forCalc.get('LebtCpOff',-999), forCalc.get('LebtCpOn',-999)], 1000)
+	PVUtil.writePV("loc://eventMebtCh", [forCalc.get('MebtCpHead',-999), forCalc.get('MebtCpTail',-999)], 1000)]]></text>
+                <pv_name trigger="false">$(PP):Sequence</pv_name>
+                <pv_name>${PP}:BPresent-Sts</pv_name>
+              </script>
+            </scripts>
             <x_axis>
               <title>event positon within the pulse[us]</title>
               <autoscale>false</autoscale>
               <log_scale>false</log_scale>
               <minimum>0.0</minimum>
-              <maximum>70000.0</maximum>
+              <maximum>73000.0</maximum>
               <show_grid>false</show_grid>
               <title_font>
                 <font family="Source Sans Pro" style="REGULAR" size="16.0">
@@ -500,9 +548,9 @@ print "=======> File Conversion  DONE<========"]]></text>
                 <y_pv>loc://eventSignature</y_pv>
                 <err_pv></err_pv>
                 <axis>0</axis>
-                <trace_type>2</trace_type>
+                <trace_type>5</trace_type>
                 <color>
-                  <color red="0" green="0" blue="255">
+                  <color name="BLACK" red="0" green="0" blue="0">
                   </color>
                 </color>
                 <line_width>1</line_width>
@@ -511,6 +559,57 @@ print "=======> File Conversion  DONE<========"]]></text>
                 <point_size>10</point_size>
                 <visible>true</visible>
               </trace>
+              <trace>
+                <name>$(traces[1].x_pv)</name>
+                <x_pv>loc://eventMagnetron</x_pv>
+                <y_pv>loc://eventSignature</y_pv>
+                <err_pv></err_pv>
+                <axis>0</axis>
+                <trace_type>1</trace_type>
+                <color>
+                  <color name="ON" red="70" green="255" blue="70">
+                  </color>
+                </color>
+                <line_width>1</line_width>
+                <line_style>0</line_style>
+                <point_type>2</point_type>
+                <point_size>10</point_size>
+                <visible>true</visible>
+              </trace>
+              <trace>
+                <name>$(traces[2].x_pv)</name>
+                <x_pv>loc://eventLebtCh</x_pv>
+                <y_pv>loc://eventSignature</y_pv>
+                <err_pv></err_pv>
+                <axis>0</axis>
+                <trace_type>1</trace_type>
+                <color>
+                  <color name="ActiveText" red="254" green="194" blue="81">
+                  </color>
+                </color>
+                <line_width>1</line_width>
+                <line_style>0</line_style>
+                <point_type>2</point_type>
+                <point_size>10</point_size>
+                <visible>true</visible>
+              </trace>
+              <trace>
+                <name>$(traces[3].x_pv)</name>
+                <x_pv>loc://eventMebtCh</x_pv>
+                <y_pv>loc://eventSignature</y_pv>
+                <err_pv></err_pv>
+                <axis>0</axis>
+                <trace_type>1</trace_type>
+                <color>
+                  <color name="SECONDARY" red="202" green="0" blue="0">
+                  </color>
+                </color>
+                <line_width>1</line_width>
+                <line_style>0</line_style>
+                <point_type>2</point_type>
+                <point_size>10</point_size>
+                <visible>true</visible>
+              </trace>
             </traces>
           </widget>
           <widget type="label" version="2.0.0">
@@ -547,6 +646,14 @@ print "=======> File Conversion  DONE<========"]]></text>
             <width>70</width>
             <height>30</height>
           </widget>
+          <widget type="label" version="2.0.0">
+            <name>Label_22</name>
+            <text>Recognized events played on expected Beam Presence ON:</text>
+            <x>59</x>
+            <y>28</y>
+            <width>402</width>
+            <height>30</height>
+          </widget>
         </children>
       </tab>
       <tab>
@@ -591,8 +698,7 @@ print "=======> File Conversion  DONE<========"]]></text>
     <x>11</x>
     <y>510</y>
     <width>1195</width>
-    <height>450</height>
-    <active_tab>1</active_tab>
+    <height>460</height>
     <tab_height>40</tab_height>
   </widget>
   <widget type="action_button" version="3.0.0">
@@ -668,7 +774,7 @@ PVUtil.writePV("BPROD:Ops:BProdStop", "0", 5000)
     <x>55</x>
     <y>103</y>
     <width>572</width>
-    <height>156</height>
+    <height>167</height>
     <line_width>2</line_width>
     <line_color>
       <color name="GROUP-BORDER" red="150" green="155" blue="151">
@@ -734,7 +840,7 @@ else:
   <widget type="label" version="2.0.0">
     <name>Label_3</name>
     <text>Proton Beam Destination</text>
-    <x>290</x>
+    <x>288</x>
     <y>144</y>
     <width>170</width>
   </widget>
@@ -742,23 +848,23 @@ else:
     <name>ActualPBMode</name>
     <pv_name>$(PP):BMod-Sel</pv_name>
     <x>88</x>
-    <y>171</y>
+    <y>177</y>
     <width>168</width>
     <height>30</height>
     <font>
-      <font family="Source Sans Pro" style="BOLD" size="16.0">
+      <font family="Source Sans Pro" style="BOLD" size="18.0">
       </font>
     </font>
   </widget>
   <widget type="textupdate" version="2.0.0">
     <name>ActualPBDestination</name>
     <pv_name>$(PP):BDest-Sel</pv_name>
-    <x>291</x>
-    <y>171</y>
+    <x>289</x>
+    <y>177</y>
     <width>168</width>
     <height>30</height>
     <font>
-      <font family="Source Sans Pro" style="BOLD" size="16.0">
+      <font family="Source Sans Pro" style="BOLD" size="18.0">
       </font>
     </font>
   </widget>
@@ -766,8 +872,12 @@ else:
     <name>selectPBMode</name>
     <pv_name>$(P):$(R):BMode</pv_name>
     <x>87</x>
-    <y>209</y>
+    <y>215</y>
     <width>170</width>
+    <font>
+      <font family="Source Sans Pro" style="REGULAR" size="18.0">
+      </font>
+    </font>
     <actions>
     </actions>
     <scripts>
@@ -790,16 +900,20 @@ else:
   <widget type="combo" version="2.0.0">
     <name>selectPBDestination</name>
     <pv_name>$(P):$(R):BDestination</pv_name>
-    <x>291</x>
-    <y>209</y>
+    <x>289</x>
+    <y>215</y>
     <width>170</width>
+    <font>
+      <font family="Source Sans Pro" style="REGULAR" size="18.0">
+      </font>
+    </font>
   </widget>
   <widget type="rectangle" version="2.0.0">
     <name>MGGrey03-background_12</name>
     <x>55</x>
-    <y>273</y>
+    <y>289</y>
     <width>574</width>
-    <height>216</height>
+    <height>200</height>
     <line_width>2</line_width>
     <line_color>
       <color name="GROUP-BORDER" red="150" green="155" blue="151">
@@ -815,8 +929,8 @@ else:
   <widget type="label" version="2.0.0">
     <name>MGGrey03-title_28</name>
     <text>Loaded Table</text>
-    <x>64</x>
-    <y>273</y>
+    <x>55</x>
+    <y>289</y>
     <width>440</width>
     <height>40</height>
     <font>
@@ -830,16 +944,16 @@ else:
     <name>Text Update_3</name>
     <pv_name>$(PP):ScTableDir-RB</pv_name>
     <x>130</x>
-    <y>322</y>
-    <width>345</width>
+    <y>347</y>
+    <width>329</width>
     <height>30</height>
   </widget>
   <widget type="textupdate" version="2.0.0">
     <name>ActualLoadedTT</name>
     <pv_name>$(PP):ScTable-RB</pv_name>
     <x>129</x>
-    <y>361</y>
-    <width>345</width>
+    <y>389</y>
+    <width>330</width>
     <height>30</height>
     <font>
       <font family="Source Sans Pro" style="BOLD" size="16.0">
@@ -851,7 +965,7 @@ else:
     <name>Label_10</name>
     <text>Name:</text>
     <x>72</x>
-    <y>361</y>
+    <y>389</y>
     <width>70</width>
     <height>30</height>
   </widget>
@@ -859,15 +973,23 @@ else:
     <name>Label_12</name>
     <text>Source:</text>
     <x>73</x>
-    <y>323</y>
+    <y>348</y>
+    <width>70</width>
+    <height>30</height>
+  </widget>
+  <widget type="label" version="2.0.0">
+    <name>Label_25</name>
+    <text>Status:</text>
+    <x>74</x>
+    <y>430</y>
     <width>70</width>
     <height>30</height>
   </widget>
   <widget type="textupdate" version="2.0.0">
     <name>Text Update_10</name>
     <pv_name>${PP}:ScTable-Sts</pv_name>
-    <x>488</x>
-    <y>361</y>
+    <x>129</x>
+    <y>431</y>
     <width>120</width>
     <height>30</height>
     <font>
@@ -1172,63 +1294,6 @@ else:
     </off_color>
     <square>true</square>
   </widget>
-  <widget type="textupdate" version="2.0.0">
-    <name>ActiveEvents</name>
-    <pv_name>loc://eventStrings</pv_name>
-    <x>72</x>
-    <y>445</y>
-    <width>536</width>
-    <height>30</height>
-    <show_units>false</show_units>
-    <scripts>
-      <script file="EmbeddedPy">
-        <text><![CDATA[
-from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil
-from jarray import array
-from java.lang import String, Double
-
-if PVUtil.getString(pvs[1]) == 'ON':
-	# TODO after finding stable version, move to BeamProd IOC
-	events = {
-	   6: "LebtCpOff",
-	   7: "LebtCpOn",
-	   8: "MebtCpHead",
-	   9: "MebtCpTail",
-	  10: "IonMagSt",
-	  11: "IonMagEnd",
-	  12: "BPulseSt",
-	  13: "BPulseEnd",
-	  15: "RFSt",
-	  17: "CEnd",
-	  18: "BIAcqSt",
-	  19: "BIAcqEnd",
-	  60: "F0Hz5",
-	  122:"F1Hz",
-	  61: "F2Hz",
-	  62: "F3Hz5",
-	  63: "F7Hz",
-	}
-	# these are usually max 15/20 elements waveforms, there is no performance issue on that...
-	x = PVUtil.getDoubleArray(pvs[0])
-	eventTs = x[::2]
-	eventCode = [int(i) for i in x[1::2]]
-	eventsConverted = [ events.get(i, str(i)) for i in  eventCode ]
-	PVUtil.writePV("loc://eventStrings", array(eventsConverted, String), 1000)
-	PVUtil.writePV("loc://eventTimestamps", eventTs, 1000)
-	PVUtil.writePV("loc://eventSignature", [1.0 for i in eventTs], 1000)]]></text>
-        <pv_name trigger="false">$(PP):Sequence</pv_name>
-        <pv_name>${PP}:BPresent-Sts</pv_name>
-      </script>
-    </scripts>
-  </widget>
-  <widget type="label" version="2.0.0">
-    <name>Label_22</name>
-    <text>Recognized events played on expected Beam Presence ON:</text>
-    <x>72</x>
-    <y>417</y>
-    <width>402</width>
-    <height>30</height>
-  </widget>
   <widget type="group" version="2.0.0">
     <name>For debugging, To HIDE for OPS, IMPORTANT NOT TO DELETE!</name>
     <x>1190</x>
-- 
GitLab


From 3d20d236698a5f58514128b88b3b4b79475f654e Mon Sep 17 00:00:00 2001
From: arek <arek.gorzawski@ess.eu>
Date: Sat, 13 Nov 2021 20:53:28 +0100
Subject: [PATCH 12/18] missing BeamWindow signature

---
 10-Top/beamprod.bob | 33 ++++++++++++++++++++++++++-------
 1 file changed, 26 insertions(+), 7 deletions(-)

diff --git a/10-Top/beamprod.bob b/10-Top/beamprod.bob
index ccb4a47b..7fb39f9c 100644
--- a/10-Top/beamprod.bob
+++ b/10-Top/beamprod.bob
@@ -434,7 +434,7 @@ print "=======> File Conversion  DONE<========"]]></text>
             <pv_name>$(PP):BState-Sel</pv_name>
             <bit>0</bit>
             <x>1101</x>
-            <y>56</y>
+            <y>15</y>
             <width>27</width>
             <height>28</height>
             <square>true</square>
@@ -443,7 +443,7 @@ print "=======> File Conversion  DONE<========"]]></text>
             <name>Label_11</name>
             <text>Beam Production:</text>
             <x>931</x>
-            <y>56</y>
+            <y>15</y>
             <width>170</width>
             <height>30</height>
             <font>
@@ -500,13 +500,14 @@ if PVUtil.getString(pvs[1]) == 'ON':
 
 	PVUtil.writePV("loc://eventMagnetron", [forCalc.get('IonMagSt',-999), forCalc.get('IonMagEnd',-999)], 1000)
 	PVUtil.writePV("loc://eventLebtCh", [forCalc.get('LebtCpOff',-999), forCalc.get('LebtCpOn',-999)], 1000)
-	PVUtil.writePV("loc://eventMebtCh", [forCalc.get('MebtCpHead',-999), forCalc.get('MebtCpTail',-999)], 1000)]]></text>
+	PVUtil.writePV("loc://eventMebtCh", [forCalc.get('MebtCpHead',-999), forCalc.get('MebtCpTail',-999)], 1000)
+	PVUtil.writePV("loc://eventBeamWindow", [forCalc.get('BPulseSt',-999), forCalc.get('BPulseEnd',-999)], 1000)]]></text>
                 <pv_name trigger="false">$(PP):Sequence</pv_name>
                 <pv_name>${PP}:BPresent-Sts</pv_name>
               </script>
             </scripts>
             <x_axis>
-              <title>event positon within the pulse[us]</title>
+              <title>Event positon within the pulse [us]</title>
               <autoscale>false</autoscale>
               <log_scale>false</log_scale>
               <minimum>0.0</minimum>
@@ -610,6 +611,23 @@ if PVUtil.getString(pvs[1]) == 'ON':
                 <point_size>10</point_size>
                 <visible>true</visible>
               </trace>
+              <trace>
+                <name>$(traces[4].x_pv)</name>
+                <x_pv>loc://eventBeamWindow</x_pv>
+                <y_pv>loc://eventSignature</y_pv>
+                <err_pv></err_pv>
+                <axis>0</axis>
+                <trace_type>1</trace_type>
+                <color>
+                  <color red="0" green="0" blue="255">
+                  </color>
+                </color>
+                <line_width>1</line_width>
+                <line_style>0</line_style>
+                <point_type>3</point_type>
+                <point_size>10</point_size>
+                <visible>true</visible>
+              </trace>
             </traces>
           </widget>
           <widget type="label" version="2.0.0">
@@ -625,7 +643,7 @@ if PVUtil.getString(pvs[1]) == 'ON':
             <pv_name>loc://eventTimestamps</pv_name>
             <x>129</x>
             <y>98</y>
-            <width>726</width>
+            <width>998</width>
             <height>30</height>
             <show_units>false</show_units>
           </widget>
@@ -634,7 +652,7 @@ if PVUtil.getString(pvs[1]) == 'ON':
             <pv_name>loc://eventStrings</pv_name>
             <x>129</x>
             <y>58</y>
-            <width>726</width>
+            <width>998</width>
             <height>30</height>
             <show_units>false</show_units>
           </widget>
@@ -699,6 +717,7 @@ if PVUtil.getString(pvs[1]) == 'ON':
     <y>510</y>
     <width>1195</width>
     <height>460</height>
+    <active_tab>1</active_tab>
     <tab_height>40</tab_height>
   </widget>
   <widget type="action_button" version="3.0.0">
@@ -1194,7 +1213,7 @@ else:
     <off_label>Switch
  Beam ON</off_label>
     <off_color>
-      <color name="OFF" red="90" green="110" blue="90">
+      <color name="Button_Background" red="236" green="236" blue="236">
       </color>
     </off_color>
     <on_label>Switch
-- 
GitLab


From 08fb4c3b18221594f7bc2f58f55e2473023680da Mon Sep 17 00:00:00 2001
From: arek <arek.gorzawski@ess.eu>
Date: Sun, 14 Nov 2021 19:09:59 +0100
Subject: [PATCH 13/18] layout changes

---
 10-Top/beamprod.bob | 82 ++++++++++++++++++++++++++-------------------
 1 file changed, 48 insertions(+), 34 deletions(-)

diff --git a/10-Top/beamprod.bob b/10-Top/beamprod.bob
index 7fb39f9c..640278bc 100644
--- a/10-Top/beamprod.bob
+++ b/10-Top/beamprod.bob
@@ -10,7 +10,7 @@
   </macros>
   <x>20</x>
   <width>1230</width>
-  <height>970</height>
+  <height>990</height>
   <widget type="rectangle" version="2.0.0">
     <name>BGGrey01-titlebar_3</name>
     <x>26</x>
@@ -372,7 +372,7 @@ print "=======> File Conversion  DONE<========"]]></text>
             <name>MGGrey03-background_15</name>
             <x>33</x>
             <y>53</y>
-            <width>607</width>
+            <width>524</width>
             <height>71</height>
             <line_width>2</line_width>
             <line_color>
@@ -389,7 +389,7 @@ print "=======> File Conversion  DONE<========"]]></text>
           <widget type="label" version="2.0.0">
             <name>Label_17</name>
             <text>Timing Tables source</text>
-            <x>76</x>
+            <x>58</x>
             <y>74</y>
             <width>170</width>
             <height>30</height>
@@ -401,9 +401,9 @@ print "=======> File Conversion  DONE<========"]]></text>
           <widget type="textentry" version="3.0.0">
             <name>Text Entry_2</name>
             <pv_name>$(PP):ScTableDir-SP</pv_name>
-            <x>270</x>
-            <y>75</y>
-            <width>309</width>
+            <x>243</x>
+            <y>73</y>
+            <width>287</width>
             <height>30</height>
           </widget>
         </children>
@@ -455,7 +455,7 @@ print "=======> File Conversion  DONE<========"]]></text>
             <name>X/Y Plot_1</name>
             <x>39</x>
             <y>148</y>
-            <width>1097</width>
+            <width>1088</width>
             <height>240</height>
             <scripts>
               <script file="EmbeddedPy">
@@ -544,7 +544,7 @@ if PVUtil.getString(pvs[1]) == 'ON':
             </y_axes>
             <traces>
               <trace>
-                <name>$(traces[0].y_pv)</name>
+                <name>$(traces[0].x_pv)</name>
                 <x_pv>loc://eventTimestamps</x_pv>
                 <y_pv>loc://eventSignature</y_pv>
                 <err_pv></err_pv>
@@ -666,10 +666,10 @@ if PVUtil.getString(pvs[1]) == 'ON':
           </widget>
           <widget type="label" version="2.0.0">
             <name>Label_22</name>
-            <text>Recognized events played on expected Beam Presence ON:</text>
+            <text>Recognized events played on Expected Beam Presence ON</text>
             <x>59</x>
             <y>28</y>
-            <width>402</width>
+            <width>684</width>
             <height>30</height>
           </widget>
         </children>
@@ -717,7 +717,6 @@ if PVUtil.getString(pvs[1]) == 'ON':
     <y>510</y>
     <width>1195</width>
     <height>460</height>
-    <active_tab>1</active_tab>
     <tab_height>40</tab_height>
   </widget>
   <widget type="action_button" version="3.0.0">
@@ -749,7 +748,7 @@ PVUtil.writePV("BPROD:Ops:BProdStop", "0", 5000)
       </font>
     </font>
     <foreground_color>
-      <color name="STOP" red="222" green="33" blue="22">
+      <color name="SECONDARY-DARK" red="102" green="31" blue="32">
       </color>
     </foreground_color>
     <tooltip>$(actions)</tooltip>
@@ -1067,9 +1066,10 @@ else:
   <widget type="label" version="2.0.0">
     <name>Label_20</name>
     <text>Expected Beam Presence</text>
-    <x>849</x>
-    <y>154</y>
-    <width>170</width>
+    <x>845</x>
+    <y>153</y>
+    <width>198</width>
+    <height>31</height>
   </widget>
   <widget type="textupdate" version="2.0.0">
     <name>Text Update_11</name>
@@ -1086,8 +1086,8 @@ else:
   <widget type="textupdate" version="2.0.0">
     <name>Text Update_12</name>
     <pv_name>${PP}:BPresent-Sts</pv_name>
-    <x>924</x>
-    <y>182</y>
+    <x>929</x>
+    <y>181</y>
     <width>81</width>
     <height>30</height>
     <font>
@@ -1105,18 +1105,20 @@ else:
   </widget>
   <widget type="label" version="2.0.0">
     <name>Label_8</name>
-    <text>Nb. of cycles executed while Beam ON:</text>
-    <x>746</x>
-    <y>223</y>
-    <width>275</width>
-    <height>30</height>
+    <text>Nb. of cycles
+ executed while Beam ON:</text>
+    <x>861</x>
+    <y>225</y>
+    <width>151</width>
+    <height>55</height>
+    <horizontal_alignment>2</horizontal_alignment>
     <tooltip>With magnetron events enabled.</tooltip>
   </widget>
   <widget type="textupdate" version="2.0.0">
     <name>Text Update</name>
     <pv_name>${PP}:CycleOnCnt</pv_name>
-    <x>906</x>
-    <y>253</y>
+    <x>912</x>
+    <y>278</y>
     <height>30</height>
     <font>
       <font family="Source Sans Pro" style="BOLD" size="16.0">
@@ -1144,7 +1146,7 @@ else:
   <widget type="led" version="2.0.0">
     <name>LED_1</name>
     <pv_name>FBIS::beam_permit_ok</pv_name>
-    <x>756</x>
+    <x>747</x>
     <y>391</y>
     <width>30</width>
     <height>30</height>
@@ -1219,7 +1221,7 @@ else:
     <on_label>Switch
  Beam OFF</on_label>
     <on_color>
-      <color name="Button_Background" red="236" green="236" blue="236">
+      <color name="ON" red="70" green="255" blue="70">
       </color>
     </on_color>
     <show_led>false</show_led>
@@ -1290,7 +1292,7 @@ else:
   <widget type="led" version="2.0.0">
     <name>LED_2</name>
     <pv_name>ISrc-CS:ISS-Magtr-01:Mw-S</pv_name>
-    <x>756</x>
+    <x>747</x>
     <y>449</y>
     <width>30</width>
     <height>30</height>
@@ -1303,8 +1305,8 @@ else:
   <widget type="led" version="2.0.0">
     <name>LED_3</name>
     <pv_name>${PP}:BState-Sts</pv_name>
-    <x>756</x>
-    <y>116</y>
+    <x>747</x>
+    <y>120</y>
     <width>30</width>
     <height>30</height>
     <off_color>
@@ -1410,13 +1412,14 @@ except Exception:
       <font family="Source Sans Pro" style="REGULAR" size="12.0">
       </font>
     </font>
+    <horizontal_alignment>1</horizontal_alignment>
   </widget>
   <widget type="label" version="2.0.0">
     <name>Label_9</name>
-    <text>SCE engine version:</text>
-    <x>748</x>
-    <y>334</y>
-    <width>112</width>
+    <text>SCE ver:</text>
+    <x>845</x>
+    <y>339</y>
+    <width>72</width>
     <height>22</height>
     <font>
       <font family="Source Sans Pro" style="REGULAR" size="12.0">
@@ -1427,11 +1430,22 @@ except Exception:
     <name>Text Update_5</name>
     <pv_name>${PP}:SwVer-I</pv_name>
     <x>897</x>
-    <y>334</y>
+    <y>337</y>
     <width>115</width>
     <font>
       <font family="Source Sans Pro" style="BOLD" size="12.0">
       </font>
     </font>
+    <horizontal_alignment>1</horizontal_alignment>
+  </widget>
+  <widget type="led" version="2.0.0">
+    <name>LED_4</name>
+    <pv_name>$(PP):BState-Sel</pv_name>
+    <bit>0</bit>
+    <x>747</x>
+    <y>250</y>
+    <width>30</width>
+    <height>30</height>
+    <square>true</square>
   </widget>
 </display>
-- 
GitLab


From c6f95ff6df5cf600f43b628ca5a0e6dd1342bd69 Mon Sep 17 00:00:00 2001
From: arek <arek.gorzawski@ess.eu>
Date: Sun, 14 Nov 2021 19:20:35 +0100
Subject: [PATCH 14/18] sort the table names

---
 10-Top/beamprod.bob | 1 +
 1 file changed, 1 insertion(+)

diff --git a/10-Top/beamprod.bob b/10-Top/beamprod.bob
index 640278bc..1f99fc04 100644
--- a/10-Top/beamprod.bob
+++ b/10-Top/beamprod.bob
@@ -172,6 +172,7 @@ for oneFileName in files:
 	row = [ oneFileName, 'N/A', 'N/A']
         data.append(row)
 
+data.sort(key=lambda x: x[0])
 table = ValueUtil.createStringTableFromRows([ "Timing Table Name", "Beam Mode", "RepRate" ], data)
 widget.setPropertyValue("value", table)]]></text>
                 <pv_name>$(PP):ScTables-I</pv_name>
-- 
GitLab


From 442f5f0f1bcfb74fef806965664afffa6c36cfc3 Mon Sep 17 00:00:00 2001
From: arek <arek.gorzawski@ess.eu>
Date: Sun, 14 Nov 2021 19:37:53 +0100
Subject: [PATCH 15/18] timing tables panel cleaned

---
 10-Top/beamprod.bob | 157 +++++++++++---------------------------------
 1 file changed, 40 insertions(+), 117 deletions(-)

diff --git a/10-Top/beamprod.bob b/10-Top/beamprod.bob
index 1f99fc04..55bb02a6 100644
--- a/10-Top/beamprod.bob
+++ b/10-Top/beamprod.bob
@@ -91,8 +91,8 @@
             <name>BGGrey01-titlebar</name>
             <x>12</x>
             <y>8</y>
-            <width>922</width>
-            <height>410</height>
+            <width>1153</width>
+            <height>420</height>
             <line_width>2</line_width>
             <line_color>
               <color name="GROUP-BORDER" red="150" green="155" blue="151">
@@ -105,23 +105,23 @@
             <corner_width>10</corner_width>
             <corner_height>10</corner_height>
           </widget>
-          <widget type="label" version="2.0.0">
-            <name>BGGrey01-title</name>
-            <text>Available Timing Tables</text>
-            <x>30</x>
-            <y>13</y>
-            <width>890</width>
-            <height>30</height>
-            <font>
-              <font family="Source Sans Pro" style="BOLD_ITALIC" size="20.0">
-              </font>
-            </font>
-            <foreground_color>
-              <color name="BLACK-TEXT" red="255" green="255" blue="255">
+          <widget type="rectangle" version="2.0.0">
+            <name>MGGrey03-background_17</name>
+            <x>537</x>
+            <y>336</y>
+            <width>608</width>
+            <height>70</height>
+            <line_width>2</line_width>
+            <line_color>
+              <color name="GROUP-BORDER" red="150" green="155" blue="151">
+              </color>
+            </line_color>
+            <background_color>
+              <color name="GROUP-BACKGROUND" red="200" green="205" blue="201">
               </color>
-            </foreground_color>
-            <horizontal_alignment>1</horizontal_alignment>
-            <vertical_alignment>1</vertical_alignment>
+            </background_color>
+            <corner_width>10</corner_width>
+            <corner_height>10</corner_height>
           </widget>
           <widget type="polygon" version="2.0.0">
             <name>Polygon</name>
@@ -134,10 +134,9 @@
           </widget>
           <widget type="table" version="2.0.0">
             <name>tt_names</name>
-            <x>35</x>
-            <y>136</y>
-            <width>880</width>
-            <height>262</height>
+            <x>34</x>
+            <y>24</y>
+            <width>921</width>
             <font>
               <font family="Source Sans Pro" style="REGULAR" size="14.0">
               </font>
@@ -199,10 +198,10 @@ PVUtil.writePV(pvToWrite.getName(), PVUtil.getString(pvToRead), 5000)
                 <description>Load table from selected</description>
               </action>
             </actions>
-            <x>665</x>
-            <y>62</y>
-            <width>247</width>
-            <height>55</height>
+            <x>981</x>
+            <y>98</y>
+            <width>150</width>
+            <height>150</height>
             <font>
               <font family="Source Sans Pro" style="BOLD" size="16.0">
               </font>
@@ -219,47 +218,12 @@ PVUtil.writePV(pvToWrite.getName(), PVUtil.getString(pvToRead), 5000)
             </scripts>
             <tooltip>$(actions)</tooltip>
           </widget>
-          <widget type="rectangle" version="2.0.0">
-            <name>BGGrey01-titlebar_1</name>
-            <x>948</x>
-            <y>8</y>
-            <width>215</width>
-            <height>400</height>
-            <line_width>2</line_width>
-            <line_color>
-              <color name="GROUP-BORDER" red="150" green="155" blue="151">
-              </color>
-            </line_color>
-            <background_color>
-              <color name="GROUP-BORDER" red="150" green="155" blue="151">
-              </color>
-            </background_color>
-            <corner_width>10</corner_width>
-            <corner_height>10</corner_height>
-          </widget>
-          <widget type="label" version="2.0.0">
-            <name>BGGrey01-title_1</name>
-            <text>Add New Table</text>
-            <x>964</x>
-            <y>22</y>
-            <width>190</width>
-            <font>
-              <font family="Source Sans Pro" style="BOLD_ITALIC" size="20.0">
-              </font>
-            </font>
-            <foreground_color>
-              <color name="BLACK-TEXT" red="255" green="255" blue="255">
-              </color>
-            </foreground_color>
-            <horizontal_alignment>1</horizontal_alignment>
-            <vertical_alignment>1</vertical_alignment>
-          </widget>
           <widget type="fileselector" version="2.0.0">
             <name>File Selector_NewTT</name>
             <pv_name>loc://pathNewFile("")</pv_name>
-            <x>967</x>
-            <y>259</y>
-            <width>170</width>
+            <x>557</x>
+            <y>358</y>
+            <width>110</width>
             <height>30</height>
             <actions>
             </actions>
@@ -311,69 +275,28 @@ print "=======> File Conversion  DONE<========"]]></text>
               </script>
             </scripts>
           </widget>
-          <widget type="label" version="2.0.0">
-            <name>Label_13</name>
-            <text>Target Beam Mode</text>
-            <x>992</x>
-            <y>66</y>
-            <width>129</width>
-            <horizontal_alignment>1</horizontal_alignment>
-          </widget>
-          <widget type="label" version="2.0.0">
-            <name>Label_14</name>
-            <text>File Name Comment</text>
-            <x>990</x>
-            <y>134</y>
-            <width>139</width>
-            <horizontal_alignment>1</horizontal_alignment>
-          </widget>
           <widget type="textentry" version="3.0.0">
             <name>Text Entry</name>
             <pv_name>$(P):$(R):TTMetaFileName</pv_name>
-            <x>968</x>
-            <y>159</y>
-            <width>171</width>
-            <height>30</height>
-            <enabled>false</enabled>
-          </widget>
-          <widget type="label" version="2.0.0">
-            <name>Label_15</name>
-            <text>Select file to upload</text>
-            <x>973</x>
-            <y>231</y>
-            <width>139</width>
-            <horizontal_alignment>1</horizontal_alignment>
-          </widget>
-          <widget type="textentry" version="3.0.0">
-            <name>Text Entry_1</name>
-            <pv_name>$(P):$(R):TTMetaBeamMode</pv_name>
-            <x>968</x>
-            <y>93</y>
-            <width>171</width>
+            <x>677</x>
+            <y>358</y>
+            <width>280</width>
             <height>30</height>
             <enabled>false</enabled>
           </widget>
           <widget type="textupdate" version="2.0.0">
             <name>Text Update_9</name>
             <pv_name>$(P):$(R):TTSaveStatus</pv_name>
-            <x>968</x>
-            <y>332</y>
+            <x>962</x>
+            <y>358</y>
             <width>170</width>
             <height>30</height>
           </widget>
-          <widget type="label" version="2.0.0">
-            <name>Label_21</name>
-            <text>Upload status:</text>
-            <x>980</x>
-            <y>307</y>
-            <width>139</width>
-            <horizontal_alignment>1</horizontal_alignment>
-          </widget>
           <widget type="rectangle" version="2.0.0">
             <name>MGGrey03-background_15</name>
-            <x>33</x>
-            <y>53</y>
-            <width>524</width>
+            <x>32</x>
+            <y>336</y>
+            <width>495</width>
             <height>71</height>
             <line_width>2</line_width>
             <line_color>
@@ -390,8 +313,8 @@ print "=======> File Conversion  DONE<========"]]></text>
           <widget type="label" version="2.0.0">
             <name>Label_17</name>
             <text>Timing Tables source</text>
-            <x>58</x>
-            <y>74</y>
+            <x>42</x>
+            <y>358</y>
             <width>170</width>
             <height>30</height>
             <font>
@@ -402,8 +325,8 @@ print "=======> File Conversion  DONE<========"]]></text>
           <widget type="textentry" version="3.0.0">
             <name>Text Entry_2</name>
             <pv_name>$(PP):ScTableDir-SP</pv_name>
-            <x>243</x>
-            <y>73</y>
+            <x>219</x>
+            <y>358</y>
             <width>287</width>
             <height>30</height>
           </widget>
-- 
GitLab


From 76f3c4011a0a1ff6cdbaf101bf5aad0f32b46f50 Mon Sep 17 00:00:00 2001
From: arek <arek.gorzawski@ess.eu>
Date: Sun, 14 Nov 2021 19:41:39 +0100
Subject: [PATCH 16/18] pvname updated

---
 99-Shared/Beam_OLC/em_SafetyLimits.bob | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/99-Shared/Beam_OLC/em_SafetyLimits.bob b/99-Shared/Beam_OLC/em_SafetyLimits.bob
index 752b4379..1bcc038b 100755
--- a/99-Shared/Beam_OLC/em_SafetyLimits.bob
+++ b/99-Shared/Beam_OLC/em_SafetyLimits.bob
@@ -69,7 +69,7 @@
   </widget>
   <widget type="textupdate" version="2.0.0">
     <name>Text Update_59</name>
-    <pv_name>$(P):$(R):BParamsI</pv_name>
+    <pv_name>$(P):$(R):BParamsCurr</pv_name>
     <x>250</x>
     <y>60</y>
     <width>140</width>
@@ -91,7 +91,7 @@
   </widget>
   <widget type="textupdate" version="2.0.0">
     <name>Text Update_61</name>
-    <pv_name>$(P):$(R):BParamsF</pv_name>
+    <pv_name>$(P):$(R):BParamsFreq</pv_name>
     <x>250</x>
     <y>140</y>
     <width>140</width>
-- 
GitLab


From 08db3a8fb0efa6720c5e9a86137e1bfc2dd27f6d Mon Sep 17 00:00:00 2001
From: arek <arek.gorzawski@ess.eu>
Date: Sun, 14 Nov 2021 19:51:11 +0100
Subject: [PATCH 17/18] removed unused script, layout fix, all buttons the size

---
 10-Top/beamprod.bob | 36 +++++++++++++++---------------------
 1 file changed, 15 insertions(+), 21 deletions(-)

diff --git a/10-Top/beamprod.bob b/10-Top/beamprod.bob
index 55bb02a6..de156fac 100644
--- a/10-Top/beamprod.bob
+++ b/10-Top/beamprod.bob
@@ -195,13 +195,13 @@ pvToWrite = ScriptUtil.getPVByName(widget, "BPROD:Ops:TTToLoad")
 PVUtil.writePV(pvToWrite.getName(), PVUtil.getString(pvToRead), 5000)
 ]]></text>
                 </script>
-                <description>Load table from selected</description>
+                <description>Load table from selected row</description>
               </action>
             </actions>
-            <x>981</x>
-            <y>98</y>
-            <width>150</width>
-            <height>150</height>
+            <x>992</x>
+            <y>118</y>
+            <width>110</width>
+            <height>110</height>
             <font>
               <font family="Source Sans Pro" style="BOLD" size="16.0">
               </font>
@@ -456,7 +456,7 @@ if PVUtil.getString(pvs[1]) == 'ON':
                 <maximum>2.0</maximum>
                 <show_grid>false</show_grid>
                 <title_font>
-                  <font name="Default Bold" family="Source Sans Pro" style="BOLD" size="16.0">
+                  <font family="Source Sans Pro" style="REGULAR" size="16.0">
                   </font>
                 </title_font>
                 <scale_font>
@@ -603,9 +603,10 @@ if PVUtil.getString(pvs[1]) == 'ON':
         <children>
           <widget type="rectangle" version="2.0.0">
             <name>BGGrey01-titlebar_2</name>
-            <y>8</y>
+            <x>11</x>
+            <y>11</y>
             <width>1150</width>
-            <height>400</height>
+            <height>407</height>
             <line_width>2</line_width>
             <line_color>
               <color name="GROUP-BORDER" red="150" green="155" blue="151">
@@ -641,6 +642,7 @@ if PVUtil.getString(pvs[1]) == 'ON':
     <y>510</y>
     <width>1195</width>
     <height>460</height>
+    <active_tab>1</active_tab>
     <tab_height>40</tab_height>
   </widget>
   <widget type="action_button" version="3.0.0">
@@ -648,24 +650,16 @@ if PVUtil.getString(pvs[1]) == 'ON':
     <actions>
       <action type="execute">
         <script file="EmbeddedPy">
-          <text><![CDATA[# Embedded python script
-from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil
-
+          <text><![CDATA[from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil
 PVUtil.writePV("BPROD:Ops:BProdStop", "0", 5000)
-
-#TODO move this writes to the BeamProd IOC
-#PVUtil.writePV("TD-M:Ctrl-SCE-1:BState-Sel", "0", 5000)
-#PVUtil.writePV("BPROD:Ops:BState", "0", 5000)
-#PVUtil.writePV("BPROD:Ops:BMode", "0", 5000)
-#PVUtil.writePV("BPROD:Ops:BDestination", "0", 5000)
-#PVUtil.writePV("BPROD:Ops:TTToLoad", "null.csv", 5000)]]></text>
+]]></text>
         </script>
         <description>ABORT BEAM and load no events</description>
       </action>
     </actions>
     <x>1056</x>
     <y>215</y>
-    <width>102</width>
+    <width>103</width>
     <height>103</height>
     <font>
       <font name="Default Bold" family="Source Sans Pro" style="BOLD" size="16.0">
@@ -1132,9 +1126,9 @@ else:
   <widget type="bool_button" version="2.0.0">
     <name>Boolean Button</name>
     <pv_name>$(P):$(R):BState</pv_name>
-    <x>506</x>
+    <x>508</x>
     <y>217</y>
-    <width>110</width>
+    <width>103</width>
     <height>103</height>
     <off_label>Switch
  Beam ON</off_label>
-- 
GitLab


From ff7e11c6fd11b31432e58bf9725aed67b404fa37 Mon Sep 17 00:00:00 2001
From: arek <arek.gorzawski@ess.eu>
Date: Thu, 18 Nov 2021 14:38:16 +0100
Subject: [PATCH 18/18] magnetron Fault instead of status PV linked to the LED

---
 10-Top/beamprod.bob | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/10-Top/beamprod.bob b/10-Top/beamprod.bob
index de156fac..0c3502da 100644
--- a/10-Top/beamprod.bob
+++ b/10-Top/beamprod.bob
@@ -1209,15 +1209,19 @@ else:
   </widget>
   <widget type="led" version="2.0.0">
     <name>LED_2</name>
-    <pv_name>ISrc-CS:ISS-Magtr-01:Mw-S</pv_name>
+    <pv_name>ISrc-CS:ISS-Magtr-01:GenFault</pv_name>
     <x>747</x>
     <y>449</y>
     <width>30</width>
     <height>30</height>
     <off_color>
-      <color name="OFF" red="90" green="110" blue="90">
+      <color name="On" red="70" green="255" blue="70">
       </color>
     </off_color>
+    <on_color>
+      <color name="SECONDARY" red="202" green="0" blue="0">
+      </color>
+    </on_color>
     <square>true</square>
   </widget>
   <widget type="led" version="2.0.0">
-- 
GitLab