viewer: live detector status bar + dataset-follow sync mode
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 11m38s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 11m49s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 11m55s
Build Packages / build:rpm (rocky8) (push) Successful in 12m55s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 13m4s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 13m16s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 14m12s
Build Packages / XDS test (durin plugin) (push) Successful in 8m5s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 8m1s
Build Packages / Generate python client (push) Successful in 19s
Build Packages / Create release (push) Skipped
Build Packages / build:rpm (ubuntu2404) (push) Successful in 9m55s
Build Packages / Build documentation (push) Successful in 45s
Build Packages / XDS test (neggia plugin) (push) Successful in 7m58s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 10m56s
Build Packages / build:rpm (rocky9) (push) Successful in 11m58s
Build Packages / DIALS test (push) Successful in 11m59s
Build Packages / Unit tests (push) Successful in 55m33s

Add a status-bar cluster, shown when connected over HTTP, that surfaces
the broker state and live acquisition info:
- broker state box (QProgressBar) with progress drawn as the bar fill,
  polled ~1 Hz on its own timer independent of image sync
- Live/Disconnected connection badge (host:port in tooltip)
- "+N new" badge and effective live-rate (Hz) readout
All widgets are fixed-width and only blanked in place, so the bar never
reflows when things appear/disappear.

Add a third autoload mode (HTTPSyncDataset): manually selecting an image
while following live now freezes the displayed image but keeps the dataset,
plots and image count updating. Surfaced via a tri-state HTTP Sync button
(off / live / data-only).

Also fix GetBrokerStatus() dropping the message field and a couple of
copy-pasted exception strings in JFJochHttpReader.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-18 08:13:07 +02:00
parent 188cbb659d
commit 56ddfaef96
8 changed files with 308 additions and 18 deletions
+29 -3
View File
@@ -50,7 +50,7 @@ BrokerStatus JFJochHttpReader::GetBrokerStatus() const {
auto res = cli_cmd.Get("/status");
if (!res || res->status != httplib::StatusCode::OK_200)
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"Could not get image buffer status");
"Could not get broker status");
try {
org::openapitools::server::model::Broker_status input = nlohmann::json::parse(res->body);
@@ -59,6 +59,8 @@ BrokerStatus JFJochHttpReader::GetBrokerStatus() const {
ret.gpu_count = input.getGpuCount();
if (input.progressIsSet())
ret.progress = input.getProgress();
if (input.messageIsSet())
ret.message = input.getMessage();
if (input.getState() == "Inactive")
ret.state = JFJochState::Inactive;
@@ -87,7 +89,7 @@ BrokerStatus JFJochHttpReader::GetBrokerStatus() const {
return ret;
} catch (std::exception &e) {
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"Could not parse image buffer status");
"Could not parse broker status");
}
}
@@ -209,6 +211,30 @@ void JFJochHttpReader::ReadURL(const std::string &url) {
SetStartMessage(UpdateDataset_i());
}
std::shared_ptr<const JFJochReaderDataset> JFJochHttpReader::RefreshDatasetIfChanged(int64_t &num_images_out) {
std::unique_lock ul(http_mutex);
num_images_out = 0;
if (addr.empty())
return {};
auto status = GetImageBufferStatus();
num_images_out = status.max_image_number + 1;
// Re-fetch the dataset (start message + plots) only when the buffer actually changed,
// so the dataset-only follow mode does not hammer the broker with plot requests.
const bool buffer_changed = !last_image_buffer_counter.has_value()
|| !status.current_counter.has_value()
|| last_image_buffer_counter.value() != status.current_counter.value();
last_image_buffer_counter = status.current_counter;
if (!buffer_changed)
return {};
SetStartMessage(UpdateDataset_i());
return GetDataset();
}
bool JFJochHttpReader::LoadImage_i(std::shared_ptr<JFJochReaderDataset> &dataset,
DataMessage &message,
std::vector<uint8_t> &buffer,
@@ -342,7 +368,7 @@ std::vector<float> JFJochHttpReader::GetPlot_i(const std::string &plot_type, flo
return {};
} catch (nlohmann::json::parse_error &e) {
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"Could not parse image buffer status");
"Could not parse plot " + plot_type);
}
}