From e3bd4fd0cdb1258bb1f0bc1a9f2b3be45483f0e7 Mon Sep 17 00:00:00 2001 From: chrin Date: Fri, 3 Jan 2025 16:46:54 +0100 Subject: [PATCH] gui.py: attributes dictionary for HIPA specific keys corrected in end-of-year clear_savings routine; Use cafe-1.12.0-0 which specifically links epics 7.0.8 libraries --- hush.py | 4 ++-- hush.sh | 4 ++-- src/gui.py | 28 +++++++++++++++++++++------- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/hush.py b/hush.py index 83e69b4..575a428 100644 --- a/hush.py +++ b/hush.py @@ -21,7 +21,7 @@ from pyrcc5 import hush_resources _pymodule = os.path.basename(__file__) _appname, _appext = _pymodule.split(".") -_appversion = "2.0.0" +_appversion = "2.3.0" # _title = """HIPA Power Usage & Saving Hierarchy""" #, HUSH!""" _title = """HUSH!""" @@ -185,7 +185,7 @@ class StartMain(BaseWindow): All rights reserved.

Author: J. Chrin, Spring 2023

(EPICS db adapted from A. Kovach, 2016)

-

IOC Administrator: H. Lutz

+

IOC Administrator: P. Fernandez (prev. H. Lutz)

1st Responsible: A. Barchetti, Tel. 4779 or 3301 (Control Room)

diff --git a/hush.sh b/hush.sh index b193d18..b7d5442 100755 --- a/hush.sh +++ b/hush.sh @@ -1,5 +1,5 @@ #!/bin/bash -cd /hipa/bd/applications/hush/hla/2.2.0 +cd /hipa/bd/applications/hush/hla/2.3.0 # For use if script is sourced rather than executed appNameDefault="hush.sh" @@ -56,7 +56,7 @@ _EPICS_HOST_ARCH=${RHREL}-x86_64 #C_EXT version for Py 3.5, 3.7. 3.8, 3.10: -export PYTHONPATH=.:/opt/gfa/cafe/python/pycafe/cafe-1.21.0/lib/${_EPICS_HOST_ARCH}:/hipa/bd/applications/deps/apps4ops/v1.11.0 +export PYTHONPATH=.:/opt/gfa/cafe/python/pycafe/cafe-1.21.0-0/lib/${_EPICS_HOST_ARCH}:/hipa/bd/applications/deps/apps4ops/v1.11.0 echo $PYTHONPATH diff --git a/src/gui.py b/src/gui.py index 7b81456..cc711af 100644 --- a/src/gui.py +++ b/src/gui.py @@ -19,7 +19,11 @@ from qtpy.QtWidgets import ( QPushButton, QTabBar, QTabWidget, QTableWidgetItem, QTextEdit, QVBoxLayout, QWidget) -from common.packages import elog +try: + import elog +except: + from common.packages import elog + from apps4ops.bdbase.utils import _line @@ -1100,11 +1104,19 @@ class AppGui(QWidget): pass # HIPA Log Book else: - attributes["Eintrag"] = self.elog_enum.eintrag.INFO.name - attributes["Effekt"] = self.elog_enum.effekt.NONE.name # keiner + required_dict = self.parent.settings.data['ElogBooks'][ + self.parent.logbook]['Required'] + optional_dict = self.parent.settings.data['ElogBooks'][ + self.parent.logbook]['Optional'] + attributes["Eintrag"] = required_dict['Eintrag'][ + self.elog_enum.eintrag.INFO] + attributes["Effekt"] = optional_dict["Effekt"][ + self.elog_enum.effekt.NONE] # NONE='', NO=keiner # "Elektorversogung" - attributes["System"] = self.elog_enum.system.ELECTRICAL_SUPPLY.name - attributes["Ort"] = self.elog_enum.ort.GLOBAL.name + attributes["System"] = optional_dict["System"][ + self.elog_enum.system.ELECTRICAL_SUPPLY] + attributes["Ort"] = optional_dict["Ort"][ + self.elog_enum.ort.GLOBAL] log_mess = self.parent.message.replace("
", "\n") @@ -1116,8 +1128,10 @@ class AppGui(QWidget): self.statusbar.showMessage("Reset Savings Account." + "Last values sent to elog") except Exception as ex: - print("Exception in sendelog.py", str(ex), flush=True) - mess = "Failed to write last saving values to elog:" + str(ex) + print("Exception in gui.py", str(ex), flush=True) + print(attributes) + mess = ("Failed to write last saving values to " + + "logbook {0}: {1}").format(self.parent.logbook, str(ex)) self.show_log_message( MsgSeverity.ERROR, _pymodule, _line(), mess) self.statusbar.showMessage(mess)