FIX: fix print error display

Change-Id: I8080648e57bef10bc7fa8de9122d57e2e637cf20
This commit is contained in:
Stone Li 2022-11-11 15:12:55 +08:00 committed by Lane.Wei
parent 06459ac808
commit 9f4b778d8c
2 changed files with 24 additions and 14 deletions

View file

@ -1393,23 +1393,36 @@ void StatusPanel::show_recenter_dialog() {
void StatusPanel::show_error_message(wxString msg) void StatusPanel::show_error_message(wxString msg)
{ {
if (msg.IsEmpty()) {
if (m_panel_error_txt->IsShown()) {
error_info_reset();
}
if (m_print_error_dlg.get() != nullptr) {
if (m_print_error_dlg.get()->IsShown()) {
m_print_error_dlg.get()->EndModal(wxID_OK);
}
}
} else {
m_error_text->SetLabel(msg); m_error_text->SetLabel(msg);
m_staticline->Show(); m_staticline->Show();
m_panel_error_txt->Show(); m_panel_error_txt->Show();
BOOST_LOG_TRIVIAL(info) << "show print error! error_msg = " << msg;
m_print_error_dlg = std::make_shared<SecondaryCheckDialog>(this->GetParent(), wxID_ANY, _L("Warning"), SecondaryCheckDialog::ButtonStyle::ONLY_CONFIRM);
m_print_error_dlg.get()->update_text(msg);
m_print_error_dlg.get()->ShowModal();
}
} }
void StatusPanel::update_error_message() void StatusPanel::update_error_message()
{ {
if (obj->print_error <= 0) { if (obj->print_error <= 0) {
before_error_code = obj->print_error; before_error_code = obj->print_error;
show_error_message(wxEmptyString);
if (m_panel_error_txt->IsShown())
error_info_reset();
return; return;
} } else if (before_error_code != obj->print_error) {
if (before_error_code != obj->print_error) {
before_error_code = obj->print_error; before_error_code = obj->print_error;
if (wxGetApp().get_hms_query()) { if (wxGetApp().get_hms_query()) {
char buf[32]; char buf[32];
::sprintf(buf, "%08X", obj->print_error); ::sprintf(buf, "%08X", obj->print_error);
@ -1424,11 +1437,6 @@ void StatusPanel::update_error_message()
error_msg, error_msg,
print_error_str); print_error_str);
show_error_message(error_msg); show_error_message(error_msg);
BOOST_LOG_TRIVIAL(info) << "show print error! error_msg = " << error_msg;
SecondaryCheckDialog print_error_dlg(this->GetParent(), wxID_ANY, _L("Warning"), SecondaryCheckDialog::ButtonStyle::ONLY_CONFIRM);
print_error_dlg.update_text(error_msg);
print_error_dlg.ShowModal();
} else { } else {
BOOST_LOG_TRIVIAL(info) << "show print error! error_msg is empty, print error = " << obj->print_error; BOOST_LOG_TRIVIAL(info) << "show print error! error_msg is empty, print error = " << obj->print_error;
} }

View file

@ -19,6 +19,7 @@
#include "Calibration.hpp" #include "Calibration.hpp"
#include "PrintOptionsDialog.hpp" #include "PrintOptionsDialog.hpp"
#include "AMSMaterialsSetting.hpp" #include "AMSMaterialsSetting.hpp"
#include "ReleaseNote.hpp"
#include "Widgets/SwitchButton.hpp" #include "Widgets/SwitchButton.hpp"
#include "Widgets/AxisCtrlButton.hpp" #include "Widgets/AxisCtrlButton.hpp"
#include "Widgets/TextInput.hpp" #include "Widgets/TextInput.hpp"
@ -255,6 +256,7 @@ protected:
PrintOptionsDialog* print_options_dlg { nullptr }; PrintOptionsDialog* print_options_dlg { nullptr };
CalibrationDialog* calibration_dlg {nullptr}; CalibrationDialog* calibration_dlg {nullptr};
AMSMaterialsSetting *m_filament_setting_dlg{nullptr}; AMSMaterialsSetting *m_filament_setting_dlg{nullptr};
std::shared_ptr<SecondaryCheckDialog> m_print_error_dlg = nullptr;
wxString m_request_url; wxString m_request_url;
bool m_start_loading_thumbnail = false; bool m_start_loading_thumbnail = false;