From 02ec94b6f8d579bb003925e27156e6ecab371848 Mon Sep 17 00:00:00 2001 From: tao wang Date: Fri, 1 Dec 2023 09:59:12 +0800 Subject: [PATCH] ENH:add preset check for sending files Change-Id: Ia3313d281b5ce91e277b380498014ffdac5debd3 --- src/slic3r/GUI/SendToPrinter.cpp | 32 +++++++++++++++++++++++++++++++- src/slic3r/GUI/SendToPrinter.hpp | 1 + 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/SendToPrinter.cpp b/src/slic3r/GUI/SendToPrinter.cpp index 4c206a10e..023ed1ec4 100644 --- a/src/slic3r/GUI/SendToPrinter.cpp +++ b/src/slic3r/GUI/SendToPrinter.cpp @@ -1058,7 +1058,11 @@ void SendToPrinterDialog::update_show_status() reset_timeout(); // reading done - if (obj_->is_in_upgrading()) { + if (is_blocking_printing(obj_)) { + show_status(PrintDialogStatus::PrintStatusUnsupportedPrinter); + return; + } + else if (obj_->is_in_upgrading()) { show_status(PrintDialogStatus::PrintStatusInUpgrading); return; } @@ -1087,6 +1091,26 @@ void SendToPrinterDialog::update_show_status() } } +bool SendToPrinterDialog::is_blocking_printing(MachineObject* obj_) +{ + DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); + if (!dev) return true; + + PresetBundle* preset_bundle = wxGetApp().preset_bundle; + auto source_model = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle); + auto target_model = obj_->printer_type; + + if (source_model != target_model) { + std::vector compatible_machine = dev->get_compatible_machine(target_model); + vector::iterator it = find(compatible_machine.begin(), compatible_machine.end(), source_model); + if (it == compatible_machine.end()) { + return true; + } + } + + return false; +} + void SendToPrinterDialog::Enable_Refresh_Button(bool en) { if (!en) { @@ -1167,6 +1191,12 @@ void SendToPrinterDialog::show_status(PrintDialogStatus status, std::vector