mirror of
https://gitlab.psi.ch/pyqtacc/proscan.git
synced 2026-02-28 16:18:40 +01:00
cast to Qt.AlignmentFlag when setAlignment includeds an OR
This commit is contained in:
49
guiheader.py
49
guiheader.py
@@ -2,7 +2,7 @@
|
||||
"""
|
||||
import os
|
||||
|
||||
from qtpy.QtCore import Qt, QTimer
|
||||
from qtpy.QtCore import Qt, QTimer, Slot
|
||||
from qtpy.QtGui import QFont, QPixmap
|
||||
from qtpy.QtWidgets import (
|
||||
QApplication, QFrame, QGridLayout, QGroupBox, QHBoxLayout, QLabel,
|
||||
@@ -45,8 +45,10 @@ class GUIHeader(QWidget):
|
||||
self.header_height = 234
|
||||
offset = 1
|
||||
|
||||
self.header_row = {"COMET": 4+offset, "BMA1": 4+offset, "G1": 4+offset, "SH": 2+offset, "G2": 3+offset,
|
||||
"O2": 2+offset, "PIF": 0, "G3":1+offset, "MASTER": 4+offset}
|
||||
self.header_row = {"COMET": 4+offset, "BMA1": 4+offset, "G1": 4+offset,
|
||||
"SH": 2+offset, "G2": 3+offset, "O2": 2+offset,
|
||||
"BMD1": 1+offset, "PIF": 0, "G3":1+offset,
|
||||
"MASTER": 4+offset}
|
||||
# self.header_row = {"COMET": 0, "G1": 0, "SH": 0, "G2": 0, "O2": 0,
|
||||
# "PIF": 0, "G3": 0, "MASTER": 0}
|
||||
|
||||
@@ -144,8 +146,15 @@ class GUIHeader(QWidget):
|
||||
self.grid_layout.addWidget(
|
||||
self.beam_current_widget(
|
||||
header=sector, pv=pv, color_obj=color),
|
||||
self.header_row[sector], j - 1, 2, 5) # j -3 with_sub_master
|
||||
self.header_row[sector], j-1, 2, 5) # j -3 with_sub_master
|
||||
j += 1
|
||||
|
||||
elif sector == "BMD1":
|
||||
self.grid_layout.addWidget(
|
||||
self.beam_current_widget(
|
||||
header=sector, pv=pv, color_obj=color),
|
||||
self.header_row[sector], j-4, 2, 3, Qt.AlignTop) # j -3 with_sub_master
|
||||
|
||||
else:
|
||||
align = Qt.AlignTop
|
||||
|
||||
@@ -207,7 +216,12 @@ class GUIHeader(QWidget):
|
||||
self.grid_layout.addWidget(qw, 0+offset, j-1, 2, 1, align)
|
||||
j += 1
|
||||
|
||||
self.shift_type = CAQLabel(self, pv_name="PRO-HUSH:SHIFT-TYPE")
|
||||
pv_shift = self.settings.data["Shift"]["type"]
|
||||
val = self.cafe.get(pv_shift)
|
||||
if val is None:
|
||||
pv_shift = "PRO-HUSH:SHIFT-TYPE"
|
||||
|
||||
self.shift_type = CAQLabel(self, pv_name=pv_shift)
|
||||
self.grid_layout.addWidget(self.shift_type, 1, 0, 1, 2,
|
||||
Qt.AlignBottom | Qt.AlignLeft)
|
||||
|
||||
@@ -263,9 +277,9 @@ class GUIHeader(QWidget):
|
||||
b16_label = QLabel("B16-B18 ")
|
||||
self.grid_layout.addWidget(b16_label, 0+offset, 10, 1, 1,
|
||||
Qt.AlignTop| Qt.AlignRight)
|
||||
b19_label = QLabel("B19 B20 ")
|
||||
self.grid_layout.addWidget(b19_label, 0+offset, 12, 1, 1,
|
||||
Qt.AlignTop | Qt.AlignRight)
|
||||
#b19_label = QLabel("B19 B20 ")
|
||||
#self.grid_layout.addWidget(b19_label, 0+offset, 12, 1, 1,
|
||||
# Qt.AlignTop | Qt.AlignRight)
|
||||
|
||||
if has_hbox_layout:
|
||||
self.grid_layout.setSpacing(6)
|
||||
@@ -334,11 +348,9 @@ class GUIHeader(QWidget):
|
||||
self.toPIF("OFF")
|
||||
self.toO2("OFF")
|
||||
self.toG2("OFF")
|
||||
|
||||
|
||||
|
||||
|
||||
@Slot()
|
||||
def receive_master_update(value, status, alarm_severity):
|
||||
|
||||
self.mastership = value
|
||||
for key, wgt_val in self.master_to_wgt.items():
|
||||
master = self.beam_current_wgt_group[wgt_val]
|
||||
@@ -473,10 +485,13 @@ class GUIHeader(QWidget):
|
||||
for key, value in self.pframe_matrix[section].items():
|
||||
#print(key, value, "\n")
|
||||
for key2, pf in value.items():
|
||||
#print("===>", key2, pf, "\n")
|
||||
#print("===>", key2, pf, "\n", flush=True)
|
||||
ss = pf.styleSheet()
|
||||
aa = ss[ss.index("#"):ss.index(";")]
|
||||
# print(aa)
|
||||
#print(ss, flush=True)
|
||||
start_idx = ss.index("#") if "#" in ss else 0
|
||||
end_idx = ss.index(";") if ";" in ss else None
|
||||
aa = ss[start_idx:end_idx]
|
||||
#print(aa, flush=True)
|
||||
if "green" in aa or self.pf_bgcolor() in aa:
|
||||
#print("PASS", ss, self.pf_bgcolor(), flush=True)
|
||||
pass
|
||||
@@ -696,7 +711,7 @@ class GUIHeader(QWidget):
|
||||
station.style().polish(station)
|
||||
|
||||
#print("===============>",header, station.objectName())
|
||||
station.setAlignment(Qt.AlignHCenter | Qt.AlignTop)
|
||||
station.setAlignment(Qt.AlignmentFlag(Qt.AlignHCenter | Qt.AlignTop))
|
||||
station.setFlat(False)
|
||||
# if header == "SH":
|
||||
# station.setTitle("BMA1 SH")
|
||||
@@ -709,7 +724,7 @@ class GUIHeader(QWidget):
|
||||
if header == "SH":
|
||||
beam_current = QLabel("SH ")
|
||||
beam_current.setStyleSheet("font-weight: bold;")
|
||||
beam_current.setAlignment(Qt.AlignTop | Qt.AlignHCenter)
|
||||
beam_current.setAlignment(Qt.AlignmentFlag(Qt.AlignTop | Qt.AlignHCenter))
|
||||
extra_height = 15
|
||||
extra_width = 0
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user