diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 816315cb3..486def05f 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -8,6 +8,7 @@ #include "MsgDialog.hpp" #include "Plater.hpp" #include "GUI_App.hpp" +#include "ReleaseNote.hpp" #include #include #include @@ -3009,14 +3010,18 @@ int MachineObject::parse_json(std::string payload) if (jj["command"].get() == "set_ctt") { if (m_agent && is_studio_cmd(sequence_id)) { if (jj["errno"].is_number()) { + wxString text; if (jj["errno"].get() == -2) { - wxString text = _L("Low temperature filament(PLA/PETG/TPU) is loaded in the extruder.In order to avoid extruder clogging,it is not allowed to set the chamber temperature above 45\u2103."); - GUI::wxGetApp().show_dialog(text); + text = _L("Low temperature filament(PLA/PETG/TPU) is loaded in the extruder.In order to avoid extruder clogging,it is not allowed to set the chamber temperature above 45\u2103."); } else if (jj["errno"].get() == -4) { - wxString text = _L("When you set the chamber temperature below 40\u2103, the chamber temperature control will not be activated. And the target chamber temperature will automatically be set to 0\u2103."); - GUI::wxGetApp().show_dialog(text); + text = _L("When you set the chamber temperature below 40\u2103, the chamber temperature control will not be activated. And the target chamber temperature will automatically be set to 0\u2103."); } +#if __WXOSX__ + set_ctt_dlg(text); +#else + GUI::wxGetApp().show_dialog(text); +#endif } } } @@ -4565,6 +4570,25 @@ int MachineObject::parse_json(std::string payload) return 0; } +void MachineObject::set_ctt_dlg( wxString text){ + if (!m_set_ctt_dlg) { + m_set_ctt_dlg = true; + auto print_error_dlg = new GUI::SecondaryCheckDialog(nullptr, wxID_ANY, _L("Warning"), GUI::SecondaryCheckDialog::ButtonStyle::ONLY_CONFIRM); + print_error_dlg->update_text(text); + print_error_dlg->Bind(wxEVT_SHOW, [this](auto& e) { + if (!e.IsShown()) { + m_set_ctt_dlg = false; + } + }); + print_error_dlg->Bind(wxEVT_CLOSE_WINDOW, [this](auto& e) { + e.Skip(); + m_set_ctt_dlg = false; + }); + print_error_dlg->on_show(); + + } +} + int MachineObject::publish_gcode(std::string gcode_str) { json j; diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index e3a6effec..443e34d74 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -52,7 +52,7 @@ using namespace nlohmann; namespace Slic3r { - +class SecondaryCheckDialog; enum PrinterArch { ARCH_CORE_XY, ARCH_I3, @@ -450,8 +450,10 @@ public: time_t last_alive; bool m_is_online; bool m_lan_mode_connection_state{false}; + bool m_set_ctt_dlg{ false }; void set_lan_mode_connection_state(bool state) {m_lan_mode_connection_state = state;}; bool get_lan_mode_connection_state() {return m_lan_mode_connection_state;}; + void set_ctt_dlg( wxString text); int parse_msg_count = 0; int keep_alive_count = 0; std::chrono::system_clock::time_point last_update_time; /* last received print data from machine */