Skip to content

Commit

Permalink
Merge pull request #724 from lnls-sirius/llrf_visual_updates
Browse files Browse the repository at this point in the history
Add RFTitleFrame and Minor Visual Tweaks
  • Loading branch information
JAFeltran authored Nov 19, 2024
2 parents c89c3d1 + f9bed20 commit 50d6e76
Show file tree
Hide file tree
Showing 19 changed files with 239 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
QSpacerItem

from ...widgets import SiriusDialog, SiriusLabel
from ..custom_widgets import RFTitleFrame
from ..util import DEFAULT_STYLESHEET, SEC_2_CHANNELS


Expand Down Expand Up @@ -38,8 +39,12 @@ def _setupUi(self):
lay.setAlignment(Qt.AlignTop)
lay.setSpacing(9)

lay.addWidget(QLabel(
f'<h4>{self.title}</h4>', alignment=Qt.AlignCenter), 0, 0, 1, 7)
title_frame = RFTitleFrame(self, self.system)
lay_title = QGridLayout(title_frame)
lay_title.addWidget(QLabel(
f'<h4>{self.title}</h4>', 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -35,8 +36,12 @@ def _setupUi(self):
lay = QGridLayout(self)
lay.setAlignment(Qt.AlignTop)
lay.setSpacing(9)
lay.addWidget(QLabel(
f'<h4>{self.title}</h4>', alignment=Qt.AlignCenter), 0, 0, 1, 9)

title_frame = RFTitleFrame(self, self.system)
lay_title = QGridLayout(title_frame)
lay_title.addWidget(QLabel(
f'<h4>{self.title}</h4>', alignment=Qt.AlignCenter), 0, 0)
lay.addWidget(title_frame, 0, 0, 1, 9)

for k, sub_dict in self.syst_dict.items():
row = 1
Expand Down
77 changes: 57 additions & 20 deletions pyqt-apps/siriushla/as_rf_control/advanced_details/adv_interlock.py
Original file line number Diff line number Diff line change
@@ -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, \
Expand All @@ -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


Expand Down Expand Up @@ -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'<h4>{self.title}</h4>', alignment=Qt.AlignCenter))

dtls = QTabWidget(self)
dtls.setObjectName(self.section+'Tab')
dtls.setStyleSheet(
Expand All @@ -49,28 +57,24 @@ 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'<h4>{self.title}</h4>', alignment=Qt.AlignCenter))
lay.addWidget(title_frame)
lay.addWidget(dtls)

def _diagnosticsLayout(self, chs_dict):
lay = QGridLayout()
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()
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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(
'<h4>Readback</h4>', alignment=Qt.AlignCenter), 0, 1)
Expand Down Expand Up @@ -237,29 +268,29 @@ def _dynamicInterlockLayout(self, chs_dict):
'<h4>Offset</h4>', 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'<h4>{chs["Label"]}</h4>',
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'),
Expand All @@ -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):
Expand Down
10 changes: 8 additions & 2 deletions pyqt-apps/siriushla/as_rf_control/advanced_details/auto_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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'<h4>{self.title}</h4>', alignment=Qt.AlignCenter))

# General
gbox_gen = QGroupBox('General')
gen_lay = QGridLayout()
Expand Down Expand Up @@ -75,8 +82,7 @@ def _setupUi(self):
self._setupLabelLed(diag_lay, key, val, row, key == '401')
row += 1

lay.addWidget(QLabel(
f'<h4>{self.title}</h4>', alignment=Qt.AlignCenter))
lay.addWidget(title_frame)
lay.addWidget(gbox_gen)
lay.addWidget(gbox_diag)

Expand Down
8 changes: 6 additions & 2 deletions pyqt-apps/siriushla/as_rf_control/advanced_details/cal_eq.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -36,8 +37,11 @@ def _setupUi(self):
lay.setAlignment(Qt.AlignTop)
lay.setSpacing(9)

