diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 3309c73be..82cc286f5 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -1459,6 +1459,17 @@ int MachineObject::command_pushing(std::string cmd) return -1; } +int MachineObject::command_clean_print_error(std::string subtask_id) +{ + BOOST_LOG_TRIVIAL(info) << "command_clean_print_error, id = " << subtask_id; + json j; + j["print"]["command"] = "clean_print_error"; + j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); + j["print"]["subtask_id"] = subtask_id; + + return this->publish_json(j.dump()); +} + int MachineObject::command_upgrade_confirm() { BOOST_LOG_TRIVIAL(info) << "command_upgrade_confirm"; diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index 0106e023e..6c2b1ae0a 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -692,6 +692,7 @@ public: int command_get_version(bool with_retry = true); int command_request_push_all(); int command_pushing(std::string cmd); + int command_clean_print_error(std::string task_id); /* command upgrade */ int command_upgrade_confirm(); diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index 8b69ea1ff..3a1763118 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -1591,7 +1591,7 @@ void StatusPanel::show_recenter_dialog() { obj->command_go_home(); } -void StatusPanel::show_error_message(wxString msg, std::string print_error_str) +void StatusPanel::show_error_message(MachineObject* obj, wxString msg, std::string print_error_str) { if (msg.IsEmpty()) { if (m_panel_error_txt->IsShown()) { @@ -1618,6 +1618,14 @@ void StatusPanel::show_error_message(wxString msg, std::string print_error_str) m_print_error_dlg->update_title_style(_L("Warning"), SecondaryCheckDialog::ButtonStyle::ONLY_CONFIRM, this); } m_print_error_dlg->update_text(msg); + + m_print_error_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this, obj](wxCommandEvent& e) { + if (obj) { + obj->command_clean_print_error(obj->subtask_id_); + } + }); + + m_print_error_dlg->on_show(); } } @@ -1626,7 +1634,7 @@ void StatusPanel::update_error_message() { if (obj->print_error <= 0) { before_error_code = obj->print_error; - show_error_message(wxEmptyString); + show_error_message(obj, wxEmptyString); return; } else if (before_error_code != obj->print_error && obj->print_error != skip_print_error) { before_error_code = obj->print_error; @@ -1646,7 +1654,7 @@ void StatusPanel::update_error_message() error_msg = wxString::Format("%s[%s %s]", error_msg, print_error_str, show_time); - show_error_message(error_msg, print_error_str); + show_error_message(obj, error_msg, print_error_str); } else { BOOST_LOG_TRIVIAL(info) << "show print error! error_msg is empty, print error = " << obj->print_error; } diff --git a/src/slic3r/GUI/StatusPanel.hpp b/src/slic3r/GUI/StatusPanel.hpp index 422dc94fb..be3f1108f 100644 --- a/src/slic3r/GUI/StatusPanel.hpp +++ b/src/slic3r/GUI/StatusPanel.hpp @@ -312,7 +312,7 @@ protected: void on_subtask_pause_resume(wxCommandEvent &event); void on_subtask_abort(wxCommandEvent &event); void on_print_error_clean(wxCommandEvent &event); - void show_error_message(wxString msg, std::string print_error_str = ""); + void show_error_message(MachineObject* obj, wxString msg, std::string print_error_str = ""); void error_info_reset(); void show_recenter_dialog();