From d2159bde92fa00900d6ca35e469e6d0a57c49c32 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Fri, 26 Jun 2026 11:42:44 +0200 Subject: [PATCH] jfjoch_viewer: Grey out "Analyze dataset" on a live HTTP connection Dataset re-processing reads a stored HDF5 file, so it is unavailable for the live HTTP stream. Disable the "Analyze dataset" hero button while a source is connected (with an explanatory tooltip) instead of letting the user click through to a "open a file first" dialog afterwards. Co-Authored-By: Claude Opus 4.8 (1M context) --- viewer/JFJochViewerWindow.cpp | 3 +++ viewer/widgets/JFJochViewerSettingsDock.cpp | 17 ++++++++++++----- viewer/widgets/JFJochViewerSettingsDock.h | 6 ++++++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/viewer/JFJochViewerWindow.cpp b/viewer/JFJochViewerWindow.cpp index b0f9ee4b..a6547f5f 100644 --- a/viewer/JFJochViewerWindow.cpp +++ b/viewer/JFJochViewerWindow.cpp @@ -481,6 +481,9 @@ JFJochViewerWindow::JFJochViewerWindow(QWidget *parent, bool dbus, const QString reading_worker, &JFJochImageReadingWorker::ReanalyzeImages); connect(settingsPanel, &JFJochViewerSettingsDock::analyzeDataset, processingJobsWindow, &JFJochProcessingJobsWindow::newJob); + // Grey out "Analyze dataset" on a live HTTP source (re-processing needs a stored file). + connect(reading_worker, &JFJochImageReadingWorker::httpConnectionChanged, + settingsPanel, &JFJochViewerSettingsDock::setHttpConnection); connect(settingsPanel, &JFJochViewerSettingsDock::experimentChanged, reading_worker, &JFJochImageReadingWorker::UpdateDataset); connect(settingsPanel, &JFJochViewerSettingsDock::findBeamCenter, diff --git a/viewer/widgets/JFJochViewerSettingsDock.cpp b/viewer/widgets/JFJochViewerSettingsDock.cpp index da00c622..3c8a5c9f 100644 --- a/viewer/widgets/JFJochViewerSettingsDock.cpp +++ b/viewer/widgets/JFJochViewerSettingsDock.cpp @@ -71,16 +71,16 @@ JFJochViewerSettingsDock::JFJochViewerSettingsDock(const SpotFindingSettings &sp analyzeImageBtn->setStyleSheet(heroStyle); analyzeImageBtn->setToolTip("Re-analyse the current image now, and keep re-analysing on every" " image / settings change while active"); - auto *analyzeDatasetBtn = new QPushButton(FramesIcon(3), " Analyze dataset", this); - analyzeDatasetBtn->setStyleSheet(heroStyle); - analyzeDatasetBtn->setToolTip("Process the whole dataset (MX or azimuthal, per the toggle below)"); + analyzeDatasetBtn_ = new QPushButton(FramesIcon(3), " Analyze dataset", this); + analyzeDatasetBtn_->setStyleSheet(heroStyle); + analyzeDatasetBtn_->setToolTip("Process the whole dataset (MX or azimuthal, per the toggle below)"); auto *analyzeRow = new QHBoxLayout(); analyzeRow->addWidget(analyzeImageBtn); - analyzeRow->addWidget(analyzeDatasetBtn); + analyzeRow->addWidget(analyzeDatasetBtn_); layout->addLayout(analyzeRow); layout->addSpacing(10); connect(analyzeImageBtn, &QPushButton::toggled, this, &JFJochViewerSettingsDock::reanalyzeImage); - connect(analyzeDatasetBtn, &QPushButton::clicked, this, [this] { emit analyzeDataset(azint_mode_); }); + connect(analyzeDatasetBtn_, &QPushButton::clicked, this, [this] { emit analyzeDataset(azint_mode_); }); // Segmented MX / AzInt toggle: the two communities pick their page; pages never share a screen. auto *mxButton = new QPushButton("MX", this); @@ -115,6 +115,13 @@ JFJochViewerSettingsDock::JFJochViewerSettingsDock(const SpotFindingSettings &sp layout->addStretch(); } +void JFJochViewerSettingsDock::setHttpConnection(bool connected, QString) { + analyzeDatasetBtn_->setEnabled(!connected); + analyzeDatasetBtn_->setToolTip(connected + ? "Dataset re-processing is only available for an open file, not a live HTTP stream" + : "Process the whole dataset (MX or azimuthal, per the toggle below)"); +} + QWidget *JFJochViewerSettingsDock::BuildGeometrySection() { auto *section = new CollapsibleSection("Geometry", this); auto *geom = new QFormLayout(); diff --git a/viewer/widgets/JFJochViewerSettingsDock.h b/viewer/widgets/JFJochViewerSettingsDock.h index 27e22e21..d4e36b2a 100644 --- a/viewer/widgets/JFJochViewerSettingsDock.h +++ b/viewer/widgets/JFJochViewerSettingsDock.h @@ -40,6 +40,9 @@ public slots: void datasetLoaded(std::shared_ptr dataset); void loadImage(std::shared_ptr image); void referenceLoaded(ReferenceMtzInfo info); // worker reports a (un)loaded reference MTZ + // Dataset re-processing reads a stored HDF5 file, so it is unavailable on a live HTTP stream: + // grey out "Analyze dataset" while connected rather than failing with a dialog afterwards. + void setHttpConnection(bool connected, QString addr); signals: void spotFindingChanged(const SpotFindingSettings &spot, const IndexingSettings &indexing, int64_t max_spots); @@ -64,6 +67,9 @@ private: int64_t max_spots_ = 1000; bool azint_mode_ = false; // false = MX page, true = AzInt page (drives "Analyze dataset") + // "Analyze dataset" hero button, disabled while a live HTTP source is connected. + QPushButton *analyzeDatasetBtn_ = nullptr; + // Indexing-algorithm combo + the description line under it (kept so the Auto resolution refreshes). QComboBox *algo_ = nullptr; QLabel *algoDesc_ = nullptr;