Believe it or not - there's documentation!

This commit is contained in:
2024-02-28 13:31:29 +01:00
parent 6b6c8608c3
commit 8ed01c116d

View File

@@ -24,11 +24,9 @@ from caqtwidgets.pvwidgets import (
CAQTextEntry, QHLine)
_pymodule = os.path.basename(__file__)
file_path = elog.__file__
# storing the directory in dir variable
dir = os.path.dirname(file_path)
dir = os.path.dirname(elog.__file__)
print(dir)
class AppGui(QWidget):
@@ -393,15 +391,14 @@ class AppGui(QWidget):
standby_value = self.settings.data[sec]["standby"][idx]
standby_value_list.append(standby_value)
print("pvlist===>", pv_list, flush=True)
print("standby ist==>", standby_value_list, flush=True)
QApplication.processEvents()
value_list, status, status_list = self.cafe.getScalarList(
pv_list, cacheFlag=True)
#print("status", status, status_list, flush=True)
print("valuelist==>", pv_list, value_list, flush=True)
if status != self.cyca.ICAFE_NORMAL:
self.check_status_list(_pymodule, "getScalarListCache",
pv_list, status_list, _line())
@@ -412,15 +409,15 @@ class AppGui(QWidget):
standby) * 1.2:
in_standby = False
break
print("is_standby", in_standby, flush=True)
return in_standby
if pvdata.value[0] == "ON" and not already_in_standby():
print("pv, sec-ON", pv, sec, flush=True)
self.table_sol_dict[sec].init_value_button.setEnabled(True)
self.table_pwr_dict[sec].init_value_button.setEnabled(True)
else:
print("pv, sec-OFF", pv, sec, flush=True)
self.table_sol_dict[sec].init_value_button.setEnabled(False)
self.table_pwr_dict[sec].init_value_button.setEnabled(False)
@@ -428,29 +425,16 @@ class AppGui(QWidget):
for sector in self.settings.data["headerMagnetSector"]:
if sector in state:
self.cafe.monitor(state, receive_sec_state)
print("MONITOR======>", sector, state)
break
'''
@Slot(str, int, int)
def receive_submaster_update(self, value, status, alarm_severity):
print("VALUE=========================", value, flush=True)
sender = self.sender()
print("sender, value", sender, value, flush=True)
print("sender.sector", sender.sector, flush=True)
self.submastership_dict[sender.sector] = value
print("VALUE ===============================", self.submastership_dict[sender.sector], flush=True)
'''
def group_submaster_status(self):
@Slot(str, int, int)
def receive_submaster_update(value, status, alarm_severity):
print("VALUE=========================", value, flush=True)
sender = self.sender()
print("sender, value", sender, value, flush=True)
print("sender.sector", sender.sector, flush=True)
self.submastership_dict[sender.sector] = value
print("VALUE ===============================", self.submastership_dict[sender.sector], flush=True)
pv_id = "mastershipStatus"
qgrid = QGridLayout()
@@ -460,37 +444,30 @@ class AppGui(QWidget):
if "mastershipStatus" in self.settings.data[sector]:
no_beamlines += 1
qgb_inner = QGroupBox(sector)
#qgb_inner.setFixedHeight(80)
qgb_inner.setObjectName("INNER")
text_color = self.settings.data[sector]["color"]
#print("text color", text_color)
sss = ("QGroupBox {" + "color: {0};".format(text_color) +
" font-weight: bold;}")
qgb_inner.setStyleSheet(sss)
#ql = QLabel(sector)
pv_name = self.settings.data[sector][pv_id]
print(type(pv_name))
#pv_name = u"{0}".format(pv_name)
print("pv_name", pv_name, "in sector", sector)
pv_name = self.settings.data[sector][pv_id]
pv_name = pv_name.encode('utf-8')
print(type(pv_name))
pv_name = pv_name.decode('ascii')
qw = CAQLabel(self, pv_name=str(pv_name))
qw.sector = sector
#self.submastership_dict[sector] = None
qw.trigger_monitor_str.connect(receive_submaster_update)
print(i, sector)
value = self.cafe.getCache(
self.settings.data[sector][pv_id], dt='str')
qw.trigger_monitor_str.emit(value, 1, 0)
print("emitted", flush=True)
qw.setFixedWidth(120)
qw.setText("submastership")
qw_layout = QHBoxLayout()
qw_layout.addWidget(qw)
qgb_inner.setLayout(qw_layout)
#qgrid.addWidget(ql, 0, i, 1, 1, Qt.AlignBottom)
qgrid.addWidget(qgb_inner, 0, i, 1, 1,
Qt.AlignTop|Qt.AlignHCenter)
@@ -653,7 +630,7 @@ class AppGui(QWidget):
line.setFixedHeight(10)
row = qgrid.rowCount()
qgrid.addWidget(line, row, 1, 1, 6)
#qgrid.setRowMinimumHeight(_row, 60)
qtot = QLabel("Total:")
fnt = qtot.font()
@@ -808,13 +785,6 @@ class AppGui(QWidget):
'''Check if update buttons are enabled
if NOT, then do not allow inital values values to be updated"
'''
'''
if self.table_pwr_dict[sector].init_value_button.isEnabled() \
and table.init_value_button.isEnabled():
return True
else:
return False
'''
return bool(
self.table_pwr_dict[sector].init_value_button.isEnabled(
) and table.init_value_button.isEnabled())
@@ -893,7 +863,7 @@ class AppGui(QWidget):
attribute_list = self.settings.data[sector]["attribute"]
try:
standby_values = self.settings.data[sector]["standby"]
print("Standby Values", sector, standby_values, flush=True)
#print("Standby Values", sector, standby_values, flush=True)
except KeyError:
print("On Standby values not given for sector {0}".format(sector))
@@ -911,9 +881,6 @@ class AppGui(QWidget):
delay = 0.09
pass
#print(pv_dict['SOL:2'], flush=True)
#print(_standby_values, flush=True)
init_column = True
standby_column = True
@@ -1204,7 +1171,7 @@ class AppGui(QWidget):
else:
time.sleep(0.1)
print("SECTOR ILOOP", sector_prefix, iloop)
if not self.input_parameters["simulation"]:
stat = self.cafe.set(pv1, 1)
self.check_status(_pymodule, "set", pv1, stat, _line())
@@ -1317,12 +1284,7 @@ class AppGui(QWidget):
qnominal.setAlignment(Qt.AlignmentFlag(Qt.AlignBottom|Qt.AlignHCenter))
qset = QLabel("Set Value (kW)")
qset.setAlignment(Qt.AlignmentFlag(Qt.AlignBottom|Qt.AlignHCenter))
#f = qsection.font()
#f.setPixelSize(16)
#qsection.setFont(f)
#qnominal.setFont(f)
#qset.setFont(f)
qgrid.addWidget(qsection, 0, 0, 1, 1)
qgrid.addWidget(qnominal, 0, 1, 1, 1)
qgrid.addWidget(qset, 0, 2, 1, 1)