diff --git a/src/slic3r/GUI/ReleaseNote.cpp b/src/slic3r/GUI/ReleaseNote.cpp index ad6f81ea3..aced6aa0e 100644 --- a/src/slic3r/GUI/ReleaseNote.cpp +++ b/src/slic3r/GUI/ReleaseNote.cpp @@ -31,6 +31,7 @@ wxDEFINE_EVENT(EVT_CHECKBOX_CHANGE, wxCommandEvent); wxDEFINE_EVENT(EVT_ENTER_IP_ADDRESS, wxCommandEvent); wxDEFINE_EVENT(EVT_CLOSE_IPADDRESS_DLG, wxCommandEvent); wxDEFINE_EVENT(EVT_CHECK_IP_ADDRESS_FAILED, wxCommandEvent); +wxDEFINE_EVENT(EVT_SECONDARY_CHECK_RETRY, wxCommandEvent); ReleaseNoteDialog::ReleaseNoteDialog(Plater *plater /*= nullptr*/) : DPIDialog(static_cast(wxGetApp().mainframe), wxID_ANY, _L("Release Note"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX) @@ -521,6 +522,7 @@ void UpdateVersionDialog::update_version_info(wxString release_note, wxString ve SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, const wxString& title, enum ButtonStyle btn_style, const wxPoint& pos, const wxSize& size, long style, bool not_show_again_check) :DPIFrame(parent, id, title, pos, size, style) { + m_button_style = btn_style; std::string icon_path = (boost::format("%1%/images/BambuStudioTitle.ico") % resources_dir()).str(); SetIcon(wxIcon(encode_path(icon_path.c_str()), wxBITMAP_TYPE_ICO)); @@ -578,6 +580,22 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons this->on_hide(); }); + m_button_retry = new Button(this, _L("Retry")); + m_button_retry->SetBackgroundColor(btn_bg_green); + m_button_retry->SetBorderColor(*wxWHITE); + m_button_retry->SetTextColor(wxColour("#FFFFFE")); + m_button_retry->SetFont(Label::Body_12); + m_button_retry->SetSize(wxSize(FromDIP(58), FromDIP(24))); + m_button_retry->SetMinSize(wxSize(-1, FromDIP(24))); + m_button_retry->SetCornerRadius(FromDIP(12)); + + m_button_retry->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e) { + wxCommandEvent evt(EVT_SECONDARY_CHECK_RETRY, GetId()); + e.SetEventObject(this); + GetEventHandler()->ProcessEvent(evt); + this->on_hide(); + }); + m_button_cancel = new Button(this, _L("Cancel")); m_button_cancel->SetBackgroundColor(btn_bg_white); m_button_cancel->SetBorderColor(wxColour(38, 46, 48)); @@ -609,15 +627,22 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons if (btn_style == CONFIRM_AND_CANCEL) { m_button_cancel->Show(); m_button_fn->Hide(); + m_button_retry->Hide(); } else if (btn_style == CONFIRM_AND_FUNC) { m_button_cancel->Hide(); m_button_fn->Show(); + m_button_retry->Hide(); + } else if (btn_style == CONFIRM_AND_RETRY) { + m_button_retry->Show(); + m_button_cancel->Hide(); } else { + m_button_retry->Hide(); m_button_cancel->Hide(); m_button_fn->Hide(); } sizer_button->AddStretchSpacer(); + sizer_button->Add(m_button_retry, 0, wxALL, FromDIP(5)); sizer_button->Add(m_button_fn, 0, wxALL, FromDIP(5)); sizer_button->Add(m_button_ok, 0, wxALL, FromDIP(5)); sizer_button->Add(m_button_cancel, 0, wxALL, FromDIP(5)); @@ -714,6 +739,8 @@ void SecondaryCheckDialog::on_hide() void SecondaryCheckDialog::update_title_style(wxString title, SecondaryCheckDialog::ButtonStyle style, wxWindow* parent) { + if (m_button_style == style && title == GetTitle() == title) return; + SetTitle(title); event_parent = parent; @@ -721,15 +748,24 @@ void SecondaryCheckDialog::update_title_style(wxString title, SecondaryCheckDial if (style == CONFIRM_AND_CANCEL) { m_button_cancel->Show(); m_button_fn->Hide(); + m_button_retry->Hide(); } else if (style == CONFIRM_AND_FUNC) { m_button_cancel->Hide(); m_button_fn->Show(); + m_button_retry->Hide(); + } + else if (style == CONFIRM_AND_RETRY) { + m_button_retry->Show(); + m_button_cancel->Hide(); } else { + m_button_retry->Hide(); m_button_cancel->Hide(); m_button_fn->Hide(); } + + Layout(); } diff --git a/src/slic3r/GUI/ReleaseNote.hpp b/src/slic3r/GUI/ReleaseNote.hpp index a90c45507..93947891e 100644 --- a/src/slic3r/GUI/ReleaseNote.hpp +++ b/src/slic3r/GUI/ReleaseNote.hpp @@ -41,6 +41,7 @@ namespace Slic3r { namespace GUI { wxDECLARE_EVENT(EVT_SECONDARY_CHECK_CONFIRM, wxCommandEvent); wxDECLARE_EVENT(EVT_SECONDARY_CHECK_CANCEL, wxCommandEvent); wxDECLARE_EVENT(EVT_SECONDARY_CHECK_FUNC, wxCommandEvent); +wxDECLARE_EVENT(EVT_SECONDARY_CHECK_RETRY, wxCommandEvent); class ReleaseNoteDialog : public DPIDialog { @@ -107,7 +108,8 @@ public: ONLY_CONFIRM = 0, CONFIRM_AND_CANCEL = 1, CONFIRM_AND_FUNC = 2, - MAX_STYLE_NUM = 3 + CONFIRM_AND_RETRY = 3, + MAX_STYLE_NUM = 4 }; SecondaryCheckDialog( wxWindow* parent, @@ -134,9 +136,11 @@ public: wxBoxSizer* m_sizer_main; wxScrolledWindow *m_vebview_release_note {nullptr}; Button* m_button_ok { nullptr }; + Button* m_button_retry { nullptr }; Button* m_button_cancel { nullptr }; Button* m_button_fn { nullptr }; wxCheckBox* m_show_again_checkbox; + ButtonStyle m_button_style; bool not_show_again = false; std::string show_again_config_text = ""; }; diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index dc92a60b1..65b35af6d 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -54,6 +54,14 @@ static wxColour PAGE_TITLE_FONT_COL = wxColour(107, 107, 107); static wxColour GROUP_TITLE_FONT_COL = wxColour(172, 172, 172); static wxColour TEXT_LIGHT_FONT_COL = wxColour(107, 107, 107); +static std::vector message_containing_retry{ + "0701 8004", + "0701 8005", + "0701 8006", + "0701 8006", + "0701 8007", +}; + /* size */ #define PAGE_TITLE_HEIGHT FromDIP(36) #define PAGE_TITLE_TEXT_WIDTH FromDIP(200) @@ -1671,6 +1679,8 @@ void StatusPanel::show_error_message(MachineObject* obj, wxString msg, std::stri m_staticline->Show(); m_panel_error_txt->Show(); + auto it = std::find(message_containing_retry.begin(), message_containing_retry.end(), print_error_str); + BOOST_LOG_TRIVIAL(info) << "show print error! error_msg = " << msg; if (m_print_error_dlg == nullptr) { m_print_error_dlg = new SecondaryCheckDialog(this->GetParent(), wxID_ANY, _L("Warning"), SecondaryCheckDialog::ButtonStyle::ONLY_CONFIRM); @@ -1678,7 +1688,10 @@ void StatusPanel::show_error_message(MachineObject* obj, wxString msg, std::stri if (print_error_str == "07FF 8007") { m_print_error_dlg->update_func_btn("Done"); m_print_error_dlg->update_title_style(_L("Warning"), SecondaryCheckDialog::ButtonStyle::CONFIRM_AND_FUNC, this); - } else { + } + else if (it != message_containing_retry.end()) { + m_print_error_dlg->update_title_style(_L("Warning"), SecondaryCheckDialog::ButtonStyle::CONFIRM_AND_RETRY, this); + }else { m_print_error_dlg->update_title_style(_L("Warning"), SecondaryCheckDialog::ButtonStyle::ONLY_CONFIRM, this); } m_print_error_dlg->update_text(msg); @@ -1690,6 +1703,12 @@ void StatusPanel::show_error_message(MachineObject* obj, wxString msg, std::stri }); + m_print_error_dlg->Bind(EVT_SECONDARY_CHECK_RETRY, [this, obj](wxCommandEvent& e) { + if (m_ams_control) { + m_ams_control->on_retry(); + } + }); + m_print_error_dlg->on_show(); } } diff --git a/src/slic3r/GUI/Widgets/AMSControl.cpp b/src/slic3r/GUI/Widgets/AMSControl.cpp index 951589366..753259efd 100644 --- a/src/slic3r/GUI/Widgets/AMSControl.cpp +++ b/src/slic3r/GUI/Widgets/AMSControl.cpp @@ -2302,6 +2302,11 @@ AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons EnterNoneAMSMode(); } +void AMSControl::on_retry() +{ + post_event(wxCommandEvent(EVT_AMS_RETRY)); +} + void AMSControl::init_scaled_buttons() { m_button_extrusion_cali->SetMinSize(wxSize(-1, FromDIP(24))); diff --git a/src/slic3r/GUI/Widgets/AMSControl.hpp b/src/slic3r/GUI/Widgets/AMSControl.hpp index 87213a44e..63e63929a 100644 --- a/src/slic3r/GUI/Widgets/AMSControl.hpp +++ b/src/slic3r/GUI/Widgets/AMSControl.hpp @@ -511,6 +511,7 @@ class AMSControl : public wxSimplebook public: AMSControl(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize); + void on_retry(); void init_scaled_buttons(); protected: