header shows beam path

This commit is contained in:
2024-02-08 14:14:01 +01:00
parent 592c49af05
commit 5a25ee0323

View File

@@ -66,8 +66,16 @@ class GUIHeader(QWidget):
self.pframe_matrix = {"POST-COMET": {}, "G1": {}, "PRE-SH": {},
"POST-SH": {}, "G2": {}, "PRE-O2": {},
"O2": {}, "PRE-PIF": {}, "PRE-G3": {}}
self.op_color = self.settings.data['StyleGuide']['bgTitleOperation']
self.sim_color = self.settings.data['StyleGuide']['bgTitleSimulation']
self.pf_off_color = self.sim_color if self.settings.data['Expert'][
'simulation']['data']['value'] else self.op_color
def pframe(color="green"):
qframe = QFrame()
qframe.setStyleSheet("background-color: {0};".format(color))
@@ -84,12 +92,10 @@ class GUIHeader(QWidget):
self.pframe_matrix[area][i] = {}
for j in range(0, nwidth):
self.pframe_matrix[area][i][j] = {}
pf = pframe('green')
pf = pframe(self.pf_off_color)
qgrid.addWidget(pf, i, j, 1, 1, Qt.AlignCenter)
#if i==3 and j==3:
# pf.setVisible(False)
self.pframe_matrix[area][i][j] = True
self.pframe_matrix[area][i][j] = pf
qgrid.setSpacing(1)
qgrid.setContentsMargins(0, 0, 0, 0)
@@ -134,7 +140,7 @@ class GUIHeader(QWidget):
self.grid_layout.addWidget(qw, 0, j, 2, 1, _align)
j += 1
elif sector in ["COMET"]:
qw = draw_box(nheight=10, nwidth=8, area="POST-COMET")
qw = draw_box(nheight=10, nwidth=10, area="POST-COMET")
self.grid_layout.addWidget(qw, 1, j, 2, 1, _align)
j += 1
elif sector in ["SH"]:
@@ -147,8 +153,7 @@ class GUIHeader(QWidget):
qw = draw_box(nheight=10, nwidth=8, area="PRE-SH")
self.grid_layout.addWidget(qw, 1, j, 2, 1, _align)
j += 1
elif sector in ["G2"]:
elif sector in ["G2"]:
qw = draw_box(nheight=10, nwidth=16, area="G2")
self.grid_layout.addWidget(qw, 0, j-1, 2, 1, _align)
qw = draw_box(nheight=10, nwidth=8, area="PRE-O2")
@@ -166,6 +171,7 @@ class GUIHeader(QWidget):
self.grid_layout.setAlignment(Qt.AlignLeft)
self.grid_layout.setContentsMargins(5, 0, 5, 0)
self.header_wgt = QGroupBox()
self.header_wgt.setObjectName(self.user_mode.name)
if has_hbox_layout:
@@ -180,7 +186,7 @@ class GUIHeader(QWidget):
title += ": {0}".format(self.title)
self.header_wgt.setTitle(title)
print(self.pframe_matrix)
#print(self.pframe_matrix)
self.target_beamline = None
@@ -193,6 +199,122 @@ class GUIHeader(QWidget):
self.master_to_wgt = {"Gantry 1": "G1", "Gantry 2": "G2",
"Gantry 3": "G3", "OPTIS2": "O2"}
self.toSH("OFF")
self.toG3("OFF")
self.toPIF("OFF")
self.toO2("OFF")
self.toG2("OFF")
self.toG1("OFF")
def color_pframe(self, color='#cccccc'):
for section in self.pframe_matrix.keys():
#print(section, flush=True)
for key, value in self.pframe_matrix[section].items():
#print(key, value, "\n")
for key2, pf in value.items():
#print("===>", key2, pf, "\n")
ss = pf.styleSheet()
aa = ss[ss.index('#'):ss.index(';')]
#print(aa)
if "green" in aa or self.pf_bgcolor() in aa:
#print("PASS", ss, self.pf_bgcolor(), flush=True)
pass
else:
pf.setStyleSheet("background-color:{0};".format(color))
def pf_bgcolor(self):
#self.pf_off_color = self.sim_color if self.input_parameters(
# 'simulation') else self.op_color
return '#cccccc'
def toG3(self, on_off: str = "ON"):
#self.toPIF(on_off)
_color = "green" if on_off=="ON" else self.pf_bgcolor()
for key, pf in self.pframe_matrix["PRE-G3"][3].items():
pf.setStyleSheet("background-color:{0};".format(_color))
def toSH(self, on_off: str = "ON"):
_color = "green" if on_off=="ON" else self.pf_bgcolor()
for key, pf in self.pframe_matrix["POST-COMET"][3].items():
pf.setStyleSheet("background-color:{0};".format(_color))
for key, pf in self.pframe_matrix["G1"][3].items():
pf.setStyleSheet("background-color:{0};".format(_color))
for key, pf in self.pframe_matrix["PRE-SH"][3].items():
pf.setStyleSheet("background-color:{0};".format(_color))
def toSHOverlap(self, on_off: str = "ON"):
_color = "green" if on_off=="ON" else self.pf_bgcolor()
pf = self.pframe_matrix["POST-COMET"][3][0]
pf.setStyleSheet("background-color:{0};".format(_color))
pf = self.pframe_matrix["POST-COMET"][3][1]
pf.setStyleSheet("background-color:{0};".format(_color))
pf = self.pframe_matrix["POST-SH"][8][0]
pf.setStyleSheet("background-color:{0};".format(_color))
pf = self.pframe_matrix["POST-SH"][8][1]
pf.setStyleSheet("background-color:{0};".format(_color))
def toPIF(self, on_off: str = "ON"):
#self.toSH(on_off)
_color = "green" if on_off=="ON" else self.pf_bgcolor()
pf = self.pframe_matrix["POST-SH"][8][0]
pf.setStyleSheet("background-color:{0};".format(_color))
for i in range(0, 5):
pf = self.pframe_matrix["POST-SH"][8-i][i+1]
pf.setStyleSheet("background-color:{0};".format(_color))
for i in range(6, 10):
pf = self.pframe_matrix["POST-SH"][3][i]
pf.setStyleSheet("background-color:{0};".format(_color))
for key, pf in self.pframe_matrix["G2"][3].items():
pf.setStyleSheet("background-color:{0};".format(_color))
for key, pf in self.pframe_matrix["PRE-O2"][3].items():
pf.setStyleSheet("background-color:{0};".format(_color))
for key, pf in self.pframe_matrix["O2"][3].items():
pf.setStyleSheet("background-color:{0};".format(_color))
for key, pf in self.pframe_matrix["PRE-PIF"][3].items():
pf.setStyleSheet("background-color:{0};".format(_color))
def toO2(self, on_off: str = "ON"):
_color = "green" if on_off=="ON" else self.pf_bgcolor()
#pf = self.pframe_matrix["POST-COMET"][3][0]
#pf.setStyleSheet("background-color:{0};".format(_color))
pf = self.pframe_matrix["POST-SH"][8][0]
pf.setStyleSheet("background-color:{0};".format(_color))
for key, pf in self.pframe_matrix["POST-SH"][8].items():
pf.setStyleSheet("background-color:{0};".format(_color))
for key, pf in self.pframe_matrix["G2"][8].items():
pf.setStyleSheet("background-color:{0};".format(_color))
for key, pf in self.pframe_matrix["PRE-O2"][8].items():
pf.setStyleSheet("background-color:{0};".format(_color))
def toG1(self, on_off: str = "ON"):
_color = "green" if on_off=="ON" else self.pf_bgcolor()
pf = self.pframe_matrix["POST-COMET"][3][0]
pf.setStyleSheet("background-color:{0};".format(_color))
for i in range(0, 5):
pf = self.pframe_matrix["POST-COMET"][3+i][i+1]
pf.setStyleSheet("background-color:{0};".format(_color))
for i in range(6, 10):
pf = self.pframe_matrix["POST-COMET"][8][i]
pf.setStyleSheet("background-color:{0};".format(_color))
def toG2(self, on_off: str = "ON"):
_color = "green" if on_off=="ON" else self.pf_bgcolor()
pf = self.pframe_matrix["POST-COMET"][3][0]
pf.setStyleSheet("background-color:{0};".format(_color))
pf = self.pframe_matrix["POST-SH"][8][0]
pf.setStyleSheet("background-color:{0};".format(_color))
for i in range(0, 5):
pf = self.pframe_matrix["POST-SH"][8+i][i+1]
pf.setStyleSheet("background-color:{0};".format(_color))
for i in range(6, 10):
pf = self.pframe_matrix["POST-SH"][13][i]
pf.setStyleSheet("background-color:{0};".format(_color))
def blink_target_beamline(self):
target = self.target_beamline
if target is None: