forked from 1b-agent/opencadstudio-upstream
Merge pull request #383 from KevinGriffin-new/fix/pdf-export
Never fail silently on PDF export; add EXPORTPDF <path> (#369). The export flow handed off to an async rfd save dialog and mapped a None result straight to Task::none(). On Linux None also means the dialog never opened (broken XDG portal / missing zenity), and rfd reports that only via log, so PDF export could end in total silence. The dialog-None arms now print a message pointing at EXPORTPDF <path>, and EXPORT/EXPORTPDF take an optional path that exports straight to a file with no dialog — the workaround where the native dialog can't open, and a headless entry point. Conflict: the fix (display.rs, file.rs, mod.rs, COMMANDS.md) auto-merged; only the additive test block in automation.rs conflicted. Resolved by keeping main's tests and adding the two #369 tests. # Conflicts: # src/app/automation.rs
This commit is contained in:
commit
5b4a6719aa
5 files changed
+116
-11
No files matched your search
+20
-2
@@ -3582,7 +3582,18 @@ impl OpenCADStudio {
|
||||
Message::PlotExportPath,
|
||||
)
|
||||
}
|
||||
Message::PlotExportPath(None) => Task::none(),
|
||||
// None means the save dialog was cancelled — or never opened at
|
||||
// all (a broken XDG portal / missing zenity on Linux resolves to
|
||||
// None too, and rfd only reports that through `log`, which is
|
||||
// opt-in). Either way say something instead of silently doing
|
||||
// nothing. (#369)
|
||||
Message::PlotExportPath(None) => {
|
||||
self.command_line.push_info(
|
||||
"PDF export canceled — no file chosen. \
|
||||
If no dialog appeared, use EXPORTPDF <path>.",
|
||||
);
|
||||
Task::none()
|
||||
}
|
||||
Message::PlotExportPath(Some(path)) => self.on_plot_export_path_some(path),
|
||||
|
||||
Message::PlotFormat(f) => {
|
||||
@@ -3606,7 +3617,14 @@ impl OpenCADStudio {
|
||||
Message::PlotWindowExportPath,
|
||||
)
|
||||
}
|
||||
Message::PlotWindowExportPath(None) => Task::none(),
|
||||
// Same silent-None trap as PlotExportPath above. (#369)
|
||||
Message::PlotWindowExportPath(None) => {
|
||||
self.command_line.push_info(
|
||||
"PDF export canceled — no file chosen. \
|
||||
If no dialog appeared, use EXPORTPDF <path>.",
|
||||
);
|
||||
Task::none()
|
||||
}
|
||||
Message::PlotWindowExportPath(Some(path)) => self.on_plot_window_export_path_some(path),
|
||||
|
||||
// ── Print to system printer ───────────────────────────────────────
|
||||
|
||||
Reference in new issue
Block a user