forked from M-Labs/artiq
1
0
Fork 0

moninj: DDS change to vert layout

This commit is contained in:
Simon Renblad 2024-04-17 13:38:12 +08:00
parent 5ad4199668
commit d6c396fc69
1 changed files with 14 additions and 20 deletions

View File

@ -169,13 +169,12 @@ class _DDSWidget(QtWidgets.QFrame):
self.setFrameShadow(QtWidgets.QFrame.Raised)
grid = QtWidgets.QGridLayout()
grid.setContentsMargins(0, 0, 0, 0)
grid.setHorizontalSpacing(0)
grid.setVerticalSpacing(0)
grid.setContentsMargins(2, 2, 2, 2)
grid.setHorizontalSpacing(2)
self.setLayout(grid)
label = QtWidgets.QLabel(title)
label.setAlignment(QtCore.Qt.AlignCenter)
grid.addWidget(label, 1, 1)
grid.addWidget(label, 0, 0)
# FREQ DATA/EDIT FIELD
self.data_stack = QtWidgets.QStackedWidget()
@ -184,15 +183,14 @@ class _DDSWidget(QtWidgets.QFrame):
grid_disp = LayoutWidget()
grid_disp.layout.setContentsMargins(0, 0, 0, 0)
grid_disp.layout.setHorizontalSpacing(0)
grid_disp.layout.setVerticalSpacing(0)
self.value_label = QtWidgets.QLabel()
self.value_label.setAlignment(QtCore.Qt.AlignCenter)
grid_disp.addWidget(self.value_label, 0, 1, 1, 2)
self.value_label.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
grid_disp.addWidget(self.value_label, 0, 0, 1, 4)
unit = QtWidgets.QLabel("MHz")
unit.setAlignment(QtCore.Qt.AlignCenter)
grid_disp.addWidget(unit, 0, 3, 1, 1)
grid_disp.addWidget(unit, 0, 4, 1, 1)
self.data_stack.addWidget(grid_disp)
@ -204,13 +202,13 @@ class _DDSWidget(QtWidgets.QFrame):
self.value_edit = _CancellableLineEdit(self)
self.value_edit.setAlignment(QtCore.Qt.AlignRight)
grid_edit.addWidget(self.value_edit, 0, 1, 1, 2)
grid_edit.addWidget(self.value_edit, 0, 0, 1, 4)
unit = QtWidgets.QLabel("MHz")
unit.setAlignment(QtCore.Qt.AlignCenter)
grid_edit.addWidget(unit, 0, 3, 1, 1)
grid_edit.addWidget(unit, 0, 4, 1, 1)
self.data_stack.addWidget(grid_edit)
grid.addWidget(self.data_stack, 2, 1)
grid.addWidget(self.data_stack, 0, 2)
# BUTTONS
self.button_stack = QtWidgets.QStackedWidget()
@ -221,14 +219,14 @@ class _DDSWidget(QtWidgets.QFrame):
set_btn = QtWidgets.QToolButton()
set_btn.setText("Set")
set_btn.setToolTip("Set frequency")
set_grid.addWidget(set_btn, 0, 1, 1, 1)
set_grid.addWidget(set_btn, 0, 0, 1, 1)
# for urukuls also allow switching off RF
if is_urukul:
off_btn = QtWidgets.QToolButton()
off_btn.setText("Off")
off_btn.setToolTip("Switch off the output")
set_grid.addWidget(off_btn, 0, 2, 1, 1)
set_grid.addWidget(off_btn, 0, 1, 1, 1)
self.button_stack.addWidget(set_grid)
@ -237,17 +235,13 @@ class _DDSWidget(QtWidgets.QFrame):
apply = QtWidgets.QToolButton()
apply.setText("Apply")
apply.setToolTip("Apply changes")
apply_grid.addWidget(apply, 0, 1, 1, 1)
apply_grid.addWidget(apply, 0, 0, 1, 1)
cancel = QtWidgets.QToolButton()
cancel.setText("Cancel")
cancel.setToolTip("Cancel changes")
apply_grid.addWidget(cancel, 0, 2, 1, 1)
apply_grid.addWidget(cancel, 0, 1, 1, 1)
self.button_stack.addWidget(apply_grid)
grid.addWidget(self.button_stack, 3, 1)
grid.setRowStretch(1, 1)
grid.setRowStretch(2, 1)
grid.setRowStretch(3, 1)
grid.addWidget(self.button_stack, 0, 1)
set_btn.clicked.connect(self.set_clicked)
apply.clicked.connect(self.apply_changes)