GUI: tidied up local contact panel
This commit is contained in:
@@ -24,7 +24,8 @@ class RecoveryPanel(QWidget):
|
||||
self._last_status: DAQStatusModel | None = None
|
||||
|
||||
layout = QVBoxLayout(self)
|
||||
layout.setSpacing(10)
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
layout.setSpacing(8)
|
||||
|
||||
self._warning_primary = QLabel(
|
||||
"⚠ Recovery actions are staff-only and intentionally dangerous.",
|
||||
@@ -36,8 +37,8 @@ class RecoveryPanel(QWidget):
|
||||
" background: #fff3cd;"
|
||||
" color: #7a4b00;"
|
||||
" border: 1px solid #f0c36d;"
|
||||
" border-radius: 6px;"
|
||||
" padding: 8px;"
|
||||
" border-radius: 8px;"
|
||||
" padding: 10px;"
|
||||
" font-weight: 600;"
|
||||
"}"
|
||||
)
|
||||
@@ -53,8 +54,8 @@ class RecoveryPanel(QWidget):
|
||||
" background: #fdeaea;"
|
||||
" color: #8b1e1e;"
|
||||
" border: 1px solid #e6a8a8;"
|
||||
" border-radius: 6px;"
|
||||
" padding: 8px;"
|
||||
" border-radius: 8px;"
|
||||
" padding: 10px;"
|
||||
" font-weight: 600;"
|
||||
"}"
|
||||
)
|
||||
@@ -67,8 +68,8 @@ class RecoveryPanel(QWidget):
|
||||
" background: #eef6ff;"
|
||||
" color: #12406a;"
|
||||
" border: 1px solid #a8c7e6;"
|
||||
" border-radius: 6px;"
|
||||
" padding: 8px;"
|
||||
" border-radius: 8px;"
|
||||
" padding: 10px;"
|
||||
" font-weight: 600;"
|
||||
"}"
|
||||
)
|
||||
@@ -77,10 +78,10 @@ class RecoveryPanel(QWidget):
|
||||
self._take_over_btn = QPushButton("Take over beamline", self)
|
||||
self._take_over_btn.setStyleSheet(
|
||||
"QPushButton {"
|
||||
" background: #fff3cd;"
|
||||
" border: 1px solid #f0c36d;"
|
||||
" border-radius: 6px;"
|
||||
" padding: 8px;"
|
||||
" background: #fff7db;"
|
||||
" border: 1px solid #e7cb73;"
|
||||
" border-radius: 8px;"
|
||||
" padding: 10px;"
|
||||
" font-weight: 600;"
|
||||
"}"
|
||||
)
|
||||
@@ -90,10 +91,10 @@ class RecoveryPanel(QWidget):
|
||||
self._free_beamline_btn = QPushButton("Free beamline", self)
|
||||
self._free_beamline_btn.setStyleSheet(
|
||||
"QPushButton {"
|
||||
" background: #fff3cd;"
|
||||
" border: 1px solid #f0c36d;"
|
||||
" border-radius: 6px;"
|
||||
" padding: 8px;"
|
||||
" background: #fff7db;"
|
||||
" border: 1px solid #e7cb73;"
|
||||
" border-radius: 8px;"
|
||||
" padding: 10px;"
|
||||
" font-weight: 600;"
|
||||
"}"
|
||||
)
|
||||
@@ -106,8 +107,8 @@ class RecoveryPanel(QWidget):
|
||||
" background: #fdeaea;"
|
||||
" color: #8b1e1e;"
|
||||
" border: 1px solid #e6a8a8;"
|
||||
" border-radius: 6px;"
|
||||
" padding: 8px;"
|
||||
" border-radius: 8px;"
|
||||
" padding: 10px;"
|
||||
" font-weight: 700;"
|
||||
"}"
|
||||
)
|
||||
@@ -120,8 +121,8 @@ class RecoveryPanel(QWidget):
|
||||
" background: #fdeaea;"
|
||||
" color: #8b1e1e;"
|
||||
" border: 1px solid #e6a8a8;"
|
||||
" border-radius: 6px;"
|
||||
" padding: 8px;"
|
||||
" border-radius: 8px;"
|
||||
" padding: 10px;"
|
||||
" font-weight: 700;"
|
||||
"}"
|
||||
)
|
||||
@@ -134,8 +135,8 @@ class RecoveryPanel(QWidget):
|
||||
" background: #eef6ff;"
|
||||
" color: #12406a;"
|
||||
" border: 1px solid #a8c7e6;"
|
||||
" border-radius: 6px;"
|
||||
" padding: 8px;"
|
||||
" border-radius: 8px;"
|
||||
" padding: 10px;"
|
||||
" font-weight: 600;"
|
||||
"}"
|
||||
)
|
||||
|
||||
@@ -63,8 +63,29 @@ class LocalContactPanel(QFrame):
|
||||
|
||||
self.setFrameShape(QFrame.Shape.StyledPanel)
|
||||
self.setFrameShadow(QFrame.Shadow.Raised)
|
||||
self.setStyleSheet(
|
||||
"""
|
||||
QGroupBox {
|
||||
background-color: white;
|
||||
border: 1px solid #c7d4e5;
|
||||
border-radius: 5px;
|
||||
margin-top: 15px;
|
||||
padding-top: 15px;
|
||||
font-weight: 700;
|
||||
color: #1e293b;
|
||||
}
|
||||
QGroupBox::title {
|
||||
subcontrol-origin: margin;
|
||||
subcontrol-position: top left;
|
||||
left: 10px;
|
||||
padding: 0 6px 0 6px;
|
||||
font:bold;
|
||||
}
|
||||
"""
|
||||
)
|
||||
|
||||
layout = QVBoxLayout(self)
|
||||
layout.setContentsMargins(8, 8, 8, 8)
|
||||
layout.setSpacing(8)
|
||||
|
||||
layout.addWidget(TitleLabel("Local Contact", parent=self))
|
||||
@@ -83,11 +104,11 @@ class LocalContactPanel(QFrame):
|
||||
" background: #fdeaea;"
|
||||
" color: #8b1e1e;"
|
||||
" border: 1px solid #e6a8a8;"
|
||||
" border-radius: 6px;"
|
||||
" border-radius: 8px;"
|
||||
"}"
|
||||
)
|
||||
transfer_error_layout = QVBoxLayout(self._transfer_error_frame)
|
||||
transfer_error_layout.setContentsMargins(8, 8, 8, 8)
|
||||
transfer_error_layout.setContentsMargins(10, 10, 10, 10)
|
||||
|
||||
self._transfer_error_title = QLabel("Error transferring information from DAQ", self._transfer_error_frame)
|
||||
self._transfer_error_title.setStyleSheet("font-weight: 700;")
|
||||
@@ -155,6 +176,7 @@ class LocalContactPanel(QFrame):
|
||||
def _build_status_tab(self) -> QWidget:
|
||||
tab = QWidget(self)
|
||||
layout = QVBoxLayout(tab)
|
||||
layout.setContentsMargins(6, 6, 6, 6)
|
||||
layout.setSpacing(8)
|
||||
layout.addWidget(
|
||||
self._make_status_widget(
|
||||
@@ -212,6 +234,7 @@ class LocalContactPanel(QFrame):
|
||||
def _build_recovery_tab(self) -> QWidget:
|
||||
tab = QWidget(self)
|
||||
layout = QVBoxLayout(tab)
|
||||
layout.setContentsMargins(6, 6, 6, 6)
|
||||
layout.setSpacing(8)
|
||||
|
||||
layout.addWidget(
|
||||
@@ -227,6 +250,7 @@ class LocalContactPanel(QFrame):
|
||||
def _build_tell_tab(self) -> QWidget:
|
||||
tab = QWidget(self)
|
||||
layout = QVBoxLayout(tab)
|
||||
layout.setContentsMargins(6, 6, 6, 6)
|
||||
layout.setSpacing(8)
|
||||
|
||||
layout.addWidget(
|
||||
@@ -238,8 +262,9 @@ class LocalContactPanel(QFrame):
|
||||
)
|
||||
|
||||
grid = QGridLayout()
|
||||
grid.setHorizontalSpacing(8)
|
||||
grid.setVerticalSpacing(8)
|
||||
row = 0
|
||||
grid.addWidget(QLabel("TELL operations", tab), row, 0, 1, 2)
|
||||
row += 1
|
||||
|
||||
grid.addWidget(self._make_button("Unmount", self._daq.unmount, "Requesting sample unmount."), row, 0)
|
||||
@@ -253,15 +278,21 @@ class LocalContactPanel(QFrame):
|
||||
grid.addWidget(self._make_button("Anneal", self._anneal_from_dialog), row, 0)
|
||||
grid.addWidget(self._make_button("TELL access info", self._show_tell_access_info), row, 1)
|
||||
|
||||
wrapper = QWidget(tab)
|
||||
wrapper.setLayout(grid)
|
||||
wrapper = QGroupBox("TELL actions", tab)
|
||||
wrapper_layout = QVBoxLayout(wrapper)
|
||||
wrapper_layout.setContentsMargins(10, 12, 10, 10)
|
||||
inner = QWidget(wrapper)
|
||||
inner.setLayout(grid)
|
||||
wrapper_layout.addWidget(inner)
|
||||
layout.addWidget(wrapper)
|
||||
|
||||
layout.addStretch(1)
|
||||
return tab
|
||||
|
||||
def _build_bec_tab(self) -> QWidget:
|
||||
tab = QWidget(self)
|
||||
layout = QVBoxLayout(tab)
|
||||
layout.setContentsMargins(6, 6, 6, 6)
|
||||
layout.setSpacing(8)
|
||||
|
||||
layout.addWidget(
|
||||
@@ -272,26 +303,34 @@ class LocalContactPanel(QFrame):
|
||||
)
|
||||
)
|
||||
|
||||
label = QLabel("BEC tools.", tab)
|
||||
label.setWordWrap(True)
|
||||
layout.addWidget(label)
|
||||
tools = QGroupBox("BEC tools", tab)
|
||||
tools_layout = QVBoxLayout(tools)
|
||||
tools_layout.setContentsMargins(10, 12, 10, 10)
|
||||
tools_layout.setSpacing(6)
|
||||
|
||||
layout.addWidget(self._make_button("Load BEC user macros", self._daq.bec_load_user_macros, "Loading BEC user macros."))
|
||||
layout.addWidget(self._make_button("Show BEC user macros", self._daq.bec_list_all_user_macros, "Listing BEC user macros."))
|
||||
layout.addWidget(self._make_button("Show BEC position devices", self._daq.bec_list_all_devices, "Listing BEC devices."))
|
||||
layout.addWidget(
|
||||
#label = QLabel("BEC inspection and recovery utilities.", tools)
|
||||
#label.setWordWrap(True)
|
||||
tools_layout.addWidget(tools)
|
||||
|
||||
tools_layout.addWidget(self._make_button("Load BEC user macros", self._daq.bec_load_user_macros, "Loading BEC user macros."))
|
||||
tools_layout.addWidget(self._make_button("Show BEC user macros", self._daq.bec_list_all_user_macros, "Listing BEC user macros."))
|
||||
tools_layout.addWidget(self._make_button("Show BEC position devices", self._daq.bec_list_all_devices, "Listing BEC devices."))
|
||||
tools_layout.addWidget(
|
||||
self._make_button(
|
||||
"Reinitialise BEC planner/devices",
|
||||
lambda: self._daq.bec_reinitialise_planner_and_position_devices("auto"),
|
||||
"Reinitialising BEC planner and position devices.",
|
||||
)
|
||||
)
|
||||
|
||||
layout.addWidget(tools)
|
||||
layout.addStretch(1)
|
||||
return tab
|
||||
|
||||
def _build_hardware_tab(self) -> QWidget:
|
||||
tab = QWidget(self)
|
||||
layout = QVBoxLayout(tab)
|
||||
layout.setContentsMargins(6, 6, 6, 6)
|
||||
layout.setSpacing(8)
|
||||
|
||||
layout.addWidget(
|
||||
@@ -360,6 +399,7 @@ class LocalContactPanel(QFrame):
|
||||
def _build_detector_tab(self) -> QWidget:
|
||||
tab = QWidget(self)
|
||||
layout = QVBoxLayout(tab)
|
||||
layout.setContentsMargins(6, 6, 6, 6)
|
||||
layout.setSpacing(8)
|
||||
|
||||
layout.addWidget(
|
||||
@@ -371,6 +411,8 @@ class LocalContactPanel(QFrame):
|
||||
)
|
||||
|
||||
grid = QGridLayout()
|
||||
grid.setHorizontalSpacing(8)
|
||||
grid.setVerticalSpacing(8)
|
||||
row = 0
|
||||
grid.addWidget(QLabel("Detector operations", tab), row, 0, 1, 2)
|
||||
row += 1
|
||||
@@ -394,16 +436,21 @@ class LocalContactPanel(QFrame):
|
||||
1,
|
||||
)
|
||||
|
||||
wrapper = QWidget(tab)
|
||||
wrapper.setLayout(grid)
|
||||
wrapper = QGroupBox("Detector actions", tab)
|
||||
wrapper_layout = QVBoxLayout(wrapper)
|
||||
wrapper_layout.setContentsMargins(10, 12, 10, 10)
|
||||
inner = QWidget(wrapper)
|
||||
inner.setLayout(grid)
|
||||
wrapper_layout.addWidget(inner)
|
||||
layout.addWidget(wrapper)
|
||||
|
||||
layout.addStretch(1)
|
||||
return tab
|
||||
|
||||
def _build_section(self, title: str, widgets: list[QWidget]) -> QWidget:
|
||||
box = QGroupBox(title, self)
|
||||
box_layout = QVBoxLayout(box)
|
||||
box_layout.setContentsMargins(10, 10, 10, 10)
|
||||
box_layout.setContentsMargins(10, 12, 10, 10)
|
||||
box_layout.setSpacing(6)
|
||||
|
||||
for widget in widgets:
|
||||
@@ -415,6 +462,7 @@ class LocalContactPanel(QFrame):
|
||||
row_widget = QWidget(self)
|
||||
row_layout = QHBoxLayout(row_widget)
|
||||
row_layout.setContentsMargins(0, 0, 0, 0)
|
||||
row_layout.setSpacing(8)
|
||||
|
||||
name = QLabel(self.DEVICE_TITLES.get(device, device.title()), row_widget)
|
||||
name.setMinimumWidth(90)
|
||||
@@ -432,6 +480,7 @@ class LocalContactPanel(QFrame):
|
||||
row_widget = QWidget(self)
|
||||
row_layout = QHBoxLayout(row_widget)
|
||||
row_layout.setContentsMargins(0, 0, 0, 0)
|
||||
row_layout.setSpacing(8)
|
||||
|
||||
name = QLabel(self.DEVICE_TITLES.get(device, device.title()), row_widget)
|
||||
name.setMinimumWidth(90)
|
||||
@@ -562,7 +611,7 @@ class LocalContactDialog(QDialog):
|
||||
def __init__(self, *, daq: DAQWorker, parent=None):
|
||||
super().__init__(parent)
|
||||
self.setWindowTitle("Local Contact")
|
||||
self.setMinimumSize(900, 680)
|
||||
self.setMinimumSize(920, 700)
|
||||
|
||||
layout = QVBoxLayout(self)
|
||||
layout.setContentsMargins(12, 12, 12, 12)
|
||||
|
||||
@@ -78,17 +78,20 @@ class LocalContactStatusWidget(QFrame):
|
||||
|
||||
self.setFrameShape(QFrame.Shape.StyledPanel)
|
||||
self.setFrameShadow(QFrame.Shadow.Raised)
|
||||
self.setObjectName("localContactStatusCard")
|
||||
self.setStyleSheet(
|
||||
"QFrame {"
|
||||
" background: #f7f9fc;"
|
||||
" border: 1px solid #c8d3e1;"
|
||||
" border-radius: 8px;"
|
||||
"}"
|
||||
"""
|
||||
QFrame#localContactStatusCard {
|
||||
background: #f8fbff;
|
||||
border: 1px solid #c7d4e5;
|
||||
border-radius: 10px;
|
||||
}
|
||||
"""
|
||||
)
|
||||
self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Maximum)
|
||||
|
||||
layout = QVBoxLayout(self)
|
||||
layout.setContentsMargins(10, 10, 10, 10)
|
||||
layout.setContentsMargins(12, 12, 12, 12)
|
||||
layout.setSpacing(6)
|
||||
|
||||
layout.addWidget(TitleLabel(self._title, self))
|
||||
@@ -100,8 +103,8 @@ class LocalContactStatusWidget(QFrame):
|
||||
|
||||
self._grid = QGridLayout()
|
||||
self._grid.setContentsMargins(0, 0, 0, 0)
|
||||
self._grid.setHorizontalSpacing(12)
|
||||
self._grid.setVerticalSpacing(4)
|
||||
self._grid.setHorizontalSpacing(14)
|
||||
self._grid.setVerticalSpacing(5)
|
||||
layout.addLayout(self._grid)
|
||||
|
||||
self._rebuild_rows()
|
||||
|
||||
Reference in New Issue
Block a user