lay.addWidget(QLabel(
f'<h4>{self.title}</h4>', alignment=Qt.AlignCenter), 0, 0, 1, 3)
title_frame = RFTitleFrame(self, self.system)
lay_title = QGridLayout(title_frame)
lay_title.addWidget(QLabel(
f'<h4>{self.title}</h4>', alignment=Qt.AlignCenter), 0, 0)
lay.addWidget(title_frame, 0, 0, 1, 3)

row = 1
column = 0
Expand Down
10 changes: 8 additions & 2 deletions pyqt-apps/siriushla/as_rf_control/advanced_details/cal_sys.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from ...widgets import SiriusDialog, SiriusLabel, SiriusLineEdit, \
SiriusTimePlot
from ..custom_widgets import RFTitleFrame
from ..util import DEFAULT_STYLESHEET, SEC_2_CHANNELS


Expand Down Expand Up @@ -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'<h4>{self.title}</h4>', alignment=Qt.AlignCenter))

dtls = QTabWidget(self)
dtls.setObjectName(self.section+'Tab')
dtls.setStyleSheet(
Expand All @@ -58,8 +65,7 @@ def _setupUi(self):
wid_iq.setLayout(self._graphLayout())
dtls.addTab(wid_iq, 'Graph')

lay.addWidget(QLabel(
f'<h4>{self.title}</h4>', alignment=Qt.AlignCenter))
lay.addWidget(title_frame)
lay.addWidget(dtls)

def _signalsLayout(self):
Expand Down
12 changes: 10 additions & 2 deletions pyqt-apps/siriushla/as_rf_control/advanced_details/hardware.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down Expand Up @@ -37,8 +39,11 @@ def _setupUi(self):
lay.setHorizontalSpacing(18)
lay.setVerticalSpacing(9)

lay.addWidget(QLabel(
f'<h4>{self.title}</h4>', alignment=Qt.AlignCenter), 0, 0, 1, 5)
title_frame = RFTitleFrame(self, self.system)
lay_title = QVBoxLayout(title_frame)
lay_title.addWidget(QLabel(
f'<h4>{self.title}</h4>', alignment=Qt.AlignCenter))
lay.addWidget(title_frame, 0, 0, 1, 5)

# FPGA Temps
gbox_fpga = QGroupBox('FPGA Temps', self)
Expand Down Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions pyqt-apps/siriushla/as_rf_control/advanced_details/limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -38,8 +39,12 @@ def _setupUi(self):
lay = QGridLayout(self)
lay.setAlignment(Qt.AlignTop)
lay.setSpacing(9)
lay.addWidget(QLabel(
f'<h4>{self.title}</h4>', alignment=Qt.AlignCenter), 0, 0, 1, 4)

title_frame = RFTitleFrame(self, self.system)
lay_title = QGridLayout(title_frame)
lay_title.addWidget(QLabel(
f'<h4>{self.title}</h4>', alignment=Qt.AlignCenter), 0, 0)
lay.addWidget(title_frame, 0, 0, 1, 4)

row = 1
for key, val in self.syst_dict.items():
Expand Down
10 changes: 8 additions & 2 deletions pyqt-apps/siriushla/as_rf_control/advanced_details/loops.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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'<h4>{self.title}</h4>', alignment=Qt.AlignCenter))

dtls = QTabWidget(self)
dtls.setObjectName(self.section+'Tab')
dtls.setStyleSheet(
Expand All @@ -58,8 +65,7 @@ def _setupUi(self):
wid_polar.setLayout(self._specificLoopsLayout('Polar'))
dtls.addTab(wid_polar, 'Polar Loops')

lay.addWidget(QLabel(
f'<h4>{self.title}</h4>', alignment=Qt.AlignCenter))
lay.addWidget(title_frame)
lay.addWidget(dtls)

def _loopsControlLayout(self):
Expand Down
Loading

0 comments on commit 50d6e76

Please sign in to comment.