From f7194ca3a4fa98a0ab3fa76a40a5955955e113fa Mon Sep 17 00:00:00 2001 From: Dawn Date: Sat, 8 Aug 2026 18:42:04 +0200 Subject: [PATCH] style: small panel polish Energy unit moves from spinbox suffix to the label (the suffix ate field width next to the new spin arrows); samcam exposure/gain get a 3:2 stretch so 3-decimal exposure isn't cut; the Exp. Config. tab bar gets a BANNER_TAB_GAP spacer under its banner. Co-Authored-By: Claude Fable 5 --- src/aare/gui/panels/data_collection_settings.py | 4 ++++ src/aare/gui/panels/monochromator_panel.py | 5 +++-- src/aare/gui/panels/samcam_panel.py | 6 ++++-- src/aare/gui/styles.py | 5 +++++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/aare/gui/panels/data_collection_settings.py b/src/aare/gui/panels/data_collection_settings.py index 8e2bdb7d..3a5fbc14 100644 --- a/src/aare/gui/panels/data_collection_settings.py +++ b/src/aare/gui/panels/data_collection_settings.py @@ -20,6 +20,7 @@ from aare.gui.panels.raster_data_collection import RasterDataCollectionPanel from aare.gui.panels.rotation_data_collection import RotationDataCollectionPanel from aare.gui.panels.smart_rotation_panel import SimpleRotationSettingsPanel from aare.gui.scan_logic.raster_grid_manager import RasterGridManager +from aare.gui.styles import BANNER_TAB_GAP from aare.gui.widgets.title_label import TitleLabel, tighten_column @@ -102,6 +103,9 @@ class DataCollectionSettings(QFrame): "Experiment configuration", exp_config, collapsible=True, default_collapsed=False ) ) + # Explicit spacer, not layout spacing: the tab bar must keep sitting + # flush on the pane below, only the banner gets breathing room. + exp_config_layout.addSpacing(BANNER_TAB_GAP) exp_config_layout.addWidget(self._tab_bar) exp_config_layout.addWidget(pane) v_layout.addWidget(exp_config) diff --git a/src/aare/gui/panels/monochromator_panel.py b/src/aare/gui/panels/monochromator_panel.py index c12982f3..aee95e50 100644 --- a/src/aare/gui/panels/monochromator_panel.py +++ b/src/aare/gui/panels/monochromator_panel.py @@ -23,13 +23,14 @@ class MonochromatorPanel(QWidget): # One row (label | value | button) instead of three — vertical space. # Display in keV; the DAQ API stays in eV (converted on emit). - grid_layout.addWidget(QLabel("Energy", parent=self), 2, 0) + # Unit lives in the label, not as a spinbox suffix — the suffix ate + # field width and sat between the value and the +/- arrow. + grid_layout.addWidget(QLabel("Energy (keV)", parent=self), 2, 0) self.energy_spin = QDoubleSpinBox(parent=self) self.energy_spin.setDecimals(3) self.energy_spin.setRange(1.0, 30.0) self.energy_spin.setSingleStep(0.1) - self.energy_spin.setSuffix(" keV") self.energy_spin.setValue(12.0) grid_layout.addWidget(self.energy_spin, 2, 1) diff --git a/src/aare/gui/panels/samcam_panel.py b/src/aare/gui/panels/samcam_panel.py index e7a591ab..7632da88 100644 --- a/src/aare/gui/panels/samcam_panel.py +++ b/src/aare/gui/panels/samcam_panel.py @@ -54,10 +54,12 @@ class SamcamPanel(QWidget): self.gain_spinbox.setDecimals(1) self.gain_spinbox.valueChanged.connect(self._changed) + # 3:2 stretch — exposure shows 3 decimals plus the side arrows and + # was getting cut; gain (1 decimal) can afford the narrower field. exposure_gain_layout.addWidget(QLabel("Exposure (s):")) - exposure_gain_layout.addWidget(self.exposure_spinbox) + exposure_gain_layout.addWidget(self.exposure_spinbox, 3) exposure_gain_layout.addWidget(QLabel("Gain:")) - exposure_gain_layout.addWidget(self.gain_spinbox) + exposure_gain_layout.addWidget(self.gain_spinbox, 2) # Persist the current gain/exposure as the beam-location preset for the # current zoom (only meaningful in beam-location mode). diff --git a/src/aare/gui/styles.py b/src/aare/gui/styles.py index c139ad6f..d9ea5b2d 100644 --- a/src/aare/gui/styles.py +++ b/src/aare/gui/styles.py @@ -93,6 +93,11 @@ FRAME_L3_COLOR = "#c9cfd8" # left edge lines up with the left-column panels above (Loop centering). DOCK_CONTENT_LEFT_PAD = 10 +# Gap (px, int — used in code, not QSS) between a TitleLabel banner and a tab +# bar sitting directly under it (Exp. Config.), so the tabs don't touch the +# banner's bottom edge line. +BANNER_TAB_GAP = 6 + # Resize-line hint: dock separators stay invisible until the mouse rests on # one for SEPARATOR_HINT_DELAY_MS (or a drag starts) — then only the exact # separator under the cursor fills with SEPARATOR_HINT. The rest/drag gate