gui enhanced

This commit is contained in:
2023-05-19 15:31:46 +02:00
parent 7b8f3a0a61
commit eed5694b04
4 changed files with 54 additions and 28 deletions

2
.gitignore vendored
View File

@@ -6,7 +6,7 @@ pyrcc5/*.*
src/*.*~
src/*.*-*
src/*.*+*
src/__pycache__/
src/__pycache__
src/__pycache__/*
help/*.*~
help/*.*-*

View File

@@ -67,14 +67,18 @@
"standby": [9.404, 25.006, -25.006, 0.05, 0.05, 0.05, 0.05, 25.006,
-25.006, 20.625, 10.0025, -10.0025, 0.05, 20.625, 25.006],
"ref" : [193.0, 205.0, -205.0, 4.0, 4.0, 4.0, 4.0, 205.0,
-205.0, 2703.0, 205.0, -205.0, 4.0, 2703.0, 205.0],
-205.0, 404.5, 205.0, -205.0, 4.0, 404.5, 205.0],
"pwrref" : [0.019, 0.053, 0.050, 0.000, 0.000, 0.000, 0.000, 0.055,
0.052, 0.117, 0.020, 0.020, 0.000, 0.113, 0.052]
},
"Parameters":{
"drawLine" : {"flag" : 0, "data":{ "widget": "QHLine", "text" : "None", "value" : "None"}}
"drawLine" : {"flag" : 0, "data":{ "widget": "QHLine", "text" : "None", "value" : "None"}},
"delayRamp" : {"flag" : 1, "data":{ "widget": "QDoubleSpinBox", "text" : "Ramp delay (s):",
"value" : 0.1, "min": 0.00, "max": 0.20, "step": 0.01,
"tooltip":"Wait time between sending set point to each magnet in 'Restore'/'Standby' "}},
"drawLine2" : {"flag" : 0, "data":{ "widget": "QHLine", "text" : "None", "value" : "None"}}
},
"Expert":{

View File

@@ -88,7 +88,7 @@ class StartMain(BaseWindow):
elog = ElogHIPA()
self.projekt_idx = elog.projekt.NONE
self.system_idx = elog.system.MAGNET_POWER_SUPPLIES
self.system_idx = elog.system.ELECTRICAL_SUPPLY
self.eintrag_idx = elog.eintrag.INFO
self.ort_idx = elog.ort.GLOBAL
self.status_idx = elog.status.NONE
@@ -108,7 +108,7 @@ class StartMain(BaseWindow):
pass
self.logbook = "Sandkasten" if _simulation else None
self.logbook = "Sandkasten" if _simulation else "HIPA"
self.title = _title
sector = ["<br>IP2: ","<br>IW2: ","<br>PK1: ", "<br>PK2: ","<br>SNQ: ",

View File

@@ -71,13 +71,17 @@ class AppGui(QWidget):
self.I_min = 1.0
self.cafe.openPrepare()
self.cafe.open(['HUSH:LASTPWR','HUSH:TOTPWR','HUSH:LASTSAVE','HUSH:TOTSAVE'])
self.cafe.openNowAndWait(0.1)
wgt = self.group_sector_qtabwidget()
self.gui_frame.measurement_layout.addWidget(
wgt, 0, 1, 6, 3, alignment=Qt.AlignTop)
status_wgt = self.group_sector_status()
self.gui_frame.measurement_layout.addWidget(
status_wgt, 2, 0, 2, 1, alignment=Qt.AlignTop) # | Qt.AlignHCenter)
@@ -86,7 +90,6 @@ class AppGui(QWidget):
self.gui_frame.measurement_layout.addWidget(
qf, 4, 0, 1, 1, alignment=Qt.AlignTop)
self.sectorI_dict = {}
self.sectorI_dict['IP2'] = 0
self.sectorI_dict['IW2'] = 0
@@ -95,7 +98,6 @@ class AppGui(QWidget):
self.sectorI_dict['SINQ'] = 0
self.sectorI_dict['UCN'] = 0
ucn_line = ["PK1", "PK2", "UCN"]
sinq_line = ["PK1", "PK2", "SINQ"]
pk1_line = ["IW2"]
@@ -150,7 +152,6 @@ class AppGui(QWidget):
self.gui_header.beam_current_wgt_dict[
"PK2"].trigger_monitor_float.connect(receive_pk2_update)
#self.cafe.monitor("MWC2:IST:2", cb)
#print(dir(self.gui_header.header_wgt.layout().widget()), flush=True)
@@ -187,7 +188,6 @@ class AppGui(QWidget):
qti.setFont(f)
qti.setAlignment(Qt.AlignCenter)
qtotsav = QLabel("Tot Saved \n(MWh)")
f = qtotsav.font()
f.setPixelSize(13)
@@ -220,9 +220,15 @@ class AppGui(QWidget):
f.setPixelSize(13)
qtot.setFont(f)
qgrid.addWidget(qtot, _row+1, 0, 1, 1)
qgrid.addWidget(
CAQLineEdit(self, pv_name="HUSH:LASTPWR", show_units=True),
_row+1, 1, 1, 1)
qgrid.addWidget(
CAQLineEdit(self, pv_name="HUSH:TOTPWR", show_units=True),
_row+1, 2, 1, 2)
_row+1, 2, 1, 1)
qgrid.addWidget(
CAQLineEdit(self, pv_name="HUSH:LASTSAVE", show_units=False),
_row+1, 3, 1, 1)
qgrid.addWidget(
CAQLineEdit(self, pv_name="HUSH:TOTSAVE", show_units=False),
_row+1, 5, 1, 1)
@@ -255,7 +261,6 @@ class AppGui(QWidget):
print(ex, self.settings.data[sector])
_color_str = "color : {0};".format(_color)
_incolor = "QLabel {" + _color_str + "}"
qsector.setStyleSheet(_incolor)
@@ -269,7 +274,7 @@ class AppGui(QWidget):
self.cafe.openPrepare()
self.cafe.open([pv_pwr_tot, pv_pwr_last, pv_pwr_saved, pv_pwr_timeout])
self.cafe.openNowAndWait(2.0)
time.sleep(0.5)
time.sleep(0.1)
#print("device", device, flush=True)
def cb_outtime(handle, pv, pvdata):
@@ -299,7 +304,7 @@ class AppGui(QWidget):
qptime = CAQLineEdit(self, pv_name=pv_pwr_timeout,
monitor_callback=cb_outtime, show_units=True)
self.offtime_dict[pv_pwr_timeout] = qptime
self.cafe.set((pv_pwr_timeout + ".PROC"), 1)
qptime.setFixedWidth(104)
@@ -360,18 +365,23 @@ class AppGui(QWidget):
for dev in device_list:
pv_dict[att].append(dev + ":" + att)
try:
CR1IN_idx = pv_dict['IST:2'].index("CR1IN:IST:2")
except ValueError:
CR1IN_idx = 3
table_pwr = [None] * 2
table_pwr[0] = CAQTableWidget(
self, pv_list=pv_dict['IST:2'][0:4], show_units=False, notify_freq_hz=0,
suffix = "kW",
self, pv_list=pv_dict['IST:2'][0:CR1IN_idx], show_units=False,
notify_freq_hz=0, suffix = "kW",
notify_unison=False, scale_factor=0.001, show_timestamp=False,
init_column=True, pv_list_show=device_list[0:4])
init_column=True, pv_list_show=device_list[0:CR1IN_idx])
table_pwr[1] = CAQTableWidget(
self, pv_list=pv_dict['IST:2'][4:], show_units=False, notify_freq_hz=0,
suffix = "kW",
self, pv_list=pv_dict['IST:2'][CR1IN_idx:], show_units=False,
notify_freq_hz=0, suffix = "kW",
notify_unison=False, scale_factor=0.001, show_timestamp=False,
init_column=True, pv_list_show=device_list[4:])
init_column=True, pv_list_show=device_list[CR1IN_idx:])
for tab in table_pwr:
header_item = QTableWidgetItem()
@@ -510,7 +520,17 @@ class AppGui(QWidget):
pv = 'SEC-' + target.sector + ":STATE"
stat = self.cafe.set(pv, 1)
self.check_status(pv, stat, _line())
_table_pwr = self.table_pwr_dict[sector]
row_pwr_dict = _table_pwr.get_init_values()
sum_pwr = sum(list(row_pwr_dict.values()))
pv_last_pwr = 'SEC-' + target.sector + ":LASTPWR"
stat = self.cafe.set(pv_last_pwr, sum_pwr)
self.check_status(pv_last_pwr, stat, _line())
def ca_table_sector_widget(self, sector: str="", color: str="MACHINE"):
device_list = self.settings.data[sector]["device"]
@@ -528,11 +548,17 @@ class AppGui(QWidget):
_table_height = 700
try:
_delay = self.input_parameters["delayRamp"]
except KeyError:
_delay = 0.09
pass
table_sol = CAQTableWidget(
self, pv_list=pv_dict['SOL:2'], show_units=True, notify_freq_hz=0,
notify_unison=False, scale_factor=1, show_timestamp=False,
init_column=True, pv_list_show=device_list, standby_column=True,
standby_values=_standby_values, set_delay = 0.09)
standby_values=_standby_values, set_delay = _delay)
table_sol.restore_value_button.setToolTip(
("Restore devices to their pre-standby values"))
@@ -547,13 +573,9 @@ class AppGui(QWidget):
table_sol.restore_value_button.clicked.disconnect()
table_sol.restore_value_button.clicked.connect(self.on_sector_restore)
self.table_sol_dict[sector] = table_sol
table_ist = CAQTableWidget(
self, pv_list=pv_dict['IST:2'], show_units=True, notify_freq_hz=2,
notify_unison=True, scale_factor=1, show_timestamp=False,