ENH:add "is_blocking_printing" api

jira: github 6181
Change-Id: I8c8659da0b27204c53d03cbbd8d410504b3fd434
(cherry picked from commit c52681071782d137338436640cd990057579949b)
This commit is contained in:
zhou.xu
2025-03-26 16:36:01 +08:00
committed by Noisyfox
parent 157bec00a1
commit 327f64c093
3 changed files with 27 additions and 4 deletions

View File

@@ -1902,6 +1902,31 @@ GUI_App::~GUI_App()
BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format(": exit");
}
bool GUI_App::is_blocking_printing(MachineObject *obj_)
{
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev) return true;
std::string target_model;
if (obj_ == nullptr) {
auto obj_ = dev->get_selected_machine();
target_model = obj_->printer_type;
} else {
target_model = obj_->printer_type;
}
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
std::string source_model = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle);
if (source_model != target_model) {
std::vector<std::string> compatible_machine = dev->get_compatible_machine(target_model);
vector<std::string>::iterator it = find(compatible_machine.begin(), compatible_machine.end(), source_model);
if (it == compatible_machine.end()) {
return true;
}
}
return false;
}
// If formatted for github, plaintext with OpenGL extensions enclosed into <details>.
// Otherwise HTML formatted for the system info dialog.
std::string GUI_App::get_gl_info(bool for_github)