From 5ead16bffe701b756140c21d65d288d355ec57ce Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Fri, 13 Nov 2026 20:41:55 -0500 Subject: [PATCH] feat(avalonia): drop Export Nest Report to match WinForms WinForms removed the direct-save command in ecd0bba4; the system PDF viewer that Nest Report opens already saves and prints the report. Co-Authored-By: Claude Opus 5.5 --- OpenNest.Avalonia/MainWindow.Export.cs | 53 +------------------------- OpenNest.Avalonia/MainWindow.axaml | 1 - OpenNest.Desktop/NestReportExport.cs | 6 +-- docs/nest-reports.md | 6 +-- 4 files changed, 8 insertions(+), 58 deletions(-) diff --git a/OpenNest.Avalonia/MainWindow.Export.cs b/OpenNest.Avalonia/MainWindow.Export.cs index 5e4c41c6..baec9fed 100644 --- a/OpenNest.Avalonia/MainWindow.Export.cs +++ b/OpenNest.Avalonia/MainWindow.Export.cs @@ -10,8 +10,8 @@ using OpenNest.Desktop; namespace OpenNest.Avalonia { /// - /// File > Export Plate, Export All Plates, Nest Report and Export Nest Report, and Plate > - /// View in CAD, as the WinForms app has them: the same suggested file names and writers + /// File > Export Plate, Export All Plates and Nest Report, and Plate > View in CAD, as + /// the WinForms app has them: the same suggested file names and writers /// (, ). A viewed report opens in the /// system's PDF viewer, which saves and prints it; View in CAD opens the plate's DXF in the /// program the system associates with .dxf. @@ -30,15 +30,11 @@ namespace OpenNest.Avalonia private static readonly FilePickerFileType SvgFiles = new("SVG file") { Patterns = new[] { "*.svg" } }; - private static readonly FilePickerFileType PdfFiles = - new("PDF file") { Patterns = new[] { "*.pdf" } }; - private void UpdateExportCommands(bool hasNest) { ExportPlateMenuItem.IsEnabled = hasNest; ExportAllPlatesMenuItem.IsEnabled = hasNest; ViewNestReportMenuItem.IsEnabled = hasNest; - ExportNestReportMenuItem.IsEnabled = hasNest; ViewInCadMenuItem.IsEnabled = hasNest; } @@ -244,51 +240,6 @@ namespace OpenNest.Avalonia $"The nest report was written to '{path}', but it could not be opened"); } - /// Saves the nest report as a PDF file the user picks. - private async void OnExportNestReport(object sender, RoutedEventArgs e) - { - var tab = tabs.Active; - if (tab == null || !TryReportFileName(tab, out var fileName)) - return; - if (!CanWrite(tab, "exporting the report")) - return; - writingFile = true; - try - { - var file = await StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions - { - Title = "Export Nest Report", - SuggestedFileName = fileName, - DefaultExtension = "pdf", - ShowOverwritePrompt = true, - FileTypeChoices = new[] { PdfFiles }, - SuggestedStartLocation = await NestFolderAsync(tab), - }); - if (file == null) - return; - var path = file.TryGetLocalPath(); - if (path == null) - { - ShowNotice("The nest report can only be saved to a folder on this computer."); - return; - } - await MachinesLoaded; - // Auto Nest may have started on it while the file picker was open. - if (IsNesting(tab, "exporting the report")) - return; - await WriteReportAsync(tab, path); - ShowNotice($"Saved nest report to {path}"); - } - catch (Exception ex) when (IsReportFailure(ex)) - { - await ReportFailureAsync(tab, ex); - } - finally - { - writingFile = false; - } - } - // The report's file name, or false (after saying why) when the nest's name cannot be one. private bool TryReportFileName(NestTab tab, out string fileName) { diff --git a/OpenNest.Avalonia/MainWindow.axaml b/OpenNest.Avalonia/MainWindow.axaml index fdd3aee1..48c006d6 100644 --- a/OpenNest.Avalonia/MainWindow.axaml +++ b/OpenNest.Avalonia/MainWindow.axaml @@ -17,7 +17,6 @@ - diff --git a/OpenNest.Desktop/NestReportExport.cs b/OpenNest.Desktop/NestReportExport.cs index cd4a173f..ff72bfc7 100644 --- a/OpenNest.Desktop/NestReportExport.cs +++ b/OpenNest.Desktop/NestReportExport.cs @@ -8,9 +8,9 @@ using OpenNest.Reporting; namespace OpenNest.Desktop; /// -/// File > Export Nest Report and View Nest Report for both desktop apps: the checks before a -/// report is written, the report file name, capturing and writing the PDF, and the private -/// temporary folders a viewed report is rendered into. Whether the nest is busy (nesting, a fill +/// View Nest Report for both desktop apps: the checks before a report is written, the report +/// file name, capturing and writing the PDF, and the private temporary folders a viewed report is +/// rendered into. Whether the nest is busy (nesting, a fill /// or plate action) is the front end's to say; see docs/nest-reports.md. /// public static class NestReportExport diff --git a/docs/nest-reports.md b/docs/nest-reports.md index e6331412..3fdd5d0f 100644 --- a/docs/nest-reports.md +++ b/docs/nest-reports.md @@ -25,9 +25,9 @@ own: **File -> Nest Report...** writes the PDF to a private folder under the system temp folder's `OpenNest/Reports/` and opens it in the system's PDF viewer (`ExternalFileLauncher`: the Windows shell, `open` on macOS, `xdg-open` elsewhere), which saves and prints it. Because that viewer's closing cannot be -seen, each view removes viewed-report folders older than a day instead. **File -> -Export Nest Report...** saves the PDF straight to a chosen file. Either refuses -while Auto Nest runs on the nest, checked before and after the file picker. +seen, each view removes viewed-report folders older than a day instead. Like +WinForms it has no separate direct-save command. It refuses while Auto Nest runs +on the nest, checked again once the machines are read. The same two calls back the command and any future integration: