FIX:add resume button

JIRA:github:2860
Change-Id: I39035d929876ab3c84c5f5c3494376967300938c
This commit is contained in:
hu.wang 2024-01-19 18:08:03 +08:00 committed by Lane.Wei
parent cd5847d1fe
commit ad214fc9aa
3 changed files with 50 additions and 4 deletions

View File

@ -27,6 +27,7 @@ namespace Slic3r { namespace GUI {
wxDEFINE_EVENT(EVT_SECONDARY_CHECK_CONFIRM, wxCommandEvent);
wxDEFINE_EVENT(EVT_SECONDARY_CHECK_CANCEL, wxCommandEvent);
wxDEFINE_EVENT(EVT_SECONDARY_CHECK_DONE, wxCommandEvent);
wxDEFINE_EVENT(EVT_SECONDARY_CHECK_RESUME, wxCommandEvent);
wxDEFINE_EVENT(EVT_CHECKBOX_CHANGE, wxCommandEvent);
wxDEFINE_EVENT(EVT_ENTER_IP_ADDRESS, wxCommandEvent);
wxDEFINE_EVENT(EVT_CLOSE_IPADDRESS_DLG, wxCommandEvent);
@ -630,6 +631,21 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons
e.Skip();
});
m_button_resume = new Button(this, _L("resume"));
m_button_resume->SetBackgroundColor(btn_bg_white);
m_button_resume->SetBorderColor(wxColour(38, 46, 48));
m_button_resume->SetFont(Label::Body_12);
m_button_resume->SetSize(wxSize(FromDIP(58), FromDIP(24)));
m_button_resume->SetMinSize(wxSize(-1, FromDIP(24)));
m_button_resume->SetMaxSize(wxSize(-1, FromDIP(24)));
m_button_resume->SetCornerRadius(FromDIP(12));
m_button_resume->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e) {
post_event(wxCommandEvent(EVT_SECONDARY_CHECK_RESUME));
e.Skip();
});
m_button_resume->Hide();
if (btn_style == CONFIRM_AND_CANCEL) {
m_button_cancel->Show();
m_button_fn->Hide();
@ -654,6 +670,7 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons
}
sizer_button->AddStretchSpacer();
sizer_button->Add(m_button_resume, 0, wxALL, FromDIP(5));
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));
@ -757,26 +774,39 @@ void SecondaryCheckDialog::update_title_style(wxString title, SecondaryCheckDial
m_button_cancel->Show();
m_button_fn->Hide();
m_button_retry->Hide();
m_button_resume->Hide();
}
else if (style == CONFIRM_AND_DONE) {
m_button_cancel->Hide();
m_button_fn->Show();
m_button_retry->Hide();
m_button_resume->Hide();
}
else if (style == CONFIRM_AND_RETRY) {
m_button_retry->Show();
m_button_cancel->Hide();
m_button_fn->Hide();
m_button_resume->Hide();
}
else if (style == DONE_AND_RETRY) {
m_button_retry->Show();
m_button_fn->Show();
m_button_cancel->Hide();
m_button_resume->Hide();
}
else if(style == CONFIRM_AND_RESUME)
{
m_button_retry->Hide();
m_button_fn->Hide();
m_button_cancel->Hide();
m_button_resume->Show();
}
else {
m_button_retry->Hide();
m_button_cancel->Hide();
m_button_fn->Hide();
m_button_resume->Hide();
}

View File

