musrview: add "Save graphics" to the interactive (root7/web) viewer
root6 musrview could save the plot as png/pdf/svg/...; the ROOT7 web rewrite dropped that. Add a "Save graphics" toolbar entry: the server renders the classic layout (same code path as --png/--pdf/... batch export) into the current working directory and hands it to the browser as a download, so the browser's own save dialog/download folder decides where it lands -- a native OS folder picker isn't reachable from here, since the --embedded window is a Qt6 QWebEngineView owned by ROOT itself, which auto-accepts downloads with no dialog. Also fixes rasterized batch export (png/gif/jpg) coming out blank when triggered from an already-running interactive session: TCanvas decides at *construction* time, from gROOT->IsBatch(), whether to build a real GUI canvas or a headless one, so canvas.SetBatch(kTRUE) after the fact was too late. Vector formats (pdf/eps/svg) don't need pixel readback and were unaffected, which is why this went unnoticed. Fixed by toggling gROOT's batch flag for the export canvas's lifetime. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017cuZPrSNaKjG8xHPVNwV16
This commit is contained in:
1 parent
4302b40d9e
commit
7a3fa94270
4 files changed
+176
-40
No files matched your search
+1
-1
@@ -446,7 +446,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (graphicsOutput) {
|
||||
for (auto &canvas : canvasList) {
|
||||
if (!canvas->SaveGraphics(fileName, graphicsExtension)) {
|
||||
if (!canvas->SaveGraphics(graphicsExtension)) {
|
||||
std::cerr << std::endl << ">> musrview **ERROR** " << canvas->GetLastError() << std::endl;
|
||||
result = PMUSR_MSR_RUN_ERROR;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user