From 6fa7a82c269f5dbcedf1dca46cce0ada81fbc09f Mon Sep 17 00:00:00 2001 From: chrin Date: Fri, 10 Jan 2025 14:16:45 +0100 Subject: [PATCH] password protected Reset Account --- config/control/#hush.json# | 20 -------------------- config/control/hush.json | 3 ++- config/control/hush_full.json | 3 ++- config/g1/hush.json | 3 ++- config/g2/hush.json | 3 ++- config/g3/hush.json | 3 ++- config/o2/hush.json | 3 ++- config/pif/hush.json | 3 ++- hush.json | 3 ++- hush.sh | 6 +++--- src/gui.py | 24 ++++++++++++++++++++---- 11 files changed, 39 insertions(+), 35 deletions(-) delete mode 100755 config/control/#hush.json# diff --git a/config/control/#hush.json# b/config/control/#hush.json# deleted file mode 100755 index 57da2f1..0000000 --- a/config/control/#hush.json# +++ /dev/null @@ -1,20 +0,0 @@ -{ - - "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.json b/config/control/hush.json index 98e4eaf..824325e 100755 --- a/config/control/hush.json +++ b/config/control/hush.json @@ -17,5 +17,6 @@ "resultsTabTitle" : "IOC" }, "headerMagnetSector": ["B1B2","G1","SH","G2","O2","PIF", "G3"], - "Master": "Controlroom" + "Master": "Controlroom", + "Reset": "HUSH!" } diff --git a/config/control/hush_full.json b/config/control/hush_full.json index 78ccc4f..0c823f4 100755 --- a/config/control/hush_full.json +++ b/config/control/hush_full.json @@ -73,5 +73,6 @@ "IOC": { "resultsTabTitle" : "IOC" }, - "Master": "Controlroom + "Master": "Controlroom", + "Reset": "HUSH!" } diff --git a/config/g1/hush.json b/config/g1/hush.json index faafc33..6ec5c0f 100755 --- a/config/g1/hush.json +++ b/config/g1/hush.json @@ -14,5 +14,6 @@ "simulation": {"flag" : 1, "data":{ "widget": "None", "text" : "Dry run", "value" : 0}} }, "headerMagnetSector": ["G1"], - "Master": "Gantry 1" + "Master": "Gantry 1", + "Reset": "HUSH!" } diff --git a/config/g2/hush.json b/config/g2/hush.json index 01d4d80..acd8d0b 100755 --- a/config/g2/hush.json +++ b/config/g2/hush.json @@ -14,5 +14,6 @@ "simulation": {"flag" : 1, "data":{ "widget": "None", "text" : "Dry run", "value" : 0}} }, "headerMagnetSector": ["G2"], - "Master": "Gantry 2" + "Master": "Gantry 2", + "Reset": "HUSH!" } diff --git a/config/g3/hush.json b/config/g3/hush.json index 1be609f..c8db0d4 100755 --- a/config/g3/hush.json +++ b/config/g3/hush.json @@ -14,5 +14,6 @@ "simulation": {"flag" : 1, "data":{ "widget": "None", "text" : "Dry run", "value" : 0}} }, "headerMagnetSector": ["PIF", "G3"], - "Master": "Gantry 3" + "Master": "Gantry 3", + "Reset": "HUSH!" } diff --git a/config/o2/hush.json b/config/o2/hush.json index 91ac03e..1e0bc68 100755 --- a/config/o2/hush.json +++ b/config/o2/hush.json @@ -14,5 +14,6 @@ "simulation": {"flag" : 1, "data":{ "widget": "None", "text" : "Dry run", "value" : 0}} }, "headerMagnetSector": ["O2"], - "Master": "OPTIS2" + "Master": "OPTIS2", + "Reset": "HUSH!" } diff --git a/config/pif/hush.json b/config/pif/hush.json index 6ce08bc..973f731 100755 --- a/config/pif/hush.json +++ b/config/pif/hush.json @@ -14,5 +14,6 @@ "simulation": {"flag" : 1, "data":{ "widget": "None", "text" : "Dry run", "value" : 0}} }, "headerMagnetSector": ["PIF"], - "Master": "PIF" + "Master": "PIF", + "Reset": "HUSH!" } diff --git a/hush.json b/hush.json index da18eb0..971a2b7 100755 --- a/hush.json +++ b/hush.json @@ -127,5 +127,6 @@ "resultsTabTitle" : "IOC" }, "headerMagnetSector": ["B1B2","G1","SH","G2","O2","PIF", "G3"], - "Master": "Controlroom" + "Master": "Controlroom", + "Reset": "HUSH!" } diff --git a/hush.sh b/hush.sh index 77a3168..acf56a2 100755 --- a/hush.sh +++ b/hush.sh @@ -1,5 +1,5 @@ #!/bin/bash -cd /proscan/bd/applications/hush/hla/1.5.0 +cd /proscan/bd/applications/hush/hla/1.6.0 # For use if script is sourced rather than executed appNameDefault="hush.sh" @@ -60,10 +60,10 @@ echo "PYTHON_VERSION $PYTHON_VERSION" #C_EXT version -export PYTHONPATH=.:/opt/gfa/cafe/python/pycafe/cafe-1.21.0/lib/${_EPICS_HOST_ARCH}:/proscan/bd/applications/deps/apps4ops/v1.10.0 +export PYTHONPATH=.:/opt/gfa/cafe/python/pycafe/cafe-1.21.0/lib/${_EPICS_HOST_ARCH}:/proscan/bd/applications/deps/apps4ops/v1.13.0 if [ "${EXTRA_PYTHON_PATH_FLAG}" -gt "0" ] ; then - export PYTHONPATH=$PYTHONPATH:/proscan/bd/applications/deps/apps4ops/v1.10.0/common/python${PYTHON_VERSION_DIR} + export PYTHONPATH=$PYTHONPATH:/proscan/bd/applications/deps/apps4ops/v1.13.0/common/python${PYTHON_VERSION_DIR} fi echo $PYTHONPATH diff --git a/src/gui.py b/src/gui.py index 0ac09d7..7bb7e28 100644 --- a/src/gui.py +++ b/src/gui.py @@ -12,9 +12,9 @@ from qtpy.QtGui import QColor, QPixmap from qtpy.QtCore import __version__ as QT_VERSION_STR from qtpy.QtCore import QEventLoop, Qt, QTimer, Slot from qtpy.QtWidgets import ( - QApplication, QFrame, QGridLayout, QGroupBox, QHBoxLayout, QLabel, - QMessageBox, QPushButton, QSpacerItem, QTabBar, QTabWidget, - QTableWidgetItem, QTextEdit, QWidget) + QApplication, QFrame, QGridLayout, QGroupBox, QHBoxLayout, QInputDialog, + QLabel, QLineEdit, QMessageBox, QPushButton, QSpacerItem, QTabBar, + QTabWidget, QTableWidgetItem, QTextEdit, QWidget) try: import elog @@ -1327,6 +1327,7 @@ class AppGui(QWidget): def clear_saving(self, sector_prefix_list: list = None): if not sector_prefix_list: 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 " + @@ -1338,7 +1339,22 @@ class AppGui(QWidget): if reply == QMessageBox.No: return - + ''' + + qd = QInputDialog(self) + #pwedit = QLineEdit() + mess = ("To execute the reset,\nplease enter the password:") + text, ok = qd.getText(None, "Reset Account", mess, + QLineEdit.Password) + if ok and text: + if text.upper()!= self.settings.data["Reset"]: + qmb = QMessageBox(qd) + mess = "Incorrect password!\nTry Reset Account once again." + qmb.information(self, "Reset Account", mess) + return + else: + return + self.parent.prepare_elog_message() print("message", self.parent.message) print("logbook", self.parent.logbook, flush=True)