ENH:add "is_blocking_printing" api
jira: github 6181 Change-Id: I8c8659da0b27204c53d03cbbd8d410504b3fd434
This commit is contained in:
parent
956f1b9a59
commit
c526810717
|
@ -2245,6 +2245,31 @@ GUI_App::~GUI_App()
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format(": exit");
|
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>.
|
// If formatted for github, plaintext with OpenGL extensions enclosed into <details>.
|
||||||
// Otherwise HTML formatted for the system info dialog.
|
// Otherwise HTML formatted for the system info dialog.
|
||||||
std::string GUI_App::get_gl_info(bool for_github)
|
std::string GUI_App::get_gl_info(bool for_github)
|
||||||
|
|
|
@ -331,6 +331,7 @@ public:
|
||||||
void show_message_box(std::string msg) { wxMessageBox(msg); }
|
void show_message_box(std::string msg) { wxMessageBox(msg); }
|
||||||
EAppMode get_app_mode() const { return m_app_mode; }
|
EAppMode get_app_mode() const { return m_app_mode; }
|
||||||
Slic3r::DeviceManager* getDeviceManager() { return m_device_manager; }
|
Slic3r::DeviceManager* getDeviceManager() { return m_device_manager; }
|
||||||
|
bool is_blocking_printing(MachineObject *obj_ = nullptr);
|
||||||
Slic3r::TaskManager* getTaskManager() { return m_task_manager; }
|
Slic3r::TaskManager* getTaskManager() { return m_task_manager; }
|
||||||
HMSQuery* get_hms_query() { return hms_query; }
|
HMSQuery* get_hms_query() { return hms_query; }
|
||||||
NetworkAgent* getAgent() { return m_agent; }
|
NetworkAgent* getAgent() { return m_agent; }
|
||||||
|
|
|
@ -15655,14 +15655,11 @@ bool Plater::is_same_printer_for_connected_and_selected()
|
||||||
}
|
}
|
||||||
if (!check_printer_initialized(obj,true))
|
if (!check_printer_initialized(obj,true))
|
||||||
return false;
|
return false;
|
||||||
std::string machine_print_name = obj->printer_type;
|
|
||||||
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
|
|
||||||
std::string target_model_id = preset_bundle->printers.get_selected_preset().get_printer_type(preset_bundle);
|
|
||||||
Preset * machine_preset = get_printer_preset(obj);
|
Preset * machine_preset = get_printer_preset(obj);
|
||||||
if (!machine_preset)
|
if (!machine_preset)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (machine_print_name != target_model_id) {
|
if (wxGetApp().is_blocking_printing()) {
|
||||||
auto printer_name = get_selected_printer_name_in_combox(); // wxString(obj->get_preset_printer_model_name(machine_print_name))
|
auto printer_name = get_selected_printer_name_in_combox(); // wxString(obj->get_preset_printer_model_name(machine_print_name))
|
||||||
pop_warning_and_go_to_device_page(printer_name, PrinterWarningType::INCONSISTENT, _L("Synchronize AMS Filament Information"));
|
pop_warning_and_go_to_device_page(printer_name, PrinterWarningType::INCONSISTENT, _L("Synchronize AMS Filament Information"));
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue