diff --git a/.gitignore b/.gitignore index b20e4b8..e2ed88e 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ pyrcc5/*.*~ pyrcc5/*.*-* pyrcc5/*.*+* hush_devl.sh +export \ No newline at end of file diff --git a/hush.py b/hush.py index ef4b1b2..0b1306f 100644 --- a/hush.py +++ b/hush.py @@ -56,6 +56,9 @@ class StartMain(BaseWindow): self.elog_enum = ElogPROSCAN() self.gui = AppGui(self) + self.setMinimumHeight(974) + self.setMinimumWidth(1460) + def prepare_elog_message(self): self.system_idx = self.elog_enum.system.NONE diff --git a/hush.sh b/hush.sh index aa06b58..8bab11d 100755 --- a/hush.sh +++ b/hush.sh @@ -87,6 +87,7 @@ 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" & +python wakeup.py 00:00 & if [ "${STDOUT_FLAG}" -gt "0" ] ; then #if changing the std::out destination, remember to also change it in your json config file (for reading) @@ -105,7 +106,6 @@ if [ "${STDOUT_FLAG}" -gt "0" ] ; 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 diff --git a/hush_g1.sh b/hush_g1.sh index 4aafe24..ae415f6 100755 --- a/hush_g1.sh +++ b/hush_g1.sh @@ -109,7 +109,8 @@ if [ "${STDOUT_FLAG}" -gt "0" ] ; then cp $STDOUT_DIR/${nameLog}.log $STDOUT_DIR/${nameLog}.log- rm -f $STDOUT_DIR/${nameLog}.log fi - + + python wakeup.py 00:00 & python ${name}.py -u ${configSector}/${nameconfig}.json >> $STDOUT_DIR/${nameLog}.log 2>&1 & chmod 777 $STDOUT_DIR/${nameLog}.log else diff --git a/hush_g2.sh b/hush_g2.sh index 908a6e8..2206173 100755 --- a/hush_g2.sh +++ b/hush_g2.sh @@ -109,7 +109,8 @@ if [ "${STDOUT_FLAG}" -gt "0" ] ; then cp $STDOUT_DIR/${nameLog}.log $STDOUT_DIR/${nameLog}.log- rm -f $STDOUT_DIR/${nameLog}.log fi - + + python wakeup.py 00:00 & python ${name}.py -u ${configSector}/${nameconfig}.json >> $STDOUT_DIR/${nameLog}.log 2>&1 & chmod 777 $STDOUT_DIR/${nameLog}.log else diff --git a/hush_g3.sh b/hush_g3.sh index b85f98b..ae93af1 100755 --- a/hush_g3.sh +++ b/hush_g3.sh @@ -108,7 +108,8 @@ if [ "${STDOUT_FLAG}" -gt "0" ] ; then cp $STDOUT_DIR/${nameLog}.log $STDOUT_DIR/${nameLog}.log- rm -f $STDOUT_DIR/${nameLog}.log fi - + + python wakeup.py 00:00 & python ${name}.py -u ${configSector}/${nameconfig}.json >> $STDOUT_DIR/${nameLog}.log 2>&1 & chmod 777 $STDOUT_DIR/${nameLog}.log else diff --git a/hush_o2.sh b/hush_o2.sh index 6f3fee8..5f58970 100755 --- a/hush_o2.sh +++ b/hush_o2.sh @@ -110,7 +110,7 @@ if [ "${STDOUT_FLAG}" -gt "0" ] ; then cp $STDOUT_DIR/${nameLog}.log $STDOUT_DIR/${nameLog}.log- rm -f $STDOUT_DIR/${nameLog}.log fi - + python wakeup.py 00:00 & python ${name}.py -u ${configSector}/${nameconfig}.json >> $STDOUT_DIR/${nameLog}.log 2>&1 & chmod 777 $STDOUT_DIR/${nameLog}.log else diff --git a/hush_pif.sh b/hush_pif.sh index 12c5177..6327395 100755 --- a/hush_pif.sh +++ b/hush_pif.sh @@ -111,7 +111,8 @@ if [ "${STDOUT_FLAG}" -gt "0" ] ; then cp $STDOUT_DIR/${nameLog}.log $STDOUT_DIR/${nameLog}.log- rm -f $STDOUT_DIR/${nameLog}.log fi - + + python wakeup.py 00:00 & python ${name}.py -u ${configSector}/${nameconfig}.json >> $STDOUT_DIR/${nameLog}.log 2>&1 & chmod 777 $STDOUT_DIR/${nameLog}.log else diff --git a/src/gui.py b/src/gui.py index 8b0f764..518e90e 100644 --- a/src/gui.py +++ b/src/gui.py @@ -13,8 +13,8 @@ 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, QTabBar, QTabWidget, QTableWidgetItem, - QTextEdit, QWidget) + QMessageBox, QPushButton, QSpacerItem, QTabBar, QTabWidget, + QTableWidgetItem, QTextEdit, QWidget) from common.packages import elog @@ -65,6 +65,8 @@ class AppGui(QWidget): # self.gui_frame.operator_wgt.setFixedHeight(240) # self.gui_frame.expert_wgt.setFixedHeight(240) + + self.lock = threading.Lock() self.timer = QTimer() self.timer.setSingleShot(True) @@ -115,7 +117,7 @@ class AppGui(QWidget): self.gui_frame.results_layout.addWidget(label, 0, 2, 1, 1, Qt.AlignTop) self.gui_frame.results_layout.setContentsMargins(15, 15, 15, 15) - self.gui_frame.results_layout.setVerticalSpacing(20) + self.gui_frame.results_layout.setVerticalSpacing(10) self.gui_frame.results_layout.setHorizontalSpacing(10) self.gui_frame.results_layout.addWidget( @@ -234,6 +236,7 @@ class AppGui(QWidget): #qf.setFixedHeight(1) #self.gui_frame.measurement_layout.addWidget(qf, 5, 0, 1, 1) + ''' qf1 = QFrame() qf1.setFixedWidth(1) @@ -244,6 +247,9 @@ class AppGui(QWidget): qf2.setFixedWidth(1) self.gui_frame.measurement_layout.addWidget( qf2, 0, 7, 1, 1, alignment=Qt.AlignTop) + ''' + self.gui_frame.measurement_layout.setRowStretch(6, 90) + self.gui_frame.measurement_layout.setColumnStretch(10, 90) if "Controlroom" in self.assigned_master: self.gui_header.beam_current_wgt_dict[ @@ -1556,7 +1562,7 @@ class AppGui(QWidget): qgrid.addWidget(pv_initpwr[i], i + 1, 1, 1, 1, Qt.AlignRight) qgrid.addWidget(pv_lastpwr[i], i + 1, 2, 1, 1, Qt.AlignLeft) - qgrid.setContentsMargins(9, 9, 9, 9) + qgrid.setContentsMargins(9, 4, 9, 4) qgrid.setSpacing(10) qw = QGroupBox("Last Power") diff --git a/wakeup.py b/wakeup.py new file mode 100644 index 0000000..5b49650 --- /dev/null +++ b/wakeup.py @@ -0,0 +1,61 @@ +import datetime +#print("1:", datetime.datetime.now()) +import sys +import time + +from qtpy.QtCore import Qt, QTime, QTimer +from qtpy.QtGui import QColor, QImage, QPainter, QPixmap +from qtpy.QtWidgets import QApplication, QLabel + +from pyqtacc.qrc_resources.facility.proscan.pyrcc5 import qrc_resources + +#print("1b:", datetime.datetime.now()) +app = QApplication(sys.argv) +#print("2:", datetime.datetime.now()) +try: + due = QTime.currentTime() + message = "HUSH! will begin to load shortly" + if len(sys.argv) < 2: + raise ValueError + hours, mins = sys.argv[1].split(":") + due = QTime(int(hours), int(mins)) + if not due.isValid(): + raise ValueError + if len(sys.argv) > 2: + message = " ".join(sys.argv[2:]) +except ValueError: + message = "Usage: wakeup.py HH:MM [optional message]" + +#print("3:", datetime.datetime.now()) +while QTime.currentTime() < due: + time.sleep(1) +#print("4:", datetime.datetime.now()) +image = QImage(":/Hush.jpg") +p = QPainter(image) +font = p.font() +font.setPixelSize(54) +p.setFont(font) +p.setPen(QColor(Qt.red)) +#p.setStyleSheet("color:red;") +#p.save() +p.drawText(40, 350, message) +#p.restore() + +#pixmap = QPixmap(":/Hush.jpg") +pixmap = QPixmap.fromImage(image) +#pixmap.scaled(80, 80, Qt.IgnoreAspectRatio) +label = QLabel() #"" + message + "") +label.setPixmap(pixmap) +label.setScaledContents(True) +#label.setMask(pixmap.mask()) +#label.setStyleSheet("border-image: url(:/Hush.jpg) 0 0 0 0 stretch stretch;") +#label.setText("") +#label.setText("" + message + "") +label.setWindowFlags(Qt.SplashScreen) +label.setAlignment(Qt.AlignCenter) +label.setFixedHeight(600) +label.setFixedWidth(600) +label.show() +QTimer.singleShot(5000, app.quit) #5 seconds +#print("5:", datetime.datetime.now(), flush=True) +app.exec_()