From 07a3424342c190ef61843b1eddccf800546a6566 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Augusto=20Rosa=20Feltran?= Date: Thu, 31 Oct 2024 08:47:41 -0300 Subject: [PATCH 01/13] Expanded horizontally Advanced Interlock's general diag --- .../advanced_details/adv_interlock.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pyqt-apps/siriushla/as_rf_control/advanced_details/adv_interlock.py b/pyqt-apps/siriushla/as_rf_control/advanced_details/adv_interlock.py index 9d4dee7ea..84bcdb0e6 100644 --- a/pyqt-apps/siriushla/as_rf_control/advanced_details/adv_interlock.py +++ b/pyqt-apps/siriushla/as_rf_control/advanced_details/adv_interlock.py @@ -146,7 +146,7 @@ def _diagnosticsLayout(self, chs_dict): lay.addWidget(gbox_inp, 0, 1) lay.addWidget(gbox_intlk, 0, 2) lay.addWidget(gbox_out, 0, 3) - lay.addWidget(frame_gen, 1, 0) + lay.addWidget(frame_gen, 1, 0, 1, 2) return lay @@ -172,16 +172,20 @@ def _genDiagLayout(self, chs_dict): # Manual Interlock, End Switches and Logic Inversions keys = ['Manual', 'EndSw', 'Beam Inv', 'Vacuum Inv', 'SSA Bypass', 'Bypass'] - row = 3 + row = 2 + column = 0 for key in keys: - lay.addWidget(QLabel(chs_dict[key][0]), row, 0) + lay.addWidget(QLabel(chs_dict[key][0]), row, column) lay.addWidget(PyDMStateButton( - self, self.prefix+chs_dict[key][1]+'-Sel'), row, 1) + self, self.prefix+chs_dict[key][1]+'-Sel'), row, column+1) lay.addWidget(SiriusLedState( self, self.prefix+chs_dict[key][1]+'-Sts'), - row, 2, alignment=Qt.AlignCenter) + row, column+2, alignment=Qt.AlignCenter) row += 1 - + if row == 4: + row = 0 + column += 3 + return lay def _setupByteMonitor(self, lay, labels, channel): From 68cdd13bb80e2593c1c57c80ab62a506c8a2079c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Augusto=20Rosa=20Feltran?= Date: Thu, 31 Oct 2024 09:15:08 -0300 Subject: [PATCH 02/13] Grouped Loop's group 1 and 2 into a tab widget --- .../as_rf_control/advanced_details/loops.py | 55 ++++++++++--------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/pyqt-apps/siriushla/as_rf_control/advanced_details/loops.py b/pyqt-apps/siriushla/as_rf_control/advanced_details/loops.py index 8c0c06334..ef8053c90 100644 --- a/pyqt-apps/siriushla/as_rf_control/advanced_details/loops.py +++ b/pyqt-apps/siriushla/as_rf_control/advanced_details/loops.py @@ -196,16 +196,16 @@ def _specificLoopsLayout(self, rect_or_polar): if rect_or_polar == 'Rect': extra_addr = '30' if self.section == 'SI' else '' - grp_1 = 'Slow' - grp_1_addrs = ['100', '110', '13', '1', '0'] - grp_2 = 'Fast' - grp_2_addrs = ['115', '111', '124', '119', '118'] + grp_dict = { + 'Slow': ['100', '110', '13', '1', '0'], + 'Fast': ['115', '111', '124', '119', '118'] + } else: extra_addr = '527' - grp_1 = 'Amp' - grp_1_addrs = ['116', '112', '121', '120'] - grp_2 = 'Phase' - grp_2_addrs = ['117', '113', '123', '122'] + grp_dict = { + 'Amp': ['116', '112', '121', '120'], + 'Phase': ['117', '113', '123', '122'] + } title_lay = QHBoxLayout() title_lay.addWidget(QLabel( @@ -216,29 +216,30 @@ def _specificLoopsLayout(self, rect_or_polar): rect_lay = self._statisticsLayout( self.syst_dict, True, rect_or_polar, extra_addr) - grp_1_lay = QVBoxLayout() - grp_1_lay.setAlignment(Qt.AlignTop) - grp_1_lay.addLayout( - self._controlLayout(chs_dict[grp_1]['Control'], grp_1_addrs)) - grp_1_lay.addItem(QSpacerItem(0, 20, QSzPlcy.Ignored, QSzPlcy.Fixed)) - grp_1_lay.addLayout(self._statisticsLayout(chs_dict[grp_1], False)) - gbox_grp_1 = QGroupBox(f'{grp_1} Loop', self) - gbox_grp_1.setLayout(grp_1_lay) - - grp_2_lay = QVBoxLayout() - grp_2_lay.setAlignment(Qt.AlignTop) - grp_2_lay.addLayout( - self._controlLayout(chs_dict[grp_2]['Control'], grp_2_addrs)) - grp_2_lay.addItem(QSpacerItem(0, 20, QSzPlcy.Ignored, QSzPlcy.Fixed)) - grp_2_lay.addLayout(self._statisticsLayout(chs_dict[grp_2], False)) - gbox_grp_2 = QGroupBox(f'{grp_2} Loop', self) - gbox_grp_2.setLayout(grp_2_lay) + grps = QTabWidget(self) + grps.setObjectName(self.section+'Tab') + grps.setStyleSheet( + "#"+self.section+'Tab'+"::pane {" + " border-left: 2px solid gray;" + " border-bottom: 2px solid gray;" + " border-right: 2px solid gray;}") + + for grp_name, addrs in grp_dict.items(): + grp_lay = QVBoxLayout() + grp_lay.setAlignment(Qt.AlignTop) + grp_lay.addLayout( + self._controlLayout(chs_dict[grp_name]['Control'], addrs)) + grp_lay.addItem(QSpacerItem(0, 20, QSzPlcy.Ignored, QSzPlcy.Fixed)) + grp_lay.addLayout( + self._statisticsLayout(chs_dict[grp_name], False)) + wid_grp = QWidget() + wid_grp.setLayout(grp_lay) + grps.addTab(wid_grp, f'{grp_name} Loop') lay.addLayout(title_lay) lay.addItem(QSpacerItem(0, 20, QSzPlcy.Ignored, QSzPlcy.Fixed)) lay.addLayout(rect_lay) - lay.addWidget(gbox_grp_1) - lay.addWidget(gbox_grp_2) + lay.addWidget(grps) return lay From 108bcfe0bcc61058b670bd8fad8a0368389938f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Augusto=20Rosa=20Feltran?= Date: Thu, 31 Oct 2024 09:40:03 -0300 Subject: [PATCH 03/13] Resizes Pre Amp and Totals in SSA Currents --- .../advanced_details/ssa_currents.py | 44 +++++++++---------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/pyqt-apps/siriushla/as_rf_control/advanced_details/ssa_currents.py b/pyqt-apps/siriushla/as_rf_control/advanced_details/ssa_currents.py index 6f9e7f2ac..52f29dc41 100644 --- a/pyqt-apps/siriushla/as_rf_control/advanced_details/ssa_currents.py +++ b/pyqt-apps/siriushla/as_rf_control/advanced_details/ssa_currents.py @@ -262,8 +262,8 @@ def _setupPreAmpLay(self, chs_dict): row = 0 column = 0 if self.section == 'SI': + # Heat Sinks for i in range(2, 9, 2): - # Heat Sinks label = QLabel( f'

Heat Sink {i}

', alignment=Qt.AlignCenter) label.setStyleSheet("min-width:6em;") @@ -279,27 +279,23 @@ def _setupPreAmpLay(self, chs_dict): lay.addWidget(lb_2, row+2, column) column += 1 - if column == 1: - if row == 0: - # Pre Amp - label = QLabel( - '

PreAmp

', alignment=Qt.AlignCenter) - label.setStyleSheet("min-width:6em;") - lb_1 = SiriusLabel(self, self._substitute_macros( - self.prefix+chs_dict['PreAmp'], curr_num='1')) - lb_1.showUnits = True - lb_2 = SiriusLabel(self, self._substitute_macros( - self.prefix+chs_dict['PreAmp'], curr_num='2')) - lb_2.showUnits = True - - lay.addWidget(label, row, column) - lay.addWidget(lb_1, row+1, column) - lay.addWidget(lb_2, row+2, column) - column += 1 - - if column > 2: + if column > 1: row += 3 column = 0 + + # Pre Amp + label = QLabel('

PreAmp

', alignment=Qt.AlignCenter) + lb_1 = SiriusLabel(self, self._substitute_macros( + self.prefix+chs_dict['PreAmp'], curr_num='1')) + lb_1.showUnits = True + lb_2 = SiriusLabel(self, self._substitute_macros( + self.prefix+chs_dict['PreAmp'], curr_num='2')) + lb_2.showUnits = True + + lay.addWidget(label, row, 0, 1, 2) + lay.addWidget(lb_1, row+1, 0, 1, 2) + lay.addWidget(lb_2, row+2, 0, 1, 2) + else: # Heat Sinks hs_nums = [1, 4, 3, 6] @@ -384,8 +380,8 @@ def _setupTotalLay(self): lay.addWidget(QLabel( f'

Rack {i}

', alignment=Qt.AlignCenter), row, column) lay.addWidget(lb_total, row+1, column) - column += 2 - if column > 2: + column += 1 + if column > 1: row += 2 column = 0 @@ -405,8 +401,8 @@ def _setupTotalLay(self): lb_total.rules = rule lay.addWidget(QLabel( - '

Total

', alignment=Qt.AlignCenter), row, 1) - lay.addWidget(lb_total, row+1, 1, alignment=Qt.AlignCenter) + '

Total

', alignment=Qt.AlignCenter), row, 0, 1, 2) + lay.addWidget(lb_total, row+1, 0, 1, 2, alignment=Qt.AlignCenter) return lay From 4c03be94aa86f39b4305682e2a456a3c83de6c40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Augusto=20Rosa=20Feltran?= Date: Thu, 31 Oct 2024 12:42:22 -0300 Subject: [PATCH 04/13] Added scroll area to advanced interlock's bypass tab --- .../advanced_details/adv_interlock.py | 47 ++++++++++++------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/pyqt-apps/siriushla/as_rf_control/advanced_details/adv_interlock.py b/pyqt-apps/siriushla/as_rf_control/advanced_details/adv_interlock.py index 84bcdb0e6..f436072d8 100644 --- a/pyqt-apps/siriushla/as_rf_control/advanced_details/adv_interlock.py +++ b/pyqt-apps/siriushla/as_rf_control/advanced_details/adv_interlock.py @@ -2,8 +2,8 @@ from qtpy.QtCore import Qt from qtpy.QtWidgets import QFrame, QGridLayout, QGroupBox, QHBoxLayout, \ - QLabel, QSizePolicy as QSzPlcy, QSpacerItem, QTabWidget, QVBoxLayout, \ - QWidget + QLabel, QScrollArea, QSizePolicy as QSzPlcy, QSpacerItem, QTabWidget, \ + QVBoxLayout, QWidget from ...widgets import PyDMStateButton, SiriusDialog, SiriusLabel, \ SiriusLedAlert, SiriusLedState, SiriusPushButton, SiriusSpinbox @@ -185,7 +185,7 @@ def _genDiagLayout(self, chs_dict): if row == 4: row = 0 column += 3 - + return lay def _setupByteMonitor(self, lay, labels, channel): @@ -198,41 +198,54 @@ def _bypassLayout(self, chs_dict): lay = QGridLayout() lay.setAlignment(Qt.AlignTop) lay.setSpacing(9) - - labels = ['Diagnostics', 'Ext LLRF', 'Tx PLC', 'FDL Trigger', + scarea = QScrollArea(self) + scarea.setSizeAdjustPolicy(scarea.AdjustToContents) + scarea.setWidgetResizable(True) + scr_ar_wid = QWidget() + scarea.setWidget(scr_ar_wid) + scr_ar_wid.setObjectName('scrollarea') + scr_ar_wid.setStyleSheet( + '#scrollarea {background-color: transparent;}') + lay.addWidget(scarea) + + lay_scr = QGridLayout(scr_ar_wid) + lay_scr.setSpacing(9) + + lbs_header = ['Diagnostics', 'Ext LLRF', 'Tx PLC', 'FDL Trigger', 'Pin Diode', 'Loops Standby'] column = 2 - for lb in labels: - lay.addWidget(QLabel( - lb, alignment=Qt.AlignCenter), 0, column) + for lb in lbs_header: + label = QLabel(lb, alignment=Qt.AlignCenter) + label.setStyleSheet('min-width: 8em') + lay_scr.addWidget(label, 0, column) column += 2 for i in range(1, column): if i % 2 == 0 or i == 1: - lay.setColumnStretch(i, 1) - lay.setColumnMinimumWidth(1, 120) + lay_scr.setColumnStretch(i, 1) + lay_scr.setColumnMinimumWidth(1, 120) row = 1 for key, val in chs_dict.items(): - lay.addWidget(QLabel(key.split()[0]), row, 0) - lay.addWidget(QLabel(val[0]), row, 1) + lay_scr.addWidget(QLabel(key.split()[0]), row, 0) + lay_scr.addWidget(QLabel(val[0]), row, 1) column = 2 - for bit in reversed(range(len(labels))): + for bit in reversed(range(len(lbs_header))): lay_state = QHBoxLayout() pb = PyDMStateButton(self, self.prefix+val[1]+'-Sel', bit=bit) lay_state.addWidget(pb, alignment=Qt.AlignRight) lay_state.addWidget(SiriusLedState( self, self.prefix+val[1]+'-Sts', bit), alignment=Qt.AlignLeft) - lay.addLayout(lay_state, row, column) - lay.addItem(QSpacerItem( + lay_scr.addLayout(lay_state, row, column) + lay_scr.addItem(QSpacerItem( 9, 0, QSzPlcy.Ignored, QSzPlcy.Fixed), row, column+1) column += 2 - lay.addWidget(SiriusPushButton( + lay_scr.addWidget(SiriusPushButton( self, self.prefix+val[1]+'-Sel', 'All Zero', releaseValue=0), row, column) - lay.addWidget(SiriusPushButton( + lay_scr.addWidget(SiriusPushButton( self, self.prefix+val[1]+'-Sel', 'All One', releaseValue=63), row, column+1) row += 1 From c45e343e502a3029efd5f315764bf94c6a97b9e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Augusto=20Rosa=20Feltran?= Date: Thu, 31 Oct 2024 12:45:47 -0300 Subject: [PATCH 05/13] Added general controls groupbox --- .../as_rf_control/advanced_details/adv_interlock.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pyqt-apps/siriushla/as_rf_control/advanced_details/adv_interlock.py b/pyqt-apps/siriushla/as_rf_control/advanced_details/adv_interlock.py index f436072d8..af193a93c 100644 --- a/pyqt-apps/siriushla/as_rf_control/advanced_details/adv_interlock.py +++ b/pyqt-apps/siriushla/as_rf_control/advanced_details/adv_interlock.py @@ -1,8 +1,8 @@ """Advanced details related to interlocks.""" from qtpy.QtCore import Qt -from qtpy.QtWidgets import QFrame, QGridLayout, QGroupBox, QHBoxLayout, \ - QLabel, QScrollArea, QSizePolicy as QSzPlcy, QSpacerItem, QTabWidget, \ +from qtpy.QtWidgets import QGridLayout, QGroupBox, QHBoxLayout, QLabel, \ + QScrollArea, QSizePolicy as QSzPlcy, QSpacerItem, QTabWidget, \ QVBoxLayout, QWidget from ...widgets import PyDMStateButton, SiriusDialog, SiriusLabel, \ @@ -62,9 +62,8 @@ def _diagnosticsLayout(self, chs_dict): lay.setSpacing(9) # General - frame_gen = QFrame(self) - frame_gen.setFrameShape(QFrame.NoFrame) - frame_gen.setLayout(self._genDiagLayout(chs_dict['General'])) + gbox_gen = QGroupBox('General Controls') + gbox_gen.setLayout(self._genDiagLayout(chs_dict['General'])) # Levels gbox_lvls = QGroupBox('Levels') @@ -146,7 +145,7 @@ def _diagnosticsLayout(self, chs_dict): lay.addWidget(gbox_inp, 0, 1) lay.addWidget(gbox_intlk, 0, 2) lay.addWidget(gbox_out, 0, 3) - lay.addWidget(frame_gen, 1, 0, 1, 2) + lay.addWidget(gbox_gen, 1, 0, 1, 2) return lay From 5daa11df467b6a377d288d9cc9c11bc0f56985cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Augusto=20Rosa=20Feltran?= Date: Thu, 31 Oct 2024 13:00:04 -0300 Subject: [PATCH 06/13] Added scroll area to interlock details --- .../as_rf_control/details/interlock.py | 36 +++++++++++++------ 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/pyqt-apps/siriushla/as_rf_control/details/interlock.py b/pyqt-apps/siriushla/as_rf_control/details/interlock.py index 40a487717..3aed47571 100644 --- a/pyqt-apps/siriushla/as_rf_control/details/interlock.py +++ b/pyqt-apps/siriushla/as_rf_control/details/interlock.py @@ -2,7 +2,8 @@ import qtawesome as qta from qtpy.QtCore import Qt -from qtpy.QtWidgets import QGridLayout, QGroupBox, QLabel, QPushButton +from qtpy.QtWidgets import QGridLayout, QGroupBox, QLabel, QPushButton, \ + QScrollArea, QVBoxLayout, QWidget from ...util import connect_window from ...widgets import SiriusDialog, SiriusLabel, SiriusLedAlert, SiriusSpinbox @@ -26,23 +27,35 @@ def __init__(self, parent, prefix='', section=''): def _setupUi(self): self.setStyleSheet(DEFAULT_STYLESHEET) - lay = QGridLayout(self) + lay = QVBoxLayout(self) lay.setAlignment(Qt.AlignTop) - lay.setHorizontalSpacing(25) - lay.setVerticalSpacing(15) self.title = QLabel( '

LLRF Interlock Details

', self, alignment=Qt.AlignCenter) - lay.addWidget(self.title, 0, 0, 1, 3) + lay.addWidget(self.title) + + scarea = QScrollArea(self) + scarea.setSizeAdjustPolicy(scarea.AdjustToContents) + scarea.setWidgetResizable(True) + scr_ar_wid = QWidget() + scarea.setWidget(scr_ar_wid) + scr_ar_wid.setObjectName('scrollarea') + scr_ar_wid.setStyleSheet( + '#scrollarea {background-color: transparent;}') + lay.addWidget(scarea) + + lay_scr = QGridLayout(scr_ar_wid) + lay_scr.setHorizontalSpacing(25) + lay_scr.setVerticalSpacing(9) if self.section == 'SI': offset = 1 for key, chs_dict in self.chs['LLRF Intlk Details'].items(): - self._setupDetails(lay, key, chs_dict, offset) + self._setupDetails(lay_scr, key, chs_dict, offset) offset += 4 else: - self._setupDetails(lay, None, self.chs['LLRF Intlk Details'], 1) + self._setupDetails(lay_scr, None, self.chs['LLRF Intlk Details'], 1) def _setupDetails(self, lay, system, chs_dict, offset): if system: @@ -56,14 +69,14 @@ def _setupDetails(self, lay, system, chs_dict, offset): gbox = QGroupBox(name, self) lay_intlk = QGridLayout(gbox) lay_intlk.setAlignment(Qt.AlignTop) - lay_intlk.setHorizontalSpacing(9) + lay_intlk.setHorizontalSpacing(0) lay_intlk.setVerticalSpacing(0) icol = 0 for key in dic['Status']: desc = QLabel(key, self, alignment=Qt.AlignCenter) - desc.setStyleSheet('QLabel{min-width:1em; max-width:2.5em;}') - lay_intlk.addWidget(desc, 0, icol) + desc.setStyleSheet('QLabel{min-width:2.5em; max-width:2.5em;}') + lay_intlk.addWidget(desc, 0, icol, alignment=Qt.AlignCenter) icol += 1 labels = dic['Labels'] @@ -74,7 +87,8 @@ def _setupDetails(self, lay, system, chs_dict, offset): led.shape = led.Square if key != 'Mon': led.offColor = led.DarkRed - lay_intlk.addWidget(led, irow, icol) + lay_intlk.addWidget(led, irow, icol, + alignment=Qt.AlignHCenter) icol += 1 lbl = QLabel(label, self) lbl.setStyleSheet('QLabel{min-width:12em;}') From dde948406c6e08f3fa852ea3f347c79a5f799151 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Augusto=20Rosa=20Feltran?= Date: Thu, 31 Oct 2024 13:28:01 -0300 Subject: [PATCH 07/13] Added scroll area to SSA Currents --- .../advanced_details/ssa_currents.py | 42 +++++++++++++------ .../siriushla/as_rf_control/details/ssa.py | 2 +- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/pyqt-apps/siriushla/as_rf_control/advanced_details/ssa_currents.py b/pyqt-apps/siriushla/as_rf_control/advanced_details/ssa_currents.py index 52f29dc41..51609a14f 100644 --- a/pyqt-apps/siriushla/as_rf_control/advanced_details/ssa_currents.py +++ b/pyqt-apps/siriushla/as_rf_control/advanced_details/ssa_currents.py @@ -2,7 +2,8 @@ from qtpy.QtCore import Qt from qtpy.QtWidgets import QGridLayout, QGroupBox, QHBoxLayout, QLabel, \ - QSizePolicy as QSzPlcy, QSpacerItem, QTabWidget, QVBoxLayout, QWidget + QScrollArea, QSizePolicy as QSzPlcy, QSpacerItem, QTabWidget, \ + QVBoxLayout, QWidget from ...widgets import SiriusDialog, SiriusLabel, SiriusLedState, SiriusSpinbox from ..util import DEFAULT_STYLESHEET, SEC_2_CHANNELS @@ -61,7 +62,19 @@ def _setupUi(self): def _setupDiagLay(self): lay = QGridLayout() lay.setAlignment(Qt.AlignTop) - lay.setSpacing(18) + + scarea = QScrollArea(self) + scarea.setSizeAdjustPolicy(scarea.AdjustToContents) + scarea.setWidgetResizable(True) + scr_ar_wid = QWidget() + scarea.setWidget(scr_ar_wid) + scr_ar_wid.setObjectName('scrollarea') + scr_ar_wid.setStyleSheet( + '#scrollarea {background-color: transparent;}') + lay.addWidget(scarea) + + lay_scr = QGridLayout(scr_ar_wid) + lay_scr.setSpacing(18) row = 0 column = 0 @@ -73,7 +86,7 @@ def _setupDiagLay(self): elif column == 4: row_label = 'right' - lay.addLayout(self._setupHeatSinkLay( + lay_scr.addLayout(self._setupHeatSinkLay( i, self.syst_dict['HeatSink'], row_label), row, column) column += 1 @@ -81,17 +94,17 @@ def _setupDiagLay(self): if row == 0: gbox_preamp = QGroupBox('Pre Amplifiers') gbox_preamp.setLayout(self._setupPreAmpLay(self.syst_dict['PreAmp'])) - lay.addWidget(gbox_preamp, row, column) + lay_scr.addWidget(gbox_preamp, row, column) column += 1 elif column == 5: - lay.addItem(QSpacerItem( + lay_scr.addItem(QSpacerItem( 0, 9, QSzPlcy.Ignored, QSzPlcy.Fixed), row+1, 0) column = 0 row += 2 gbox_total = QGroupBox('Total Current') gbox_total.setLayout(self._setupTotalLay()) - lay.addWidget(gbox_total, 2, 2) + lay_scr.addWidget(gbox_total, 2, 2) else: for i in range(1, 7): row_label = '' @@ -100,7 +113,7 @@ def _setupDiagLay(self): elif column == 6: row_label = 'right' - lay.addLayout(self._setupHeatSinkLay( + lay_scr.addLayout(self._setupHeatSinkLay( i, self.syst_dict['HeatSink'], row_label), row, column, 2, 1) @@ -109,10 +122,10 @@ def _setupDiagLay(self): # PreAmp gbox_preamp = QGroupBox('Pre Amplifiers') gbox_preamp.setLayout(self._setupPreAmpLay(self.syst_dict['PreAmp'])) - lay.addWidget(gbox_preamp, row, column) + lay_scr.addWidget(gbox_preamp, row, column) # Power - lay.addLayout(self._setupPowerLay( + lay_scr.addLayout(self._setupPowerLay( self.syst_dict['Pwr']), row+1, column) # Total Current @@ -123,7 +136,7 @@ def _setupDiagLay(self): lay_total.addWidget(QLabel( '

Total Current

', alignment=Qt.AlignCenter)) lay_total.addWidget(lb_total, alignment=Qt.AlignCenter) - lay.addLayout(lay_total, row+2, column) + lay_scr.addLayout(lay_total, row+2, column) column += 1 @@ -221,8 +234,10 @@ def _setupHeatSinkLay(self, hs_num, chs_dict, row_label=''): lb_curr_1 = SiriusLabel(self, pv_curr_1) lb_curr_1.showUnits = True + lb_curr_1.setStyleSheet('SiriusLabel{min-width:4.5em;}') lb_curr_2 = SiriusLabel(self, pv_curr_2) lb_curr_2.showUnits = True + lb_curr_2.setStyleSheet('SiriusLabel{min-width:4.5em;}') if row_label == 'left': lay.addWidget(QLabel( @@ -307,10 +322,12 @@ def _setupPreAmpLay(self, chs_dict): self.prefix+chs_dict['HS'], hs_num=hs_num, m_num=m_nums[i], curr_num='1')) lb_1.showUnits = True + lb_1.setStyleSheet('SiriusLabel{min-width:4.5em;}') lb_2 = SiriusLabel(self, self._substitute_macros( self.prefix+chs_dict['HS'], hs_num=hs_num, m_num=m_nums[i], curr_num='2')) lb_2.showUnits = True + lb_2.setStyleSheet('SiriusLabel{min-width:4.5em;}') lay.addWidget(QLabel( f'

Heat Sink {hs_num}

', @@ -420,8 +437,9 @@ def _setupAlarmLay(self): row = 0 for _, lst in self.syst_dict['Offsets'].items(): - lay_off.addWidget(QLabel( - f'

{lst[0]}

', alignment=Qt.AlignCenter), row, 0) + lb_off = QLabel(f'

{lst[0]}

', alignment=Qt.AlignCenter) + lb_off.setStyleSheet('QLabel{min-width:12em;}') + lay_off.addWidget(lb_off, row, 0) lay_off.addWidget(SiriusSpinbox( self, self._substitute_macros(self.prefix+lst[1])), row, 2) row += 1 diff --git a/pyqt-apps/siriushla/as_rf_control/details/ssa.py b/pyqt-apps/siriushla/as_rf_control/details/ssa.py index 646a3444d..c8a5da763 100644 --- a/pyqt-apps/siriushla/as_rf_control/details/ssa.py +++ b/pyqt-apps/siriushla/as_rf_control/details/ssa.py @@ -481,7 +481,7 @@ def _setupDiagLay(self): lay_temp.addWidget(QLabel( '

PreAmp 01

', alignment=Qt.AlignCenter), row, 0) - lay_temp.addWidget(lb_temp, row, 1) + lay_temp.addWidget(lb_temp, row, 1, alignment=Qt.AlignCenter) lay_temp.addWidget(QLabel('-', alignment=Qt.AlignCenter), row, 2) lay_temp.addWidget(SiriusLedState( self, self.prefix+self.syst_dict['PreAmp']['PT-100']), From d3d34b04a4c0bb64a5b6eb3f5ce1b904c9288ae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Augusto=20Rosa=20Feltran?= Date: Thu, 31 Oct 2024 13:41:50 -0300 Subject: [PATCH 08/13] Added scroll area to main window --- pyqt-apps/siriushla/as_rf_control/control.py | 46 +++++++++++++------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/pyqt-apps/siriushla/as_rf_control/control.py b/pyqt-apps/siriushla/as_rf_control/control.py index cf4022796..e2c82a113 100644 --- a/pyqt-apps/siriushla/as_rf_control/control.py +++ b/pyqt-apps/siriushla/as_rf_control/control.py @@ -8,8 +8,8 @@ from qtpy.QtCore import Qt from qtpy.QtGui import QColor from qtpy.QtWidgets import QCheckBox, QComboBox, QGridLayout, QGroupBox, \ - QHBoxLayout, QLabel, QPushButton, QRadioButton, QSizePolicy as QSzPlcy, \ - QSpacerItem, QTabWidget, QVBoxLayout, QWidget + QHBoxLayout, QLabel, QPushButton, QRadioButton, QScrollArea, \ + QSizePolicy as QSzPlcy, QSpacerItem, QTabWidget, QVBoxLayout, QWidget from ..util import connect_newprocess, get_appropriate_color from ..widgets import PyDMLed, PyDMLedMultiChannel, PyDMStateButton, \ @@ -49,9 +49,21 @@ def _setupUi(self): self.setStyleSheet(DEFAULT_STYLESHEET) cwid = QWidget(self) self.setCentralWidget(cwid) + lay = QVBoxLayout(cwid) label = QLabel('

'+self.section+' RF Controls - Overview

', self, alignment=Qt.AlignCenter) + scarea = QScrollArea(self) + scarea.setSizeAdjustPolicy(scarea.AdjustToContents) + scarea.setWidgetResizable(True) + scr_ar_wid = QWidget() + scarea.setWidget(scr_ar_wid) + scr_ar_wid.setObjectName('scrollarea') + scr_ar_wid.setStyleSheet( + '#scrollarea {background-color: transparent;}') + + lay.addWidget(label) + lay.addWidget(scarea) gbox_intlks = QGroupBox('Status', self) gbox_intlks.setLayout(self._statusLayout()) @@ -101,18 +113,17 @@ def _setupUi(self): gbox_graphs = QGroupBox('Graphs', self) gbox_graphs.setLayout(self._graphsLayout()) - lay = QGridLayout(cwid) - lay.addWidget(label, 0, 0, 1, 4) - lay.addWidget(gbox_intlks, 1, 0) - lay.addWidget(gbox_rfgen, 2, 0) - lay.addWidget(wid_startctrl, 1, 1, 2, 1) - lay.addWidget(wid_pwrmon, 1, 2, 2, 1) - lay.addWidget(gbox_graphs, 1, 3, 2, 1) - lay.setRowStretch(1, 1) - lay.setColumnStretch(0, 0) - lay.setColumnStretch(1, 5) - lay.setColumnStretch(2, 3) - lay.setColumnStretch(3, 4) + lay_scr = QGridLayout(scr_ar_wid) + lay_scr.addWidget(gbox_intlks, 0, 0) + lay_scr.addWidget(gbox_rfgen, 1, 0) + lay_scr.addWidget(wid_startctrl, 0, 1, 2, 1) + lay_scr.addWidget(wid_pwrmon, 0, 2, 2, 1) + lay_scr.addWidget(gbox_graphs, 0, 3, 2, 1) + lay_scr.setRowStretch(0, 1) + lay_scr.setColumnStretch(0, 0) + lay_scr.setColumnStretch(1, 5) + lay_scr.setColumnStretch(2, 3) + lay_scr.setColumnStretch(3, 4) def _statusLayout(self): lay = QGridLayout() @@ -127,7 +138,8 @@ def _statusLayout(self): # # Emergency if self.section == 'BO': - self.ld_emerg = QLabel('Emergency Stop', self, alignment=Qt.AlignRight) + self.ld_emerg = QLabel( + 'Emergency Stop', self, alignment=Qt.AlignRight) self.ld_emerg.setStyleSheet('min-width: 6.8em;') self.led_emerg = SiriusLedAlert( self, self.prefix+self.chs['Emergency']) @@ -144,6 +156,7 @@ def _statusLayout(self): for key, val in self.chs['Sirius Intlk'].items(): ld_llrf = QLabel( f'• {key}', alignment=Qt.AlignRight | Qt.AlignVCenter) + ld_llrf.setStyleSheet('min-width: 6em') led_siriusintlk = SiriusLedAlert(self, self.prefix+val) lay.addWidget(ld_llrf, row, 0) lay.addWidget(led_siriusintlk, row, 1, @@ -158,6 +171,7 @@ def _statusLayout(self): # # LLRF Interlock self.ld_intlk = QLabel('LLRF Interlock', self, alignment=Qt.AlignRight) + self.ld_intlk.setStyleSheet('min-width: 6em') self.pb_intlkdtls = QPushButton(qta.icon('fa5s.ellipsis-v'), '', self) self.pb_intlkdtls.setObjectName('dtls') self.pb_intlkdtls.setStyleSheet( @@ -188,6 +202,7 @@ def _statusLayout(self): if self.section == 'SI': self.ld_cryosts = QLabel( 'Cryo Module', self, alignment=Qt.AlignRight) + self.ld_cryosts.setStyleSheet('min-width: 6em') self.pb_cryodtls = QPushButton( qta.icon('fa5s.ellipsis-v'), '', self) self.pb_cryodtls.setObjectName('dtls') @@ -229,6 +244,7 @@ def _statusLayout(self): # # Transmission Line self.ld_tlsts = QLabel('Transm. Line', self, alignment=Qt.AlignRight) + self.ld_tlsts.setStyleSheet('min-width: 6em') self.pb_tldtls = QPushButton(qta.icon('fa5s.ellipsis-v'), '', self) self.pb_tldtls.setObjectName('dtls') self.pb_tldtls.setStyleSheet( From f25cb63ff221915590ae4013ca078874022f521d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Augusto=20Rosa=20Feltran?= Date: Thu, 31 Oct 2024 14:50:01 -0300 Subject: [PATCH 09/13] Removed Conditioning window and added it's informations to Loop's group box --- pyqt-apps/scripts/sirius-hla-bo-rf-control.py | 9 +- pyqt-apps/scripts/sirius-hla-si-rf-control.py | 9 +- .../advanced_details/__init__.py | 1 - .../advanced_details/conditioning.py | 99 ------------------- .../as_rf_control/advanced_details/loops.py | 99 ++++++++++++++++--- pyqt-apps/siriushla/as_rf_control/control.py | 2 - pyqt-apps/siriushla/as_rf_control/util.py | 54 +++++----- 7 files changed, 118 insertions(+), 155 deletions(-) delete mode 100644 pyqt-apps/siriushla/as_rf_control/advanced_details/conditioning.py diff --git a/pyqt-apps/scripts/sirius-hla-bo-rf-control.py b/pyqt-apps/scripts/sirius-hla-bo-rf-control.py index 2e671977c..43f931e55 100755 --- a/pyqt-apps/scripts/sirius-hla-bo-rf-control.py +++ b/pyqt-apps/scripts/sirius-hla-bo-rf-control.py @@ -5,17 +5,15 @@ import argparse as _argparse import sys -from siriuspy.envars import VACA_PREFIX - from siriushla.as_rf_control.advanced_details import ADCDACDetails, \ - AutoStartDetails, CalEqDetails, CalSysDetails, ConditioningDetails, \ - HardwareDetails, LoopsDetails, RampsDetails, RFInputsDetails, \ - TuningDetails + AutoStartDetails, CalEqDetails, CalSysDetails, HardwareDetails, \ + LoopsDetails, RampsDetails, RFInputsDetails, TuningDetails from siriushla.as_rf_control.control import RFMainControl from siriushla.as_rf_control.details import CavityStatusDetails, FDLDetails, \ LLRFInterlockDetails, SlowLoopErrorDetails, SlowLoopParametersDetails, \ SSADetailsBO, TempMonitor, TransmLineStatusDetails from siriushla.sirius_application import SiriusApplication +from siriuspy.envars import VACA_PREFIX parser = _argparse.ArgumentParser( description="Run RF Control Interface.") @@ -31,7 +29,6 @@ 'auto-start': AutoStartDetails, 'cal-eq': CalEqDetails, 'cal-sys': CalSysDetails, - 'conditioning': ConditioningDetails, 'hardware': HardwareDetails, 'loops': LoopsDetails, 'ramps': RampsDetails, diff --git a/pyqt-apps/scripts/sirius-hla-si-rf-control.py b/pyqt-apps/scripts/sirius-hla-si-rf-control.py index 840e9827e..4dfdcfbc1 100755 --- a/pyqt-apps/scripts/sirius-hla-si-rf-control.py +++ b/pyqt-apps/scripts/sirius-hla-si-rf-control.py @@ -5,17 +5,15 @@ import argparse as _argparse import sys -from siriuspy.envars import VACA_PREFIX - from siriushla.as_rf_control.advanced_details import ADCDACDetails, \ - AutoStartDetails, CalEqDetails, CalSysDetails, ConditioningDetails, \ - HardwareDetails, LoopsDetails, RampsDetails, RFInputsDetails, \ - TuningDetails + AutoStartDetails, CalEqDetails, CalSysDetails, HardwareDetails, \ + LoopsDetails, RampsDetails, RFInputsDetails, TuningDetails from siriushla.as_rf_control.control import RFMainControl from siriushla.as_rf_control.details import CavityStatusDetails, FDLDetails, \ LLRFInterlockDetails, SlowLoopErrorDetails, SlowLoopParametersDetails, \ SSADetailsSI, TempMonitor, TransmLineStatusDetails from siriushla.sirius_application import SiriusApplication +from siriuspy.envars import VACA_PREFIX parser = _argparse.ArgumentParser( description="Run RF Control Interface.") @@ -35,7 +33,6 @@ 'auto-start': AutoStartDetails, 'cal-eq': CalEqDetails, 'cal-sys': CalSysDetails, - 'conditioning': ConditioningDetails, 'hardware': HardwareDetails, 'loops': LoopsDetails, 'ramps': RampsDetails, diff --git a/pyqt-apps/siriushla/as_rf_control/advanced_details/__init__.py b/pyqt-apps/siriushla/as_rf_control/advanced_details/__init__.py index 9882deaeb..1a02a3985 100644 --- a/pyqt-apps/siriushla/as_rf_control/advanced_details/__init__.py +++ b/pyqt-apps/siriushla/as_rf_control/advanced_details/__init__.py @@ -4,7 +4,6 @@ from .auto_start import AutoStartDetails from .cal_eq import CalEqDetails from .cal_sys import CalSysDetails -from .conditioning import ConditioningDetails from .hardware import HardwareDetails from .loops import LoopsDetails from .ramps import RampsDetails diff --git a/pyqt-apps/siriushla/as_rf_control/advanced_details/conditioning.py b/pyqt-apps/siriushla/as_rf_control/advanced_details/conditioning.py deleted file mode 100644 index a4e535a63..000000000 --- a/pyqt-apps/siriushla/as_rf_control/advanced_details/conditioning.py +++ /dev/null @@ -1,99 +0,0 @@ -"""Conditioning advanced details.""" - -from qtpy.QtCore import Qt -from qtpy.QtWidgets import QGridLayout, QLabel - -from ...widgets import PyDMStateButton, SiriusDialog, SiriusLabel, \ - SiriusLedState, SiriusSpinbox -from ..util import DEFAULT_STYLESHEET, SEC_2_CHANNELS - - -class ConditioningDetails(SiriusDialog): - """Conditioning advanced details.""" - - def __init__(self, parent=None, prefix='', section='', system=''): - """Init.""" - super().__init__(parent) - self.prefix = prefix - self.prefix += ('-' if prefix and not prefix.endswith('-') else '') - self.section = section - self.system = system - self.chs = SEC_2_CHANNELS[self.section] - self.setObjectName(self.section+'App') - self.title = 'Conditioning Details' - self.title += (f' - {self.system}' if self.section == 'SI' else '') - self.setWindowTitle(self.title) - if self.section == 'SI': - self.syst_dict = self.chs['Conditioning'][self.system] - else: - self.syst_dict = self.chs['Conditioning'] - self._setupUi() - - def _setupUi(self): - self.setStyleSheet(DEFAULT_STYLESHEET) - lay = QGridLayout(self) - lay.setAlignment(Qt.AlignTop) - lay.setSpacing(9) - lay.addWidget(QLabel( - f'

{self.title}

', alignment=Qt.AlignCenter), 0, 0, 1, 4) - - # Pulse Enable - self._setupLedState(lay, '200', 1, True) - - # Auto Cond Enable - self._setupLedState(lay, '201', 2, True) - - # Duty Cycle - self._setupLabelEdit(lay, '202', 3) - - # Duty Cycle RB - lb_condfreq = SiriusLabel(self, self.prefix+self.syst_dict['530'][1]) - lb_condfreq.showUnits = True - lay.addWidget(QLabel('530'), 4, 0) - lay.addWidget(QLabel(self.syst_dict['530'][0]), 4, 1) - lay.addWidget(lb_condfreq, 4, 3, alignment=Qt.AlignCenter) - - row = 5 - if self.section == 'BO': - relay_keys = [ - 'CGC Fast Relay', 'Relay Setpoint RB', 'Relay Hysteria RB'] - for key in relay_keys: - lb_relay = SiriusLabel( - self, self.prefix+self.syst_dict['Relay'][key]+'-RB') - lb_relay.showUnits = True - - lay.addWidget(QLabel(key), row, 1) - if key.split()[-1] != 'RB': - lay.addWidget(SiriusSpinbox( - self, self.prefix+self.syst_dict['Relay'][key]+'-SP'), - row, 2) - lay.addWidget(lb_relay, row, 3) - row += 1 - - # Vacuum - self._setupLedState(lay, '79', row, False) - - def _setupLedState(self, lay, key, row, has_button): - lay.addWidget(QLabel(key), row, 0) - lay.addWidget(QLabel(self.syst_dict[key][0]), row, 1) - - ending = '' - if has_button: - lay.addWidget(PyDMStateButton( - self, self.prefix+self.syst_dict[key][1]+'-Sel'), - row, 2, alignment=Qt.AlignCenter) - ending = '-Sts' - - lay.addWidget(SiriusLedState( - self, self.prefix+self.syst_dict[key][1]+ending), - row, 3, alignment=Qt.AlignCenter) - - def _setupLabelEdit(self, lay, key, row): - label = SiriusLabel(self, self.prefix+self.syst_dict[key][1]+'-RB') - label.showUnits = True - - lay.addWidget(QLabel(key), row, 0) - lay.addWidget(QLabel(self.syst_dict[key][0]), row, 1) - lay.addWidget(SiriusSpinbox( - self, self.prefix+self.syst_dict[key][1]+'-SP'), row, 2) - lay.addWidget(label, row, 3, alignment=Qt.AlignCenter) diff --git a/pyqt-apps/siriushla/as_rf_control/advanced_details/loops.py b/pyqt-apps/siriushla/as_rf_control/advanced_details/loops.py index ef8053c90..72d2814a1 100644 --- a/pyqt-apps/siriushla/as_rf_control/advanced_details/loops.py +++ b/pyqt-apps/siriushla/as_rf_control/advanced_details/loops.py @@ -47,8 +47,7 @@ def _setupUi(self): " border-right: 2px solid gray;}") wid_controls = QWidget(self) - wid_controls.setLayout( - self._loopsControlLayout(self.syst_dict['Control'])) + wid_controls.setLayout(self._loopsControlLayout()) dtls.addTab(wid_controls, 'Loops Control') wid_iq = QWidget(self) @@ -63,11 +62,26 @@ def _setupUi(self): f'

{self.title}

', alignment=Qt.AlignCenter)) lay.addWidget(dtls) - def _loopsControlLayout(self, chs_dict): - lay = QGridLayout() + def _loopsControlLayout(self): + lay = QVBoxLayout() lay.setAlignment(Qt.AlignTop) lay.setSpacing(9) + gbox_gen = QGroupBox('General Controls') + gbox_gen.setLayout(self._setupGeneralControlsLayout(self.syst_dict['Control'])) + + gbox_cond = QGroupBox('Conditioning') + gbox_cond.setLayout(self._setupConditioningLayout(self.syst_dict['Conditioning'])) + + lay.addWidget(gbox_gen) + lay.addWidget(gbox_cond) + + return lay + + def _setupGeneralControlsLayout(self, chs_dict): + lay = QGridLayout() + lay.setSpacing(9) + # Amp Loop Ref self._setupLabelEdit(lay, chs_dict, '24 mV', 0, 0) self._setupLabelEdit(lay, chs_dict, '24 VGap', 1, 0) @@ -79,7 +93,7 @@ def _loopsControlLayout(self, chs_dict): lb_vinc = SiriusLabel(self, self.prefix+chs_dict['29'][1]+'-RB', alignment=Qt.AlignCenter) lb_vinc.showUnits = True - lay.addWidget(QLabel('29'), 3, 0) + lay.addWidget(QLabel('29', alignment=Qt.AlignCenter), 3, 0) lay.addWidget(QLabel(chs_dict['29'][0]), 3, 1) lay.addWidget(SiriusEnumComboBox( self, self.prefix+chs_dict['29'][1]+'-SP'), @@ -90,7 +104,7 @@ def _loopsControlLayout(self, chs_dict): lb_pinc = SiriusLabel(self, self.prefix+chs_dict['28'][1]+'-RB', alignment=Qt.AlignCenter) lb_pinc.showUnits = True - lay.addWidget(QLabel('28'), 4, 0) + lay.addWidget(QLabel('28', alignment=Qt.AlignCenter), 4, 0) lay.addWidget(QLabel(chs_dict['28'][0]), 4, 1) lay.addWidget(SiriusEnumComboBox( self, self.prefix+chs_dict['28'][1]+'-SP'), @@ -98,7 +112,7 @@ def _loopsControlLayout(self, chs_dict): lay.addWidget(lb_pinc, 4, 3) # Look Reference - lay.addWidget(QLabel('106'), 5, 0) + lay.addWidget(QLabel('106', alignment=Qt.AlignCenter), 5, 0) lay.addWidget(QLabel(chs_dict['106'][0]), 5, 1) lay.addWidget(SiriusPushButton( self, self.prefix+chs_dict['106'][1], @@ -109,7 +123,7 @@ def _loopsControlLayout(self, chs_dict): 5, 3, alignment=Qt.AlignCenter) # # Rect/Polar Mode Select - lay.addWidget(QLabel('114'), 6, 0) + lay.addWidget(QLabel('114', alignment=Qt.AlignCenter), 6, 0) lay.addWidget(QLabel(chs_dict['114'][0]), 6, 1) lay.addWidget(SiriusEnumComboBox( self, self.prefix+chs_dict['114'][1]+'-Sel'), @@ -118,7 +132,7 @@ def _loopsControlLayout(self, chs_dict): alignment=Qt.AlignCenter), 6, 3) # Quadrant Selection - lay.addWidget(QLabel('107'), 7, 0) + lay.addWidget(QLabel('107', alignment=Qt.AlignCenter), 7, 0) lay.addWidget(QLabel(chs_dict['107'][0]), 7, 1) lay.addWidget(SiriusEnumComboBox( self, self.prefix+chs_dict['107'][1]+'-Sel'), @@ -149,7 +163,7 @@ def _loopsControlLayout(self, chs_dict): self._setupLabelEdit(lay, chs_dict, '30', 3, 5) # Phase Correction Control - lay.addWidget(QLabel('31'), 4, 5) + lay.addWidget(QLabel('31', alignment=Qt.AlignCenter), 4, 5) lay.addWidget(QLabel(chs_dict['31'][0]), 4, 6) lay.addWidget(PyDMStateButton( self, self.prefix+chs_dict['31'][1]+'-Sel'), 4, 7) @@ -161,7 +175,7 @@ def _loopsControlLayout(self, chs_dict): lb_80 = SiriusLabel(self, self.prefix+chs_dict['80'][1], alignment=Qt.AlignCenter) lb_80.showUnits = True - lay.addWidget(QLabel('80'), 5, 5) + lay.addWidget(QLabel('80', alignment=Qt.AlignCenter), 5, 5) lay.addWidget(QLabel(chs_dict['80'][0]), 5, 6) lay.addWidget(lb_80, 5, 8) @@ -169,7 +183,7 @@ def _loopsControlLayout(self, chs_dict): lb_81 = SiriusLabel(self, self.prefix+chs_dict['81'][1], alignment=Qt.AlignCenter) lb_81.showUnits = True - lay.addWidget(QLabel('81'), 6, 5) + lay.addWidget(QLabel('81', alignment=Qt.AlignCenter), 6, 5) lay.addWidget(QLabel(chs_dict['81'][0]), 6, 6) lay.addWidget(lb_81, 6, 8) @@ -178,16 +192,75 @@ def _loopsControlLayout(self, chs_dict): return lay + def _setupConditioningLayout(self, chs_dict): + lay = QGridLayout(self) + lay.setAlignment(Qt.AlignTop) + lay.setSpacing(9) + + # Pulse Enable + self._setupLedState(lay, chs_dict, '200', 0, True) + + # Auto Cond Enable + self._setupLedState(lay, chs_dict, '201', 1, True) + + # Vacuum + self._setupLedState(lay, chs_dict, '79', 2, False) + + # Duty Cycle + self._setupLabelEdit(lay, chs_dict, '202', 0, 4) + + # Duty Cycle RB + lb_condfreq = SiriusLabel(self, self.prefix+chs_dict['530'][1]) + lb_condfreq.showUnits = True + lay.addWidget(QLabel('530', alignment=Qt.AlignCenter), 1, 4) + lay.addWidget(QLabel(chs_dict['530'][0]), 1, 5) + lay.addWidget(lb_condfreq, 1, 7, alignment=Qt.AlignCenter) + + row = 2 + if self.section == 'BO': + relay_keys = [ + 'CGC Fast Relay', 'Relay Setpoint RB', 'Relay Hysteria RB'] + for key in relay_keys: + lb_relay = SiriusLabel( + self, self.prefix+chs_dict['Relay'][key]+'-RB') + lb_relay.showUnits = True + + lay.addWidget(QLabel(key), row, 5) + if key.split()[-1] != 'RB': + lay.addWidget(SiriusSpinbox( + self, self.prefix+chs_dict['Relay'][key]+'-SP'), + row, 6) + lay.addWidget(lb_relay, row, 7) + row += 1 + + return lay + def _setupLabelEdit(self, lay, chs_dict, key, row, column): label = SiriusLabel(self, self.prefix+chs_dict[key][1]+'-RB') label.showUnits = True - lay.addWidget(QLabel(key.split()[0]), row, column) + lay.addWidget(QLabel( + key.split()[0], alignment=Qt.AlignCenter), row, column) lay.addWidget(QLabel(chs_dict[key][0]), row, column+1) lay.addWidget(SiriusSpinbox( self, self.prefix+chs_dict[key][1]+'-SP'), row, column+2) lay.addWidget(label, row, column+3, alignment=Qt.AlignCenter) + def _setupLedState(self, lay, chs_dict, key, row, has_button): + lay.addWidget(QLabel(key, alignment=Qt.AlignCenter), row, 0) + lay.addWidget(QLabel(chs_dict[key][0]), row, 1) + + ending = '' + if has_button: + lay.addWidget(PyDMStateButton( + self, self.prefix+chs_dict[key][1]+'-Sel'), + row, 2, alignment=Qt.AlignCenter) + ending = '-Sts' + + lay.addWidget(SiriusLedState( + self, self.prefix+chs_dict[key][1]+ending), + row, 3, alignment=Qt.AlignCenter) + def _specificLoopsLayout(self, rect_or_polar): lay = QVBoxLayout() lay.setAlignment(Qt.AlignTop) diff --git a/pyqt-apps/siriushla/as_rf_control/control.py b/pyqt-apps/siriushla/as_rf_control/control.py index e2c82a113..dc7335a85 100644 --- a/pyqt-apps/siriushla/as_rf_control/control.py +++ b/pyqt-apps/siriushla/as_rf_control/control.py @@ -921,8 +921,6 @@ def _advancedDetailsLayout(self): 'Cavity Ramps', 'ramps', systems[i], buttons) self._addDetailButton( 'Auto Start', 'auto-start', systems[i], buttons) - self._addDetailButton( - 'Conditioning', 'conditioning', systems[i], buttons) self._addDetailButton( 'Tuning', 'tuning', systems[i], buttons) self._addDetailButton( diff --git a/pyqt-apps/siriushla/as_rf_control/util.py b/pyqt-apps/siriushla/as_rf_control/util.py index e0b6d3450..d1d6def39 100644 --- a/pyqt-apps/siriushla/as_rf_control/util.py +++ b/pyqt-apps/siriushla/as_rf_control/util.py @@ -667,6 +667,18 @@ '0': ['Slow Loop Kp', 'RA-RaBO01:RF-LLRF:SLKP'], } }, + 'Conditioning': { + '200': ['Pulse Mode Enable', 'RA-RaBO01:RF-LLRF:CondEnbl'], + '201': ['Auto Conditioning Enable', 'RA-RaBO01:RF-LLRF:CondAuto'], + '202': ['Duty Cycle', 'RA-RaBO01:RF-LLRF:CondDuty'], + '530': ['Duty Cycle Ref', 'RA-RaBO01:RF-LLRF:CondDutyCycle-Mon'], + '79': ['Vacuum', 'RA-RaBO01:RF-LLRF:VacuumFastRly-Mon'], + 'Relay': { + 'CGC Fast Relay': 'BO-05D:VA-CCG-RFC:FastRelay', + 'Relay Setpoint RB': 'BO-RA02:VA-VGC-01:Relay1:Setpoint', + 'Relay Hysteria RB': 'BO-RA02:VA-VGC-01:Relay1:Hyst' + } + }, 'General': { '0': { 'Label': 'Cavity Voltage', @@ -1147,18 +1159,6 @@ '23': ['Command Start', 'RA-RaBO01:RF-LLRF:AutoStartupCmdStart'], '500': ['State Start', 'RA-RaBO01:RF-LLRF:AutoStartState-Mon'] }, - 'Conditioning': { - '200': ['Pulse Mode Enable', 'RA-RaBO01:RF-LLRF:CondEnbl'], - '201': ['Auto Conditioning Enable', 'RA-RaBO01:RF-LLRF:CondAuto'], - '202': ['Duty Cycle', 'RA-RaBO01:RF-LLRF:CondDuty'], - '530': ['Duty Cycle Ref', 'RA-RaBO01:RF-LLRF:CondDutyCycle-Mon'], - '79': ['Vacuum', 'RA-RaBO01:RF-LLRF:VacuumFastRly-Mon'], - 'Relay': { - 'CGC Fast Relay': 'BO-05D:VA-CCG-RFC:FastRelay', - 'Relay Setpoint RB': 'BO-RA02:VA-VGC-01:Relay1:Setpoint', - 'Relay Hysteria RB': 'BO-RA02:VA-VGC-01:Relay1:Hyst' - } - }, 'TunDtls': { 'General': { '34': ['Fwd Pwr Amplitude', 'RA-RaBO01:RF-LLRF:CavFwdAmp-Mon'], @@ -2960,6 +2960,13 @@ '0': ['Slow Loop Kp', 'RA-RaSIA01:RF-LLRF:SLKP'], } }, + 'Conditioning': { + '200': ['Pulse Mode Enable', 'RA-RaSIA01:RF-LLRF:CondEnbl'], + '201': ['Auto Conditioning Enable', 'RA-RaSIA01:RF-LLRF:CondAuto'], + '202': ['Duty Cycle', 'RA-RaSIA01:RF-LLRF:CondDuty'], + '530': ['Duty Cycle Ref', 'RA-RaSIA01:RF-LLRF:CondDutyCycle-Mon'], + '79': ['Vacuum', 'RA-RaSIA01:RF-LLRF:VacuumFastRly-Mon'], + }, 'General': { '0': { 'Label': 'Cavity Voltage', @@ -3262,6 +3269,13 @@ '0': ['Slow Loop Kp', 'RA-RaSIB01:RF-LLRF:SLKP'], } }, + 'Conditioning': { + '200': ['Pulse Mode Enable', 'RA-RaSIB01:RF-LLRF:CondEnbl'], + '201': ['Auto Conditioning Enable', 'RA-RaSIB01:RF-LLRF:CondAuto'], + '202': ['Duty Cycle', 'RA-RaSIB01:RF-LLRF:CondDuty'], + '530': ['Duty Cycle Ref', 'RA-RaSIB01:RF-LLRF:CondDutyCycle-Mon'], + '79': ['Vacuum', 'RA-RaSIB01:RF-LLRF:VacuumFastRly-Mon'], + }, 'General': { '0': { 'Label': 'Cavity Voltage', @@ -4008,22 +4022,6 @@ '500': ['State Start', 'RA-RaSIB01:RF-LLRF:AutoStartState-Mon'] } }, - 'Conditioning': { - 'A': { - '200': ['Pulse Mode Enable', 'RA-RaSIA01:RF-LLRF:CondEnbl'], - '201': ['Auto Conditioning Enable', 'RA-RaSIA01:RF-LLRF:CondAuto'], - '202': ['Duty Cycle', 'RA-RaSIA01:RF-LLRF:CondDuty'], - '530': ['Duty Cycle Ref', 'RA-RaSIA01:RF-LLRF:CondDutyCycle-Mon'], - '79': ['Vacuum', 'RA-RaSIA01:RF-LLRF:VacuumFastRly-Mon'], - }, - 'B': { - '200': ['Pulse Mode Enable', 'RA-RaSIB01:RF-LLRF:CondEnbl'], - '201': ['Auto Conditioning Enable', 'RA-RaSIB01:RF-LLRF:CondAuto'], - '202': ['Duty Cycle', 'RA-RaSIB01:RF-LLRF:CondDuty'], - '530': ['Duty Cycle Ref', 'RA-RaSIB01:RF-LLRF:CondDutyCycle-Mon'], - '79': ['Vacuum', 'RA-RaSIB01:RF-LLRF:VacuumFastRly-Mon'], - } - }, 'TunDtls': { 'A': { 'General': { From 232e650d25bad0921a787453db33657a06367625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Augusto=20Rosa=20Feltran?= Date: Fri, 1 Nov 2024 11:27:57 -0300 Subject: [PATCH 10/13] Added Dynamic Interlock tab to Advanced Interlock window --- .../advanced_details/adv_interlock.py | 80 +++++++++++++++++++ pyqt-apps/siriushla/as_rf_control/util.py | 50 ++++++++++++ 2 files changed, 130 insertions(+) diff --git a/pyqt-apps/siriushla/as_rf_control/advanced_details/adv_interlock.py b/pyqt-apps/siriushla/as_rf_control/advanced_details/adv_interlock.py index af193a93c..ae820191a 100644 --- a/pyqt-apps/siriushla/as_rf_control/advanced_details/adv_interlock.py +++ b/pyqt-apps/siriushla/as_rf_control/advanced_details/adv_interlock.py @@ -48,6 +48,11 @@ def _setupUi(self): self._diagnosticsLayout(self.syst_dict['Diagnostics'])) dtls.addTab(wid_diag, 'Diagnostics') + wid_dyn = QWidget(self) + wid_dyn.setLayout( + self._dynamicInterlockLayout(self.syst_dict['Dynamic'])) + dtls.addTab(wid_dyn, 'Dynamic Interlock') + wid_bypass = QWidget(self) wid_bypass.setLayout(self._bypassLayout(self.syst_dict['Bypass'])) dtls.addTab(wid_bypass, 'Interlock Bypass') @@ -193,6 +198,81 @@ def _setupByteMonitor(self, lay, labels, channel): lay.addWidget(SiriusLedState( self, channel, bit), bit+1, 1, alignment=Qt.AlignCenter) + def _dynamicInterlockLayout(self, chs_dict): + lay = QGridLayout() + lay.setAlignment(Qt.AlignTop) + lay.setSpacing(9) + + # Current + lb_curr = SiriusLabel(self, self.prefix+chs_dict['Curr']) + lb_curr.showUnits = True + lb_delta = SiriusLabel(self, self.prefix+chs_dict['Curr Delta']+'-RB') + lb_delta.showUnits = True + lb_delta.setStyleSheet('background-color: white') + + lay.addWidget(QLabel( + '

Readback

', alignment=Qt.AlignCenter), 0, 1) + lay.addWidget(QLabel( + '

Delta

', alignment=Qt.AlignCenter), 0, 2, 1, 2) + lay.addWidget(QLabel( + '

Current

', + alignment=Qt.AlignRight | Qt.AlignVCenter), 1, 0) + lay.addWidget(lb_curr, 1, 1, alignment=Qt.AlignCenter) + lay.addWidget(SiriusSpinbox( + self, self.prefix+chs_dict['Curr Delta']+'-SP'), + 1, 2, alignment=Qt.AlignCenter) + lay.addWidget(lb_delta, 1, 3, alignment=Qt.AlignCenter) + lay.addItem(QSpacerItem(0, 20, QSzPlcy.Ignored, QSzPlcy.Fixed), 2, 0) + + # Rev Cav, Fwd Cav and Quench Cond 1 Ratio + # # Header + lay.addWidget(QLabel( + '

Readback

', alignment=Qt.AlignCenter), 3, 1) + lay.addWidget(QLabel( + '

Enable

', alignment=Qt.AlignCenter), 3, 2) + lay.addWidget(QLabel( + '

Coeff

', alignment=Qt.AlignCenter), 3, 3, 1, 2) + lay.addWidget(QLabel( + '

Offset

', alignment=Qt.AlignCenter), 3, 5, 1, 2) + + # # Body + keys = ['Rev Cav', 'Fwd Cav', 'Quench'] + row = 4 + for key in keys: + chs = chs_dict[key] + + lb_value = SiriusLabel(self, self.prefix+chs['Value']) + lb_value.showUnits = True + lb_coeff = SiriusLabel(self, self.prefix+chs['Coeff']+'-RB') + lb_coeff.showUnits = True + lb_ofs = SiriusLabel(self, self.prefix+chs['Offset']+'-RB') + lb_ofs.showUnits = True + + lay_enable = QHBoxLayout() + lay_enable.addWidget(PyDMStateButton( + self, self.prefix+chs['Enable']+'-SP'), + alignment=Qt.AlignCenter) + lay_enable.addWidget(SiriusLedState( + self, self.prefix+chs['Enable']+'-RB'), + alignment=Qt.AlignCenter) + + lay.addWidget(QLabel(f'

{chs["Label"]}

', + alignment=Qt.AlignRight | Qt.AlignVCenter), row, 0) + lay.addWidget(lb_value, row, 1) + lay.addLayout(lay_enable, row, 2) + lay.addWidget(SiriusSpinbox( + self, self.prefix+chs['Coeff']+'-SP'), + row, 3, alignment=Qt.AlignCenter) + lay.addWidget(lb_coeff, row, 4, alignment=Qt.AlignCenter) + lay.addWidget(SiriusSpinbox( + self, self.prefix+chs['Offset']+'-SP'), + row, 5, alignment=Qt.AlignCenter) + lay.addWidget(lb_ofs, row, 6, alignment=Qt.AlignCenter) + + row += 1 + + return lay + def _bypassLayout(self, chs_dict): lay = QGridLayout() lay.setAlignment(Qt.AlignTop) diff --git a/pyqt-apps/siriushla/as_rf_control/util.py b/pyqt-apps/siriushla/as_rf_control/util.py index d1d6def39..5edef97e1 100644 --- a/pyqt-apps/siriushla/as_rf_control/util.py +++ b/pyqt-apps/siriushla/as_rf_control/util.py @@ -4153,6 +4153,31 @@ 'Out': 'RA-RaSIA01:RF-LLRF:GPIOOut-Mon' } }, + 'Dynamic': { + 'Curr': 'RA-RaSIA01:RF-LLRF:Current-Mon', + 'Curr Delta': 'RA-RaSIA01:RF-LLRF:CurrentDelta', + 'Rev Cav': { + 'Label': 'Rev Cav', + 'Value': 'RA-RaSIA01:RF-LLRF:LimRevCav-RB', + 'Enable': 'RA-RaSIA01:RF-LLRF:LimRevCavEn', + 'Coeff': 'RA-RaSIA01:RF-LLRF:LimRevCavCoeff', + 'Offset': 'RA-RaSIA01:RF-LLRF:LimRevCavOffset' + }, + 'Fwd Cav': { + 'Label': 'Fwd Cav', + 'Value': 'RA-RaSIA01:RF-LLRF:LimFwdCav-RB', + 'Enable': 'RA-RaSIA01:RF-LLRF:LimFwdCavEn', + 'Coeff': 'RA-RaSIA01:RF-LLRF:LimFwdCavCoeff', + 'Offset': 'RA-RaSIA01:RF-LLRF:LimFwdCavOffset' + }, + 'Quench': { + 'Label': 'Quench Cond 1 Ratio', + 'Value': 'RA-RaSIA01:RF-LLRF:QuenchCond1RvRatio-RB', + 'Enable': 'RA-RaSIA01:RF-LLRF:QuenchCond1RvRatioEn', + 'Coeff': 'RA-RaSIA01:RF-LLRF:QuenchCond1RvRatioCoeff', + 'Offset': 'RA-RaSIA01:RF-LLRF:QuenchCond1RvRatioOffset' + }, + }, 'Bypass': { '806': ['Rev SSA 1', 'RA-RaSIA01:RF-LLRF:FIMRevSSA1'], '807': ['Rev SSA 2', 'RA-RaSIA01:RF-LLRF:FIMRevSSA2'], @@ -4221,6 +4246,31 @@ 'Out': 'RA-RaSIB01:RF-LLRF:GPIOOut-Mon' } }, + 'Dynamic': { + 'Curr': 'RA-RaSIB01:RF-LLRF:Current-Mon', + 'Curr Delta': 'RA-RaSIB01:RF-LLRF:CurrentDelta', + 'Rev Cav': { + 'Label': 'Rev Cav', + 'Value': 'RA-RaSIB01:RF-LLRF:LimRevCav-RB', + 'Enable': 'RA-RaSIB01:RF-LLRF:LimRevCavEn', + 'Coeff': 'RA-RaSIB01:RF-LLRF:LimRevCavCoeff', + 'Offset': 'RA-RaSIB01:RF-LLRF:LimRevCavOffset' + }, + 'Fwd Cav': { + 'Label': 'Fwd Cav', + 'Value': 'RA-RaSIB01:RF-LLRF:LimFwdCav-RB', + 'Enable': 'RA-RaSIB01:RF-LLRF:LimFwdCavEn', + 'Coeff': 'RA-RaSIB01:RF-LLRF:LimFwdCavCoeff', + 'Offset': 'RA-RaSIB01:RF-LLRF:LimFwdCavOffset' + }, + 'Quench': { + 'Label': 'Quench Cond 1 Ratio', + 'Value': 'RA-RaSIB01:RF-LLRF:QuenchCond1RvRatio-RB', + 'Enable': 'RA-RaSIB01:RF-LLRF:QuenchCond1RvRatioEn', + 'Coeff': 'RA-RaSIB01:RF-LLRF:QuenchCond1RvRatioCoeff', + 'Offset': 'RA-RaSIB01:RF-LLRF:QuenchCond1RvRatioOffset' + }, + }, 'Bypass': { '806': ['Rev SSA 1', 'RA-RaSIB01:RF-LLRF:FIMRevSSA1'], '807': ['Rev SSA 2', 'RA-RaSIB01:RF-LLRF:FIMRevSSA2'], From fd8bb27ef4f8842c78373725f0cdf072245566e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Augusto=20Rosa=20Feltran?= Date: Fri, 1 Nov 2024 13:22:44 -0300 Subject: [PATCH 11/13] Fixed wrong PV on BO's Ramp Control --- pyqt-apps/siriushla/as_rf_control/control.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyqt-apps/siriushla/as_rf_control/control.py b/pyqt-apps/siriushla/as_rf_control/control.py index dc7335a85..fd30c998b 100644 --- a/pyqt-apps/siriushla/as_rf_control/control.py +++ b/pyqt-apps/siriushla/as_rf_control/control.py @@ -758,9 +758,9 @@ def _rampControlLayout(self): self.led_rmptrig.offColor = PyDMLed.Red self.cb_rmpincts = SiriusSpinbox( - self, self.prefix+'RA-RaBO01:RF-LLRF:RmpIncTime-SP') + self, self.prefix+'RA-RaBO01:RF-LLRF:RmpIncTimeTs-SP') self.lb_rmpincts = SiriusLabel( - self, self.prefix+'RA-RaBO01:RF-LLRF:RmpIncTime-RB') + self, self.prefix+'RA-RaBO01:RF-LLRF:RmpIncTimeTs-RB') self.lb_rmpincts.showUnits = True self.sb_rmpts1 = SiriusSpinbox( From ac6a4b217b6eae0950b7316a590b82801c0f7d52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Augusto=20Rosa=20Feltran?= Date: Fri, 1 Nov 2024 14:34:21 -0300 Subject: [PATCH 12/13] Changed Dynamic Interlock's spinboxes to line edits --- .../as_rf_control/advanced_details/adv_interlock.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pyqt-apps/siriushla/as_rf_control/advanced_details/adv_interlock.py b/pyqt-apps/siriushla/as_rf_control/advanced_details/adv_interlock.py index ae820191a..449f47ed9 100644 --- a/pyqt-apps/siriushla/as_rf_control/advanced_details/adv_interlock.py +++ b/pyqt-apps/siriushla/as_rf_control/advanced_details/adv_interlock.py @@ -6,7 +6,8 @@ QVBoxLayout, QWidget from ...widgets import PyDMStateButton, SiriusDialog, SiriusLabel, \ - SiriusLedAlert, SiriusLedState, SiriusPushButton, SiriusSpinbox + SiriusLedAlert, SiriusLedState, SiriusLineEdit, SiriusPushButton, \ + SiriusSpinbox from ..util import DEFAULT_STYLESHEET, SEC_2_CHANNELS @@ -218,7 +219,7 @@ def _dynamicInterlockLayout(self, chs_dict): '

Current

', alignment=Qt.AlignRight | Qt.AlignVCenter), 1, 0) lay.addWidget(lb_curr, 1, 1, alignment=Qt.AlignCenter) - lay.addWidget(SiriusSpinbox( + lay.addWidget(SiriusLineEdit( self, self.prefix+chs_dict['Curr Delta']+'-SP'), 1, 2, alignment=Qt.AlignCenter) lay.addWidget(lb_delta, 1, 3, alignment=Qt.AlignCenter) @@ -260,11 +261,11 @@ def _dynamicInterlockLayout(self, chs_dict): alignment=Qt.AlignRight | Qt.AlignVCenter), row, 0) lay.addWidget(lb_value, row, 1) lay.addLayout(lay_enable, row, 2) - lay.addWidget(SiriusSpinbox( + lay.addWidget(SiriusLineEdit( self, self.prefix+chs['Coeff']+'-SP'), row, 3, alignment=Qt.AlignCenter) lay.addWidget(lb_coeff, row, 4, alignment=Qt.AlignCenter) - lay.addWidget(SiriusSpinbox( + lay.addWidget(SiriusLineEdit( self, self.prefix+chs['Offset']+'-SP'), row, 5, alignment=Qt.AlignCenter) lay.addWidget(lb_ofs, row, 6, alignment=Qt.AlignCenter) From bdba33b9cd0bd6bbab0f5edc029870404d0731e7 Mon Sep 17 00:00:00 2001 From: Ana Clara Oliveira Date: Fri, 1 Nov 2024 18:40:24 -0300 Subject: [PATCH 13/13] Update version to 1.5.0 --- pyqt-apps/siriushla/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyqt-apps/siriushla/VERSION b/pyqt-apps/siriushla/VERSION index 88c5fb891..bc80560fa 100644 --- a/pyqt-apps/siriushla/VERSION +++ b/pyqt-apps/siriushla/VERSION @@ -1 +1 @@ -1.4.0 +1.5.0