@ -44,6 +44,7 @@ wxDECLARE_EVENT(EVT_SECONDARY_CHECK_CONFIRM, wxCommandEvent);
wxDECLARE_EVENT(EVT_SECONDARY_CHECK_CANCEL, wxCommandEvent);
wxDECLARE_EVENT(EVT_SECONDARY_CHECK_RETRY, wxCommandEvent);
wxDECLARE_EVENT(EVT_SECONDARY_CHECK_DONE, wxCommandEvent);
wxDECLARE_EVENT(EVT_SECONDARY_CHECK_RESUME, wxCommandEvent);
wxDECLARE_EVENT(EVT_UPDATE_NOZZLE, wxCommandEvent);
class ReleaseNoteDialog : public DPIDialog
@ -114,8 +115,9 @@ public:
CONFIRM_AND_CANCEL = 1,
CONFIRM_AND_DONE = 2,
CONFIRM_AND_RETRY = 3,
DONE_AND_RETRY = 4,
MAX_STYLE_NUM = 5
CONFIRM_AND_RESUME = 4,
DONE_AND_RETRY = 5,
MAX_STYLE_NUM = 6
};
SecondaryCheckDialog(
wxWindow* parent,
@ -148,6 +150,7 @@ public:
Button* m_button_retry { nullptr };
Button* m_button_cancel { nullptr };
Button* m_button_fn { nullptr };
Button* m_button_resume { nullptr };
wxCheckBox* m_show_again_checkbox;
ButtonStyle m_button_style;
bool not_show_again = false;

View File

@ -84,7 +84,6 @@ static std::vector<std::string> message_containing_retry{
"07FF 8012",
"07FF 8013",
"12FF 8007"
};
static std::vector<std::string> message_containing_done{
@ -92,6 +91,10 @@ static std::vector<std::string> message_containing_done{
"12FF 8007"
};
static std::vector<std::string> message_containing_resume{
"0300 8013"
};
static wxImage fail_image;
@ -1690,6 +1693,7 @@ StatusPanel::StatusPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, co
Bind(EVT_AMS_RETRY, &StatusPanel::on_ams_retry, this);
Bind(EVT_FAN_CHANGED, &StatusPanel::on_fan_changed, this);
Bind(EVT_SECONDARY_CHECK_DONE, &StatusPanel::on_print_error_done, this);
Bind(EVT_SECONDARY_CHECK_RESUME, &StatusPanel::on_subtask_pause_resume, this);
m_switch_speed->Connect(wxEVT_LEFT_DOWN, wxCommandEventHandler(StatusPanel::on_switch_speed), NULL, this);
m_calibration_btn->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_start_calibration), NULL, this);
@ -1840,6 +1844,10 @@ void StatusPanel::on_subtask_pause_resume(wxCommandEvent &event)
BOOST_LOG_TRIVIAL(info) << "monitor: pause current print task dev_id =" << obj->dev_id;
obj->command_task_pause();
}
if (m_print_error_dlg) {
m_print_error_dlg->on_hide();
}
}
}
@ -2069,6 +2077,7 @@ void StatusPanel::show_error_message(MachineObject* obj, wxString msg, std::stri
auto it_retry = std::find(message_containing_retry.begin(), message_containing_retry.end(), print_error_str);
auto it_done = std::find(message_containing_done.begin(), message_containing_done.end(), print_error_str);
auto it_resume = std::find(message_containing_resume.begin(), message_containing_resume.end(), print_error_str);
BOOST_LOG_TRIVIAL(info) << "show print error! error_msg = " << msg;
if (m_print_error_dlg == nullptr) {
@ -2083,7 +2092,11 @@ void StatusPanel::show_error_message(MachineObject* obj, wxString msg, std::stri
}
else if (it_retry != message_containing_retry.end()) {
m_print_error_dlg->update_title_style(_L("Warning"), SecondaryCheckDialog::ButtonStyle::CONFIRM_AND_RETRY, this);
}else {
}
else if (it_resume!= message_containing_resume.end()) {
m_print_error_dlg->update_title_style(_L("Warning"), SecondaryCheckDialog::ButtonStyle::CONFIRM_AND_RESUME, this);
}
else {
m_print_error_dlg->update_title_style(_L("Warning"), SecondaryCheckDialog::ButtonStyle::ONLY_CONFIRM, this);
}
m_print_error_dlg->update_text(msg);