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) <noreply@anthropic.com>
This commit is contained in:
2026-06-26 11:42:44 +02:00
co-authored by Claude Opus 4.8
parent 54c667190f
commit d2159bde92
3 changed files with 21 additions and 5 deletions
+3
View File
@@ -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,
+12 -5
View File
@@ -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();
@@ -40,6 +40,9 @@ public slots:
void datasetLoaded(std::shared_ptr<const JFJochReaderDataset> dataset);
void loadImage(std::shared_ptr<const JFJochReaderImage> 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;