fix(gui): keep the file-name preview in the plain theme color
CI / lint (push) Skipped
CI / test (3.12) (push) Skipped
CI / test (3.13) (push) Skipped
CI / test-with-beamline-plugins (pxi_bec) (push) Skipped
CI / test-with-beamline-plugins (pxii_bec) (push) Skipped
CI / test-with-beamline-plugins (pxiii_bec) (push) Skipped
CI / test (3.12) (pull_request) Failing after 1m4s
CI / test (3.14) (pull_request) Successful in 1m7s
CI / lint (pull_request) Successful in 1m18s
CI / test (3.13) (pull_request) Successful in 1m15s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Successful in 1m17s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Successful in 1m17s
CI / test-with-coverage (pull_request) Successful in 1m35s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Successful in 1m40s
CI / coverage-analysis (pull_request) Successful in 4s
CI / lint (push) Skipped
CI / test (3.12) (push) Skipped
CI / test (3.13) (push) Skipped
CI / test-with-beamline-plugins (pxi_bec) (push) Skipped
CI / test-with-beamline-plugins (pxii_bec) (push) Skipped
CI / test-with-beamline-plugins (pxiii_bec) (push) Skipped
CI / test (3.12) (pull_request) Failing after 1m4s
CI / test (3.14) (pull_request) Successful in 1m7s
CI / lint (pull_request) Successful in 1m18s
CI / test (3.13) (pull_request) Successful in 1m15s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Successful in 1m17s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Successful in 1m17s
CI / test-with-coverage (pull_request) Successful in 1m35s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Successful in 1m40s
CI / coverage-analysis (pull_request) Successful in 4s
Dawn: the red "file exists" tint on the path label reads as an error across the whole panel. The Run guard's popup already reports a clash, so the label stays in the standard text color. The popup now also asks the user to run the data collection again after the run number bump. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,6 @@ from aarecommon.models.models import DAQStatusModel, SampleShortInfo
|
||||
from PySide6.QtCore import Qt, Signal, Slot
|
||||
from PySide6.QtWidgets import QGridLayout, QLabel, QLineEdit, QMessageBox, QSpinBox, QWidget
|
||||
|
||||
from aare.gui.styles import PATH_WARN_TEXT
|
||||
from aare.gui.widgets.title_label import TitleLabel
|
||||
|
||||
## Logic for filenames:
|
||||
@@ -165,13 +164,11 @@ class FilePathPanel(QWidget):
|
||||
# Store the GUI’s base (without applying scan-kind transforms) for wiring into requests later
|
||||
self._filename = self._expand_macros(base, run_number)
|
||||
|
||||
# Preview label shows the effective path (what will be written)
|
||||
# Preview label shows the effective path (what will be written), in the
|
||||
# plain theme color: a clash is reported by the Run guard's popup, not
|
||||
# by a red label.
|
||||
effective = self._effective_dataset_base(self._filename)
|
||||
exists = self._exists_for_run(self._filename)
|
||||
self.file_name_label.setText(effective + "_master.h5")
|
||||
# Empty stylesheet = reset to the THEME text color (a hardcoded
|
||||
# "default" black would be invisible on the dark theme).
|
||||
self.file_name_label.setStyleSheet(f"color: {PATH_WARN_TEXT};" if exists else "")
|
||||
self.path_updated.emit(self._filename)
|
||||
|
||||
@Slot()
|
||||
@@ -257,6 +254,6 @@ class FilePathPanel(QWidget):
|
||||
self,
|
||||
"File exists",
|
||||
f"File already exists:\n{path}\n\n"
|
||||
f"Run number increased to {self.run_number_edit.value()}.",
|
||||
f"Run number increased to {self.run_number_edit.value()}. Please run data collection again.",
|
||||
)
|
||||
return False
|
||||
|
||||
@@ -518,11 +518,9 @@ def test_run_is_blocked_with_a_popup_when_the_file_exists(file_panel, monkeypatc
|
||||
boxes = []
|
||||
monkeypatch.setattr(QMessageBox, "warning", lambda *a, **k: boxes.append(a))
|
||||
|
||||
# Editing never skips a taken run silently: the name stays literal and
|
||||
# the label only turns red.
|
||||
# Editing never skips a taken run silently: the name stays literal.
|
||||
file_panel.set_scan_kind("rotation")
|
||||
assert file_panel.run_number_edit.value() == 1
|
||||
assert file_panel.file_name_label.styleSheet() != ""
|
||||
|
||||
assert file_panel.file_path_error_box(scan_kind="rotation") is False
|
||||
assert len(boxes) == 1
|
||||
@@ -555,11 +553,10 @@ def test_a_derived_dataset_counts_as_taken(file_panel, monkeypatch):
|
||||
|
||||
|
||||
def test_a_directory_or_a_sibling_run_is_not_taken(file_panel, monkeypatch):
|
||||
# Only the exact master files count; anything else would paint runs red
|
||||
# that nothing will write.
|
||||
# Only the exact master files count; anything else would block runs that
|
||||
# nothing will write.
|
||||
_taken(monkeypatch, "raster/d/x_001", "raster/d/x_0011_master.h5", "raster/d/x_001_data.h5")
|
||||
file_panel.set_scan_kind("raster")
|
||||
assert file_panel.file_name_label.styleSheet() == ""
|
||||
assert file_panel.file_path_error_box(scan_kind="raster") is True
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user