diff --git a/pyqt-apps/siriushla/as_rf_control/advanced_details/ac_panel.py b/pyqt-apps/siriushla/as_rf_control/advanced_details/ac_panel.py index 923f8baa5..36294a7ca 100644 --- a/pyqt-apps/siriushla/as_rf_control/advanced_details/ac_panel.py +++ b/pyqt-apps/siriushla/as_rf_control/advanced_details/ac_panel.py @@ -5,6 +5,7 @@ QSpacerItem from ...widgets import SiriusDialog, SiriusLabel +from ..custom_widgets import RFTitleFrame from ..util import DEFAULT_STYLESHEET, SEC_2_CHANNELS @@ -38,8 +39,12 @@ def _setupUi(self): lay.setAlignment(Qt.AlignTop) lay.setSpacing(9) - lay.addWidget(QLabel( - f'

{self.title}

', alignment=Qt.AlignCenter), 0, 0, 1, 7) + title_frame = RFTitleFrame(self, self.system) + lay_title = QGridLayout(title_frame) + lay_title.addWidget(QLabel( + f'

{self.title}

', alignment=Qt.AlignCenter), 0, 0) + + lay.addWidget(title_frame, 0, 0, 1, 7) lay.addItem(QSpacerItem(0, 18, QSzPlcy.Ignored, QSzPlcy.Fixed), 1, 0) # Phases diff --git a/pyqt-apps/siriushla/as_rf_control/advanced_details/adcs_dacs.py b/pyqt-apps/siriushla/as_rf_control/advanced_details/adcs_dacs.py index 1365e39a0..771859011 100644 --- a/pyqt-apps/siriushla/as_rf_control/advanced_details/adcs_dacs.py +++ b/pyqt-apps/siriushla/as_rf_control/advanced_details/adcs_dacs.py @@ -6,6 +6,7 @@ from ...widgets import PyDMStateButton, SiriusDialog, SiriusEnumComboBox, \ SiriusLabel, SiriusLedState, SiriusSpinbox +from ..custom_widgets import RFTitleFrame from ..util import DEFAULT_STYLESHEET, SEC_2_CHANNELS @@ -35,8 +36,12 @@ def _setupUi(self): lay = QGridLayout(self) lay.setAlignment(Qt.AlignTop) lay.setSpacing(9) - lay.addWidget(QLabel( - f'

{self.title}

', alignment=Qt.AlignCenter), 0, 0, 1, 9) + + title_frame = RFTitleFrame(self, self.system) + lay_title = QGridLayout(title_frame) + lay_title.addWidget(QLabel( + f'

{self.title}

', alignment=Qt.AlignCenter), 0, 0) + lay.addWidget(title_frame, 0, 0, 1, 9) for k, sub_dict in self.syst_dict.items(): row = 1 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 449f47ed9..3bcc844a5 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,5 +1,6 @@ """Advanced details related to interlocks.""" +from pydm.widgets import PyDMLabel from qtpy.QtCore import Qt from qtpy.QtWidgets import QGridLayout, QGroupBox, QHBoxLayout, QLabel, \ QScrollArea, QSizePolicy as QSzPlcy, QSpacerItem, QTabWidget, \ @@ -8,6 +9,7 @@ from ...widgets import PyDMStateButton, SiriusDialog, SiriusLabel, \ SiriusLedAlert, SiriusLedState, SiriusLineEdit, SiriusPushButton, \ SiriusSpinbox +from ..custom_widgets import RFTitleFrame from ..util import DEFAULT_STYLESHEET, SEC_2_CHANNELS @@ -36,6 +38,12 @@ def _setupUi(self): self.setStyleSheet(DEFAULT_STYLESHEET) lay = QVBoxLayout(self) lay.setAlignment(Qt.AlignTop) + + title_frame = RFTitleFrame(self, self.system) + lay_title = QVBoxLayout(title_frame) + lay_title.addWidget(QLabel( + f'

{self.title}

', alignment=Qt.AlignCenter)) + dtls = QTabWidget(self) dtls.setObjectName(self.section+'Tab') dtls.setStyleSheet( @@ -49,17 +57,17 @@ 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') + if self.section == 'SI': + 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') - lay.addWidget(QLabel( - f'

{self.title}

', alignment=Qt.AlignCenter)) + lay.addWidget(title_frame) lay.addWidget(dtls) def _diagnosticsLayout(self, chs_dict): @@ -67,10 +75,6 @@ def _diagnosticsLayout(self, chs_dict): lay.setAlignment(Qt.AlignTop) lay.setSpacing(9) - # General - gbox_gen = QGroupBox('General Controls') - gbox_gen.setLayout(self._genDiagLayout(chs_dict['General'])) - # Levels gbox_lvls = QGroupBox('Levels') lay_lvls = QGridLayout() @@ -147,11 +151,39 @@ def _diagnosticsLayout(self, chs_dict): self, self.prefix+chs_dict['GPIO']['Out']), 0, 0, 1, 2, alignment=Qt.AlignCenter) + # General Controls + gbox_gen = QGroupBox('General Controls') + gbox_gen.setLayout(self._genDiagLayout(chs_dict['General'])) + + # Quench Cond. 1 + gbox_quench = QGroupBox('Quench Cond. 1', self) + lay_quench = QGridLayout(gbox_quench) + lay_quench.setAlignment(Qt.AlignTop) + lay_quench.setSpacing(9) + + rv_ch = self.prefix+chs_dict['Quench1']['Rv'] + dly_ch = self.prefix+chs_dict['Quench1']['Dly'] + lb_dly = SiriusLabel(self, dly_ch+'-RB') + lb_dly.showUnits = True + + lay_quench.addWidget(QLabel( + 'Rv Ratio'), 0, 0, alignment=Qt.AlignRight | Qt.AlignVCenter) + lay_quench.addWidget(SiriusSpinbox( + self, rv_ch+'-SP'), 0, 1, alignment=Qt.AlignCenter) + lay_quench.addWidget(SiriusLabel( + self, self.prefix+rv_ch+'-RB'), 0, 2, alignment=Qt.AlignCenter) + lay_quench.addWidget(QLabel( + 'Delay'), 1, 0, alignment=Qt.AlignRight | Qt.AlignVCenter) + lay_quench.addWidget(SiriusSpinbox( + self, dly_ch+'-SP'), 1, 1, alignment=Qt.AlignCenter) + lay_quench.addWidget(lb_dly, 1, 2, alignment=Qt.AlignCenter) + lay.addWidget(gbox_lvls, 0, 0) lay.addWidget(gbox_inp, 0, 1) lay.addWidget(gbox_intlk, 0, 2) lay.addWidget(gbox_out, 0, 3) lay.addWidget(gbox_gen, 1, 0, 1, 2) + lay.addWidget(gbox_quench, 1, 2, 1, 2) return lay @@ -205,11 +237,10 @@ def _dynamicInterlockLayout(self, chs_dict): lay.setSpacing(9) # Current - lb_curr = SiriusLabel(self, self.prefix+chs_dict['Curr']) + lb_curr = PyDMLabel(self, self.prefix+chs_dict['Curr']) lb_curr.showUnits = True - lb_delta = SiriusLabel(self, self.prefix+chs_dict['Curr Delta']+'-RB') + lb_delta = PyDMLabel(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) @@ -237,29 +268,29 @@ def _dynamicInterlockLayout(self, chs_dict): '

Offset

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

{chs["Label"]}

', alignment=Qt.AlignRight | Qt.AlignVCenter), row, 0) - lay.addWidget(lb_value, row, 1) + lay.addWidget(lb_value, row, 1, alignment=Qt.AlignCenter) lay.addLayout(lay_enable, row, 2) lay.addWidget(SiriusLineEdit( self, self.prefix+chs['Coeff']+'-SP'), @@ -272,6 +303,12 @@ def _dynamicInterlockLayout(self, chs_dict): row += 1 + lay.addItem(QSpacerItem(0, 20, QSzPlcy.Ignored, QSzPlcy.Fixed), row, 0) + lay.addWidget(QLabel( + "Out = Coeff * Current + Offset", + alignment=Qt.AlignCenter), row+1, 0, 1, 2) + row += 2 + return lay def _bypassLayout(self, chs_dict): diff --git a/pyqt-apps/siriushla/as_rf_control/advanced_details/auto_start.py b/pyqt-apps/siriushla/as_rf_control/advanced_details/auto_start.py index 8149c407d..4e7595d69 100644 --- a/pyqt-apps/siriushla/as_rf_control/advanced_details/auto_start.py +++ b/pyqt-apps/siriushla/as_rf_control/advanced_details/auto_start.py @@ -5,6 +5,7 @@ from ...widgets import PyDMStateButton, SiriusDialog, SiriusEnumComboBox, \ SiriusLabel, SiriusLedAlert, SiriusLedState +from ..custom_widgets import RFTitleFrame from ..util import DEFAULT_STYLESHEET, SEC_2_CHANNELS @@ -35,6 +36,12 @@ def _setupUi(self): lay.setAlignment(Qt.AlignTop) lay.setSpacing(9) + # Title + title_frame = RFTitleFrame(self, self.system) + lay_title = QVBoxLayout(title_frame) + lay_title.addWidget(QLabel( + f'

{self.title}

', alignment=Qt.AlignCenter)) + # General gbox_gen = QGroupBox('General') gen_lay = QGridLayout() @@ -75,8 +82,7 @@ def _setupUi(self): self._setupLabelLed(diag_lay, key, val, row, key == '401') row += 1 - lay.addWidget(QLabel( - f'

{self.title}

', alignment=Qt.AlignCenter)) + lay.addWidget(title_frame) lay.addWidget(gbox_gen) lay.addWidget(gbox_diag) diff --git a/pyqt-apps/siriushla/as_rf_control/advanced_details/cal_eq.py b/pyqt-apps/siriushla/as_rf_control/advanced_details/cal_eq.py index 86da0ccb5..95b3ac471 100644 --- a/pyqt-apps/siriushla/as_rf_control/advanced_details/cal_eq.py +++ b/pyqt-apps/siriushla/as_rf_control/advanced_details/cal_eq.py @@ -6,6 +6,7 @@ QSizePolicy as QSzPlcy, QSpacerItem from ...widgets import SiriusDialog, SiriusLabel +from ..custom_widgets import RFTitleFrame from ..util import DEFAULT_STYLESHEET, SEC_2_CHANNELS @@ -36,8 +37,11 @@ def _setupUi(self): lay.setAlignment(Qt.AlignTop) lay.setSpacing(9) - lay.addWidget(QLabel( - f'

{self.title}

', alignment=Qt.AlignCenter), 0, 0, 1, 3) + title_frame = RFTitleFrame(self, self.system) + lay_title = QGridLayout(title_frame) + lay_title.addWidget(QLabel( + f'

{self.title}

', alignment=Qt.AlignCenter), 0, 0) + lay.addWidget(title_frame, 0, 0, 1, 3) row = 1 column = 0 diff --git a/pyqt-apps/siriushla/as_rf_control/advanced_details/cal_sys.py b/pyqt-apps/siriushla/as_rf_control/advanced_details/cal_sys.py index a2081a4fe..7fc3f3891 100644 --- a/pyqt-apps/siriushla/as_rf_control/advanced_details/cal_sys.py +++ b/pyqt-apps/siriushla/as_rf_control/advanced_details/cal_sys.py @@ -8,6 +8,7 @@ from ...widgets import SiriusDialog, SiriusLabel, SiriusLineEdit, \ SiriusTimePlot +from ..custom_widgets import RFTitleFrame from ..util import DEFAULT_STYLESHEET, SEC_2_CHANNELS @@ -36,6 +37,12 @@ def _setupUi(self): self.setStyleSheet(DEFAULT_STYLESHEET) lay = QVBoxLayout(self) lay.setAlignment(Qt.AlignTop) + + title_frame = RFTitleFrame(self, self.system) + lay_title = QVBoxLayout(title_frame) + lay_title.addWidget(QLabel( + f'

{self.title}

', alignment=Qt.AlignCenter)) + dtls = QTabWidget(self) dtls.setObjectName(self.section+'Tab') dtls.setStyleSheet( @@ -58,8 +65,7 @@ def _setupUi(self): wid_iq.setLayout(self._graphLayout()) dtls.addTab(wid_iq, 'Graph') - lay.addWidget(QLabel( - f'

{self.title}

', alignment=Qt.AlignCenter)) + lay.addWidget(title_frame) lay.addWidget(dtls) def _signalsLayout(self): diff --git a/pyqt-apps/siriushla/as_rf_control/advanced_details/hardware.py b/pyqt-apps/siriushla/as_rf_control/advanced_details/hardware.py index 8a5111511..d00e89c3e 100644 --- a/pyqt-apps/siriushla/as_rf_control/advanced_details/hardware.py +++ b/pyqt-apps/siriushla/as_rf_control/advanced_details/hardware.py @@ -1,11 +1,13 @@ """Advanced details related to the hardware.""" from pydm.widgets import PyDMEnumComboBox +from pydm.widgets.display_format import DisplayFormat from qtpy.QtCore import Qt from qtpy.QtWidgets import QGridLayout, QGroupBox, QLabel, QVBoxLayout from ...widgets import SiriusDialog, SiriusLabel, SiriusLedAlert, \ SiriusLedState, SiriusPushButton, SiriusScaleIndicator +from ..custom_widgets import RFTitleFrame from ..util import DEFAULT_STYLESHEET, SEC_2_CHANNELS @@ -37,8 +39,11 @@ def _setupUi(self): lay.setHorizontalSpacing(18) lay.setVerticalSpacing(9) - lay.addWidget(QLabel( - f'

{self.title}

', alignment=Qt.AlignCenter), 0, 0, 1, 5) + title_frame = RFTitleFrame(self, self.system) + lay_title = QVBoxLayout(title_frame) + lay_title.addWidget(QLabel( + f'

{self.title}

', alignment=Qt.AlignCenter)) + lay.addWidget(title_frame, 0, 0, 1, 5) # FPGA Temps gbox_fpga = QGroupBox('FPGA Temps', self) @@ -153,6 +158,9 @@ def _setupLabelsLayout(self, gbox, isFPGA, chs_dict): for key, val in chs_dict.items(): lb_value = SiriusLabel(self, self.prefix+val) lb_value.showUnits = True + if key == 'Firmware': + lb_value.displayFormat = DisplayFormat.Hex + lay.addWidget(QLabel(key, alignment=Qt.AlignRight), row, 0) lay.addWidget(lb_value, row, 1) row += 1 diff --git a/pyqt-apps/siriushla/as_rf_control/advanced_details/limits.py b/pyqt-apps/siriushla/as_rf_control/advanced_details/limits.py index 3f70ef9eb..30315bb87 100644 --- a/pyqt-apps/siriushla/as_rf_control/advanced_details/limits.py +++ b/pyqt-apps/siriushla/as_rf_control/advanced_details/limits.py @@ -4,6 +4,7 @@ from qtpy.QtWidgets import QGridLayout, QLabel from ...widgets import SiriusDialog, SiriusLabel, SiriusLineEdit, SiriusSpinbox +from ..custom_widgets import RFTitleFrame from ..util import DEFAULT_STYLESHEET, SEC_2_CHANNELS @@ -38,8 +39,12 @@ def _setupUi(self): lay = QGridLayout(self) lay.setAlignment(Qt.AlignTop) lay.setSpacing(9) - lay.addWidget(QLabel( - f'

{self.title}

', alignment=Qt.AlignCenter), 0, 0, 1, 4) + + title_frame = RFTitleFrame(self, self.system) + lay_title = QGridLayout(title_frame) + lay_title.addWidget(QLabel( + f'

{self.title}

', alignment=Qt.AlignCenter), 0, 0) + lay.addWidget(title_frame, 0, 0, 1, 4) row = 1 for key, val in self.syst_dict.items(): 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 72d2814a1..3da8738d5 100644 --- a/pyqt-apps/siriushla/as_rf_control/advanced_details/loops.py +++ b/pyqt-apps/siriushla/as_rf_control/advanced_details/loops.py @@ -9,6 +9,7 @@ from ...util import connect_window from ...widgets import PyDMStateButton, SiriusDialog, SiriusEnumComboBox, \ SiriusLabel, SiriusLedState, SiriusPushButton, SiriusSpinbox +from ..custom_widgets import RFTitleFrame from ..util import DEFAULT_STYLESHEET, SEC_2_CHANNELS from .limits import LimitsDetails @@ -38,6 +39,12 @@ def _setupUi(self): self.setStyleSheet(DEFAULT_STYLESHEET) lay = QVBoxLayout(self) lay.setAlignment(Qt.AlignTop) + + title_frame = RFTitleFrame(self, self.system) + lay_title = QVBoxLayout(title_frame) + lay_title.addWidget(QLabel( + f'

{self.title}

', alignment=Qt.AlignCenter)) + dtls = QTabWidget(self) dtls.setObjectName(self.section+'Tab') dtls.setStyleSheet( @@ -58,8 +65,7 @@ def _setupUi(self): wid_polar.setLayout(self._specificLoopsLayout('Polar')) dtls.addTab(wid_polar, 'Polar Loops') - lay.addWidget(QLabel( - f'

{self.title}

', alignment=Qt.AlignCenter)) + lay.addWidget(title_frame) lay.addWidget(dtls) def _loopsControlLayout(self): diff --git a/pyqt-apps/siriushla/as_rf_control/advanced_details/ramps.py b/pyqt-apps/siriushla/as_rf_control/advanced_details/ramps.py index dff9d8d31..bac821289 100644 --- a/pyqt-apps/siriushla/as_rf_control/advanced_details/ramps.py +++ b/pyqt-apps/siriushla/as_rf_control/advanced_details/ramps.py @@ -9,6 +9,7 @@ from ...util import connect_window from ...widgets import PyDMStateButton, SiriusDialog, SiriusLabel, \ SiriusLedState, SiriusSpinbox, SiriusTimePlot +from ..custom_widgets import RFTitleFrame from ..util import DEFAULT_STYLESHEET, SEC_2_CHANNELS from .limits import LimitsDetails @@ -46,6 +47,11 @@ def _setupUi(self): " border-bottom: 2px solid gray;" " border-right: 2px solid gray;}") + title_frame = RFTitleFrame(self, self.system) + lay_title = QVBoxLayout(title_frame) + lay_title.addWidget(QLabel( + f'

{self.title}

', alignment=Qt.AlignCenter)) + wid_controls = QWidget(self) wid_controls.setLayout( self._rampsControlLayout(self.syst_dict['Control'])) @@ -56,8 +62,7 @@ def _setupUi(self): self._diagnosticsRampLayout(self.syst_dict['Diagnostics'])) dtls.addTab(wid_top, 'Ramp Diagnostics') - lay.addWidget(QLabel( - f'

{self.title}

', alignment=Qt.AlignCenter)) + lay.addWidget(title_frame) lay.addWidget(dtls) def _rampsControlLayout(self, chs_dict): diff --git a/pyqt-apps/siriushla/as_rf_control/advanced_details/rf_inputs.py b/pyqt-apps/siriushla/as_rf_control/advanced_details/rf_inputs.py index 0e87429d6..a726a2c40 100644 --- a/pyqt-apps/siriushla/as_rf_control/advanced_details/rf_inputs.py +++ b/pyqt-apps/siriushla/as_rf_control/advanced_details/rf_inputs.py @@ -5,6 +5,7 @@ QSpacerItem from ...widgets import SiriusDialog, SiriusLabel +from ..custom_widgets import RFTitleFrame from ..util import DEFAULT_STYLESHEET, SEC_2_CHANNELS @@ -36,8 +37,12 @@ def _setupUi(self): lay.setVerticalSpacing(9) lay.setHorizontalSpacing(18) - lay.addWidget(QLabel( - f'

{self.title}

', alignment=Qt.AlignCenter), 0, 0, 1, 9) + title_frame = RFTitleFrame(self, self.system) + lay_title = QGridLayout(title_frame) + lay_title.addWidget(QLabel( + f'

{self.title}

', alignment=Qt.AlignCenter), 0, 0) + lay.addWidget(title_frame, 0, 0, 1, 9) + lay.addWidget(QLabel('In-Phase', alignment=Qt.AlignCenter), 1, 2) lay.addWidget(QLabel('Quadrature', alignment=Qt.AlignCenter), 1, 3) lay.addWidget(QLabel('Amp', alignment=Qt.AlignCenter), 1, 4) 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 51609a14f..d142dc37a 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 @@ -6,6 +6,7 @@ QVBoxLayout, QWidget from ...widgets import SiriusDialog, SiriusLabel, SiriusLedState, SiriusSpinbox +from ..custom_widgets import RFTitleFrame from ..util import DEFAULT_STYLESHEET, SEC_2_CHANNELS @@ -39,6 +40,11 @@ def _setupUi(self): lay = QVBoxLayout(self) lay.setAlignment(Qt.AlignTop) + title_frame = RFTitleFrame(self, self.system) + lay_title = QHBoxLayout(title_frame) + lay_title.addWidget(QLabel( + f'

{self.title}

', alignment=Qt.AlignCenter)) + dtls = QTabWidget(self) dtls.setObjectName(self.section+'Tab') dtls.setStyleSheet( @@ -55,8 +61,7 @@ def _setupUi(self): wid_graphs.setLayout(self._setupAlarmLay()) dtls.addTab(wid_graphs, 'Alarm Limits') - lay.addWidget(QLabel( - f'

{self.title}

', alignment=Qt.AlignCenter)) + lay.addWidget(title_frame) lay.addWidget(dtls) def _setupDiagLay(self): diff --git a/pyqt-apps/siriushla/as_rf_control/advanced_details/tuning.py b/pyqt-apps/siriushla/as_rf_control/advanced_details/tuning.py index 7e2912b0b..53386f04a 100644 --- a/pyqt-apps/siriushla/as_rf_control/advanced_details/tuning.py +++ b/pyqt-apps/siriushla/as_rf_control/advanced_details/tuning.py @@ -8,6 +8,7 @@ from ...widgets import PyDMStateButton, SiriusDialog, SiriusEnumComboBox, \ SiriusLabel, SiriusLedAlert, SiriusLedState, SiriusPushButton, \ SiriusSpinbox +from ..custom_widgets import RFTitleFrame from ..util import DEFAULT_STYLESHEET, SEC_2_CHANNELS @@ -37,8 +38,12 @@ def _setupUi(self): lay = QGridLayout(self) lay.setAlignment(Qt.AlignTop) lay.setSpacing(9) - lay.addWidget(QLabel( - f'

{self.title}

', alignment=Qt.AlignCenter), 0, 0, 1, 3) + + title_frame = RFTitleFrame(self, self.system) + lay_title = QGridLayout(title_frame) + lay_title.addWidget(QLabel( + f'

{self.title}

', alignment=Qt.AlignCenter), 0, 0) + lay.addWidget(title_frame, 0, 0, 1, 3) gbox_gen = QGroupBox('General') gbox_gen.setLayout(self._generalLayout(self.syst_dict['General'])) diff --git a/pyqt-apps/siriushla/as_rf_control/control.py b/pyqt-apps/siriushla/as_rf_control/control.py index fd30c998b..f577c2c38 100644 --- a/pyqt-apps/siriushla/as_rf_control/control.py +++ b/pyqt-apps/siriushla/as_rf_control/control.py @@ -7,8 +7,8 @@ from pyqtgraph import InfiniteLine, mkPen from qtpy.QtCore import Qt from qtpy.QtGui import QColor -from qtpy.QtWidgets import QCheckBox, QComboBox, QGridLayout, QGroupBox, \ - QHBoxLayout, QLabel, QPushButton, QRadioButton, QScrollArea, \ +from qtpy.QtWidgets import QCheckBox, QComboBox, QFrame, QGridLayout, \ + QGroupBox, QHBoxLayout, QLabel, QPushButton, QRadioButton, QScrollArea, \ QSizePolicy as QSzPlcy, QSpacerItem, QTabWidget, QVBoxLayout, QWidget from ..util import connect_newprocess, get_appropriate_color @@ -420,10 +420,15 @@ def _startControlLayout(self): # # Slow Loop Control wid_sl = QWidget() lay_slc = QGridLayout(wid_sl) - lay_slc.setAlignment(Qt.AlignTop | Qt.AlignHCenter) + lay_slc.setAlignment(Qt.AlignTop) lay_slc.setVerticalSpacing(6) lay_slc.setHorizontalSpacing(20) + if self.section == 'BO': + lay_slc.setColumnStretch(0, 1) + lay_slc.setColumnStretch(1, 2) + lay_slc.setColumnStretch(2, 2) + lay_slc.addWidget(QLabel( '

Mode

', self, alignment=Qt.AlignCenter), 2, 0) lay_slc.addWidget(QLabel( @@ -446,7 +451,13 @@ def _startControlLayout(self): offset = 1 if self.section == 'SI': for key, chs_dict in self.chs['SL']['Over'].items(): - self._create_slc_lay(lay_slc, key, chs_dict, offset) + line = QFrame() + line.setFrameShape(QFrame.VLine) + line.setFrameShadow(QFrame.Plain) + line.setLineWidth(2) + line.setStyleSheet('color: gray') + lay_slc.addWidget(line, 0, offset, 17, 1) + self._create_slc_lay(lay_slc, key, chs_dict, offset+1) offset += 3 else: self._create_slc_lay(lay_slc, None, self.chs['SL']['Over'], 1) @@ -473,7 +484,7 @@ def _startControlLayout(self): lay_details.addWidget(self.pb_errdtls, alignment=Qt.AlignCenter) lay_details.addWidget(self.pb_paramdtls, alignment=Qt.AlignCenter) - lay_slc.addWidget(gbox_details, 17, 0, 2, offset) + lay_slc.addWidget(gbox_details, 17, 0, 1, offset) # # Tuning # # # Tuning settings @@ -691,13 +702,18 @@ def _startControlLayout(self): lay_diag = QGridLayout(wid_diag) lay_diag.setAlignment(Qt.AlignTop) lay_diag.setSpacing(9) + + add_labels = True if self.section == 'SI': column = 1 for k, chs in self.chs['Diagnostics'].items(): - self._create_diag_lay(lay_diag, k, chs, column) - column += 2 + self._create_diag_lay(lay_diag, k, chs, column, add_labels) + if add_labels: + add_labels = False + column += 1 else: - self._create_diag_lay(lay_diag, None, self.chs['Diagnostics'], 0) + self._create_diag_lay( + lay_diag, None, self.chs['Diagnostics'], 1, add_labels) # # FDL wid_fdl = QWidget() @@ -1718,11 +1734,19 @@ def _create_fdl_lay(self, lay_fdl, key, chs): lay_fdl.addLayout(lay_checks) lay_fdl.addWidget(self.amp_graph) - def _create_diag_lay(self, lay_diag, key, chs, column): + def _create_diag_lay(self, lay_diag, key, chs, column, add_labels): + if add_labels: + row = 2 + for _, val in chs.items(): + lay_diag.addWidget( + QLabel(val[0], alignment=Qt.AlignRight | Qt.AlignVCenter), + row, column-1) + row += 1 + if key is not None: lay_diag.addWidget(QLabel( f'

{key}

', alignment=Qt.AlignCenter), - 0, column, 1, 2) + 0, column) lay_diag.addItem(QSpacerItem( 0, 9, QSzPlcy.Ignored, QSzPlcy.Fixed), 1, column) else: @@ -1735,17 +1759,13 @@ def _create_diag_lay(self, lay_diag, key, chs, column): led = SiriusLedAlert(self, self.prefix+val[1]) else: led = SiriusLedState(self, self.prefix+val[1]) - lay_diag.addWidget(QLabel( - val[0], alignment=Qt.AlignRight), row, column) - lay_diag.addWidget(led, row, column+1, - alignment=Qt.AlignCenter) + lay_diag.addWidget(led, row, column, alignment=Qt.AlignCenter) row += 1 def _create_slc_lay(self, lay_slc, key, chs_dict, offset): if key: lay_slc.addWidget(QLabel( - f'

{key}

', self, alignment=Qt.AlignRight), - 1, offset) + f'

{key}

', alignment=Qt.AlignCenter), 1, offset, 1, 2) lb_slmode = SiriusLabel( self, self.prefix+chs_dict['Mode']+'-Sts') diff --git a/pyqt-apps/siriushla/as_rf_control/custom_widgets.py b/pyqt-apps/siriushla/as_rf_control/custom_widgets.py index ede36ee5e..3720995f5 100644 --- a/pyqt-apps/siriushla/as_rf_control/custom_widgets.py +++ b/pyqt-apps/siriushla/as_rf_control/custom_widgets.py @@ -1,8 +1,8 @@ - - -from qtpy.QtWidgets import QHBoxLayout, QWidget +from qtpy.QtWidgets import QFrame, QHBoxLayout, QWidget from siriushla.widgets import SiriusPushButton +from .util import SYSTEM_COLORS + class RFEnblDsblButton(QWidget): """Button to enbl/dsbl attribute controlled by 2 PVs.""" @@ -24,3 +24,12 @@ def __init__(self, parent=None, channels=dict()): lay.addWidget(self.pb_off) lay.addWidget(self.pb_on) lay.addStretch() + + +class RFTitleFrame(QFrame): + """QFrame with background color set depending on the specific system.""" + + def __init__(self, parent=None, system=''): + super().__init__(parent) + if system != '': + self.setStyleSheet(f'background-color: {SYSTEM_COLORS[system]};') diff --git a/pyqt-apps/siriushla/as_rf_control/details/fdl.py b/pyqt-apps/siriushla/as_rf_control/details/fdl.py index 0f2f0b746..593c540ae 100644 --- a/pyqt-apps/siriushla/as_rf_control/details/fdl.py +++ b/pyqt-apps/siriushla/as_rf_control/details/fdl.py @@ -8,6 +8,7 @@ from ...widgets import PyDMStateButton, SiriusDialog, SiriusLabel, \ SiriusLedAlert, SiriusLedState, SiriusLineEdit, SiriusPushButton, \ SiriusSpinbox, SiriusWaveformPlot +from ..custom_widgets import RFTitleFrame from ..util import DEFAULT_STYLESHEET, SEC_2_CHANNELS @@ -39,7 +40,9 @@ def _setupUi(self): lay = QVBoxLayout(self) lay.setAlignment(Qt.AlignTop) - lay.addWidget(QLabel( + title_frame = RFTitleFrame(self, self.system) + lay_title = QHBoxLayout(title_frame) + lay_title.addWidget(QLabel( f'

{self.title}

', alignment=Qt.AlignCenter)) controls = QGroupBox('Controls', self) @@ -48,6 +51,7 @@ def _setupUi(self): graphs = QGroupBox('Graphs', self) graphs.setLayout(self._graphsLayout()) + lay.addWidget(title_frame) lay.addWidget(controls) lay.addWidget(graphs) diff --git a/pyqt-apps/siriushla/as_rf_control/details/interlock.py b/pyqt-apps/siriushla/as_rf_control/details/interlock.py index 3aed47571..b690e2b0b 100644 --- a/pyqt-apps/siriushla/as_rf_control/details/interlock.py +++ b/pyqt-apps/siriushla/as_rf_control/details/interlock.py @@ -6,7 +6,7 @@ QScrollArea, QVBoxLayout, QWidget from ...util import connect_window -from ...widgets import SiriusDialog, SiriusLabel, SiriusLedAlert, SiriusSpinbox +from ...widgets import SiriusDialog, SiriusLabel, SiriusLedAlert from ..advanced_details import AdvancedInterlockDetails from ..util import DEFAULT_STYLESHEET, SEC_2_CHANNELS @@ -52,12 +52,12 @@ def _setupUi(self): if self.section == 'SI': offset = 1 for key, chs_dict in self.chs['LLRF Intlk Details'].items(): - self._setupDetails(lay_scr, key, chs_dict, offset) - offset += 4 + self._setupDetails(lay_scr, chs_dict, offset, key) + offset += 3 else: - self._setupDetails(lay_scr, None, self.chs['LLRF Intlk Details'], 1) + self._setupDetails(lay_scr, self.chs['LLRF Intlk Details'], 1) - def _setupDetails(self, lay, system, chs_dict, offset): + def _setupDetails(self, lay, chs_dict, offset, system=''): if system: lay.addWidget(QLabel( f'

LLRF {system}

', self, @@ -94,7 +94,7 @@ def _setupDetails(self, lay, system, chs_dict, offset): lbl.setStyleSheet('QLabel{min-width:12em;}') lay_intlk.addWidget(lbl, irow, icol) - lay.addWidget(gbox, offset+1, col, 3, 1) + lay.addWidget(gbox, offset+1, col, 2, 1) col += 1 # timestamps @@ -113,31 +113,6 @@ def _setupDetails(self, lay, system, chs_dict, offset): lay_time.addWidget(lbl, irow, 1) lay.addWidget(gbox_time, offset+1, col) - # quench - if self.section == 'SI': - gbox_quench = QGroupBox('Quench Cond. 1', self) - lay_quench = QGridLayout(gbox_quench) - lay_quench.setAlignment(Qt.AlignTop) - lay_quench.setSpacing(9) - - rv_ch = self.prefix+chs_dict['Quench1']['Rv'] - dly_ch = self.prefix+chs_dict['Quench1']['Dly'] - lb_dly = SiriusLabel(self, dly_ch+'-RB') - lb_dly.showUnits = True - - lay_quench.addWidget(QLabel( - 'Rv Ratio'), 0, 0, alignment=Qt.AlignRight | Qt.AlignVCenter) - lay_quench.addWidget(SiriusSpinbox( - self, rv_ch+'-SP'), 0, 1, alignment=Qt.AlignCenter) - lay_quench.addWidget(SiriusLabel( - self, self.prefix+rv_ch+'-RB'), 0, 2, alignment=Qt.AlignCenter) - lay_quench.addWidget(QLabel( - 'Delay'), 1, 0, alignment=Qt.AlignRight | Qt.AlignVCenter) - lay_quench.addWidget(SiriusSpinbox( - self, dly_ch+'-SP'), 1, 1, alignment=Qt.AlignCenter) - lay_quench.addWidget(lb_dly, 1, 2, alignment=Qt.AlignCenter) - lay.addWidget(gbox_quench, offset+2, col) - # advanced details pb_dtls = QPushButton( qta.icon('fa5s.external-link-alt'), ' Advanced Details', self) @@ -145,4 +120,4 @@ def _setupDetails(self, lay, system, chs_dict, offset): connect_window( pb_dtls, AdvancedInterlockDetails, parent=self, prefix=self.prefix, section=self.section, system=system) - lay.addWidget(pb_dtls, offset+3, col, alignment=Qt.AlignCenter) + lay.addWidget(pb_dtls, offset+2, col, alignment=Qt.AlignCenter) diff --git a/pyqt-apps/siriushla/as_rf_control/details/ssa.py b/pyqt-apps/siriushla/as_rf_control/details/ssa.py index c8a5da763..93f64b733 100644 --- a/pyqt-apps/siriushla/as_rf_control/details/ssa.py +++ b/pyqt-apps/siriushla/as_rf_control/details/ssa.py @@ -10,7 +10,8 @@ from ...util import connect_window from ...widgets import PyDMLed, PyDMLedMultiChannel, SiriusDialog, \ SiriusLabel, SiriusLedAlert, SiriusLedState, SiriusTimePlot -from ..advanced_details import SSACurrentsDetails, ACPanelDetails +from ..advanced_details import ACPanelDetails, SSACurrentsDetails +from ..custom_widgets import RFTitleFrame from ..util import DEFAULT_STYLESHEET, SEC_2_CHANNELS @@ -37,6 +38,11 @@ def _setupUi(self): lay = QVBoxLayout(self) lay.setAlignment(Qt.AlignTop) + title_frame = RFTitleFrame(self, self.system) + lay_title = QHBoxLayout(title_frame) + lay_title.addWidget(QLabel( + f'

SSA 0{self.num} Details

', alignment=Qt.AlignCenter)) + dtls = QTabWidget(self) dtls.setObjectName(self.section+'Tab') dtls.setStyleSheet( @@ -53,8 +59,7 @@ def _setupUi(self): wid_graphs.setLayout(self._setupGraphsLay()) dtls.addTab(wid_graphs, 'Graphs') - title = f'

SSA 0{self.num} Details

' - lay.addWidget(QLabel(title, alignment=Qt.AlignCenter)) + lay.addWidget(title_frame) lay.addWidget(dtls) def _setupDiagLay(self): @@ -418,6 +423,11 @@ def _setupUi(self): lay.setSpacing(9) lay.setAlignment(Qt.AlignTop) + title_frame = RFTitleFrame(self) + lay_title = QHBoxLayout(title_frame) + lay_title.addWidget(QLabel( + '

SSA Details

', alignment=Qt.AlignCenter)) + dtls = QTabWidget(self) dtls.setObjectName(self.section+'Tab') dtls.setStyleSheet( @@ -434,8 +444,7 @@ def _setupUi(self): wid_graphs.setLayout(self._setupGraphsLay()) dtls.addTab(wid_graphs, 'Graphs') - title = '

SSA Details

' - lay.addWidget(QLabel(title, alignment=Qt.AlignCenter)) + lay.addWidget(title_frame) lay.addWidget(dtls) def _setupDiagLay(self): diff --git a/pyqt-apps/siriushla/as_rf_control/util.py b/pyqt-apps/siriushla/as_rf_control/util.py index af8cdf812..1d92bb72a 100644 --- a/pyqt-apps/siriushla/as_rf_control/util.py +++ b/pyqt-apps/siriushla/as_rf_control/util.py @@ -20,6 +20,11 @@ max-height:1.5em; min-width:4em; }""" +SYSTEM_COLORS = { + 'A': 'royalBlue', + 'B': 'lightBlue' +} + SEC_2_CHANNELS = { 'BO': { 'Emergency': 'BO-05D:RF-Intlk:EStop-Mon', @@ -82,6 +87,7 @@ 'Circulator Out Fwd (RF In 14)', 'Circulator Out Rev (RF In 15)', 'LLRF Beam Trip', + 'Quench Condition 1' ), } }, @@ -1245,6 +1251,10 @@ 'Inp': 'RA-RaBO01:RF-LLRF:GPIOInp-Mon', 'Intlk': 'RA-RaBO01:RF-LLRF:GPIOIntlk-Mon', 'Out': 'RA-RaBO01:RF-LLRF:GPIOOut-Mon' + }, + 'Quench1': { + 'Rv': 'RA-RaBO01:RF-LLRF:QuenchCond1RvRatio', + 'Dly': 'RA-RaBO01:RF-LLRF:QuenchCond1Dly' } }, 'Bypass': { @@ -1262,6 +1272,7 @@ '817 1': ['End Switch Down 1', 'RA-RaBO01:RF-LLRF:FIMPLG1Down'], '816 2': ['End Switch Up 2', 'RA-RaBO01:RF-LLRF:FIMPLG2Up'], '817 2': ['End Switch Down 2', 'RA-RaBO01:RF-LLRF:FIMPLG2Down'], + '853': ['Quench Condition 1', 'RA-RaBO01:RF-LLRF:FIMQuenchCond1'], '835': ['ILK VCav', 'RA-RaBO01:RF-LLRF:FIMCav'], '836': ['ILK Fwd Cav', 'RA-RaBO01:RF-LLRF:FIMFwdCav'], '837': ['ILK Fw SSA 1', 'RA-RaBO01:RF-LLRF:FIMFwdSSA1'], @@ -1590,10 +1601,6 @@ '6': 'RA-RaSIA01:RF-LLRF:IntlkTs6-Mon', '7': 'RA-RaSIA01:RF-LLRF:IntlkTs7-Mon', }, - 'Quench1': { - 'Rv': 'RA-RaSIA01:RF-LLRF:QuenchCond1RvRatio', - 'Dly': 'RA-RaSIA01:RF-LLRF:QuenchCond1Dly' - } }, 'B': { 'Inputs': { @@ -1664,10 +1671,6 @@ '5': 'RA-RaSIB01:RF-LLRF:IntlkTs5-Mon', '6': 'RA-RaSIB01:RF-LLRF:IntlkTs6-Mon', '7': 'RA-RaSIB01:RF-LLRF:IntlkTs7-Mon', - }, - 'Quench1': { - 'Rv': 'RA-RaSIB01:RF-LLRF:QuenchCond1RvRatio', - 'Dly': 'RA-RaSIB01:RF-LLRF:QuenchCond1Dly' } } }, @@ -4151,6 +4154,10 @@ 'Inp': 'RA-RaSIA01:RF-LLRF:GPIOInp-Mon', 'Intlk': 'RA-RaSIA01:RF-LLRF:GPIOIntlk-Mon', 'Out': 'RA-RaSIA01:RF-LLRF:GPIOOut-Mon' + }, + 'Quench1': { + 'Rv': 'RA-RaSIA01:RF-LLRF:QuenchCond1RvRatio', + 'Dly': 'RA-RaSIA01:RF-LLRF:QuenchCond1Dly' } }, 'Dynamic': { @@ -4244,6 +4251,10 @@ 'Inp': 'RA-RaSIB01:RF-LLRF:GPIOInp-Mon', 'Intlk': 'RA-RaSIB01:RF-LLRF:GPIOIntlk-Mon', 'Out': 'RA-RaSIB01:RF-LLRF:GPIOOut-Mon' + }, + 'Quench1': { + 'Rv': 'RA-RaSIB01:RF-LLRF:QuenchCond1RvRatio', + 'Dly': 'RA-RaSIB01:RF-LLRF:QuenchCond1Dly' } }, 'Dynamic': {