wakeup.py is an additional additional pre-splash window

This commit is contained in:
2024-03-12 08:51:55 +01:00
parent fabd8e40a3
commit b2a169b4a7
10 changed files with 85 additions and 10 deletions

1
.gitignore vendored
View File

@@ -11,3 +11,4 @@ pyrcc5/*.*~
pyrcc5/*.*-*
pyrcc5/*.*+*
hush_devl.sh
export

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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")

61
wakeup.py Normal file
View File

@@ -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() #"<font color=red size=72><b>" + message + "</b></font>")
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("<img width=80px height=80px src=\":/Hush.jpg\"/>")
#label.setText("<font color=red size=72><b>" + message + "</b></font>")
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_()