From a28ff8be060d948d86a95df5a77794d423a6a531 Mon Sep 17 00:00:00 2001 From: chrin Date: Thu, 15 Feb 2024 16:13:12 +0100 Subject: [PATCH] GUIs for beamlines --- config/control/hush.json | 21 + config/control/hush_full.json | 77 +++ config/g1/hush.json | 18 + config/g2/hush.json | 18 + config/g3/hush.json | 18 + config/o2/hush.json | 18 + config/pif/hush.json | 18 + help/hush_resources.py | 206 +++--- help/index.html | 8 +- hush.json | 61 +- hush.py | 141 ++-- hush.sh | 4 +- hush_g1.sh | 102 +++ hush_g2.sh | 102 +++ hush_g3.sh | 102 +++ hush_o2.sh | 102 +++ hush_pif.sh | 102 +++ pyrcc5/hush_resources.py | 206 +++--- src/gui.py | 1222 ++++++++++++++++----------------- 19 files changed, 1640 insertions(+), 906 deletions(-) create mode 100755 config/control/hush.json create mode 100755 config/control/hush_full.json create mode 100755 config/g1/hush.json create mode 100755 config/g2/hush.json create mode 100755 config/g3/hush.json create mode 100755 config/o2/hush.json create mode 100755 config/pif/hush.json create mode 100755 hush_g1.sh create mode 100755 hush_g2.sh create mode 100755 hush_g3.sh create mode 100755 hush_o2.sh create mode 100755 hush_pif.sh diff --git a/config/control/hush.json b/config/control/hush.json new file mode 100755 index 0000000..98e4eaf --- /dev/null +++ b/config/control/hush.json @@ -0,0 +1,21 @@ +{ + + "Parameters":{ + + "drawLine" : {"flag" : 0, "data":{ "widget": "QHLine", "text" : "None", "value" : "None"}}, + "delayRamp" : {"flag" : 1, "data":{ "widget": "QDoubleSpinBox", "text" : "Ramp delay (s):", + "value" : 0.1, "min": 0.00, "max": 0.20, "step": 0.01, + "tooltip":"Wait time between sending set point to each magnet in 'Restore'/'Standby' "}}, + "drawLine2" : {"flag" : 0, "data":{ "widget": "QHLine", "text" : "None", "value" : "None"}} + + }, + "Expert":{ + "debug": {"flag" : 0, "data":{ "widget": "None", "text" : "Debug", "value" : 0}}, + "simulation": {"flag" : 1, "data":{ "widget": "None", "text" : "Dry run", "value" : 0}} + }, + "IOC": { + "resultsTabTitle" : "IOC" + }, + "headerMagnetSector": ["B1B2","G1","SH","G2","O2","PIF", "G3"], + "Master": "Controlroom" +} diff --git a/config/control/hush_full.json b/config/control/hush_full.json new file mode 100755 index 0000000..78ccc4f --- /dev/null +++ b/config/control/hush_full.json @@ -0,0 +1,77 @@ +{ + "menuFlags":{ + "hasFile": 0, + "loadInitFile": 0, + "hasDaq": 0, + "hasH5": 0, + "hasEpics": 0 + }, + "hdf": { + "destination" : "./" + }, + "G1":{ + "standby": [-6.867, 6.867, 9.155, 6.867, 6.867, 9.155, 6.867, -6.867, 6.867, -6.867], + "ref" : [-43.813, 43.177, 157.28, 20.017, 30.544, 157,79, 42.203, -42.467, 52.179, -77.032], + "pwrref" : [0.789, 0.764, 17.341, 0.164, 0.366, 17.482, 0.737, 0.736, 1.096, 2.464], + "iocDevice" : ["AME1", "AME2", "QME10"] + }, + "SH":{ + "standby": [-6.8, 6.8, 6.8, -6.8, 6.8, 6.8, -6.8, -6.8, + 6.8, 0], + "ref" : [-34.048, 26.68, 26.68, -34.05, 87.764, 37.424, -47.207, -38.156, + 36.977, 87.642], + "pwrref" : [0.504, 0.292, 0.289, 0.498, 5.434, 0.577, 0.912, 0.608, + 0.578, 3.712], + "iocDevice" : ["QMA7", "AMA2", "QMA12"] + }, + "G2":{ + "standby" : [-6.867, 6.867, -6.867, 6.867, -6.867, -7.553, 7.553, -7.553, + 7.553, 7.553, -7.553, 10.758, 10.758, 23.804], + "ref": [-41.056, 36.548, -30.490, 52.433, -27.636, -37.412, 41.966, -37.296, + 51.200, 53.657, -41.966, 109.543, 109.405, 251.492], + "pwrref" : [0.699, 0.545, 0.389, 1.152, 0.323, 0.374, 0.467, 0.378, + 0.700, 0.772, 0.464, 7.114, 7.112, 21.727], + "iocDevice" : ["QMB2", "QMB4", "AMF1"] + }, + "O2":{ + "standby": [-6.867, 6.867, 6.867, -6.867, 9.155, 6.867, -6.867, 6.867, + -6.867, 6.867], + "ref" : [-40.85, 26.974, 26.974, -40.851, 45.988, 30.890, -29.542, 33.742, + -45.960, 20.165], + "pwrref" : [0.681, 0.297, 0.295, 0.677, 1.013, 0.401, 0.363, 0.475, + 0.887, 0.169], + "iocDevice" : ["QMC2", "AMC1", "QMC7"] + }, + "PIF":{ + "standby": [-6.800, 6.800, 6.800, -6.800, 6.800, 6.800, -6.800, 6.800, + -6.800, 6.800], + "ref" : [-36.159, 34.434, 42.277, -43, 135, 61, -62, 37, + -55, 30], + "pwrref" : [0.16, 0.16, 0.28, 0.31, 3.7, 0.6, 0.73, 0.25, + 0.59, 0.145], + "iocDevice" : ["QMD2", "AMD1", "QMD9"] + }, + "G3":{ + "standby": [-6.800, 6.800, -6.800], + "ref" : [-40.388, 68.393, -34.805], + "pwrref" : [0.64, 1.8, 0.46], + "iocDevice" : ["QMD10", "QMD11", "QMD12"] + }, + "Parameters":{ + + "drawLine" : {"flag" : 0, "data":{ "widget": "QHLine", "text" : "None", "value" : "None"}}, + "delayRamp" : {"flag" : 1, "data":{ "widget": "QDoubleSpinBox", "text" : "Ramp delay (s):", + "value" : 0.1, "min": 0.00, "max": 0.20, "step": 0.01, + "tooltip":"Wait time between sending set point to each magnet in 'Restore'/'Standby' "}}, + "drawLine2" : {"flag" : 0, "data":{ "widget": "QHLine", "text" : "None", "value" : "None"}} + + }, + "Expert":{ + "debug": {"flag" : 0, "data":{ "widget": "None", "text" : "Debug", "value" : 0}}, + "simulation": {"flag" : 1, "data":{ "widget": "None", "text" : "Dry run", "value" : 0}} + }, + "IOC": { + "resultsTabTitle" : "IOC" + }, + "Master": "Controlroom +} diff --git a/config/g1/hush.json b/config/g1/hush.json new file mode 100755 index 0000000..faafc33 --- /dev/null +++ b/config/g1/hush.json @@ -0,0 +1,18 @@ +{ + + "Parameters":{ + + "drawLine" : {"flag" : 0, "data":{ "widget": "QHLine", "text" : "None", "value" : "None"}}, + "delayRamp" : {"flag" : 1, "data":{ "widget": "QDoubleSpinBox", "text" : "Ramp delay (s):", + "value" : 0.1, "min": 0.00, "max": 0.20, "step": 0.01, + "tooltip":"Wait time between sending set point to each magnet in 'Restore'/'Standby' "}}, + "drawLine2" : {"flag" : 0, "data":{ "widget": "QHLine", "text" : "None", "value" : "None"}} + + }, + "Expert":{ + "debug": {"flag" : 0, "data":{ "widget": "None", "text" : "Debug", "value" : 0}}, + "simulation": {"flag" : 1, "data":{ "widget": "None", "text" : "Dry run", "value" : 0}} + }, + "headerMagnetSector": ["G1"], + "Master": "Gantry 1" +} diff --git a/config/g2/hush.json b/config/g2/hush.json new file mode 100755 index 0000000..01d4d80 --- /dev/null +++ b/config/g2/hush.json @@ -0,0 +1,18 @@ +{ + + "Parameters":{ + + "drawLine" : {"flag" : 0, "data":{ "widget": "QHLine", "text" : "None", "value" : "None"}}, + "delayRamp" : {"flag" : 1, "data":{ "widget": "QDoubleSpinBox", "text" : "Ramp delay (s):", + "value" : 0.1, "min": 0.00, "max": 0.20, "step": 0.01, + "tooltip":"Wait time between sending set point to each magnet in 'Restore'/'Standby' "}}, + "drawLine2" : {"flag" : 0, "data":{ "widget": "QHLine", "text" : "None", "value" : "None"}} + + }, + "Expert":{ + "debug": {"flag" : 0, "data":{ "widget": "None", "text" : "Debug", "value" : 0}}, + "simulation": {"flag" : 1, "data":{ "widget": "None", "text" : "Dry run", "value" : 0}} + }, + "headerMagnetSector": ["G2"], + "Master": "Gantry 2" +} diff --git a/config/g3/hush.json b/config/g3/hush.json new file mode 100755 index 0000000..1be609f --- /dev/null +++ b/config/g3/hush.json @@ -0,0 +1,18 @@ +{ + + "Parameters":{ + + "drawLine" : {"flag" : 0, "data":{ "widget": "QHLine", "text" : "None", "value" : "None"}}, + "delayRamp" : {"flag" : 1, "data":{ "widget": "QDoubleSpinBox", "text" : "Ramp delay (s):", + "value" : 0.1, "min": 0.00, "max": 0.20, "step": 0.01, + "tooltip":"Wait time between sending set point to each magnet in 'Restore'/'Standby' "}}, + "drawLine2" : {"flag" : 0, "data":{ "widget": "QHLine", "text" : "None", "value" : "None"}} + + }, + "Expert":{ + "debug": {"flag" : 0, "data":{ "widget": "None", "text" : "Debug", "value" : 0}}, + "simulation": {"flag" : 1, "data":{ "widget": "None", "text" : "Dry run", "value" : 0}} + }, + "headerMagnetSector": ["PIF", "G3"], + "Master": "Gantry 3" +} diff --git a/config/o2/hush.json b/config/o2/hush.json new file mode 100755 index 0000000..91ac03e --- /dev/null +++ b/config/o2/hush.json @@ -0,0 +1,18 @@ +{ + + "Parameters":{ + + "drawLine" : {"flag" : 0, "data":{ "widget": "QHLine", "text" : "None", "value" : "None"}}, + "delayRamp" : {"flag" : 1, "data":{ "widget": "QDoubleSpinBox", "text" : "Ramp delay (s):", + "value" : 0.1, "min": 0.00, "max": 0.20, "step": 0.01, + "tooltip":"Wait time between sending set point to each magnet in 'Restore'/'Standby' "}}, + "drawLine2" : {"flag" : 0, "data":{ "widget": "QHLine", "text" : "None", "value" : "None"}} + + }, + "Expert":{ + "debug": {"flag" : 0, "data":{ "widget": "None", "text" : "Debug", "value" : 0}}, + "simulation": {"flag" : 1, "data":{ "widget": "None", "text" : "Dry run", "value" : 0}} + }, + "headerMagnetSector": ["O2"], + "Master": "OPTIS2" +} diff --git a/config/pif/hush.json b/config/pif/hush.json new file mode 100755 index 0000000..6ce08bc --- /dev/null +++ b/config/pif/hush.json @@ -0,0 +1,18 @@ +{ + + "Parameters":{ + + "drawLine" : {"flag" : 0, "data":{ "widget": "QHLine", "text" : "None", "value" : "None"}}, + "delayRamp" : {"flag" : 1, "data":{ "widget": "QDoubleSpinBox", "text" : "Ramp delay (s):", + "value" : 0.1, "min": 0.00, "max": 0.20, "step": 0.01, + "tooltip":"Wait time between sending set point to each magnet in 'Restore'/'Standby' "}}, + "drawLine2" : {"flag" : 0, "data":{ "widget": "QHLine", "text" : "None", "value" : "None"}} + + }, + "Expert":{ + "debug": {"flag" : 0, "data":{ "widget": "None", "text" : "Debug", "value" : 0}}, + "simulation": {"flag" : 1, "data":{ "widget": "None", "text" : "Dry run", "value" : 0}} + }, + "headerMagnetSector": ["PIF"], + "Master": "PIF" +} diff --git a/help/hush_resources.py b/help/hush_resources.py index e9707eb..fe63827 100644 --- a/help/hush_resources.py +++ b/help/hush_resources.py @@ -2,79 +2,23 @@ # Resource object code # -# Created by: The Resource Compiler for PyQt5 (Qt v5.15.3) +# Created by: The Resource Compiler for PyQt5 (Qt v5.9.7) # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore qt_resource_data = b"\ -\x00\x00\x00\xa7\ +\x00\x00\x00\x80\ \x3c\ \x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ \x65\x3e\x57\x65\x62\x20\x48\x65\x6c\x70\x3c\x2f\x74\x69\x74\x6c\ \x65\x3e\x3c\x2f\x68\x65\x61\x64\x3e\x0a\x3c\x62\x6f\x64\x79\x3e\ -\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x50\x61\x67\x65\x20\x31\x20\x6f\ +\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x50\x61\x67\x65\x20\x35\x20\x6f\ \x66\x20\x77\x65\x62\x20\x68\x65\x6c\x70\x3c\x2f\x62\x3e\x3c\x2f\ -\x70\x3e\x0a\x3c\x70\x3e\x20\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\ -\x22\x70\x61\x67\x65\x32\x2e\x68\x74\x6d\x6c\x22\x3e\x20\x4e\x65\ -\x78\x74\x3c\x2f\x61\x3e\x3c\x2f\x70\x3e\x0a\x3c\x70\x3e\x3c\x62\ -\x3e\x65\x74\x63\x2e\x2e\x2e\x3c\x2f\x62\x3e\x20\x65\x74\x63\x2e\ -\x2e\x2e\x3c\x2f\x70\x3e\x0a\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\ -\x68\x74\x6d\x6c\x3e\x0a\ -\x00\x00\x03\x2c\ -\x3c\ -\x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ -\x65\x3e\x48\x79\x70\x65\x72\x20\x50\x6f\x77\x65\x72\x20\x55\x73\ -\x61\x67\x65\x20\x61\x6e\x64\x20\x53\x61\x76\x69\x6e\x67\x20\x48\ -\x69\x67\x68\x6c\x69\x67\x68\x74\x73\x20\x61\x74\x20\x50\x72\x6f\ -\x73\x63\x61\x6e\x2c\x20\x48\x55\x53\x48\x21\x3c\x2f\x74\x69\x74\ -\x6c\x65\x3e\x3c\x2f\x68\x65\x61\x64\x3e\x0a\x3c\x62\x6f\x64\x79\ -\x3e\x0a\x0a\x3c\x68\x35\x20\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\ -\x6f\x6c\x6f\x72\x3a\x67\x72\x61\x79\x3b\x22\x3e\x4a\x61\x6e\x75\ -\x61\x72\x79\x20\x32\x30\x32\x34\x2c\x20\x4a\x61\x6e\x20\x43\x68\ -\x72\x69\x6e\x20\x61\x6e\x64\x20\x2e\x2e\x2e\x3c\x2f\x68\x35\x3e\ -\x0a\x3c\x68\x34\x3e\x20\x3c\x73\x70\x61\x6e\x20\x73\x74\x79\x6c\ -\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x20\x72\x65\x64\x3b\x22\x3e\ -\x48\x3c\x2f\x73\x70\x61\x6e\x3e\x79\x70\x65\x72\x20\x3c\x73\x70\ -\x61\x6e\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\ -\x20\x67\x72\x61\x79\x3b\x22\x3e\x50\x6f\x77\x65\x72\x3c\x2f\x73\ -\x70\x61\x6e\x3e\x20\x3c\x73\x70\x61\x6e\x20\x73\x74\x79\x6c\x65\ -\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x20\x72\x65\x64\x3b\x22\x3e\x55\ -\x3c\x2f\x73\x70\x61\x6e\x3e\x73\x61\x67\x65\x20\x61\x6e\x64\x20\ -\x3c\x73\x70\x61\x6e\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\ -\x6f\x72\x3a\x20\x72\x65\x64\x3b\x22\x3e\x53\x3c\x2f\x73\x70\x61\ -\x6e\x3e\x61\x76\x69\x6e\x67\x20\x3c\x73\x70\x61\x6e\x20\x73\x74\ -\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x20\x72\x65\x64\x3b\ -\x22\x3e\x48\x3c\x2f\x73\x70\x61\x6e\x3e\x69\x67\x68\x6c\x69\x67\ -\x68\x74\x73\x20\x61\x74\x20\x50\x72\x6f\x73\x63\x61\x6e\x2c\x20\ -\x3c\x73\x70\x61\x6e\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\ -\x6f\x72\x3a\x20\x72\x65\x64\x3b\x22\x3e\x48\x55\x53\x48\x21\x3c\ -\x2f\x73\x70\x61\x6e\x3e\x3c\x2f\x68\x34\x3e\x0a\x3c\x68\x32\x20\ -\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x62\x6c\x75\ -\x65\x3b\x22\x3e\x41\x62\x6f\x75\x74\x3c\x2f\x68\x32\x3e\x0a\x0a\ -\x3c\x70\x3e\x54\x68\x69\x73\x20\x3c\x62\x3e\x68\x75\x73\x68\x3c\ -\x2f\x62\x3e\x20\x61\x70\x70\x6c\x69\x63\x61\x74\x69\x6f\x6e\x20\ -\x69\x6e\x68\x65\x72\x69\x74\x73\x20\x66\x72\x6f\x6d\x20\x74\x68\ -\x65\x20\x57\x69\x6e\x64\x6f\x77\x20\x62\x61\x73\x65\x20\x63\x6c\ -\x61\x73\x73\x2e\x3c\x62\x72\x3e\x20\x20\x0a\x3c\x70\x3e\x69\x6e\ -\x66\x6f\x72\x6d\x61\x74\x69\x6f\x6e\x20\x63\x6f\x6e\x63\x65\x72\ -\x6e\x69\x6e\x67\x20\x74\x68\x69\x73\x20\x61\x70\x70\x6c\x69\x63\ -\x61\x74\x69\x6f\x6e\x2c\x20\x73\x75\x63\x68\x20\x61\x73\x20\x63\ -\x6f\x6e\x66\x69\x67\x75\x72\x61\x74\x69\x6f\x6e\x20\x70\x61\x72\ -\x61\x6d\x65\x74\x65\x72\x73\x20\x6f\x72\x20\x6f\x74\x68\x65\x72\ -\x2c\x20\x6d\x61\x79\x20\x62\x65\x20\x65\x6e\x74\x65\x72\x65\x64\ -\x2c\x20\x65\x2e\x67\x2e\x2c\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\ -\x22\x70\x61\x67\x65\x31\x2e\x68\x74\x6d\x6c\x22\x3e\x68\x65\x72\ -\x65\x3c\x2f\x61\x3e\x3c\x2f\x70\x3e\x0a\x0a\x3c\x68\x32\x20\x73\ -\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x62\x6c\x75\x65\ -\x3b\x22\x3e\x54\x68\x65\x20\x50\x61\x6e\x65\x6c\x3c\x2f\x68\x32\ -\x3e\x0a\x0a\x3c\x70\x3e\x54\x68\x65\x73\x65\x20\x77\x65\x62\x20\ -\x70\x61\x67\x65\x73\x20\x61\x72\x65\x20\x74\x6f\x20\x62\x65\x20\ -\x63\x6f\x6d\x70\x6c\x65\x74\x65\x64\x20\x62\x79\x20\x74\x68\x65\ -\x20\x61\x70\x70\x6c\x69\x63\x61\x74\x69\x6f\x6e\x20\x6f\x77\x6e\ -\x65\x72\x2e\x3c\x62\x72\x3e\x0a\x0a\x0a\x0a\x0a\x3c\x2f\x62\x6f\ -\x64\x79\x3e\x3c\x2f\x68\x74\x6d\x6c\x3e\x0a\ +\x70\x3e\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x65\x74\x63\x2e\x2e\x2e\ +\x3c\x2f\x62\x3e\x20\x65\x74\x63\x2e\x2e\x2e\x3c\x2f\x70\x3e\x0a\ +\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\x68\x74\x6d\x6c\x3e\x0a\ \x00\x00\x00\xa7\ \x3c\ \x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ @@ -88,16 +32,19 @@ qt_resource_data = b"\ \x3e\x65\x74\x63\x2e\x2e\x2e\x3c\x2f\x62\x3e\x20\x65\x74\x63\x2e\ \x2e\x2e\x3c\x2f\x70\x3e\x0a\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\ \x68\x74\x6d\x6c\x3e\x0a\ -\x00\x00\x00\x80\ +\x00\x00\x00\xa7\ \x3c\ \x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ \x65\x3e\x57\x65\x62\x20\x48\x65\x6c\x70\x3c\x2f\x74\x69\x74\x6c\ \x65\x3e\x3c\x2f\x68\x65\x61\x64\x3e\x0a\x3c\x62\x6f\x64\x79\x3e\ -\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x50\x61\x67\x65\x20\x35\x20\x6f\ +\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x50\x61\x67\x65\x20\x32\x20\x6f\ \x66\x20\x77\x65\x62\x20\x68\x65\x6c\x70\x3c\x2f\x62\x3e\x3c\x2f\ -\x70\x3e\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x65\x74\x63\x2e\x2e\x2e\ -\x3c\x2f\x62\x3e\x20\x65\x74\x63\x2e\x2e\x2e\x3c\x2f\x70\x3e\x0a\ -\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\x68\x74\x6d\x6c\x3e\x0a\ +\x70\x3e\x0a\x3c\x70\x3e\x20\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\ +\x22\x70\x61\x67\x65\x33\x2e\x68\x74\x6d\x6c\x22\x3e\x20\x4e\x65\ +\x78\x74\x3c\x2f\x61\x3e\x3c\x2f\x70\x3e\x0a\x3c\x70\x3e\x3c\x62\ +\x3e\x65\x74\x63\x2e\x2e\x2e\x3c\x2f\x62\x3e\x20\x65\x74\x63\x2e\ +\x2e\x2e\x3c\x2f\x70\x3e\x0a\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\ +\x68\x74\x6d\x6c\x3e\x0a\ \x00\x00\x00\xa7\ \x3c\ \x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ @@ -116,18 +63,87 @@ qt_resource_data = b"\ \x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ \x65\x3e\x57\x65\x62\x20\x48\x65\x6c\x70\x3c\x2f\x74\x69\x74\x6c\ \x65\x3e\x3c\x2f\x68\x65\x61\x64\x3e\x0a\x3c\x62\x6f\x64\x79\x3e\ -\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x50\x61\x67\x65\x20\x32\x20\x6f\ +\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x50\x61\x67\x65\x20\x31\x20\x6f\ \x66\x20\x77\x65\x62\x20\x68\x65\x6c\x70\x3c\x2f\x62\x3e\x3c\x2f\ \x70\x3e\x0a\x3c\x70\x3e\x20\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\ -\x22\x70\x61\x67\x65\x33\x2e\x68\x74\x6d\x6c\x22\x3e\x20\x4e\x65\ +\x22\x70\x61\x67\x65\x32\x2e\x68\x74\x6d\x6c\x22\x3e\x20\x4e\x65\ \x78\x74\x3c\x2f\x61\x3e\x3c\x2f\x70\x3e\x0a\x3c\x70\x3e\x3c\x62\ \x3e\x65\x74\x63\x2e\x2e\x2e\x3c\x2f\x62\x3e\x20\x65\x74\x63\x2e\ \x2e\x2e\x3c\x2f\x70\x3e\x0a\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\ \x68\x74\x6d\x6c\x3e\x0a\ +\x00\x00\x03\x29\ +\x3c\ +\x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ +\x65\x3e\x48\x61\x6e\x64\x73\x6f\x6d\x65\x20\x50\x6f\x77\x65\x72\ +\x20\x55\x73\x61\x67\x65\x20\x61\x6e\x64\x20\x53\x61\x76\x69\x6e\ +\x67\x20\x48\x69\x65\x72\x61\x72\x63\x68\x79\x20\x61\x74\x20\x50\ +\x72\x6f\x73\x63\x61\x6e\x2c\x20\x48\x55\x53\x48\x21\x3c\x2f\x74\ +\x69\x74\x6c\x65\x3e\x3c\x2f\x68\x65\x61\x64\x3e\x0a\x3c\x62\x6f\ +\x64\x79\x3e\x0a\x0a\x3c\x68\x35\x20\x20\x73\x74\x79\x6c\x65\x3d\ +\x22\x63\x6f\x6c\x6f\x72\x3a\x67\x72\x61\x79\x3b\x22\x3e\x4a\x61\ +\x6e\x75\x61\x72\x79\x20\x32\x30\x32\x34\x2c\x20\x4a\x61\x6e\x20\ +\x43\x68\x72\x69\x6e\x3c\x2f\x68\x35\x3e\x0a\x3c\x68\x34\x3e\x20\ +\x3c\x73\x70\x61\x6e\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\ +\x6f\x72\x3a\x20\x72\x65\x64\x3b\x22\x3e\x48\x3c\x2f\x73\x70\x61\ +\x6e\x3e\x61\x6e\x64\x73\x6f\x6d\x65\x20\x3c\x73\x70\x61\x6e\x20\ +\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x20\x67\x72\ +\x61\x79\x3b\x22\x3e\x50\x6f\x77\x65\x72\x3c\x2f\x73\x70\x61\x6e\ +\x3e\x20\x3c\x73\x70\x61\x6e\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\ +\x6f\x6c\x6f\x72\x3a\x20\x72\x65\x64\x3b\x22\x3e\x55\x3c\x2f\x73\ +\x70\x61\x6e\x3e\x73\x61\x67\x65\x20\x61\x6e\x64\x20\x3c\x73\x70\ +\x61\x6e\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\ +\x20\x72\x65\x64\x3b\x22\x3e\x53\x3c\x2f\x73\x70\x61\x6e\x3e\x61\ +\x76\x69\x6e\x67\x20\x3c\x73\x70\x61\x6e\x20\x73\x74\x79\x6c\x65\ +\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x20\x72\x65\x64\x3b\x22\x3e\x48\ +\x3c\x2f\x73\x70\x61\x6e\x3e\x69\x65\x72\x61\x72\x63\x68\x79\x20\ +\x61\x74\x20\x50\x72\x6f\x73\x63\x61\x6e\x2c\x20\x3c\x73\x70\x61\ +\x6e\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x20\ +\x72\x65\x64\x3b\x22\x3e\x48\x55\x53\x48\x21\x3c\x2f\x73\x70\x61\ +\x6e\x3e\x3c\x2f\x68\x34\x3e\x0a\x3c\x68\x32\x20\x73\x74\x79\x6c\ +\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x62\x6c\x75\x65\x3b\x22\x3e\ +\x41\x62\x6f\x75\x74\x3c\x2f\x68\x32\x3e\x0a\x0a\x3c\x70\x3e\x54\ +\x68\x69\x73\x20\x3c\x62\x3e\x48\x55\x53\x48\x21\x3c\x2f\x62\x3e\ +\x20\x61\x70\x70\x6c\x69\x63\x61\x74\x69\x6f\x6e\x20\x69\x6e\x68\ +\x65\x72\x69\x74\x73\x20\x66\x72\x6f\x6d\x20\x74\x68\x65\x20\x57\ +\x69\x6e\x64\x6f\x77\x20\x62\x61\x73\x65\x20\x63\x6c\x61\x73\x73\ +\x2e\x3c\x62\x72\x3e\x20\x20\x0a\x3c\x70\x3e\x69\x6e\x66\x6f\x72\ +\x6d\x61\x74\x69\x6f\x6e\x20\x63\x6f\x6e\x63\x65\x72\x6e\x69\x6e\ +\x67\x20\x74\x68\x69\x73\x20\x61\x70\x70\x6c\x69\x63\x61\x74\x69\ +\x6f\x6e\x2c\x20\x73\x75\x63\x68\x20\x61\x73\x20\x63\x6f\x6e\x66\ +\x69\x67\x75\x72\x61\x74\x69\x6f\x6e\x20\x70\x61\x72\x61\x6d\x65\ +\x74\x65\x72\x73\x20\x6f\x72\x20\x6f\x74\x68\x65\x72\x2c\x20\x6d\ +\x61\x79\x20\x62\x65\x20\x65\x6e\x74\x65\x72\x65\x64\x2c\x20\x65\ +\x2e\x67\x2e\x2c\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\x22\x70\x61\ +\x67\x65\x31\x2e\x68\x74\x6d\x6c\x22\x3e\x68\x65\x72\x65\x3c\x2f\ +\x61\x3e\x3c\x2f\x70\x3e\x0a\x0a\x3c\x68\x32\x20\x73\x74\x79\x6c\ +\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x62\x6c\x75\x65\x3b\x22\x3e\ +\x54\x68\x65\x20\x50\x61\x6e\x65\x6c\x3c\x2f\x68\x32\x3e\x0a\x0a\ +\x3c\x70\x3e\x54\x68\x65\x73\x65\x20\x77\x65\x62\x20\x70\x61\x67\ +\x65\x73\x20\x61\x72\x65\x20\x74\x6f\x20\x62\x65\x20\x63\x6f\x6d\ +\x70\x6c\x65\x74\x65\x64\x20\x62\x79\x20\x74\x68\x65\x20\x61\x70\ +\x70\x6c\x69\x63\x61\x74\x69\x6f\x6e\x20\x6f\x77\x6e\x65\x72\x2e\ +\x3c\x62\x72\x3e\x0a\x0a\x0a\x0a\x0a\x3c\x2f\x62\x6f\x64\x79\x3e\ +\x3c\x2f\x68\x74\x6d\x6c\x3e\x0a\ " qt_resource_name = b"\ \x00\x0a\ +\x08\x8a\x34\x9c\ +\x00\x70\ +\x00\x61\x00\x67\x00\x65\x00\x35\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ +\x00\x0a\ +\x08\x7a\x34\x9c\ +\x00\x70\ +\x00\x61\x00\x67\x00\x65\x00\x34\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ +\x00\x0a\ +\x08\x5a\x34\x9c\ +\x00\x70\ +\x00\x61\x00\x67\x00\x65\x00\x32\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ +\x00\x0a\ +\x08\x6a\x34\x9c\ +\x00\x70\ +\x00\x61\x00\x67\x00\x65\x00\x33\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ +\x00\x0a\ \x08\x4a\x34\x9c\ \x00\x70\ \x00\x61\x00\x67\x00\x65\x00\x31\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ @@ -135,53 +151,37 @@ qt_resource_name = b"\ \x0c\xba\xf2\x7c\ \x00\x69\ \x00\x6e\x00\x64\x00\x65\x00\x78\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ -\x00\x0a\ -\x08\x7a\x34\x9c\ -\x00\x70\ -\x00\x61\x00\x67\x00\x65\x00\x34\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ -\x00\x0a\ -\x08\x8a\x34\x9c\ -\x00\x70\ -\x00\x61\x00\x67\x00\x65\x00\x35\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ -\x00\x0a\ -\x08\x6a\x34\x9c\ -\x00\x70\ -\x00\x61\x00\x67\x00\x65\x00\x33\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ -\x00\x0a\ -\x08\x5a\x34\x9c\ -\x00\x70\ -\x00\x61\x00\x67\x00\x65\x00\x32\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ " qt_resource_struct_v1 = b"\ \x00\x00\x00\x00\x00\x02\x00\x00\x00\x06\x00\x00\x00\x01\ +\x00\x00\x00\x68\x00\x00\x00\x00\x00\x01\x00\x00\x02\x85\ +\x00\x00\x00\x34\x00\x00\x00\x00\x00\x01\x00\x00\x01\x2f\ +\x00\x00\x00\x4e\x00\x00\x00\x00\x00\x01\x00\x00\x01\xda\ +\x00\x00\x00\x1a\x00\x00\x00\x00\x00\x01\x00\x00\x00\x84\ \x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ -\x00\x00\x00\x82\x00\x00\x00\x00\x00\x01\x00\x00\x05\xb5\ -\x00\x00\x00\x68\x00\x00\x00\x00\x00\x01\x00\x00\x05\x0a\ -\x00\x00\x00\x34\x00\x00\x00\x00\x00\x01\x00\x00\x03\xdb\ -\x00\x00\x00\x4e\x00\x00\x00\x00\x00\x01\x00\x00\x04\x86\ -\x00\x00\x00\x1a\x00\x00\x00\x00\x00\x01\x00\x00\x00\xab\ +\x00\x00\x00\x82\x00\x00\x00\x00\x00\x01\x00\x00\x03\x30\ " qt_resource_struct_v2 = b"\ \x00\x00\x00\x00\x00\x02\x00\x00\x00\x06\x00\x00\x00\x01\ \x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x68\x00\x00\x00\x00\x00\x01\x00\x00\x02\x85\ +\x00\x00\x01\x8d\x9c\xeb\xd9\x5b\ +\x00\x00\x00\x34\x00\x00\x00\x00\x00\x01\x00\x00\x01\x2f\ +\x00\x00\x01\x8d\x9c\xeb\xd9\x5c\ +\x00\x00\x00\x4e\x00\x00\x00\x00\x00\x01\x00\x00\x01\xda\ +\x00\x00\x01\x8d\x9c\xeb\xd9\x5e\ +\x00\x00\x00\x1a\x00\x00\x00\x00\x00\x01\x00\x00\x00\x84\ +\x00\x00\x01\x8d\x9c\xeb\xd9\x5f\ \x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ -\x00\x00\x01\x8d\x3b\x71\x36\x5d\ -\x00\x00\x00\x82\x00\x00\x00\x00\x00\x01\x00\x00\x05\xb5\ -\x00\x00\x01\x8d\x3b\x71\x36\x75\ -\x00\x00\x00\x68\x00\x00\x00\x00\x00\x01\x00\x00\x05\x0a\ -\x00\x00\x01\x8d\x3b\x71\x36\x78\ -\x00\x00\x00\x34\x00\x00\x00\x00\x00\x01\x00\x00\x03\xdb\ -\x00\x00\x01\x8d\x3b\x71\x36\x90\ -\x00\x00\x00\x4e\x00\x00\x00\x00\x00\x01\x00\x00\x04\x86\ -\x00\x00\x01\x8d\x3b\x71\x36\x94\ -\x00\x00\x00\x1a\x00\x00\x00\x00\x00\x01\x00\x00\x00\xab\ -\x00\x00\x01\x8d\x3b\x78\x4e\xc0\ +\x00\x00\x01\x8d\x9c\xeb\xd9\x61\ +\x00\x00\x00\x82\x00\x00\x00\x00\x00\x01\x00\x00\x03\x30\ +\x00\x00\x01\x8d\xa7\xc7\x77\x2b\ " -qt_version = [int(v) for v in QtCore.qVersion().split('.')] -if qt_version < [5, 8, 0]: +qt_version = QtCore.qVersion().split('.') +if qt_version < ['5', '8', '0']: rcc_version = 1 qt_resource_struct = qt_resource_struct_v1 else: diff --git a/help/index.html b/help/index.html index 713c5d9..c868595 100755 --- a/help/index.html +++ b/help/index.html @@ -1,11 +1,11 @@ -Hyper Power Usage and Saving Highlights at Proscan, HUSH! +Handsome Power Usage and Saving Hierarchy at Proscan, HUSH! -
January 2024, Jan Chrin and ...
-

Hyper Power Usage and Saving Highlights at Proscan, HUSH!

+
January 2024, Jan Chrin
+

Handsome Power Usage and Saving Hierarchy at Proscan, HUSH!

About

-

This hush application inherits from the Window base class.
+

This HUSH! application inherits from the Window base class.

information concerning this application, such as configuration parameters or other, may be entered, e.g., here

The Panel

diff --git a/hush.json b/hush.json index b1c8045..da18eb0 100755 --- a/hush.json +++ b/hush.json @@ -9,13 +9,40 @@ "hdf": { "destination" : "./" }, + "header" : ["COMET","BMA1","G1","SH","G2","O2","PIF","G3","MASTER"], + "B1B2":{ + "status": "PRO-HUSH:SHIFT-TYPE", + "colorObj" : "Beamline", + "color": "#9888b6", + "qlingrad": "qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffffff, stop: 1 #9888b6)", + "device" : ["QMA1", "QMA2", "QMA3", "QMA4", "QMA5"], + "attribute" : ["SOL:2", "IST:2", "PWR:2"], + "standby": [-9.155, 9.155, -6.867, -6.867, 6.867], + "ref" : [-91.464, 102.359, -97.096, -44.269, 37.113], + "pwrref" : [9.065, 5.142, 4.061, 0.867, 0.597], + "iocDevice" : ["QMA1", "QMA2", "QMA5"] + }, "G1":{ + "status": "BME1:STA:2", + "colorObj" : "Beamline", + "color": "#9888b6", + "qlingrad": "qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffffff, stop: 1 #9888b6)", + "device" : ["QME1", "QME2", "AME1", "QME4", "QME5", + "AME2", "QME7", "QME8", "QME10", "QME11"], + "attribute" : ["SOL:2", "IST:2", "PWR"], "standby": [-6.867, 6.867, 9.155, 6.867, 6.867, 9.155, 6.867, -6.867, 6.867, -6.867], "ref" : [-43.813, 43.177, 157.28, 20.017, 30.544, 157,79, 42.203, -42.467, 52.179, -77.032], "pwrref" : [0.789, 0.764, 17.341, 0.164, 0.366, 17.482, 0.737, 0.736, 1.096, 2.464], "iocDevice" : ["AME1", "AME2", "QME10"] }, "SH":{ + "status": "BMA1:STA:2", + "colorObj" : "Machine", + "color": "gray", + "qlingrad": "qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffffff, stop: 1 gray)", + "device" : ["QMA6", "QMA7", "QMA8", "QMA9", "AMA2", "QMA10", "QMA11", + "QMA12", "QMA13", "AMA3"], + "attribute" : ["SOL:2", "IST:2", "PWR"], "standby": [-6.8, 6.8, 6.8, -6.8, 6.8, 6.8, -6.8, -6.8, 6.8, 0], "ref" : [-34.048, 26.68, 26.68, -34.05, 87.764, 37.424, -47.207, -38.156, @@ -25,6 +52,13 @@ "iocDevice" : ["QMA7", "AMA2", "QMA12"] }, "G2":{ + "status": "BMB1:STA:2", + "colorObj" : "Beamline", + "color": "#9888b6", + "qlingrad": "qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffffff, stop: 1 #9888b6)", + "device" : ["QMB1", "QMB2", "QMB3", "QMB4", "QMB5", "QMF1", "QMF2", + "QMF3", "QMF4", "QMF6", "QMF7", "AMF1", "AMF2", "AMF3"], + "attribute" : ["SOL:2", "IST:2", "PWR"], "standby" : [-6.867, 6.867, -6.867, 6.867, -6.867, -7.553, 7.553, -7.553, 7.553, 7.553, -7.553, 10.758, 10.758, 23.804], "ref": [-41.056, 36.548, -30.490, 52.433, -27.636, -37.412, 41.966, -37.296, @@ -34,6 +68,13 @@ "iocDevice" : ["QMB2", "QMB4", "AMF1"] }, "O2":{ + "status": "BMC1:STA:2", + "colorObj" : "Beamline", + "color": "#9888b6", + "qlingrad": "qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffffff, stop: 1 #9888b6)", + "device" : ["QMC1", "QMC2", "QMC3", "QMC4", "AMC1", "QMC5", "QMC6", + "QMC7", "QMC8", "QMC9"], + "attribute" : ["SOL:2", "IST:2", "PWR"], "standby": [-6.867, 6.867, 6.867, -6.867, 9.155, 6.867, -6.867, 6.867, -6.867, 6.867], "ref" : [-40.85, 26.974, 26.974, -40.851, 45.988, 30.890, -29.542, 33.742, @@ -43,6 +84,13 @@ "iocDevice" : ["QMC2", "AMC1", "QMC7"] }, "PIF":{ + "status": "BMD1:STA:2", + "colorObj" : "Athos", + "color": "#2e5894", + "qlingrad": "qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffffff, stop: 1 #2e5894)", + "device" : ["QMD1", "QMD2", "QMD3", "QMD4", "AMD1","QMD5", "QMD6", "QMD7", + "QMD8", "QMD9"], + "attribute" : ["SOL:2", "IST:2", "PWR"], "standby": [-6.800, 6.800, 6.800, -6.800, 6.800, 6.800, -6.800, 6.800, -6.800, 6.800], "ref" : [-36.159, 34.434, 42.277, -43, 135, 61, -62, 37, @@ -52,13 +100,16 @@ "iocDevice" : ["QMD2", "AMD1", "QMD9"] }, "G3":{ + "colorObj" : "Beamline", + "color": "#9888b6", + "qlingrad": "qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffffff, stop: 1 #9888b6)", + "device" : ["QMD10", "QMD11", "QMD12"], + "attribute" : ["SOL:2", "IST:2", "PWR"], "standby": [-6.800, 6.800, -6.800], "ref" : [-40.388, 68.393, -34.805], "pwrref" : [0.64, 1.8, 0.46], "iocDevice" : ["QMD10", "QMD11", "QMD12"] - }, - - + }, "Parameters":{ "drawLine" : {"flag" : 0, "data":{ "widget": "QHLine", "text" : "None", "value" : "None"}}, @@ -74,5 +125,7 @@ }, "IOC": { "resultsTabTitle" : "IOC" - } + }, + "headerMagnetSector": ["B1B2","G1","SH","G2","O2","PIF", "G3"], + "Master": "Controlroom" } diff --git a/hush.py b/hush.py index 1410fdf..b194acc 100644 --- a/hush.py +++ b/hush.py @@ -1,39 +1,31 @@ +"""Hush.py module for energy saving accounting +""" import inspect -import logging import os import platform -import random import sys import time - -from qtpy import QtCore, QtGui -from qtpy.QtGui import QColor, QFont, QIcon from qtpy.QtCore import __version__ as QT_VERSION_STR from qtpy.QtCore import ( - PYQT_VERSION_STR, QFile, QIODevice, Qt, QThread, Signal, Slot) -from qtpy.QtWidgets import ( - QApplication, QDockWidget, QGridLayout, QGroupBox, QHBoxLayout, QLabel, - QMainWindow, QMessageBox, QProgressBar, QPushButton, QSizePolicy, - QSpacerItem, QTabWidget, QTableWidget, QTableWidgetItem, QVBoxLayout, - QWidget) + PYQT_VERSION_STR, Signal, Slot) +from qtpy.QtWidgets import QApplication, QMessageBox from apps4ops.bdbase.base import BaseWindow -from apps4ops.bdbase.enumkind import MsgSeverity, UserMode, Facility +from apps4ops.bdbase.enumkind import UserMode, Facility from apps4ops.bdbase.helpbrowser import HelpBrowser -from apps4ops.proscan.sendelogproscan import QSendToELOG - from apps4ops.proscan.enumkind import ElogPROSCAN - -from src.gui import AppGui +from apps4ops.proscan.sendelogproscan import QSendToELOG from pyrcc5 import hush_resources +from src.gui import AppGui _pymodule = os.path.basename(__file__) _appname, _appext = _pymodule.split(".") _appversion = "1.0.0" -#_title = """Power Usage & Saving Hierarchy""" #, HUSH!""" +# _title = """Power Usage & Saving Hierarchy""" #, HUSH!""" _title = """HUSH!""" + def _line(): """Macro to return the current line number. @@ -45,71 +37,75 @@ def _line(): """ return inspect.currentframe().f_back.f_lineno + class StartMain(BaseWindow): + """Main class, inherits from apps4ops BaseWindow + """ trigger_log_message = Signal(str, str, int, str, dict) - - def __init__(self, parent=None): - super(StartMain, self).__init__( - parent=parent, pymodule=_pymodule, appversion=_appversion, - title=_title, user_mode=UserMode.OPERATION, facility=Facility.PROSCAN, - has_optics=False, has_procedure=False) + + def __init__(self, parent=None): + # super(StartMain, self).__init__( + # Using Python 3 style super() without arguments + super().__init__( + parent=parent, pymodule=_pymodule, appversion=_appversion, + title=_title, user_mode=UserMode.OPERATION, + facility=Facility.PROSCAN, has_optics=False, has_procedure=False) self.appname = _appname self.title = _title self.gui = AppGui(self) - #print(self.input_parameters) - - def prepare_elog_message(self): - + elog = ElogPROSCAN() - - + self.system_idx = elog.system.NONE self.eintrag_idx = elog.eintrag.INFO self.effekt_idx = elog.effekt.NO - + self.attach_files = [] - _simulation = self.input_parameters['simulation'] + simulation = self.input_parameters["simulation"] if self.all_data: - if self.all_data['Input data'] is not None: + if self.all_data["Input data"] is not None: try: - _simulation = self.all_data['Input data']['simulation'] + simulation = self.all_data["Input data"]["simulation"] except KeyError: - _simulation = self.input_parameters['simulation'] + simulation = self.input_parameters["simulation"] pass - - self.logbook = "Sandkasten" if _simulation else "Proscan" - self.title = _title - - sector = ["
G1: ","
SH: ","
G2: ", "
O2: ","
PIF: ", - "
G3: ","
------------------
Tot: "] - pvlist = ['PG1-HUSH:TOTSAVE', 'PSH-HUSH:TOTSAVE', 'PG2-HUSH:TOTSAVE', - 'PO2-HUSH:TOTSAVE', 'PPIF-HUSH:TOTSAVE', 'PG3-HUSH:TOTSAVE', - 'PRO-HUSH:TOTSAVE'] - value, stat, stat_list =self.cafe.getScalarList(pvlist, cacheFlag=True) - message = "Power saved for the current year stands at {:.3f} MWh:".format( - value[-1]) + self.logbook = "Sandkasten" if simulation else "Proscan" + self.title = _title + + sector = ["
G1: ", "
SH: ", "
G2: ", "
O2: ", "
PIF: ", + "
G3: ", "
------------------
Tot: "] + pvlist = ["PG1-HUSH:TOTSAVE", "PSH-HUSH:TOTSAVE", "PG2-HUSH:TOTSAVE", + "PO2-HUSH:TOTSAVE", "PPIF-HUSH:TOTSAVE", "PG3-HUSH:TOTSAVE", + "PRO-HUSH:TOTSAVE"] + value, stat, stat_list = self.cafe.getScalarList( + pvlist, cacheFlag=True) + + if stat != self.cyca.ICAFE_NORMAL: + self.check_status_list(_pymodule, "getScalarListCache", + pvlist, stat_list, _line()) + + message = ("Power saved for the current year stands at " + + "{:.3f} MWh:").format(value[-1]) for label, val in zip(sector, value): - message += label + "{:.3f}".format(val) + " MWh" - + message += label + "{:.3f} MwH".format(val) + self.message = message print(self.message, flush=True) - - return @Slot() def send_to_elog(self): @Slot() def save_fig_thread_finished(): - + time.sleep(0.2) - + if self.all_data: QSendToELOG(self, logbook=self.logbook, eintragIdx=self.eintrag_idx, @@ -118,16 +114,14 @@ class StartMain(BaseWindow): title=self.title, message=self.message, attachFile=self.attach_files) - + time.sleep(1.0) - return - - #if not self.verify_send_to_elog(): + + # if not self.verify_send_to_elog(): # return - self.prepare_elog_message() - + print(self.message, flush=True) if not self.all_data: @@ -140,12 +134,12 @@ class StartMain(BaseWindow): attachFile=self.attach_files) return + folder_name = self.elog_dest + if not os.path.exists(folder_name): + os.makedirs(folder_name) - _folder_name = self.elog_dest - if not os.path.exists(_folder_name): - os.makedirs(_folder_name) - - ''' + time_in_seconds = 0 + ''' time_in_seconds = self.all_data['Ambient data']['Time in seconds'] if self.all_data['Processed data']['Reanalysis time']: reanalysis_time = self.all_data['Processed data'][ @@ -153,19 +147,18 @@ class StartMain(BaseWindow): else: reanalysis_time = None ''' - + reanalysis_time = None - self.folder_name = _folder_name + self.folder_name = folder_name save_fig_thread = self.SaveFigureThread( self, self.folder_name, time_in_seconds, reanalysis_time) save_fig_thread.finished.connect(save_fig_thread_finished) - + save_fig_thread.start() time.sleep(0.05) - @Slot() def closeEvent(self, event): @@ -190,7 +183,7 @@ class StartMain(BaseWindow):

IOC Administrator: H. Lutz

1st Responsible: J. Chrin or 3301 (Control Room)

- +

Initiates energy saving procedures and records power saved

Python {2} - Qt {3} - PyQt {4}
cafe {5} - epics {6} on {7}""".format( @@ -204,24 +197,24 @@ class StartMain(BaseWindow): def show_help(self): """ Invoke help pages from hush_resources """ - index_html ="index.html" #self.appname + "/index.html" - help_base = ":" # + self.appname + index_html = "index.html" # self.appname + "/index.html" + help_base = ":" # + self.appname help_page = HelpBrowser(help_base, index_html, self) help_page.show() + ######################################################################### if __name__ == "__main__": app = QApplication(sys.argv) splash = BaseWindow.initialize_application( - app, appname=_appname, delay=20, facility=Facility.PROSCAN) - + app, appname=_appname, delay=25, facility=Facility.PROSCAN) + myapp = StartMain() - + myapp.show() if splash is not None: splash.finish(myapp) app.exec_() - diff --git a/hush.sh b/hush.sh index a832307..6c733bd 100755 --- a/hush.sh +++ b/hush.sh @@ -1,5 +1,5 @@ #!/bin/bash -cd /proscan/bd/applications/hush/hla/1.0.0 +cd /proscan/bd/applications/hush/hla/1.1.0 # For use if script is sourced rather than executed appNameDefault="hush.sh" @@ -43,7 +43,7 @@ _EPICS_HOST_ARCH=${RHREL}-x86_64 #/sf/bd/applications/OnlineModel/default/scripts/VA: #C_EXT version for Py 3.7: -export PYTHONPATH=.:/opt/gfa/cafe/python/pycafe/cafe-1.19.3/lib/${_EPICS_HOST_ARCH}:/proscan/bd/applications/deps/apps4ops/v1.7.0 +export PYTHONPATH=.:/opt/gfa/cafe/python/pycafe/cafe-1.19.3/lib/${_EPICS_HOST_ARCH}:/proscan/bd/applications/deps/apps4ops/v1.8.0 echo $PYTHONPATH diff --git a/hush_g1.sh b/hush_g1.sh new file mode 100755 index 0000000..674799c --- /dev/null +++ b/hush_g1.sh @@ -0,0 +1,102 @@ +#!/bin/bash +cd /proscan/bd/applications/hush/hla/1.1.0 + +# For use if script is sourced rather than executed +appNameDefault="hush.sh" +configBase="config" +configSector=${configBase}/g1 +echo "${configSector}" + +module unload gcc +module load gcc/7.3.0 + +if [ -z "$PS1" ] # no prompt? +### if [ -v PS1 ] # On Bash 4.2+ ... +then + # non-interactive + echo "Non-interactive script" +else + # interactive + echo "Interactive/sourced script" +fi + +# Select Python Version here. Currently one of 3.5, 3.7 +PYTHON_VERSION=3.7 + +if [ "$1" ]; then + + if [ "$1" == "3.5" -o "$1" == "35" ]; then + echo "Using default version $PYTHON_VERSION" + elif [ "$1" == "3.7" -o "$1" == "37" ]; then + PYTHON_VERSION=3.7 + else + echo "Requested Python version is not supported" + echo "Using default version $PYTHON_VERSION" + fi + +fi + +echo "PYTHON_VERSION $PYTHON_VERSION" + +_EPICS_HOST_ARCH=${RHREL}-x86_64 +#_EPICS_HOST_ARCH=${EPICS_HOST_ARCH} +. /opt/gfa/python $PYTHON_VERSION + +#/sf/bd/applications/OnlineModel/current/PythonModule:/sf/bd/applications/OnlineModel/current +#/sf/bd/applications/OnlineModel/default/scripts/VA: + +#C_EXT version for Py 3.7: +export PYTHONPATH=.:/opt/gfa/cafe/python/pycafe/cafe-1.19.3/lib/${_EPICS_HOST_ARCH}:/proscan/bd/applications/deps/apps4ops/v1.8.0 + + +echo $PYTHONPATH + +STDOUT_DIR="/tmp" +#Set to 0 if you do not wish std::out to write to logger +STDOUT_FLAG=1 + +if [ "$#" -gt "0" ]; then + appName=$0 + if [ "$appName" == "-bash" ]; then + appName=$appNameDefault + fi +else +appName=$appNameDefault +fi + +#echo "$appName $@ $#" +baseName="${appName##*/}" +name=$(echo "$baseName" | cut -f 1 -d '.') +nameLog=${name}-$USER +echo "Application: $name" +echo "nameLog: $nameLog" + +#Configuration files can be overwritten +#python ${name}.py -s="/sf/bd/deps/pyqtacc/common/config/style.json" -f="/sf/bd/deps/pyqtacc/v1.0.0/pyqtacc/qrc_resources/facility/sf/config/base.json" -q="/sf/bd/deps/pyqtacc/common/config/acc.qss" & + +if [ "${STDOUT_FLAG}" -gt "0" ] ; then +#if changing the std::out destination, remember to also change it in your json config file (for reading) + if test -f "$STDOUT_DIR/${nameLog}.log---"; then + rm -f $STDOUT_DIR/${nameLog}.log--- + fi + if test -f "$STDOUT_DIR/${nameLog}.log--"; then + cp $STDOUT_DIR/${nameLog}.log-- $STDOUT_DIR/${nameLog}.log--- + rm -f $STDOUT_DIR/${nameLog}.log-- + fi + if test -f "$STDOUT_DIR/${nameLog}.log-"; then + cp $STDOUT_DIR/${nameLog}.log- $STDOUT_DIR/${nameLog}.log-- + rm -f $STDOUT_DIR/${nameLog}.log- + fi + if test -f "$STDOUT_DIR/${nameLog}.log"; then + cp $STDOUT_DIR/${nameLog}.log $STDOUT_DIR/${nameLog}.log- + rm -f $STDOUT_DIR/${nameLog}.log + fi + + python ${name}.py -u ${configSector}/${name}.json >> $STDOUT_DIR/${nameLog}.log 2>&1 & + chmod 777 $STDOUT_DIR/${nameLog}.log +else +#Run instead without std::out + python ${name}.py -u ${configSector}/${name}.json & +fi + + diff --git a/hush_g2.sh b/hush_g2.sh new file mode 100755 index 0000000..dc594e0 --- /dev/null +++ b/hush_g2.sh @@ -0,0 +1,102 @@ +#!/bin/bash +cd /proscan/bd/applications/hush/hla/1.1.0 + +# For use if script is sourced rather than executed +appNameDefault="hush.sh" +configBase="config" +configSector=${configBase}/g2 +echo "${configSector}" + +module unload gcc +module load gcc/7.3.0 + +if [ -z "$PS1" ] # no prompt? +### if [ -v PS1 ] # On Bash 4.2+ ... +then + # non-interactive + echo "Non-interactive script" +else + # interactive + echo "Interactive/sourced script" +fi + +# Select Python Version here. Currently one of 3.5, 3.7 +PYTHON_VERSION=3.7 + +if [ "$1" ]; then + + if [ "$1" == "3.5" -o "$1" == "35" ]; then + echo "Using default version $PYTHON_VERSION" + elif [ "$1" == "3.7" -o "$1" == "37" ]; then + PYTHON_VERSION=3.7 + else + echo "Requested Python version is not supported" + echo "Using default version $PYTHON_VERSION" + fi + +fi + +echo "PYTHON_VERSION $PYTHON_VERSION" + +_EPICS_HOST_ARCH=${RHREL}-x86_64 +#_EPICS_HOST_ARCH=${EPICS_HOST_ARCH} +. /opt/gfa/python $PYTHON_VERSION + +#/sf/bd/applications/OnlineModel/current/PythonModule:/sf/bd/applications/OnlineModel/current +#/sf/bd/applications/OnlineModel/default/scripts/VA: + +#C_EXT version for Py 3.7: +export PYTHONPATH=.:/opt/gfa/cafe/python/pycafe/cafe-1.19.3/lib/${_EPICS_HOST_ARCH}:/proscan/bd/applications/deps/apps4ops/v1.8.0 + + +echo $PYTHONPATH + +STDOUT_DIR="/tmp" +#Set to 0 if you do not wish std::out to write to logger +STDOUT_FLAG=1 + +if [ "$#" -gt "0" ]; then + appName=$0 + if [ "$appName" == "-bash" ]; then + appName=$appNameDefault + fi +else +appName=$appNameDefault +fi + +#echo "$appName $@ $#" +baseName="${appName##*/}" +name=$(echo "$baseName" | cut -f 1 -d '.') +nameLog=${name}-$USER +echo "Application: $name" +echo "nameLog: $nameLog" + +#Configuration files can be overwritten +#python ${name}.py -s="/sf/bd/deps/pyqtacc/common/config/style.json" -f="/sf/bd/deps/pyqtacc/v1.0.0/pyqtacc/qrc_resources/facility/sf/config/base.json" -q="/sf/bd/deps/pyqtacc/common/config/acc.qss" & + +if [ "${STDOUT_FLAG}" -gt "0" ] ; then +#if changing the std::out destination, remember to also change it in your json config file (for reading) + if test -f "$STDOUT_DIR/${nameLog}.log---"; then + rm -f $STDOUT_DIR/${nameLog}.log--- + fi + if test -f "$STDOUT_DIR/${nameLog}.log--"; then + cp $STDOUT_DIR/${nameLog}.log-- $STDOUT_DIR/${nameLog}.log--- + rm -f $STDOUT_DIR/${nameLog}.log-- + fi + if test -f "$STDOUT_DIR/${nameLog}.log-"; then + cp $STDOUT_DIR/${nameLog}.log- $STDOUT_DIR/${nameLog}.log-- + rm -f $STDOUT_DIR/${nameLog}.log- + fi + if test -f "$STDOUT_DIR/${nameLog}.log"; then + cp $STDOUT_DIR/${nameLog}.log $STDOUT_DIR/${nameLog}.log- + rm -f $STDOUT_DIR/${nameLog}.log + fi + + python ${name}.py -u ${configSector}/${name}.json >> $STDOUT_DIR/${nameLog}.log 2>&1 & + chmod 777 $STDOUT_DIR/${nameLog}.log +else +#Run instead without std::out + python ${name}.py -u ${configSector}/${name}.json & +fi + + diff --git a/hush_g3.sh b/hush_g3.sh new file mode 100755 index 0000000..8e87ba7 --- /dev/null +++ b/hush_g3.sh @@ -0,0 +1,102 @@ +#!/bin/bash +cd /proscan/bd/applications/hush/hla/1.1.0 + +# For use if script is sourced rather than executed +appNameDefault="hush.sh" +configBase="config" +configSector=${configBase}/g3 +echo "${configSector}" + +module unload gcc +module load gcc/7.3.0 + +if [ -z "$PS1" ] # no prompt? +### if [ -v PS1 ] # On Bash 4.2+ ... +then + # non-interactive + echo "Non-interactive script" +else + # interactive + echo "Interactive/sourced script" +fi + +# Select Python Version here. Currently one of 3.5, 3.7 +PYTHON_VERSION=3.7 + +if [ "$1" ]; then + + if [ "$1" == "3.5" -o "$1" == "35" ]; then + echo "Using default version $PYTHON_VERSION" + elif [ "$1" == "3.7" -o "$1" == "37" ]; then + PYTHON_VERSION=3.7 + else + echo "Requested Python version is not supported" + echo "Using default version $PYTHON_VERSION" + fi + +fi + +echo "PYTHON_VERSION $PYTHON_VERSION" + +_EPICS_HOST_ARCH=${RHREL}-x86_64 +#_EPICS_HOST_ARCH=${EPICS_HOST_ARCH} +. /opt/gfa/python $PYTHON_VERSION + +#/sf/bd/applications/OnlineModel/current/PythonModule:/sf/bd/applications/OnlineModel/current +#/sf/bd/applications/OnlineModel/default/scripts/VA: + +#C_EXT version for Py 3.7: +export PYTHONPATH=.:/opt/gfa/cafe/python/pycafe/cafe-1.19.3/lib/${_EPICS_HOST_ARCH}:/proscan/bd/applications/deps/apps4ops/v1.8.0 + + +echo $PYTHONPATH + +STDOUT_DIR="/tmp" +#Set to 0 if you do not wish std::out to write to logger +STDOUT_FLAG=1 + +if [ "$#" -gt "0" ]; then + appName=$0 + if [ "$appName" == "-bash" ]; then + appName=$appNameDefault + fi +else +appName=$appNameDefault +fi + +#echo "$appName $@ $#" +baseName="${appName##*/}" +name=$(echo "$baseName" | cut -f 1 -d '.') +nameLog=${name}-$USER +echo "Application: $name" +echo "nameLog: $nameLog" + +#Configuration files can be overwritten +#python ${name}.py -s="/sf/bd/deps/pyqtacc/common/config/style.json" -f="/sf/bd/deps/pyqtacc/v1.0.0/pyqtacc/qrc_resources/facility/sf/config/base.json" -q="/sf/bd/deps/pyqtacc/common/config/acc.qss" & + +if [ "${STDOUT_FLAG}" -gt "0" ] ; then +#if changing the std::out destination, remember to also change it in your json config file (for reading) + if test -f "$STDOUT_DIR/${nameLog}.log---"; then + rm -f $STDOUT_DIR/${nameLog}.log--- + fi + if test -f "$STDOUT_DIR/${nameLog}.log--"; then + cp $STDOUT_DIR/${nameLog}.log-- $STDOUT_DIR/${nameLog}.log--- + rm -f $STDOUT_DIR/${nameLog}.log-- + fi + if test -f "$STDOUT_DIR/${nameLog}.log-"; then + cp $STDOUT_DIR/${nameLog}.log- $STDOUT_DIR/${nameLog}.log-- + rm -f $STDOUT_DIR/${nameLog}.log- + fi + if test -f "$STDOUT_DIR/${nameLog}.log"; then + cp $STDOUT_DIR/${nameLog}.log $STDOUT_DIR/${nameLog}.log- + rm -f $STDOUT_DIR/${nameLog}.log + fi + + python ${name}.py -u ${configSector}/${name}.json >> $STDOUT_DIR/${nameLog}.log 2>&1 & + chmod 777 $STDOUT_DIR/${nameLog}.log +else +#Run instead without std::out + python ${name}.py -u ${configSector}/${name}.json & +fi + + diff --git a/hush_o2.sh b/hush_o2.sh new file mode 100755 index 0000000..6ac82df --- /dev/null +++ b/hush_o2.sh @@ -0,0 +1,102 @@ +#!/bin/bash +cd /proscan/bd/applications/hush/hla/1.1.0 + +# For use if script is sourced rather than executed +appNameDefault="hush.sh" +configBase="config" +configSector=${configBase}/o2 +echo "${configSector}" + +module unload gcc +module load gcc/7.3.0 + +if [ -z "$PS1" ] # no prompt? +### if [ -v PS1 ] # On Bash 4.2+ ... +then + # non-interactive + echo "Non-interactive script" +else + # interactive + echo "Interactive/sourced script" +fi + +# Select Python Version here. Currently one of 3.5, 3.7 +PYTHON_VERSION=3.7 + +if [ "$1" ]; then + + if [ "$1" == "3.5" -o "$1" == "35" ]; then + echo "Using default version $PYTHON_VERSION" + elif [ "$1" == "3.7" -o "$1" == "37" ]; then + PYTHON_VERSION=3.7 + else + echo "Requested Python version is not supported" + echo "Using default version $PYTHON_VERSION" + fi + +fi + +echo "PYTHON_VERSION $PYTHON_VERSION" + +_EPICS_HOST_ARCH=${RHREL}-x86_64 +#_EPICS_HOST_ARCH=${EPICS_HOST_ARCH} +. /opt/gfa/python $PYTHON_VERSION + +#/sf/bd/applications/OnlineModel/current/PythonModule:/sf/bd/applications/OnlineModel/current +#/sf/bd/applications/OnlineModel/default/scripts/VA: + +#C_EXT version for Py 3.7: +export PYTHONPATH=.:/opt/gfa/cafe/python/pycafe/cafe-1.19.3/lib/${_EPICS_HOST_ARCH}:/proscan/bd/applications/deps/apps4ops/v1.8.0 + + +echo $PYTHONPATH + +STDOUT_DIR="/tmp" +#Set to 0 if you do not wish std::out to write to logger +STDOUT_FLAG=1 + +if [ "$#" -gt "0" ]; then + appName=$0 + if [ "$appName" == "-bash" ]; then + appName=$appNameDefault + fi +else +appName=$appNameDefault +fi + +#echo "$appName $@ $#" +baseName="${appName##*/}" +name=$(echo "$baseName" | cut -f 1 -d '.') +nameLog=${name}-$USER +echo "Application: $name" +echo "nameLog: $nameLog" + +#Configuration files can be overwritten +#python ${name}.py -s="/sf/bd/deps/pyqtacc/common/config/style.json" -f="/sf/bd/deps/pyqtacc/v1.0.0/pyqtacc/qrc_resources/facility/sf/config/base.json" -q="/sf/bd/deps/pyqtacc/common/config/acc.qss" & + +if [ "${STDOUT_FLAG}" -gt "0" ] ; then +#if changing the std::out destination, remember to also change it in your json config file (for reading) + if test -f "$STDOUT_DIR/${nameLog}.log---"; then + rm -f $STDOUT_DIR/${nameLog}.log--- + fi + if test -f "$STDOUT_DIR/${nameLog}.log--"; then + cp $STDOUT_DIR/${nameLog}.log-- $STDOUT_DIR/${nameLog}.log--- + rm -f $STDOUT_DIR/${nameLog}.log-- + fi + if test -f "$STDOUT_DIR/${nameLog}.log-"; then + cp $STDOUT_DIR/${nameLog}.log- $STDOUT_DIR/${nameLog}.log-- + rm -f $STDOUT_DIR/${nameLog}.log- + fi + if test -f "$STDOUT_DIR/${nameLog}.log"; then + cp $STDOUT_DIR/${nameLog}.log $STDOUT_DIR/${nameLog}.log- + rm -f $STDOUT_DIR/${nameLog}.log + fi + + python ${name}.py -u ${configSector}/${name}.json >> $STDOUT_DIR/${nameLog}.log 2>&1 & + chmod 777 $STDOUT_DIR/${nameLog}.log +else +#Run instead without std::out + python ${name}.py -u ${configSector}/${name}.json & +fi + + diff --git a/hush_pif.sh b/hush_pif.sh new file mode 100755 index 0000000..486c78b --- /dev/null +++ b/hush_pif.sh @@ -0,0 +1,102 @@ +#!/bin/bash +cd /proscan/bd/applications/hush/hla/1.1.0 + +# For use if script is sourced rather than executed +appNameDefault="hush.sh" +configBase="config" +configSector=${configBase}/pif +echo "${configSector}" + +module unload gcc +module load gcc/7.3.0 + +if [ -z "$PS1" ] # no prompt? +### if [ -v PS1 ] # On Bash 4.2+ ... +then + # non-interactive + echo "Non-interactive script" +else + # interactive + echo "Interactive/sourced script" +fi + +# Select Python Version here. Currently one of 3.5, 3.7 +PYTHON_VERSION=3.7 + +if [ "$1" ]; then + + if [ "$1" == "3.5" -o "$1" == "35" ]; then + echo "Using default version $PYTHON_VERSION" + elif [ "$1" == "3.7" -o "$1" == "37" ]; then + PYTHON_VERSION=3.7 + else + echo "Requested Python version is not supported" + echo "Using default version $PYTHON_VERSION" + fi + +fi + +echo "PYTHON_VERSION $PYTHON_VERSION" + +_EPICS_HOST_ARCH=${RHREL}-x86_64 +#_EPICS_HOST_ARCH=${EPICS_HOST_ARCH} +. /opt/gfa/python $PYTHON_VERSION + +#/sf/bd/applications/OnlineModel/current/PythonModule:/sf/bd/applications/OnlineModel/current +#/sf/bd/applications/OnlineModel/default/scripts/VA: + +#C_EXT version for Py 3.7: +export PYTHONPATH=.:/opt/gfa/cafe/python/pycafe/cafe-1.19.3/lib/${_EPICS_HOST_ARCH}:/proscan/bd/applications/deps/apps4ops/v1.8.0 + + +echo $PYTHONPATH + +STDOUT_DIR="/tmp" +#Set to 0 if you do not wish std::out to write to logger +STDOUT_FLAG=1 + +if [ "$#" -gt "0" ]; then + appName=$0 + if [ "$appName" == "-bash" ]; then + appName=$appNameDefault + fi +else +appName=$appNameDefault +fi + +#echo "$appName $@ $#" +baseName="${appName##*/}" +name=$(echo "$baseName" | cut -f 1 -d '.') +nameLog=${name}-$USER +echo "Application: $name" +echo "nameLog: $nameLog" + +#Configuration files can be overwritten +#python ${name}.py -s="/sf/bd/deps/pyqtacc/common/config/style.json" -f="/sf/bd/deps/pyqtacc/v1.0.0/pyqtacc/qrc_resources/facility/sf/config/base.json" -q="/sf/bd/deps/pyqtacc/common/config/acc.qss" & + +if [ "${STDOUT_FLAG}" -gt "0" ] ; then +#if changing the std::out destination, remember to also change it in your json config file (for reading) + if test -f "$STDOUT_DIR/${nameLog}.log---"; then + rm -f $STDOUT_DIR/${nameLog}.log--- + fi + if test -f "$STDOUT_DIR/${nameLog}.log--"; then + cp $STDOUT_DIR/${nameLog}.log-- $STDOUT_DIR/${nameLog}.log--- + rm -f $STDOUT_DIR/${nameLog}.log-- + fi + if test -f "$STDOUT_DIR/${nameLog}.log-"; then + cp $STDOUT_DIR/${nameLog}.log- $STDOUT_DIR/${nameLog}.log-- + rm -f $STDOUT_DIR/${nameLog}.log- + fi + if test -f "$STDOUT_DIR/${nameLog}.log"; then + cp $STDOUT_DIR/${nameLog}.log $STDOUT_DIR/${nameLog}.log- + rm -f $STDOUT_DIR/${nameLog}.log + fi + + python ${name}.py -u ${configSector}/${name}.json >> $STDOUT_DIR/${nameLog}.log 2>&1 & + chmod 777 $STDOUT_DIR/${nameLog}.log +else +#Run instead without std::out + python ${name}.py -u ${configSector}/${name}.json & +fi + + diff --git a/pyrcc5/hush_resources.py b/pyrcc5/hush_resources.py index e9707eb..fe63827 100644 --- a/pyrcc5/hush_resources.py +++ b/pyrcc5/hush_resources.py @@ -2,79 +2,23 @@ # Resource object code # -# Created by: The Resource Compiler for PyQt5 (Qt v5.15.3) +# Created by: The Resource Compiler for PyQt5 (Qt v5.9.7) # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore qt_resource_data = b"\ -\x00\x00\x00\xa7\ +\x00\x00\x00\x80\ \x3c\ \x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ \x65\x3e\x57\x65\x62\x20\x48\x65\x6c\x70\x3c\x2f\x74\x69\x74\x6c\ \x65\x3e\x3c\x2f\x68\x65\x61\x64\x3e\x0a\x3c\x62\x6f\x64\x79\x3e\ -\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x50\x61\x67\x65\x20\x31\x20\x6f\ +\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x50\x61\x67\x65\x20\x35\x20\x6f\ \x66\x20\x77\x65\x62\x20\x68\x65\x6c\x70\x3c\x2f\x62\x3e\x3c\x2f\ -\x70\x3e\x0a\x3c\x70\x3e\x20\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\ -\x22\x70\x61\x67\x65\x32\x2e\x68\x74\x6d\x6c\x22\x3e\x20\x4e\x65\ -\x78\x74\x3c\x2f\x61\x3e\x3c\x2f\x70\x3e\x0a\x3c\x70\x3e\x3c\x62\ -\x3e\x65\x74\x63\x2e\x2e\x2e\x3c\x2f\x62\x3e\x20\x65\x74\x63\x2e\ -\x2e\x2e\x3c\x2f\x70\x3e\x0a\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\ -\x68\x74\x6d\x6c\x3e\x0a\ -\x00\x00\x03\x2c\ -\x3c\ -\x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ -\x65\x3e\x48\x79\x70\x65\x72\x20\x50\x6f\x77\x65\x72\x20\x55\x73\ -\x61\x67\x65\x20\x61\x6e\x64\x20\x53\x61\x76\x69\x6e\x67\x20\x48\ -\x69\x67\x68\x6c\x69\x67\x68\x74\x73\x20\x61\x74\x20\x50\x72\x6f\ -\x73\x63\x61\x6e\x2c\x20\x48\x55\x53\x48\x21\x3c\x2f\x74\x69\x74\ -\x6c\x65\x3e\x3c\x2f\x68\x65\x61\x64\x3e\x0a\x3c\x62\x6f\x64\x79\ -\x3e\x0a\x0a\x3c\x68\x35\x20\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\ -\x6f\x6c\x6f\x72\x3a\x67\x72\x61\x79\x3b\x22\x3e\x4a\x61\x6e\x75\ -\x61\x72\x79\x20\x32\x30\x32\x34\x2c\x20\x4a\x61\x6e\x20\x43\x68\ -\x72\x69\x6e\x20\x61\x6e\x64\x20\x2e\x2e\x2e\x3c\x2f\x68\x35\x3e\ -\x0a\x3c\x68\x34\x3e\x20\x3c\x73\x70\x61\x6e\x20\x73\x74\x79\x6c\ -\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x20\x72\x65\x64\x3b\x22\x3e\ -\x48\x3c\x2f\x73\x70\x61\x6e\x3e\x79\x70\x65\x72\x20\x3c\x73\x70\ -\x61\x6e\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\ -\x20\x67\x72\x61\x79\x3b\x22\x3e\x50\x6f\x77\x65\x72\x3c\x2f\x73\ -\x70\x61\x6e\x3e\x20\x3c\x73\x70\x61\x6e\x20\x73\x74\x79\x6c\x65\ -\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x20\x72\x65\x64\x3b\x22\x3e\x55\ -\x3c\x2f\x73\x70\x61\x6e\x3e\x73\x61\x67\x65\x20\x61\x6e\x64\x20\ -\x3c\x73\x70\x61\x6e\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\ -\x6f\x72\x3a\x20\x72\x65\x64\x3b\x22\x3e\x53\x3c\x2f\x73\x70\x61\ -\x6e\x3e\x61\x76\x69\x6e\x67\x20\x3c\x73\x70\x61\x6e\x20\x73\x74\ -\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x20\x72\x65\x64\x3b\ -\x22\x3e\x48\x3c\x2f\x73\x70\x61\x6e\x3e\x69\x67\x68\x6c\x69\x67\ -\x68\x74\x73\x20\x61\x74\x20\x50\x72\x6f\x73\x63\x61\x6e\x2c\x20\ -\x3c\x73\x70\x61\x6e\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\ -\x6f\x72\x3a\x20\x72\x65\x64\x3b\x22\x3e\x48\x55\x53\x48\x21\x3c\ -\x2f\x73\x70\x61\x6e\x3e\x3c\x2f\x68\x34\x3e\x0a\x3c\x68\x32\x20\ -\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x62\x6c\x75\ -\x65\x3b\x22\x3e\x41\x62\x6f\x75\x74\x3c\x2f\x68\x32\x3e\x0a\x0a\ -\x3c\x70\x3e\x54\x68\x69\x73\x20\x3c\x62\x3e\x68\x75\x73\x68\x3c\ -\x2f\x62\x3e\x20\x61\x70\x70\x6c\x69\x63\x61\x74\x69\x6f\x6e\x20\ -\x69\x6e\x68\x65\x72\x69\x74\x73\x20\x66\x72\x6f\x6d\x20\x74\x68\ -\x65\x20\x57\x69\x6e\x64\x6f\x77\x20\x62\x61\x73\x65\x20\x63\x6c\ -\x61\x73\x73\x2e\x3c\x62\x72\x3e\x20\x20\x0a\x3c\x70\x3e\x69\x6e\ -\x66\x6f\x72\x6d\x61\x74\x69\x6f\x6e\x20\x63\x6f\x6e\x63\x65\x72\ -\x6e\x69\x6e\x67\x20\x74\x68\x69\x73\x20\x61\x70\x70\x6c\x69\x63\ -\x61\x74\x69\x6f\x6e\x2c\x20\x73\x75\x63\x68\x20\x61\x73\x20\x63\ -\x6f\x6e\x66\x69\x67\x75\x72\x61\x74\x69\x6f\x6e\x20\x70\x61\x72\ -\x61\x6d\x65\x74\x65\x72\x73\x20\x6f\x72\x20\x6f\x74\x68\x65\x72\ -\x2c\x20\x6d\x61\x79\x20\x62\x65\x20\x65\x6e\x74\x65\x72\x65\x64\ -\x2c\x20\x65\x2e\x67\x2e\x2c\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\ -\x22\x70\x61\x67\x65\x31\x2e\x68\x74\x6d\x6c\x22\x3e\x68\x65\x72\ -\x65\x3c\x2f\x61\x3e\x3c\x2f\x70\x3e\x0a\x0a\x3c\x68\x32\x20\x73\ -\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x62\x6c\x75\x65\ -\x3b\x22\x3e\x54\x68\x65\x20\x50\x61\x6e\x65\x6c\x3c\x2f\x68\x32\ -\x3e\x0a\x0a\x3c\x70\x3e\x54\x68\x65\x73\x65\x20\x77\x65\x62\x20\ -\x70\x61\x67\x65\x73\x20\x61\x72\x65\x20\x74\x6f\x20\x62\x65\x20\ -\x63\x6f\x6d\x70\x6c\x65\x74\x65\x64\x20\x62\x79\x20\x74\x68\x65\ -\x20\x61\x70\x70\x6c\x69\x63\x61\x74\x69\x6f\x6e\x20\x6f\x77\x6e\ -\x65\x72\x2e\x3c\x62\x72\x3e\x0a\x0a\x0a\x0a\x0a\x3c\x2f\x62\x6f\ -\x64\x79\x3e\x3c\x2f\x68\x74\x6d\x6c\x3e\x0a\ +\x70\x3e\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x65\x74\x63\x2e\x2e\x2e\ +\x3c\x2f\x62\x3e\x20\x65\x74\x63\x2e\x2e\x2e\x3c\x2f\x70\x3e\x0a\ +\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\x68\x74\x6d\x6c\x3e\x0a\ \x00\x00\x00\xa7\ \x3c\ \x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ @@ -88,16 +32,19 @@ qt_resource_data = b"\ \x3e\x65\x74\x63\x2e\x2e\x2e\x3c\x2f\x62\x3e\x20\x65\x74\x63\x2e\ \x2e\x2e\x3c\x2f\x70\x3e\x0a\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\ \x68\x74\x6d\x6c\x3e\x0a\ -\x00\x00\x00\x80\ +\x00\x00\x00\xa7\ \x3c\ \x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ \x65\x3e\x57\x65\x62\x20\x48\x65\x6c\x70\x3c\x2f\x74\x69\x74\x6c\ \x65\x3e\x3c\x2f\x68\x65\x61\x64\x3e\x0a\x3c\x62\x6f\x64\x79\x3e\ -\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x50\x61\x67\x65\x20\x35\x20\x6f\ +\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x50\x61\x67\x65\x20\x32\x20\x6f\ \x66\x20\x77\x65\x62\x20\x68\x65\x6c\x70\x3c\x2f\x62\x3e\x3c\x2f\ -\x70\x3e\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x65\x74\x63\x2e\x2e\x2e\ -\x3c\x2f\x62\x3e\x20\x65\x74\x63\x2e\x2e\x2e\x3c\x2f\x70\x3e\x0a\ -\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\x68\x74\x6d\x6c\x3e\x0a\ +\x70\x3e\x0a\x3c\x70\x3e\x20\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\ +\x22\x70\x61\x67\x65\x33\x2e\x68\x74\x6d\x6c\x22\x3e\x20\x4e\x65\ +\x78\x74\x3c\x2f\x61\x3e\x3c\x2f\x70\x3e\x0a\x3c\x70\x3e\x3c\x62\ +\x3e\x65\x74\x63\x2e\x2e\x2e\x3c\x2f\x62\x3e\x20\x65\x74\x63\x2e\ +\x2e\x2e\x3c\x2f\x70\x3e\x0a\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\ +\x68\x74\x6d\x6c\x3e\x0a\ \x00\x00\x00\xa7\ \x3c\ \x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ @@ -116,18 +63,87 @@ qt_resource_data = b"\ \x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ \x65\x3e\x57\x65\x62\x20\x48\x65\x6c\x70\x3c\x2f\x74\x69\x74\x6c\ \x65\x3e\x3c\x2f\x68\x65\x61\x64\x3e\x0a\x3c\x62\x6f\x64\x79\x3e\ -\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x50\x61\x67\x65\x20\x32\x20\x6f\ +\x0a\x0a\x3c\x70\x3e\x3c\x62\x3e\x50\x61\x67\x65\x20\x31\x20\x6f\ \x66\x20\x77\x65\x62\x20\x68\x65\x6c\x70\x3c\x2f\x62\x3e\x3c\x2f\ \x70\x3e\x0a\x3c\x70\x3e\x20\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\ -\x22\x70\x61\x67\x65\x33\x2e\x68\x74\x6d\x6c\x22\x3e\x20\x4e\x65\ +\x22\x70\x61\x67\x65\x32\x2e\x68\x74\x6d\x6c\x22\x3e\x20\x4e\x65\ \x78\x74\x3c\x2f\x61\x3e\x3c\x2f\x70\x3e\x0a\x3c\x70\x3e\x3c\x62\ \x3e\x65\x74\x63\x2e\x2e\x2e\x3c\x2f\x62\x3e\x20\x65\x74\x63\x2e\ \x2e\x2e\x3c\x2f\x70\x3e\x0a\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\ \x68\x74\x6d\x6c\x3e\x0a\ +\x00\x00\x03\x29\ +\x3c\ +\x68\x74\x6d\x6c\x3e\x3c\x68\x65\x61\x64\x3e\x3c\x74\x69\x74\x6c\ +\x65\x3e\x48\x61\x6e\x64\x73\x6f\x6d\x65\x20\x50\x6f\x77\x65\x72\ +\x20\x55\x73\x61\x67\x65\x20\x61\x6e\x64\x20\x53\x61\x76\x69\x6e\ +\x67\x20\x48\x69\x65\x72\x61\x72\x63\x68\x79\x20\x61\x74\x20\x50\ +\x72\x6f\x73\x63\x61\x6e\x2c\x20\x48\x55\x53\x48\x21\x3c\x2f\x74\ +\x69\x74\x6c\x65\x3e\x3c\x2f\x68\x65\x61\x64\x3e\x0a\x3c\x62\x6f\ +\x64\x79\x3e\x0a\x0a\x3c\x68\x35\x20\x20\x73\x74\x79\x6c\x65\x3d\ +\x22\x63\x6f\x6c\x6f\x72\x3a\x67\x72\x61\x79\x3b\x22\x3e\x4a\x61\ +\x6e\x75\x61\x72\x79\x20\x32\x30\x32\x34\x2c\x20\x4a\x61\x6e\x20\ +\x43\x68\x72\x69\x6e\x3c\x2f\x68\x35\x3e\x0a\x3c\x68\x34\x3e\x20\ +\x3c\x73\x70\x61\x6e\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\ +\x6f\x72\x3a\x20\x72\x65\x64\x3b\x22\x3e\x48\x3c\x2f\x73\x70\x61\ +\x6e\x3e\x61\x6e\x64\x73\x6f\x6d\x65\x20\x3c\x73\x70\x61\x6e\x20\ +\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x20\x67\x72\ +\x61\x79\x3b\x22\x3e\x50\x6f\x77\x65\x72\x3c\x2f\x73\x70\x61\x6e\ +\x3e\x20\x3c\x73\x70\x61\x6e\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\ +\x6f\x6c\x6f\x72\x3a\x20\x72\x65\x64\x3b\x22\x3e\x55\x3c\x2f\x73\ +\x70\x61\x6e\x3e\x73\x61\x67\x65\x20\x61\x6e\x64\x20\x3c\x73\x70\ +\x61\x6e\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\ +\x20\x72\x65\x64\x3b\x22\x3e\x53\x3c\x2f\x73\x70\x61\x6e\x3e\x61\ +\x76\x69\x6e\x67\x20\x3c\x73\x70\x61\x6e\x20\x73\x74\x79\x6c\x65\ +\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x20\x72\x65\x64\x3b\x22\x3e\x48\ +\x3c\x2f\x73\x70\x61\x6e\x3e\x69\x65\x72\x61\x72\x63\x68\x79\x20\ +\x61\x74\x20\x50\x72\x6f\x73\x63\x61\x6e\x2c\x20\x3c\x73\x70\x61\ +\x6e\x20\x73\x74\x79\x6c\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x20\ +\x72\x65\x64\x3b\x22\x3e\x48\x55\x53\x48\x21\x3c\x2f\x73\x70\x61\ +\x6e\x3e\x3c\x2f\x68\x34\x3e\x0a\x3c\x68\x32\x20\x73\x74\x79\x6c\ +\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x62\x6c\x75\x65\x3b\x22\x3e\ +\x41\x62\x6f\x75\x74\x3c\x2f\x68\x32\x3e\x0a\x0a\x3c\x70\x3e\x54\ +\x68\x69\x73\x20\x3c\x62\x3e\x48\x55\x53\x48\x21\x3c\x2f\x62\x3e\ +\x20\x61\x70\x70\x6c\x69\x63\x61\x74\x69\x6f\x6e\x20\x69\x6e\x68\ +\x65\x72\x69\x74\x73\x20\x66\x72\x6f\x6d\x20\x74\x68\x65\x20\x57\ +\x69\x6e\x64\x6f\x77\x20\x62\x61\x73\x65\x20\x63\x6c\x61\x73\x73\ +\x2e\x3c\x62\x72\x3e\x20\x20\x0a\x3c\x70\x3e\x69\x6e\x66\x6f\x72\ +\x6d\x61\x74\x69\x6f\x6e\x20\x63\x6f\x6e\x63\x65\x72\x6e\x69\x6e\ +\x67\x20\x74\x68\x69\x73\x20\x61\x70\x70\x6c\x69\x63\x61\x74\x69\ +\x6f\x6e\x2c\x20\x73\x75\x63\x68\x20\x61\x73\x20\x63\x6f\x6e\x66\ +\x69\x67\x75\x72\x61\x74\x69\x6f\x6e\x20\x70\x61\x72\x61\x6d\x65\ +\x74\x65\x72\x73\x20\x6f\x72\x20\x6f\x74\x68\x65\x72\x2c\x20\x6d\ +\x61\x79\x20\x62\x65\x20\x65\x6e\x74\x65\x72\x65\x64\x2c\x20\x65\ +\x2e\x67\x2e\x2c\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\x22\x70\x61\ +\x67\x65\x31\x2e\x68\x74\x6d\x6c\x22\x3e\x68\x65\x72\x65\x3c\x2f\ +\x61\x3e\x3c\x2f\x70\x3e\x0a\x0a\x3c\x68\x32\x20\x73\x74\x79\x6c\ +\x65\x3d\x22\x63\x6f\x6c\x6f\x72\x3a\x62\x6c\x75\x65\x3b\x22\x3e\ +\x54\x68\x65\x20\x50\x61\x6e\x65\x6c\x3c\x2f\x68\x32\x3e\x0a\x0a\ +\x3c\x70\x3e\x54\x68\x65\x73\x65\x20\x77\x65\x62\x20\x70\x61\x67\ +\x65\x73\x20\x61\x72\x65\x20\x74\x6f\x20\x62\x65\x20\x63\x6f\x6d\ +\x70\x6c\x65\x74\x65\x64\x20\x62\x79\x20\x74\x68\x65\x20\x61\x70\ +\x70\x6c\x69\x63\x61\x74\x69\x6f\x6e\x20\x6f\x77\x6e\x65\x72\x2e\ +\x3c\x62\x72\x3e\x0a\x0a\x0a\x0a\x0a\x3c\x2f\x62\x6f\x64\x79\x3e\ +\x3c\x2f\x68\x74\x6d\x6c\x3e\x0a\ " qt_resource_name = b"\ \x00\x0a\ +\x08\x8a\x34\x9c\ +\x00\x70\ +\x00\x61\x00\x67\x00\x65\x00\x35\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ +\x00\x0a\ +\x08\x7a\x34\x9c\ +\x00\x70\ +\x00\x61\x00\x67\x00\x65\x00\x34\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ +\x00\x0a\ +\x08\x5a\x34\x9c\ +\x00\x70\ +\x00\x61\x00\x67\x00\x65\x00\x32\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ +\x00\x0a\ +\x08\x6a\x34\x9c\ +\x00\x70\ +\x00\x61\x00\x67\x00\x65\x00\x33\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ +\x00\x0a\ \x08\x4a\x34\x9c\ \x00\x70\ \x00\x61\x00\x67\x00\x65\x00\x31\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ @@ -135,53 +151,37 @@ qt_resource_name = b"\ \x0c\xba\xf2\x7c\ \x00\x69\ \x00\x6e\x00\x64\x00\x65\x00\x78\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ -\x00\x0a\ -\x08\x7a\x34\x9c\ -\x00\x70\ -\x00\x61\x00\x67\x00\x65\x00\x34\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ -\x00\x0a\ -\x08\x8a\x34\x9c\ -\x00\x70\ -\x00\x61\x00\x67\x00\x65\x00\x35\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ -\x00\x0a\ -\x08\x6a\x34\x9c\ -\x00\x70\ -\x00\x61\x00\x67\x00\x65\x00\x33\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ -\x00\x0a\ -\x08\x5a\x34\x9c\ -\x00\x70\ -\x00\x61\x00\x67\x00\x65\x00\x32\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ " qt_resource_struct_v1 = b"\ \x00\x00\x00\x00\x00\x02\x00\x00\x00\x06\x00\x00\x00\x01\ +\x00\x00\x00\x68\x00\x00\x00\x00\x00\x01\x00\x00\x02\x85\ +\x00\x00\x00\x34\x00\x00\x00\x00\x00\x01\x00\x00\x01\x2f\ +\x00\x00\x00\x4e\x00\x00\x00\x00\x00\x01\x00\x00\x01\xda\ +\x00\x00\x00\x1a\x00\x00\x00\x00\x00\x01\x00\x00\x00\x84\ \x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ -\x00\x00\x00\x82\x00\x00\x00\x00\x00\x01\x00\x00\x05\xb5\ -\x00\x00\x00\x68\x00\x00\x00\x00\x00\x01\x00\x00\x05\x0a\ -\x00\x00\x00\x34\x00\x00\x00\x00\x00\x01\x00\x00\x03\xdb\ -\x00\x00\x00\x4e\x00\x00\x00\x00\x00\x01\x00\x00\x04\x86\ -\x00\x00\x00\x1a\x00\x00\x00\x00\x00\x01\x00\x00\x00\xab\ +\x00\x00\x00\x82\x00\x00\x00\x00\x00\x01\x00\x00\x03\x30\ " qt_resource_struct_v2 = b"\ \x00\x00\x00\x00\x00\x02\x00\x00\x00\x06\x00\x00\x00\x01\ \x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x68\x00\x00\x00\x00\x00\x01\x00\x00\x02\x85\ +\x00\x00\x01\x8d\x9c\xeb\xd9\x5b\ +\x00\x00\x00\x34\x00\x00\x00\x00\x00\x01\x00\x00\x01\x2f\ +\x00\x00\x01\x8d\x9c\xeb\xd9\x5c\ +\x00\x00\x00\x4e\x00\x00\x00\x00\x00\x01\x00\x00\x01\xda\ +\x00\x00\x01\x8d\x9c\xeb\xd9\x5e\ +\x00\x00\x00\x1a\x00\x00\x00\x00\x00\x01\x00\x00\x00\x84\ +\x00\x00\x01\x8d\x9c\xeb\xd9\x5f\ \x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ -\x00\x00\x01\x8d\x3b\x71\x36\x5d\ -\x00\x00\x00\x82\x00\x00\x00\x00\x00\x01\x00\x00\x05\xb5\ -\x00\x00\x01\x8d\x3b\x71\x36\x75\ -\x00\x00\x00\x68\x00\x00\x00\x00\x00\x01\x00\x00\x05\x0a\ -\x00\x00\x01\x8d\x3b\x71\x36\x78\ -\x00\x00\x00\x34\x00\x00\x00\x00\x00\x01\x00\x00\x03\xdb\ -\x00\x00\x01\x8d\x3b\x71\x36\x90\ -\x00\x00\x00\x4e\x00\x00\x00\x00\x00\x01\x00\x00\x04\x86\ -\x00\x00\x01\x8d\x3b\x71\x36\x94\ -\x00\x00\x00\x1a\x00\x00\x00\x00\x00\x01\x00\x00\x00\xab\ -\x00\x00\x01\x8d\x3b\x78\x4e\xc0\ +\x00\x00\x01\x8d\x9c\xeb\xd9\x61\ +\x00\x00\x00\x82\x00\x00\x00\x00\x00\x01\x00\x00\x03\x30\ +\x00\x00\x01\x8d\xa7\xc7\x77\x2b\ " -qt_version = [int(v) for v in QtCore.qVersion().split('.')] -if qt_version < [5, 8, 0]: +qt_version = QtCore.qVersion().split('.') +if qt_version < ['5', '8', '0']: rcc_version = 1 qt_resource_struct = qt_resource_struct_v1 else: diff --git a/src/gui.py b/src/gui.py index d45bc96..38f613c 100644 --- a/src/gui.py +++ b/src/gui.py @@ -1,239 +1,181 @@ +'''The GUI module for Savings Overview and magnet control +''' import getpass -import inspect import os -import platform import random -import sys import time from datetime import timedelta - -from qtpy import QtCore, QtGui -from qtpy.QtGui import QColor, QFont, QIcon +from qtpy.QtGui import QColor from qtpy.QtCore import __version__ as QT_VERSION_STR -from qtpy.QtCore import ( - PYQT_VERSION_STR, QDate, QDateTime, QEventLoop, Qt, Signal, Slot) +from qtpy.QtCore import QEventLoop, Qt, Slot from qtpy.QtWidgets import ( - QApplication, QDockWidget, QFrame, QGridLayout, QGroupBox, QHBoxLayout, - QLabel, QMainWindow, QMessageBox, QProgressBar, QPushButton, QSizePolicy, - QSpacerItem, QStackedWidget, QTabBar, QTabWidget, QTableWidget, - QTableWidgetItem, QVBoxLayout, QWidget) + QApplication, QFrame, QGridLayout, QGroupBox, QHBoxLayout, QLabel, + QMessageBox, QPushButton, QTabBar, QTabWidget, QTableWidgetItem, QTextEdit, + QWidget) import elog -from apps4ops.bdbase.base import BaseWindow -from apps4ops.bdbase.enumkind import MsgSeverity, UserMode, Facility +from apps4ops.bdbase.utils import _line +from apps4ops.bdbase.enumkind import MsgSeverity from caqtwidgets.pvwidgets import ( CAQLabel, CAQLineEdit, CAQMenu, CAQMessageButton, CAQTableWidget, QHLine) - _pymodule = os.path.basename(__file__) -def _line(): - """Macro to return the current line number.688 - - The current line number within the file is used when - reporting messages to the message logging window. - - Returns: - int: Current line number. - """ - return inspect.currentframe().f_back.f_lineno class AppGui(QWidget): - + '''The GUI class + ''' def __init__(self, parent): - super(AppGui, self).__init__() + #super(AppGui, self).__init__() + super().__init__() # Python 3 style for super() self.parent = parent self.cafe = self.parent.cafe self.cyca = self.parent.cyca self.check_status = self.parent.check_status self.check_status_list = self.parent.check_status_list - #Required for caqtwidgets + # Required for caqtwidgets self.settings = self.parent.settings self.show_log_message = self.parent.show_log_message self.statusbar = self.parent.statusbar self.gui_frame = self.parent.gui_frame self.gui_header = self.parent.gui_header self.font_gui = self.parent.gui_frame.font_gui - self.input_parameters = self.parent.input_parameters + self.input_parameters = self.parent.input_parameters self.input_labels = self.parent.input_labels - self.expert_parameters = self.parent.expert_parameters + self.expert_parameters = self.parent.expert_parameters self.gui_frame.expert_parameters_group.setFixedWidth(260) - self.gui_frame.expert_parameters_group.setFixedHeight(120) + self.gui_frame.expert_parameters_group.setFixedHeight(130) self.gui_frame.operator_parameters_group.setFixedWidth(260) - self.gui_frame.operator_parameters_group.setFixedHeight(160) + if "Controlroom" in self.settings.data["Master"]: + self.gui_frame.operator_parameters_group.setFixedHeight(160) + else: + self.gui_frame.operator_parameters_group.setFixedHeight(130) self.gui_frame.measurement_tab_wgt.setFixedWidth(440) self.gui_frame.measurement_tab_wgt.setFixedHeight(240) - #self.gui_frame.operator_wgt.setFixedHeight(240) - #self.gui_frame.expert_wgt.setFixedHeight(240) + # self.gui_frame.operator_wgt.setFixedHeight(240) + # self.gui_frame.expert_wgt.setFixedHeight(240) - self.sec_state_list = ['PG1-HUSH:STATE', 'PSH-HUSH:STATE', - 'PG2-HUSH:STATE', 'PO2-HUSH:STATE', - 'PPIF-HUSH:STATE', 'PG3-HUSH:STATE'] - - #Overwrite default + self.assigned_master = self.gui_header.assigned_master + + self.sec_state_list = ["PG1-HUSH:STATE", "PSH-HUSH:STATE", + "PG2-HUSH:STATE", "PO2-HUSH:STATE", + "PPIF-HUSH:STATE", "PG3-HUSH:STATE"] + + # Overwrite default self.gui_frame.central_tab_widget.tabBar().setTabText(0, "Control") - self.gui_frame.central_tab_widget.tabBar().setTabText(1, "IOC") - + #self.gui_frame.central_tab_widget.tabBar().setTabText(1, "IOC") + #wgt = self.gui_frame.central_tab_widget.widget(1) #lay = self.gui_frame.central_tab_widget.widget(1).layout() - shift_type = CAQMenu(self, pv_name="PRO-HUSH:SHIFT-TYPE") - self.gui_frame.operator_parameters_group.layout().insertWidget(0, QLabel(' Shift Type:')) - self.gui_frame.operator_parameters_group.layout().insertWidget(1, shift_type) - - ''' - def deleteItemsOfLayout(layout): - if layout is not None: - while layout.count(): - item = layout.takeAt(0) - widget = item.widget() - if widget is not None: - widget.setParent(None) - else: - deleteItemsOfLayout(item.layout()) - - vlayout = self.gui_frame.central_tab_widget.widget(1).layout() - - if vlayout is not None: - for i in range(vlayout.count()): - layout_item = vlayout.itemAt(i) - #if layout_item.layout() == box: - deleteItemsOfLayout(layout_item.layout()) - vlayout.removeItem(layout_item) - layout_item = None - break - vlayout = None - ''' - - self.gui_frame.results_wgt.setFixedWidth(1200) - self.gui_frame.results_wgt.setFixedHeight(400) - - self.gui_frame.results_wgt.setLayout(self.gui_frame.results_layout) - - self.gui_frame.results_layout.addWidget(self.reset_ioc_sm(), 0, 0, 1, 1) + + if "Controlroom" in self.assigned_master: + shift_type = CAQMenu(self, pv_name="PRO-HUSH:SHIFT-TYPE") + self.gui_frame.operator_parameters_group.layout().insertWidget( + 0, QLabel(" Shift Type:")) + self.gui_frame.operator_parameters_group.layout().insertWidget( + 1, shift_type) + + self.gui_frame.results_wgt.setFixedWidth(1200) + self.gui_frame.results_wgt.setFixedHeight(400) + self.gui_frame.results_wgt.setLayout(self.gui_frame.results_layout) + + self.gui_frame.results_layout.addWidget( + self.reset_ioc_sm(), 0, 0, 1, 1) + sec_prefix_list = [ sub[0: sub.index("-")] for sub in self.sec_state_list] - + self.gui_frame.results_layout.addWidget( self.reset_ioc_saving(sec_prefix_list), 0, 1, 1, 1) self.gui_frame.results_layout.setContentsMargins(40, 40, 40, 40) - + self.expert_labels = self.parent.expert_labels self.settings = self.parent.settings - self.obj_to_upper = True if random.randint(1, 10) > 3 else False - + self.obj_to_upper = bool(random.randint(1, 10) > 3) + self.table_sol_dict = {} self.table_pwr_dict = {} self.offtime_dict = {} - - #self.I_min = 0.002 HIPA + + # self.I_min = 0.002 HIPA self.cafe.openPrepare() - self.cafe.open(['PRO-HUSH:LASTPWR','PRO-HUSH:TOTPWR', - 'PRO:LASTSAVE', 'PPO-HUSH:TOTSAVE']) + self.cafe.open(["PRO-HUSH:LASTPWR", "PRO-HUSH:TOTPWR", + "PRO:LASTSAVE", "PPO-HUSH:TOTSAVE"]) self.cafe.open(self.sec_state_list) self.cafe.openNowAndWait(0.1) - self.magnet_tab_wgt = self.group_sector_qtabwidget() self.gui_frame.measurement_layout.addWidget( - self.magnet_tab_wgt, 0, 1, 6, 3, alignment=Qt.AlignTop) + self.magnet_tab_wgt, 0, 2, 6, 20, alignment=Qt.AlignTop) + + idx = self.magnet_tab_wgt.count() - 1 + for i in range(0, self.magnet_tab_wgt.count()): + tabtext = self.magnet_tab_wgt.tabText(i) + if tabtext == "SH": + idx = i + break + + self.magnet_tab_wgt.setCurrentIndex(idx) - self.magnet_tab_wgt.setCurrentIndex(1) - status_wgt = self.group_sector_status() status_wgt.setFixedHeight(340) - + self.gui_frame.measurement_layout.addWidget( - status_wgt, 2, 0, 2, 1, alignment=Qt.AlignTop) # | Qt.AlignHCenter) + status_wgt, 3, 0, 2, 1, alignment=Qt.AlignTop) # | Qt.AlignHCenter) qf = QFrame() - qf.setFixedHeight(1) + qf.setFixedHeight(5) self.gui_frame.measurement_layout.addWidget( - qf, 4, 0, 1, 1, alignment=Qt.AlignTop) - - self.sectorI_dict = {} - self.sectorI_dict['G1'] = "Geschlossen" - self.sectorI_dict['SH'] = "Geschlossen" - self.sectorI_dict['G2'] = "Geschlossen" - self.sectorI_dict['O2'] = "Geschlossen" - self.sectorI_dict['PIF'] = "Geschlossen" - self.sectorI_dict['G3'] = "Geschlossen" - - g3_line = ["SH", "PIF", "G3"] - pif_line = ["SH", "PIF"] - o2_line = ["SH", "O2"] - g2_line = ["SH", "G2"] - g1_line = ["G1"] - sh_line = ["SH"] + qf, 2, 0, 1, 1, alignment=Qt.AlignTop) - try: - pv_master = self.settings.data["MASTER"]["status"] - self.mastership = self.cafe.getCache(pv_master) - self.check_status(_pymodule, 'get', pv_master, None, _line()) - except KeyError as ex: - print("KeyError: {0}".format(str(ex))) + qf1 = QFrame() + qf1.setFixedWidth(10) + + self.gui_frame.measurement_layout.addWidget( + qf1, 4, 1, 2, 1, alignment=Qt.AlignTop) - def is_master(): - return True if "Control" in self.mastership else False - - #defined in guiheader.py - #master_to_wgt = {"Gantry 1": "G1", "Gantry 2": "G2", - # "Gantry 3": "G3", "OPTIS2": "O2"} + #qf2 = QFrame() + #qf2.setFixedWidth(1) + #self.gui_frame.measurement_layout.addWidget( + # qf2, 0, 22, 1, 1, alignment=Qt.AlignTop) + + # Overload from guiheader.py + self.sector_disruptor_dict = {} + self.sector_disruptor_dict["G1"] = "Geschlossen" + self.sector_disruptor_dict["SH"] = "Geschlossen" + self.sector_disruptor_dict["G2"] = "Geschlossen" + self.sector_disruptor_dict["O2"] = "Geschlossen" + self.sector_disruptor_dict["PIF"] = "Geschlossen" + self.sector_disruptor_dict["G3"] = "Geschlossen" - def receive_master_update(value, status, alarm_severity): - - self.mastership = value - for key, wgt_val in self.gui_header.master_to_wgt.items(): - master = self.gui_header.beam_current_wgt_group[wgt_val] - if value in key: - master.setObjectName("ARAMIS") - master.style().polish(master) - self.gui_header.target_beamline = wgt_val - self.gui_header.timer.start(750) - self.gui_header.timer_count = 0 - else: - if "BEAMLINE" not in master.objectName(): - master.setObjectName("BEAMLINE") - master.style().polish(master) - - self.gui_header.beam_current_wgt_dict[ - wgt_val].trigger_monitor_str.emit( - self.sectorI_dict[wgt_val], 1, 0) - - def enable_disable_beamline(sect, sector_line, value): - - def reset_check_mini_post_sh(): - #Redo "G2" in case first two elements - #are grayed by other beamlines - if "Offen" in (self.sectorI_dict["G2"], - self.sectorI_dict["O2"], - self.sectorI_dict["PIF"]): - #self.sectorI_dict["G3"]): - self.gui_header.toSHOverlap("ON") - - self.sectorI_dict[sect] = value + self.sector_disruptor_dict[sect] = value #print("sect/value", sect, value) for sector in sector_line: - if "Geschlossen" not in self.sectorI_dict[ - sector] or not is_master(): + if "Geschlossen" not in self.sector_disruptor_dict[ + sector] or not self.gui_header.is_master(): #print("sector/value", sector, value) + #print("isMaster", self.gui_header.is_master()) + #print("master", self.gui_header.mastership) + #print("assigned master", self.assigned_master) if self.table_sol_dict[ sector].standby_value_button.isEnabled(): self.table_sol_dict[ sector].standby_value_button.setEnabled(False) - if not is_master(): + if not self.gui_header.is_master(): if self.table_sol_dict[ - sector].restore_value_button.isEnabled(): + sector].restore_value_button.isEnabled(): self.table_sol_dict[ - sector].restore_value_button.setEnabled(False) - + sector].restore_value_button.setEnabled(False) + else: - print("Geschlossen? sector/value/ismaster", sector, value, self.mastership) + print("Geschlossen? sector/value/ismaster", sector, value, + self.gui_header.mastership) if not self.table_sol_dict[ sector].standby_value_button.isEnabled(): self.table_sol_dict[ @@ -241,150 +183,168 @@ class AppGui(QWidget): if not self.table_sol_dict[ sector].restore_value_button.isEnabled(): self.table_sol_dict[ - sector].restore_value_button.setEnabled(True) + sector].restore_value_button.setEnabled(True) - _action = "OFF" if "Geschlossen" in self.sectorI_dict[ - sector] else "ON" + # [1:] do not include SH for target specific HLA + idx = 0 if "Controlroom" in self.settings.data["Master"] else 1 - - - if sector == "SH": - self.gui_header.toSH(_action) - if "Geschlossen" not in self.sectorI_dict["G1"]: - self.gui_header.toSH("OFF") - self.gui_header.toCometOverlap("ON") - elif sector == "G1": - self.gui_header.toG1(_action) - if _action == "ON": - self.gui_header.toSH("OFF") - self.gui_header.toCometOverlap("ON") - elif sector == "G2": - self.gui_header.toG2(_action) - reset_check_mini_post_sh() - elif sector == "O2": - self.gui_header.toO2(_action) - reset_check_mini_post_sh() - elif sector == "G3": - self.gui_header.toG3(_action) - elif sector == "PIF": - self.gui_header.toPIF(_action) - reset_check_mini_post_sh() - - reset_check_mini_post_sh() - - def receive_sh_update(value, status, alarm_severity): - enable_disable_beamline('SH', sh_line, value) - def receive_g1_update(value, status, alarm_severity): - enable_disable_beamline('G1', g1_line, value) - def receive_g3_update(value, status, alarm_severity): - enable_disable_beamline('G3', g3_line, value) - def receive_o2_update(value, status, alarm_severity): - enable_disable_beamline('O2', o2_line, value) - def receive_g2_update(value, status, alarm_severity): - enable_disable_beamline('G2', g2_line, value) - def receive_pif_update(value, status, alarm_severity): - enable_disable_beamline('PIF', pif_line, value) - - self.gui_header.beam_current_wgt_dict[ - "G3"].trigger_monitor_str.connect(receive_g3_update) - self.gui_header.beam_current_wgt_dict[ - "O2"].trigger_monitor_str.connect(receive_o2_update) - self.gui_header.beam_current_wgt_dict[ - "G2"].trigger_monitor_str.connect(receive_g2_update) - self.gui_header.beam_current_wgt_dict[ - "PIF"].trigger_monitor_str.connect(receive_pif_update) - self.gui_header.beam_current_wgt_dict[ - "SH"].trigger_monitor_str.connect(receive_sh_update) - self.gui_header.beam_current_wgt_dict[ - "G1"].trigger_monitor_str.connect(receive_g1_update) - - self.gui_header.beam_current_wgt_dict[ - "MASTER"].trigger_monitor_str.connect(receive_master_update) + enable_disable_beamline("SH", self.gui_header.sh_line, value) - pvd=self.cafe.getPVCache(self.settings.data["G3"]["status"], dt='str') - receive_g3_update(pvd.value[0], pvd.alarmStatus, pvd.alarmSeverity) - pvd=self.cafe.getPVCache(self.settings.data["PIF"]["status"], dt='str') - receive_pif_update(pvd.value[0], pvd.alarmStatus, pvd.alarmSeverity) - pvd=self.cafe.getPVCache(self.settings.data["G2"]["status"], dt='str') - receive_g2_update(pvd.value[0], pvd.alarmStatus, pvd.alarmSeverity) - pvd=self.cafe.getPVCache(self.settings.data["O2"]["status"], dt='str') - receive_o2_update(pvd.value[0], pvd.alarmStatus, pvd.alarmSeverity) - pvd=self.cafe.getPVCache(self.settings.data["SH"]["status"], dt='str') - receive_sh_update(pvd.value[0], pvd.alarmStatus, pvd.alarmSeverity) - pvd=self.cafe.getPVCache(self.settings.data["G1"]["status"], dt='str') - receive_g1_update(pvd.value[0], pvd.alarmStatus, pvd.alarmSeverity) - pvd=self.cafe.getPVCache(self.settings.data["MASTER"]["status"], dt='str') - receive_master_update(pvd.value[0], pvd.alarmStatus, pvd.alarmSeverity) + def receive_g1_update(value, status, alarm_severity): + enable_disable_beamline("G1", self.gui_header.g1_line, value) + + def receive_g3_update(value, status, alarm_severity): + enable_disable_beamline("G3", self.gui_header.g3_line[idx:], value) + + def receive_o2_update(value, status, alarm_severity): + enable_disable_beamline("O2", self.gui_header.o2_line[idx:], value) + + def receive_g2_update(value, status, alarm_severity): + enable_disable_beamline("G2", self.gui_header.g2_line[idx:], value) + + def receive_pif_update(value, status, alarm_severity): + enable_disable_beamline( + "PIF", self.gui_header.pif_line[idx:], value) + + if "G1" in self.settings.data["headerMagnetSector"]: + self.gui_header.beam_current_wgt_dict[ + "G1"].trigger_monitor_str.connect(receive_g1_update) + pvd = self.cafe.getPVCache( + self.settings.data["G1"]["status"], dt="str") + receive_g1_update(pvd.value[0], pvd.alarmStatus, pvd.alarmSeverity) + + if "SH" in self.settings.data["headerMagnetSector"]: + self.gui_header.beam_current_wgt_dict[ + "BMA1"].trigger_monitor_str.connect(receive_sh_update) + pvd = self.cafe.getPVCache( + self.settings.data["SH"]["status"], dt="str") + receive_sh_update(pvd.value[0], pvd.alarmStatus, pvd.alarmSeverity) + + if "G2" in self.settings.data["headerMagnetSector"]: + self.gui_header.beam_current_wgt_dict[ + "G2"].trigger_monitor_str.connect(receive_g2_update) + pvd = self.cafe.getPVCache( + self.settings.data["G2"]["status"], dt="str") + receive_g2_update(pvd.value[0], pvd.alarmStatus, pvd.alarmSeverity) + + if "O2" in self.settings.data["headerMagnetSector"]: + self.gui_header.beam_current_wgt_dict[ + "O2"].trigger_monitor_str.connect(receive_o2_update) + pvd = self.cafe.getPVCache( + self.settings.data["O2"]["status"], dt="str") + receive_o2_update(pvd.value[0], pvd.alarmStatus, pvd.alarmSeverity) + + if "PIF" in self.settings.data["headerMagnetSector"]: + self.gui_header.beam_current_wgt_dict[ + "PIF"].trigger_monitor_str.connect(receive_pif_update) + pvd = self.cafe.getPVCache( + self.settings.data["PIF"]["status"], dt="str") + receive_pif_update(pvd.value[0], pvd.alarmStatus, pvd.alarmSeverity) + + if "G3" in self.settings.data["headerMagnetSector"]: + self.gui_header.beam_current_wgt_dict[ + "G3"].trigger_monitor_str.connect(receive_g3_update) + pvd = self.cafe.getPVCache( + self.settings.data["G3"]["status"], dt="str") + receive_g3_update(pvd.value[0], pvd.alarmStatus, pvd.alarmSeverity) + + + + + def receive_b1b2_update(value, status, alarm_severity): + #Enable Only on shutdown and if there is no current in the machine + comet_I = self.cafe.getCache("MMAC3:STR:2") + if comet_I is None: + comet_I = 0.001 + if value != "Shutdown" or comet_I > 0.001 or \ + not self.gui_header.is_master(): + if self.table_sol_dict["B1B2"].standby_value_button.isEnabled(): + self.table_sol_dict[ + "B1B2"].standby_value_button.setEnabled(False) + if not self.gui_header.is_master(): + if self.table_sol_dict[ + "B1B2"].restore_value_button.isEnabled(): + self.table_sol_dict[ + "B1B2"].restore_value_button.setEnabled(False) + + else: + if not self.table_sol_dict[ + "B1B2"].standby_value_button.isEnabled(): + self.table_sol_dict[ + "B1B2"].standby_value_button.setEnabled(True) + + if not self.table_sol_dict[ + "B1B2"].restore_value_button.isEnabled(): + self.table_sol_dict[ + "B1B2"].restore_value_button.setEnabled(True) + + if "B1B2" in self.settings.data["headerMagnetSector"]: + self.gui_header.shift_type.trigger_monitor_str.connect( + receive_b1b2_update) + #holds shifttype + pvd = self.cafe.getPVCache( + self.settings.data["B1B2"]["status"], dt="str") + receive_b1b2_update(pvd.value[0], pvd.alarmStatus, pvd.alarmSeverity) + # end overload from guiheader.py @Slot() def simulation_update(state): if bool(state): - _color = self.gui_header.sim_color + color = self.gui_header.sim_color else: - _color = self.gui_header.op_color - print("SIM STATE CHANGED", state, _color, flush=True) - self.gui_header.pf_off_color = _color - self.gui_header.color_pframe(_color) - print("SIM STATE CHANGED//", state, _color, flush=True) - - self.gui_frame.simulation_checkbox.stateChanged.connect(simulation_update) - + color = self.gui_header.op_color + print("SIM STATE CHANGED", state, color, flush=True) + self.gui_header.pf_off_color = color + ###JC CHANGE BACK# + self.gui_header.color_pframe(color) + print("SIM STATE CHANGED//", state, color, flush=True) + + self.gui_frame.simulation_checkbox.stateChanged.connect( + simulation_update) + def receive_sec_state(handle, pv, pvdata): pvsplit = pv.split("-") - sec=pvsplit[0][1:] - if pvdata.status == self.cyca.ICAFE_CA_OP_CONN_DOWN: + sec = pvsplit[0][1:] + if pvdata.status == self.cyca.ICAFE_CA_OP_CONN_DOWN: return - + def already_in_standby(): - devices = self.settings.data[sec]["iocDevice"] pv_list = [] standby_value_list = [] - + for magnet in devices: pv_magnet = magnet + ":SOL:2" pv_list.append(pv_magnet) - #get standby values + # get standby values idx = self.settings.data[sec]["device"].index(magnet) standby_value = self.settings.data[sec]["standby"][idx] standby_value_list.append(standby_value) - + print("pvlist===>", pv_list, flush=True) print("standby ist==>", standby_value_list, flush=True) - + QApplication.processEvents() value_list, status, status_list = self.cafe.getScalarList( pv_list, cacheFlag=True) - - ''' - value_list = [] - for pv in pv_list: - print("isConnected===>", flush=True) - is_conn = self.cafe.isConnected(pv) - print("isConnected===>", is_conn, flush=True) - - for pv in pv_list: - val = self.cafe.getCache(pv) - if val is not None: - value_list.append(val) - ''' + #print("status", status, status_list, flush=True) - print("valuelist==>", pv_list, value_list, flush=True) + print("valuelist==>", pv_list, value_list, flush=True) if status != self.cyca.ICAFE_NORMAL: self.check_status_list(_pymodule, "getScalarListCache", pv_list, status_list, _line()) - #check standby values - in_standby = True + # check standby values + in_standby = True for value, standby in zip(value_list, standby_value_list): - if abs(value) < abs(standby)*0.8 or abs(value) > abs( - standby)*1.2: + if abs(value) < abs(standby) * 0.8 or abs(value) > abs( + standby) * 1.2: in_standby = False break print("is_standby", in_standby, flush=True) - return in_standby - - if pvdata.value[0] == 'ON' and not already_in_standby(): + return in_standby + + if pvdata.value[0] == "ON" and not already_in_standby(): print("pv, sec-ON", pv, sec, flush=True) self.table_sol_dict[sec].init_value_button.setEnabled(True) self.table_pwr_dict[sec].init_value_button.setEnabled(True) @@ -392,49 +352,48 @@ class AppGui(QWidget): print("pv, sec-OFF", pv, sec, flush=True) self.table_sol_dict[sec].init_value_button.setEnabled(False) self.table_pwr_dict[sec].init_value_button.setEnabled(False) - - - for state in self.sec_state_list: - self.cafe.monitor(state, receive_sec_state) - - ''' - def monitor_reference_magnets(sec): - def receive_magnet_value(handle, pv, pvdata): - pass - - pv_list, standby_value_list = self.get_reference_magnets_standby_value( - sec) - for pv in pv_list: - self.cafe.monitor(pv, receive_magnet_value) - - - def get_reference_magnets_standby_value(self, sec: str = None): - if sec is None: - return - devices = self.settings.data[sec]["iocDevice"] - pv_list = [] - standby_value_list = [] - print("sector", sec, flush=True) - for magnet in devices: - pv = magnet + ":SOL:2" - pv_list.append(pv) - print("pvlist===>", pv_list, flush=True) - idx = self.settings.data[sec]["device"].index(magnet) - standby_value = self.settings.data[sec]["standby"][idx] - standby_value_list.append(standby_value) - print("standby ist==>", standby_value_list, flush=True) - return pv_list, standby_value_list - ''' + for state in self.sec_state_list: + for sector in self.settings.data["headerMagnetSector"]: + if sector in state: + self.cafe.monitor(state, receive_sec_state) + print("MONITOR======>", sector, state) + break def group_sector_status(self): + qgrid = QGridLayout() - #Connect all channels - #Heading + + # Heading idx = self.settings.data["header"].index("G1") idx_last = self.settings.data["header"].index("MASTER") - #Sector - + # Sector + + ''' + qgrid.setContentsMargins(0, 0, 0, 0) + qgrid.setSpacing(0) + container2 = QWidget() + container3 = QWidget() + container4 = QWidget() + container5 = QWidget() + container6 = QWidget() + layout2 = QHBoxLayout(container2) + layout2.setContentsMargins(0, 0, 0, 0) + layout2.setAlignment(Qt.AlignCenter) + layout3 = QHBoxLayout(container3) + layout3.setContentsMargins(0, 0, 0, 0) + layout3.setAlignment(Qt.AlignCenter) + layout4 = QHBoxLayout(container4) + layout4.setContentsMargins(0, 0, 0, 0) + layout4.setAlignment(Qt.AlignCenter) + layout5 = QHBoxLayout(container5) + layout5.setContentsMargins(0, 0, 0, 0) + layout5.setAlignment(Qt.AlignCenter) + layout6 = QHBoxLayout(container6) + layout6.setContentsMargins(0, 0, 0, 0) + layout6.setAlignment(Qt.AlignCenter) + ''' + qlp = QLabel("Power \n(kW)") f = qlp.font() f.setPixelSize(13) @@ -446,8 +405,12 @@ class AppGui(QWidget): f.setPixelSize(13) qli.setFont(f) qli.setAlignment(Qt.AlignCenter) + + # layout2.addWidget(qli) + #qgrid.addWidget(container2, 0, 1, 1, 1) + qgrid.addWidget(qli, 0, 1, 1, 1) - + qsa = QLabel("Saving \n(MWh)") f = qsa.font() f.setPixelSize(13) @@ -466,46 +429,109 @@ class AppGui(QWidget): qtotsav.setFont(f) qtotsav.setAlignment(Qt.AlignCenter) + ''' + layout3.addWidget(qlp) + layout4.addWidget(qsa) + layout5.addWidget(qti) + layout6.addWidget(qtotsav) + + qgrid.addWidget(container3, 0, 2, 1, 1) + qgrid.addWidget(container4, 0, 3, 1, 1) + qgrid.addWidget(container5, 0, 5, 1, 1) + qgrid.addWidget(container6, 0, 6, 1, 1) + #q=QFrame() + #q.setFixedWidth(12) + #qgrid.addWidget(q, 0, 7, 1, 1) + ''' qgrid.addWidget(qlp, 0, 2, 1, 1) qgrid.addWidget(qsa, 0, 3, 1, 1) qgrid.addWidget(qti, 0, 5, 1, 1) qgrid.addWidget(qtotsav, 0, 6, 1, 1) - for i, sector in enumerate(self.settings.data["header"][idx:idx_last]): a, b, c, d, e, f = self.sector_status(sector) + ''' + container = QWidget() + layout = QHBoxLayout(container) + layout.setContentsMargins(2, 0, 0, 0) + container.setStyleSheet("background-color: lightblue;") + layout.addWidget(a) a.setContentsMargins(2, 0, 0, 0) - qgrid.addWidget(a, i+1, 0, 1, 1) - qgrid.addWidget(b, i+1, 1, 1, 1) - qgrid.addWidget(c, i+1, 2, 1, 1) - qgrid.addWidget(d, i+1, 3, 1, 1) - qgrid.addWidget(e, i+1, 5, 1, 1) - qgrid.addWidget(f, i+1, 6, 1, 1) - _line = QHLine() - _line.setFixedHeight(10) - _row = qgrid.rowCount() - qgrid.addWidget(_line, _row, 1, 1, 6) - #qgrid.setRowMinimumHeight(_row, 60) + container2 = QWidget() + container3 = QWidget() + container4 = QWidget() + container5 = QWidget() + container6 = QWidget() + layout2 = QHBoxLayout(container2) + layout2.setContentsMargins(0, 0, 0, 0) + container2.setStyleSheet("background-color: lightblue;") + layout2.addWidget(b) + b.setContentsMargins(0, 0, 0, 0) + layout3 = QHBoxLayout(container3) + layout3.setContentsMargins(0, 0, 0, 0) + container3.setStyleSheet("background-color: lightblue;") + layout3.addWidget(c) + c.setContentsMargins(0, 0, 0, 0) + layout4 = QHBoxLayout(container4) + layout4.setContentsMargins(0, 0, 0, 0) + container4.setStyleSheet("background-color: lightblue;") + layout4.addWidget(d) + d.setContentsMargins(0, 0, 0, 0) + layout5 = QHBoxLayout(container5) + layout5.setContentsMargins(0, 0, 0, 0) + container5.setStyleSheet("background-color: lightblue;") + layout5.addWidget(e) + e.setContentsMargins(0, 0, 0, 0) + layout6 = QHBoxLayout(container6) + layout6.setContentsMargins(0, 0, 0, 0) + container6.setStyleSheet("background-color: lightblue;") + layout6.addWidget(f) + f.setContentsMargins(0, 0, 0, 0) + layout2.setAlignment(Qt.AlignLeft) + layout3.setAlignment(Qt.AlignLeft) + layout4.setAlignment(Qt.AlignLeft) + layout5.setAlignment(Qt.AlignLeft) + layout6.setAlignment(Qt.AlignLeft) + qgrid.addWidget(container, i+1, 0, 1, 1) + qgrid.addWidget(container2, i+1, 1, 1, 1) + qgrid.addWidget(container3, i+1, 2, 1, 1) + qgrid.addWidget(container4, i+1, 3, 1, 1) + qgrid.addWidget(container5, i+1, 5, 1, 1) + qgrid.addWidget(container6, i+1, 6, 1, 1) + ''' + qgrid.addWidget(a, i + 1, 0, 1, 1) + qgrid.addWidget(b, i + 1, 1, 1, 1) + qgrid.addWidget(c, i + 1, 2, 1, 1) + qgrid.addWidget(d, i + 1, 3, 1, 1) + qgrid.addWidget(e, i + 1, 5, 1, 1) + qgrid.addWidget(f, i + 1, 6, 1, 1) + + line = QHLine() + line.setFixedHeight(10) + row = qgrid.rowCount() + qgrid.addWidget(line, row, 1, 1, 6) + #qgrid.setRowMinimumHeight(_row, 60) qtot = QLabel("Total:") fnt = qtot.font() fnt.setPixelSize(13) qtot.setFont(fnt) - qgrid.addWidget(qtot, _row+1, 0, 1, 1) + + qgrid.addWidget(qtot, row + 1, 0, 1, 1) qgrid.addWidget( CAQLineEdit(self, pv_name="PRO-HUSH:LASTPWR", show_units=True), - _row+1, 1, 1, 1) + row + 1, 1, 1, 1) qgrid.addWidget( CAQLineEdit(self, pv_name="PRO-HUSH:TOTPWR", show_units=True), - _row+1, 2, 1, 1) + row + 1, 2, 1, 1) qgrid.addWidget( CAQLineEdit(self, pv_name="PRO-HUSH:LASTSAVE", show_units=True), - _row+1, 3, 1, 2) + row + 1, 3, 1, 2) qgrid.addWidget( CAQLineEdit(self, pv_name="PRO-HUSH:TOTSAVE", show_units=True), - _row+1, 6, 1, 2) + row + 1, 6, 1, 2) qgrid.setContentsMargins(9, 20, 9, 9) @@ -513,44 +539,38 @@ class AppGui(QWidget): qw.setContentsMargins(9, 9, 9, 9) qw.setObjectName("OUTER") qw.setLayout(qgrid) - qw.setFixedWidth(596) #480 + qw.setFixedWidth(596) # 480 - #for column_no in range(0, 5): - # qgrid.itemAtPosition(1, column_no).widget().setStyleSheet("QWidget { background: lightblue; }") #addStyleName( - #item = qgrid.itemAt(2) #.widget().setStyleSheet("QLabel { background-color: green }") - #item.widget().setStyleSheet("background-color: green") #widgets on grid from left to right starting at top rtow return qw - - - def sector_status(self, sector): '''Create each sector line for inclusion into group ''' - #device = "SEC-" + sector device = "P" + sector + "-HUSH" - #Qlabel - qsector = QLabel(sector+":") + # Qlabel + qsector = QLabel(sector + ":") f = qsector.font() f.setPixelSize(13) qsector.setFont(f) - _color = "black" + color = "black" try: - _color = self.settings.data[sector]["color"] + color = self.settings.data[sector]["color"] except KeyError as ex: print(ex, self.settings.data[sector]) - _color_str = "color : {0};".format(_color) - _incolor = "QLabel {" + _color_str + "}" - - qsector.setStyleSheet(_incolor) - #Savings - pv_pwr_tot = device + ":TOTPWR" - pv_pwr_last = device + ":LASTPWR" - pv_pwr_saved = device + ":LASTSAVE" + weight = "bold" if sector in self.settings.data[ + "headerMagnetSector"] else "medium" + color_str = "color : {0}; font-weight:{1};".format(color, weight) + incolor = "QLabel {" + color_str + "}" + + qsector.setStyleSheet(incolor) + # Savings + pv_pwr_tot = device + ":TOTPWR" + pv_pwr_last = device + ":LASTPWR" + pv_pwr_saved = device + ":LASTSAVE" pv_pwr_timeout = device + ":OFFTIME" - pv_pwr_totsave = device + ":TOTSAVE" - + pv_pwr_totsave = device + ":TOTSAVE" + self.cafe.openPrepare() self.cafe.open([pv_pwr_tot, pv_pwr_last, pv_pwr_saved, pv_pwr_timeout]) self.cafe.openNowAndWait(2.0) @@ -558,252 +578,209 @@ class AppGui(QWidget): #print("device", device, flush=True) def cb_outtime(handle, pv, pvdata): - try: - _delta = "{}".format(str(timedelta(seconds=(pvdata.value[0])))) - if _delta == "0:00:00": - _delta = "0 s" - elif ", " in _delta: - _split = _delta.split(", ") - if len(_split) == 2: - if len(_split[1]) == len("0:00:00"): - _delta = _split[0] + ", " + _split[1] - if 'days,' in _delta: - _delta = _delta.replace("days,", "d") - elif 'day,' in _delta: - _delta = _delta.replace("day,", "d") - self.offtime_dict[pv].setText(_delta) + try: + delta = "{}".format(str(timedelta(seconds=(pvdata.value[0])))) + if delta == "0:00:00": + + delta = "0 s " + self.offtime_dict[pv].setAlignment(Qt.AlignRight) + + elif ", " in delta: + le_split = delta.split(", ") + if len(le_split) == 2: + if len(le_split[1]) == len("0:00:00"): + delta = le_split[0] + ", " + le_split[1] + if "days," in delta: + delta = delta.replace("days,", "d") + elif "day," in delta: + delta = delta.replace("day,", "d") + self.offtime_dict[pv].setText(delta) except KeyError: pass - now = QDateTime.currentDateTime() - xdate = QDate(now.date().year(), 1, 15) - xstart = QDateTime(xdate) - qpinit = CAQLineEdit(self, pv_name=pv_pwr_last, show_units=False) - qpnow = CAQLineEdit(self, pv_name=pv_pwr_tot, show_units=False, notify_freq_hz=1) + qpnow = CAQLineEdit(self, pv_name=pv_pwr_tot, show_units=False, + notify_freq_hz=1) qpsave = CAQLineEdit(self, pv_name=pv_pwr_saved, show_units=False) qptotsave = CAQLineEdit(self, pv_name=pv_pwr_totsave, show_units=False) - qptime = CAQLineEdit(self, pv_name=pv_pwr_timeout, - monitor_callback=cb_outtime, show_units=True) + monitor_callback=cb_outtime, show_units=True) self.offtime_dict[pv_pwr_timeout] = qptime - #Time to allow cb_outtime to fire + # Time to allow cb_outtime to fire time.sleep(0.2) - + qptime.setFixedWidth(104) - #qtdis = QBasicTimer() - #qpnow.setAlignment(Qt.AlignRight) - #qpnow.style().polish(qpnow) return qsector, qpinit, qpnow, qpsave, qptime, qptotsave def group_sector_qtabwidget(self): - - idx_last = self.settings.data["header"].index("MASTER") - idx = self.settings.data["header"].index("G1") - - #open all PVS + + #idx_last = self.settings.data["header"].index("MASTER") + #idx = self.settings.data["header"].index("G1") + + # open all PVS pv = [] - for sector in self.settings.data["header"][idx:idx_last]: - + # for sector in self.settings.data["header"][idx:idx_last]: + for sector in self.settings.data["headerMagnetSector"]: + device_list = self.settings.data[sector]["device"] attribute_list = self.settings.data[sector]["attribute"] for att in attribute_list: for dev in device_list: pv.append(dev + ":" + att) - + self.cafe.openPrepare() self.cafe.open(pv) self.cafe.openNowAndWait(1.0) - #self.cafe.supplementHandles() - - sector_wgt_dict = {} - - for sector in self.settings.data["header"][idx:idx_last]: - sector_wgt_dict[sector] = self.ca_table_sector_widget(sector=sector) + # self.cafe.supplementHandles() + + self.sector_wgt_dict = {} + + # for sector in self.settings.data["header"][idx:idx_last]: + for sector in self.settings.data["headerMagnetSector"]: + self.sector_wgt_dict[sector] = self.ca_table_sector_widget( + sector=sector) QApplication.processEvents() - - sector_tab_widget = QTabWidget() + + sector_tab_widget = QTabWidget() sector_tab_widget.setFont(self.font_gui) sector_tab_widget.setStyleSheet("QTabBar {font-size: 12pt;}") sector_tab_widget.tabBar().setShape(QTabBar.TriangularNorth) - for i, sector in enumerate(self.settings.data["header"][idx:idx_last]): - sector_tab_widget.addTab(sector_wgt_dict[sector], sector) + # for i, sector in + # enumerate(self.settings.data["header"][idx:idx_last]): + for i, sector in enumerate(self.settings.data["headerMagnetSector"]): + sector_tab_widget.addTab(self.sector_wgt_dict[sector], sector) color = self.settings.data[sector]["color"] sector_tab_widget.tabBar().setTabTextColor(i, QColor(color)) - - + return sector_tab_widget - ''' - def check_status_list(self, pv_list, status_list, line): - _brk = ("------------------------------------------------------" + - "------------------------------------------------------") - self.parent.trigger_log_message.emit( - MsgSeverity.INFO.name, _pymodule, line, _brk, {}) - - _options = {} - - for pv, stat in zip(pv_list, status_list): - if stat != self.cyca.ICAFE_NORMAL: - _mess = ("Error in 'set' for " + pv + " ") - _options['statusCode'] = ( - str(stat) + " " + - self.cafe.getStatusCodeAsString(stat)) - _options['statusInfo'] = self.cafe.getStatusInfo(stat) - - self.parent.trigger_log_message.emit( - MsgSeverity.WARN.name, _pymodule, line, _mess, _options) - - - self.parent.trigger_log_message.emit( - MsgSeverity.INFO.name, _pymodule, line, _brk, {}) - - _mess = ("The following devices reported an error " + - "in 'set' operation:") - self.parent.trigger_log_message.emit( - MsgSeverity.INFO.name, _pymodule, line, _mess, {}) - - def check_status(self, pv, stat, line): - if stat != self.cyca.ICAFE_NORMAL: - _mess = ("Error in 'set' for " + pv + ".") - _options = {} - _options['statusCode'] = ( - str(stat) + " " + - self.cafe.getStatusCodeAsString(stat)) - _options['statusInfo'] = self.cafe.getStatusInfo( - stat) - self.parent.trigger_log_message.emit( - MsgSeverity.WARN.name, _pymodule, line, - _mess, _options) - ''' - - def on_sector_standby(self): + def on_sector_standby(self): target = self.sender() sector = target.sector - _table = self.table_sol_dict[sector] - + table = self.table_sol_dict[sector] + def is_update_enabled(): - '''Check if update buttons are enabled + '''Check if update buttons are enabled if NOT, then do not allow inital values values to be updated" ''' - + ''' if self.table_pwr_dict[sector].init_value_button.isEnabled() \ - and _table.init_value_button.isEnabled(): + and table.init_value_button.isEnabled(): return True else: return False - + ''' + return bool( + self.table_pwr_dict[sector].init_value_button.isEnabled( + ) and table.init_value_button.isEnabled()) QApplication.processEvents(QEventLoop.AllEvents, 1.0) - - #Do NOT do updates if in standby mode! - #Update button is disabled when in standby - - - #disenable widgets to avoid circular behaviour since - #updates of SOL also update PWR, and vice-versa - #Do not click if already on standby!! - update_enabled = is_update_enabled() - + # Do NOT do updates if in standby mode! + # Update button is disabled when in standby + + # disenable widgets to avoid circular behaviour since + # updates of SOL also update PWR, and vice-versa + # Do not click if already on standby!! + + update_enabled = is_update_enabled() + if update_enabled: self.table_pwr_dict[sector].init_value_button.setEnabled(False) - _table.init_value_button.click() + table.init_value_button.click() time.sleep(0.05) - self.table_pwr_dict[sector].init_value_button.setEnabled(True) - - _table.init_value_button.setEnabled(False) + self.table_pwr_dict[sector].init_value_button.setEnabled(True) + + table.init_value_button.setEnabled(False) self.table_pwr_dict[sector].init_value_button.click() time.sleep(0.05) - self.table_sol_dict[sector].init_value_button.setEnabled(True) - + self.table_sol_dict[sector].init_value_button.setEnabled(True) + QApplication.processEvents(QEventLoop.AllEvents, 1.0) - - if not self.input_parameters['simulation']: - status, status_list, pv_list = _table.set_standby_values() - + + if not self.input_parameters["simulation"]: + status, status_list, pv_list = table.set_standby_values() + if status != self.cyca.ICAFE_NORMAL: self.check_status_list( - _pymodule, 'setScalarList', pv_list, status_list, _line()) + _pymodule, "setScalarList", pv_list, status_list, _line()) - - #Seqeuncer ONLY determines when to go into STANDBY mode - #and NOT the HLA + # Seqeuncer ONLY determines when to go into STANDBY mode + # and NOT the HLA ##pv = 'P' + target.sector + "-HUSH:STATE" ##stat = self.cafe.set(pv, 0) ##self.check_status(_pymodule, 'set', pv, stat, _line()) - #Disable because _table.set_standby_values() enables it + # Disable because _table.set_standby_values() enables it if not update_enabled: self.table_pwr_dict[sector].init_value_button.setEnabled(False) - _table.init_value_button.setEnabled(False) - + table.init_value_button.setEnabled(False) - def on_sector_restore(self): + def on_sector_restore(self): target = self.sender() sector = target.sector - _table = self.table_sol_dict[sector] + table = self.table_sol_dict[sector] + + if not self.input_parameters["simulation"]: + status, status_list, pv_list = table.restore_init_values() - if not self.input_parameters['simulation']: - status, status_list, pv_list = _table.restore_init_values() - if status != self.cyca.ICAFE_NORMAL: self.check_status_list( - _pymodule, 'setScalarList', pv_list, status_list, _line()) + _pymodule, "setScalarList", pv_list, status_list, _line()) - #Seqeuncer ONLY determines when to go into STANDBY mode - #and NOT the HLA + # Seqeuncer ONLY determines when to go into STANDBY mode + # and NOT the HLA #pv = 'P' + target.sector + "-HUSH:STATE" #stat = self.cafe.set(pv, 1) #self.check_status(_pymodule, 'set', pv, stat, _line()) - - _table_pwr = self.table_pwr_dict[sector] - row_pwr_dict = _table_pwr.get_init_values() - sum_pwr = sum(list(row_pwr_dict.values())) - pv_last_pwr = 'P' + target.sector + "-HUSH:LASTPWR" - - stat = self.cafe.set(pv_last_pwr, sum_pwr) - self.check_status(_pymodule, 'set', pv_last_pwr, stat, _line()) - def ca_table_sector_widget(self, sector: str="", color: str="MACHINE"): + table_pwr = self.table_pwr_dict[sector] + row_pwr_dict = table_pwr.get_init_values() + sum_pwr = sum(list(row_pwr_dict.values())) + pv_last_pwr = "P" + target.sector + "-HUSH:LASTPWR" + + stat = self.cafe.set(pv_last_pwr, sum_pwr) + self.check_status(_pymodule, "set", pv_last_pwr, stat, _line()) + + def ca_table_sector_widget(self, sector: str = ""): device_list = self.settings.data[sector]["device"] attribute_list = self.settings.data[sector]["attribute"] try: - _standby_values = self.settings.data[sector]["standby"] - print("Standby Values", sector, _standby_values, flush=True) - except KeyError as ex: + standby_values = self.settings.data[sector]["standby"] + print("Standby Values", sector, standby_values, flush=True) + except KeyError: print("On Standby values not given for sector {0}".format(sector)) pv_dict = {} for att in attribute_list: - pv_dict[att] = [] #[None] * len(device_list) + att_pv = att + att_key = att if att != "PWR:2" else "PWR" + pv_dict[att_key] = [] # [None] * len(device_list) for dev in device_list: - pv_dict[att].append(dev + ":" + att) - - _table_height = 700 - + pv_dict[att_key].append(dev + ":" + att_pv) + try: - _delay = self.input_parameters["delayRamp"] + delay = self.input_parameters["delayRamp"] except KeyError: - _delay = 0.09 + delay = 0.09 pass #print(pv_dict['SOL:2'], flush=True) #print(_standby_values, flush=True) table_sol = CAQTableWidget( - self, pv_list=pv_dict['SOL:2'], show_units=True, notify_freq_hz=0, + self, pv_list=pv_dict["SOL:2"], show_units=True, notify_freq_hz=0, notify_unison=False, scale_factor=1, show_timestamp=False, init_column=True, pv_list_show=device_list, standby_column=True, - standby_values=_standby_values, set_delay = _delay) + standby_values=standby_values, set_delay=delay) table_sol.restore_value_button.setToolTip( - ("Restore devices to their pre-standby values")) + ("Restore devices to their pre-standby values")) table_sol.init_value_button.setToolTip( - ("Shows initial, pre-standby values. Update is also " + - "executed automatically before the standby procedure.")) + ("Shows initial, pre-standby values. Update is also " + + "executed automatically before the standby procedure.")) table_sol.standby_value_button.sector = sector table_sol.standby_value_button.clicked.disconnect() @@ -812,23 +789,22 @@ class AppGui(QWidget): table_sol.restore_value_button.clicked.disconnect() table_sol.restore_value_button.clicked.connect(self.on_sector_restore) - self.table_sol_dict[sector] = table_sol table_ist = CAQTableWidget( - self, pv_list=pv_dict['IST:2'], show_units=True, notify_freq_hz=1, + self, pv_list=pv_dict["IST:2"], show_units=True, notify_freq_hz=1, notify_unison=True, scale_factor=1, show_timestamp=False, init_column=False, pv_list_show=[False]) table_pwr = CAQTableWidget( - self, pv_list=pv_dict['PWR'], show_units=False, notify_freq_hz=1, - suffix = "kW", + self, pv_list=pv_dict["PWR"], show_units=False, notify_freq_hz=1, + suffix="kW", notify_unison=True, scale_factor=0.001, show_timestamp=False, - init_column=True, init_list=pv_dict['PWR'], pv_list_show=[False]) + init_column=True, init_list=pv_dict["PWR"], pv_list_show=[False]) table_pwr.init_value_button.setToolTip( - ("Shows initial, pre-standby values. Update is also " + - "executed automatically before the standby procedure.")) + ("Shows initial, pre-standby values. Update is also " + + "executed automatically before the standby procedure.")) self.table_pwr_dict[sector] = table_pwr @@ -839,13 +815,13 @@ class AppGui(QWidget): f = header_value.font() f.setPixelSize(13) header_item.setFont(f) - header_item.setText('Device') + header_item.setText("Device") header_init.setFont(f) - header_init.setText('Init. Value') + header_init.setText("Init. Value") header_standby.setFont(f) - header_standby.setText('Standby') + header_standby.setText("Standby") header_value.setFont(f) - header_value.setText('SOL:2') + header_value.setText("SOL:2") table_sol.setContentsMargins(15, 0, 15, 10) table_sol.setHorizontalHeaderItem(0, header_item) table_sol.setHorizontalHeaderItem(1, header_init) @@ -855,60 +831,59 @@ class AppGui(QWidget): table_sol.setColumnWidth(1, 88) table_sol.setColumnWidth(2, 80) table_sol.setColumnWidth(3, 88) - table_sol.setFixedWidth(386) - + table_sol.setFixedWidth(386) + ioc_magnets = [] for i, device in enumerate(device_list): if device in self.settings.data[sector]["iocDevice"]: ioc_magnets.append(i) - header_value = QTableWidgetItem() f = header_value.font() f.setPixelSize(13) header_value.setFont(f) - header_value.setText('IST:2') + header_value.setText("IST:2") table_ist.setContentsMargins(15, 0, 15, 10) table_ist.setHorizontalHeaderItem(0, header_value) table_ist.setColumnWidth(0, 90) - table_ist.setFixedWidth(140) - + table_ist.setFixedWidth(140) + header_init = QTableWidgetItem() f = header_init.font() header_init.setFont(f) - header_init.setText('Init. Value') + header_init.setText("Init. Value") header_value = QTableWidgetItem() f = header_value.font() f.setPixelSize(13) header_value.setFont(f) - header_value.setText('PWR') + header_value.setText("PWR") table_pwr.setContentsMargins(15, 0, 15, 10) table_pwr.setHorizontalHeaderItem(0, header_init) table_pwr.setHorizontalHeaderItem(1, header_value) table_pwr.setColumnWidth(0, 88) table_pwr.setColumnWidth(1, 88) - table_pwr.setFixedWidth(226) - - for i in ioc_magnets: - table_sol.paint_rows(row_range=[i, i+1], reset=False, - columns=[0, 1]) - table_ist.paint_rows(row_range=[i, i+1], reset=False) - table_pwr.paint_rows(row_range=[i, i+1], reset=False) + table_pwr.setFixedWidth(226) - - pvStatus = self.settings.data[sector]['status'] - beamline_status = self.cafe.getCache(pvStatus) + if "Controlroom" in self.assigned_master and "B1B2" not in sector: + for i in ioc_magnets: + table_sol.paint_rows(row_range=[i, i + 1], reset=False, + columns=[0, 1]) + table_ist.paint_rows(row_range=[i, i + 1], reset=False) + table_pwr.paint_rows(row_range=[i, i + 1], reset=False) + + pv_status = self.settings.data[sector]["status"] + beamline_status = self.cafe.getCache(pv_status) if beamline_status is not None: - #in HIPA this was I < self.I_min: + # in HIPA this was I < self.I_min: if "Geschlossen" in beamline_status: try: - values = self.settings.data[sector]['ref'] + values = self.settings.data[sector]["ref"] table_sol.set_init_values(values) except KeyError: pass try: - pwr_values = self.settings.data[sector]['pwrref'] - table_pwr.set_init_values(pwr_values) + pwr_values = self.settings.data[sector]["pwrref"] + table_pwr.set_init_values(pwr_values) except KeyError: pass @@ -917,15 +892,18 @@ class AppGui(QWidget): table_pwr.init_value_button.click() time.sleep(0.1) table_sol.init_value_button.setEnabled(True) - pv = "P" + table_pwr.init_value_button.sector + "-HUSH:LASTPWR" - _sum = sum(table_pwr.get_init_values().values()) - print("SUM up all the values", pv, _sum, flush=True) - stat = self.cafe.set(pv, _sum) - self.check_status(_pymodule, 'set', pv, stat, _line()) - - def on_init_update(): + pv = "P" + table_pwr.init_value_button.sector + "-HUSH:LASTPWR" + init_sum = sum(table_pwr.get_init_values().values()) + print("SUM up all the values", pv, init_sum, flush=True) + #B1B2 is not is not in state machine + if "B1B2" in table_pwr.init_value_button.sector: + retrun + stat = self.cafe.set(pv, init_sum) + self.check_status(_pymodule, "set", pv, stat, _line()) + + def on_init_update(): table_pwr.init_value_button.setEnabled(False) - table_sol.init_value_button.click() + table_sol.init_value_button.click() time.sleep(0.1) table_pwr.init_value_button.setEnabled(True) @@ -934,11 +912,11 @@ class AppGui(QWidget): table_pwr.init_value_button.sector = sector table_pwr.init_value_button.clicked.connect(on_init_update) - hbox = QHBoxLayout() + hbox = QHBoxLayout() hbox.addWidget(table_sol) hbox.addWidget(table_ist) hbox.addWidget(table_pwr) - + hbox.setSpacing(10) hbox.setAlignment(Qt.AlignTop) qw = QWidget() @@ -946,8 +924,8 @@ class AppGui(QWidget): obj_name = self.settings.data[sector]["colorObj"] if self.obj_to_upper: - obj_name = obj_name.upper() - + obj_name = obj_name.upper() + qw.setObjectName(obj_name) return qw @@ -957,43 +935,43 @@ class AppGui(QWidget): return qm = QMessageBox() mess = ("This action will reset the energy saving account to zero. \n" + - "This is typically undertaken at the end of the calendar year. \n" + - "Please be sure that the present accounting figures are entered \n" + - "into the log book before initiating this action. \n\n" + + "This is typically undertaken at the end of the calendar " + + "year. \n\n" + + "Present accounting figures will be entered in the elogbook\n" + "Are you sure you wish to continue with the reset?") reply = qm.warning(self, "Reset Accounting", mess, QMessageBox.Yes | QMessageBox.No) - + if reply == QMessageBox.No: - return + return self.parent.prepare_elog_message() print("message", self.parent.message) print("logbook", self.parent.logbook, flush=True) url = self.settings.data["ElogBooks"][self.parent.logbook]["url"] print("url", url, flush=True) - _logbook = elog.open(url, user='robot', password='robot') - #QApplication.processEvents() - - attributes = {} - attributes['Autor'] = getpass.getuser() - attributes['Author'] = getpass.getuser() - attributes['Application'] = self.parent.appname - attributes['Titel'] = self.parent.title - attributes['Title'] = self.parent.title - attributes['When'] = str(time.time()) - attributes['Wann'] = str(time.time()) - if 'Sandkasten' in self.parent.logbook: - attributes['Eintrag'] = "Anregung" - else: - attributes['Eintrag'] = "Info" - attributes['Effekt'] = 'keiner' + logbook = elog.open(url, user="robot", password="robot") + # QApplication.processEvents() + + attributes = {} + attributes["Autor"] = getpass.getuser() + attributes["Author"] = getpass.getuser() + attributes["Application"] = self.parent.appname + attributes["Titel"] = self.parent.title + attributes["Title"] = self.parent.title + attributes["When"] = str(time.time()) + attributes["Wann"] = str(time.time()) + if "Sandkasten" in self.parent.logbook: + attributes["Eintrag"] = "Anregung" + else: + attributes["Eintrag"] = "Info" + attributes["Effekt"] = "keiner" + + log_mess = self.parent.message.replace("
", "\n") - log_mess = self.parent.message.replace("
","\n") - try: - _logbook.post(log_mess, attributes=attributes) - + logbook.post(log_mess, attributes=attributes) + self.show_log_message(MsgSeverity.INFO, _pymodule, _line(), log_mess) self.statusbar.showMessage("Reset Savings Account." + @@ -1004,35 +982,34 @@ class AppGui(QWidget): self.show_log_message( MsgSeverity.ERROR, _pymodule, _line(), mess) self.statusbar.showMessage(mess) - - + for sector in sector_prefix_list: self.sector_sm_off(sector) - + for sector in sector_prefix_list: - self.clear_sector_saving(sector) - + self.clear_sector_saving(sector) + def sector_sm_off(self, sector_prefix: str = None): if not sector_prefix: return - pv1 = sector_prefix +"-HUSH:SEQ-ONOFF" + pv1 = sector_prefix + "-HUSH:SEQ-ONOFF" stat = self.cafe.set(pv1, 0) - self.check_status(_pymodule, 'set', pv1, stat, _line()) + self.check_status(_pymodule, "set", pv1, stat, _line()) time.sleep(0.05) QApplication.processEvents() - return - + return + def clear_sector_saving(self, sector_prefix: str = None): if not sector_prefix: return - pv1 = sector_prefix +"-HUSH:SEQ-ONOFF" - pv2 = sector_prefix +"-HUSH:TOTSAVE" - pv3 = sector_prefix +"-HUSH:OFFTIME" + pv1 = sector_prefix + "-HUSH:SEQ-ONOFF" + pv2 = sector_prefix + "-HUSH:TOTSAVE" + pv3 = sector_prefix + "-HUSH:OFFTIME" stat = self.cafe.set(pv1, 0) - self.check_status(_pymodule, 'set', pv1, stat, _line()) + self.check_status(_pymodule, "set", pv1, stat, _line()) off_time = self.cafe.get(pv3) - self.check_status(_pymodule, 'get', pv3, None, _line()) - + self.check_status(_pymodule, "get", pv3, None, _line()) + iloop = 0 if off_time is not None: while off_time > 0 and iloop < 100: @@ -1043,11 +1020,11 @@ class AppGui(QWidget): QApplication.processEvents() else: time.sleep(0.1) - print("SECTOR ILOOP",sector_prefix, iloop) + print("SECTOR ILOOP", sector_prefix, iloop) stat = self.cafe.set(pv1, 1) - self.check_status(_pymodule, 'set', pv1, stat, _line()) + self.check_status(_pymodule, "set", pv1, stat, _line()) stat = self.cafe.set(pv2, 0) - self.check_status(_pymodule, 'set', pv2, stat, _line()) + self.check_status(_pymodule, "set", pv2, stat, _line()) return def reset_ioc_saving(self, sector_prefix_list: list = None): @@ -1056,12 +1033,25 @@ class AppGui(QWidget): qpb = QPushButton("Reset Account") qpb.setObjectName("WriteData") qpb.clicked.connect(lambda: self.clear_saving(sector_prefix_list)) - qpb.setFixedHeight(40) #self.gui_frame.widget_height) + qpb.setFixedHeight(40) # self.gui_frame.widget_height) qpb.setFixedWidth(160) - + + qtext = QTextEdit() + qtext.setText("""
  The Reset Account Button resets Total Power Saved (MWh) to zero.
+   This is typically executed at the end of the calendar year.
+   The present energy saving figures will be entered into the elogbook.
+   The button prompts the user for confirmation before proceeding.
+ """) + qtext.setReadOnly(True) + qtext.setStyleSheet("background-color: QColor(0, 0, 50, 10);") + qtext.setFixedHeight(104) + qtext.setFixedWidth(440) + qgrid = QGridLayout() - qgrid.addWidget(qpb, 0, 0, 1, 1) - + qgrid.setSpacing(0) + qgrid.addWidget(qtext, 0, 0, 1, 1, Qt.AlignHCenter) + qgrid.addWidget(qpb, 1, 0, 1, 1, Qt.AlignHCenter) + qw = QGroupBox("HUSH! Accounting") qw.setContentsMargins(5, 10, 5, 0) qw.setAlignment(Qt.AlignTop) @@ -1070,22 +1060,22 @@ class AppGui(QWidget): qw.setFixedWidth(460) qw.setFixedHeight(280) return qw - - def reset_ioc_sm(self): + + def reset_ioc_sm(self): msg_button = [None] * len(self.sec_state_list) - monitor_state = [None] * len(self.sec_state_list) + monitor_seq_onoff = [None] * len(self.sec_state_list) monitor_seq_state = [None] * len(self.sec_state_list) monitor_standby_state = [None] * len(self.sec_state_list) qgrid = QGridLayout() qreset = QLabel("Reset") - qreset.setAlignment(Qt.AlignBottom|Qt.AlignHCenter) + qreset.setAlignment(Qt.AlignBottom | Qt.AlignHCenter) qsm = QLabel("SM ") - qsm.setAlignment(Qt.AlignBottom|Qt.AlignHCenter) + qsm.setAlignment(Qt.AlignBottom | Qt.AlignHCenter) qss = QLabel("Sequencer State ") - qss.setAlignment(Qt.AlignBottom|Qt.AlignHCenter) + qss.setAlignment(Qt.AlignBottom | Qt.AlignHCenter) qstandby = QLabel("ON or \nStandby") - qstandby.setAlignment(Qt.AlignBottom|Qt.AlignHCenter) + qstandby.setAlignment(Qt.AlignBottom | Qt.AlignHCenter) qgrid.addWidget(qreset, 0, 0, 1, 1) qgrid.addWidget(qsm, 0, 1, 1, 1) qgrid.addWidget(qss, 0, 2, 1, 1) @@ -1093,28 +1083,28 @@ class AppGui(QWidget): for i, pv in enumerate(self.sec_state_list): pvsplit = pv.split("-") sec = pvsplit[0][1:] - pv_seq_onoff = pv.replace('STATE','SEQ-ONOFF') - pv_seq_state = pv.replace('STATE','SEQ-STATE') - msg_button[i] = CAQMessageButton(self, - pv_name=pv_seq_onoff, msg_label=sec, msg_press_value="Off", - msg_release_value="On") + pv_seq_onoff = pv.replace("STATE", "SEQ-ONOFF") + pv_seq_state = pv.replace("STATE", "SEQ-STATE") + msg_button[i] = CAQMessageButton( + self, pv_name=pv_seq_onoff, msg_label=sec, + msg_press_value="Off", msg_release_value="On") monitor_seq_onoff[i] = CAQLabel(self, pv_name=pv_seq_onoff) monitor_seq_state[i] = CAQLabel(self, pv_name=pv_seq_state) monitor_standby_state[i] = CAQLabel(self, pv_name=pv) - qgrid.addWidget(msg_button[i], i+1, 0, 1, 1, Qt.AlignLeft) - qgrid.addWidget(monitor_seq_onoff[i], i+1, 1, 1, 1, Qt.AlignLeft) - qgrid.addWidget(monitor_seq_state[i], i+1, 2, 1, 1, Qt.AlignLeft) - qgrid.addWidget(monitor_standby_state[i], i+1, 3, 1, 1, Qt.AlignLeft) - + qgrid.addWidget(msg_button[i], i + 1, 0, 1, 1, Qt.AlignLeft) + qgrid.addWidget(monitor_seq_onoff[i], i + 1, 1, 1, 1, Qt.AlignLeft) + qgrid.addWidget(monitor_seq_state[i], i + 1, 2, 1, 1, Qt.AlignLeft) + qgrid.addWidget( + monitor_standby_state[i], + i + 1, + 3, + 1, + 1, + Qt.AlignLeft) + qgrid.setContentsMargins(9, 9, 9, 9) qgrid.setSpacing(10) - ''' - qw = QWidget() - qw.setLayout(qgrid) - qw.setFixedHeight(260) - qw.setFixedWidth(400) - ''' - + qw = QGroupBox("State Machine") qw.setContentsMargins(5, 10, 5, 0) qw.setAlignment(Qt.AlignTop) @@ -1122,5 +1112,5 @@ class AppGui(QWidget): qw.setLayout(qgrid) qw.setFixedWidth(460) qw.setFixedHeight(280) - + return qw