From ac4d48106348b82f47a5818ad0cd8db4a8a3cd4c Mon Sep 17 00:00:00 2001 From: Ocraftyone Date: Tue, 18 Jun 2024 00:52:24 -0400 Subject: [PATCH] Update Spoolman Stats via PhysicalPrinterDialog If any spoolman-related keys are updated in the PhysicalPrinterDialog, call update_spoolman_statistics --- src/slic3r/GUI/PhysicalPrinterDialog.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/slic3r/GUI/PhysicalPrinterDialog.cpp b/src/slic3r/GUI/PhysicalPrinterDialog.cpp index 5d0e6b8022..6ee9b5643d 100644 --- a/src/slic3r/GUI/PhysicalPrinterDialog.cpp +++ b/src/slic3r/GUI/PhysicalPrinterDialog.cpp @@ -702,7 +702,20 @@ void PhysicalPrinterDialog::on_dpi_changed(const wxRect& suggested_rect) void PhysicalPrinterDialog::OnOK(wxEvent& event) { + // determine if any spoolman related keys have been updated + bool update_spool_stats = false; + const vector& current_dirty_options = m_presets->current_dirty_options(); + if (!current_dirty_options.empty()) { + for (const auto& option_key : {"spoolman_enabled", "spoolman_host", "print_host"}) { + if (std::find(current_dirty_options.begin(), current_dirty_options.end(), option_key) != current_dirty_options.end()) { + update_spool_stats = true; + break; + } + } + } wxGetApp().get_tab(Preset::TYPE_PRINTER)->save_preset("", false, false, true, m_preset_name ); + if (update_spool_stats) // only update spoolman if spoolman related keys were changed + wxGetApp().preset_bundle->update_spoolman_statistics(true); event.Skip(); }