diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 43f8dc6d0..3ed1702f4 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -3702,7 +3702,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only) if (jj["errno"].is_number()) { if (jj["errno"].get() == -2) { wxString text = _L("The current chamber temperature or the target chamber temperature exceeds 45\u2103.In order to avoid extruder clogging,low temperature filament(PLA/PETG/TPU) is not allowed to be loaded."); - GUI::wxGetApp().push_notification(text); + GUI::wxGetApp().push_notification(this, text); } } } @@ -3722,7 +3722,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only) #if __WXOSX__ set_ctt_dlg(text); #else - GUI::wxGetApp().push_notification(text); + GUI::wxGetApp().push_notification(this, text); #endif } } @@ -4942,7 +4942,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only) result = jj["result"].get(); if (result == "FAIL") { wxString text = _L("Failed to start printing job"); - GUI::wxGetApp().push_notification(text); + GUI::wxGetApp().push_notification(this, text); } } } else if (jj["command"].get() == "ams_filament_setting" && !key_field_only) { @@ -5092,7 +5092,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only) else { info = reason; } - GUI::wxGetApp().push_notification(info, _L("Calibration error"), UserNotificationStyle::UNS_WARNING_CONFIRM); + GUI::wxGetApp().push_notification(this, info, _L("Calibration error"), UserNotificationStyle::UNS_WARNING_CONFIRM); BOOST_LOG_TRIVIAL(info) << cali_mode << " result fail, reason = " << reason; } } diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index e1e35b3b6..ebac81eb3 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -5405,23 +5405,33 @@ void GUI_App::show_dialog(wxString msg) } } -void GUI_App::push_notification(wxString msg, wxString title, UserNotificationStyle style) +void GUI_App::push_notification(const MachineObject* obj, wxString msg, wxString title, UserNotificationStyle style) { - if (!this->is_enable_multi_machine()) { - if (style == UserNotificationStyle::UNS_NORMAL) { - if (m_info_dialog_content.empty()) { - wxCommandEvent* evt = new wxCommandEvent(EVT_SHOW_DIALOG); - evt->SetString(msg); - GUI::wxGetApp().QueueEvent(evt); - m_info_dialog_content = msg; - } + if (this->is_enable_multi_machine()) + { + if (m_device_manager && (obj != m_device_manager->get_selected_machine())) + { + return; } - else if (style == UserNotificationStyle::UNS_WARNING_CONFIRM) { - GUI::wxGetApp().CallAfter([msg, title] { + } + + if (style == UserNotificationStyle::UNS_NORMAL) + { + if (m_info_dialog_content.empty()) + { + wxCommandEvent* evt = new wxCommandEvent(EVT_SHOW_DIALOG); + evt->SetString(msg); + GUI::wxGetApp().QueueEvent(evt); + m_info_dialog_content = msg; + } + } + else if (style == UserNotificationStyle::UNS_WARNING_CONFIRM) + { + GUI::wxGetApp().CallAfter([msg, title] + { GUI::MessageDialog msg_dlg(nullptr, msg, title, wxICON_WARNING | wxOK); msg_dlg.ShowModal(); }); - } } } diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index d0482f935..62ce01903 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -484,7 +484,7 @@ public: static std::string format_display_version(); std::string format_IP(const std::string& ip); void show_dialog(wxString msg); - void push_notification(wxString msg, wxString title = wxEmptyString, UserNotificationStyle style = UserNotificationStyle::UNS_NORMAL); + void push_notification(const MachineObject* obj, wxString msg, wxString title = wxEmptyString, UserNotificationStyle style = UserNotificationStyle::UNS_NORMAL); void reload_settings(); void remove_user_presets(); void sync_preset(Preset* preset);