FIX:fixed incomplete operation buttons

jira:[STUDIO-4119]

Change-Id: I73dd64fae9a42bfe248e6535d9cedb1343a2cc08
(cherry picked from commit f3176c419506a337ebb2801c66dffa4a4c8ae788)
This commit is contained in:
tao wang 2023-08-24 17:57:19 +08:00 committed by Lane.Wei
parent 165bb96e35
commit b27dc119d7
4 changed files with 36 additions and 24 deletions

View file

@ -26,7 +26,7 @@ namespace Slic3r { namespace GUI {
wxDEFINE_EVENT(EVT_SECONDARY_CHECK_CONFIRM, wxCommandEvent);
wxDEFINE_EVENT(EVT_SECONDARY_CHECK_CANCEL, wxCommandEvent);
wxDEFINE_EVENT(EVT_SECONDARY_CHECK_FUNC, wxCommandEvent);
wxDEFINE_EVENT(EVT_SECONDARY_CHECK_DONE, wxCommandEvent);
wxDEFINE_EVENT(EVT_CHECKBOX_CHANGE, wxCommandEvent);
wxDEFINE_EVENT(EVT_ENTER_IP_ADDRESS, wxCommandEvent);
wxDEFINE_EVENT(EVT_CLOSE_IPADDRESS_DLG, wxCommandEvent);
@ -531,10 +531,10 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons
auto bottom_sizer = new wxBoxSizer(wxVERTICAL);
auto sizer_button = new wxBoxSizer(wxHORIZONTAL);
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed), std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered),
btn_bg_green = StateColor(std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed), std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered),
std::pair<wxColour, int>(AMS_CONTROL_BRAND_COLOUR, StateColor::Normal));
StateColor btn_bg_white(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
btn_bg_white = StateColor(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
std::pair<wxColour, int>(*wxWHITE, StateColor::Normal));
@ -609,7 +609,7 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons
m_button_fn->SetCornerRadius(FromDIP(12));
m_button_fn->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e) {
post_event(wxCommandEvent(EVT_SECONDARY_CHECK_FUNC));
post_event(wxCommandEvent(EVT_SECONDARY_CHECK_DONE));
e.Skip();
});
@ -617,14 +617,20 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons
m_button_cancel->Show();
m_button_fn->Hide();
m_button_retry->Hide();
} else if (btn_style == CONFIRM_AND_FUNC) {
} else if (btn_style == CONFIRM_AND_DONE) {
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_fn->Hide();
} else if (style == DONE_AND_RETRY) {
m_button_retry->Show();
m_button_fn->Show();
m_button_cancel->Hide();
}
else {
m_button_retry->Hide();
m_button_cancel->Hide();
m_button_fn->Hide();
@ -734,7 +740,7 @@ void SecondaryCheckDialog::update_title_style(wxString title, SecondaryCheckDial
m_button_fn->Hide();
m_button_retry->Hide();
}
else if (style == CONFIRM_AND_FUNC) {
else if (style == CONFIRM_AND_DONE) {
m_button_cancel->Hide();
m_button_fn->Show();
m_button_retry->Hide();
@ -742,6 +748,12 @@ void SecondaryCheckDialog::update_title_style(wxString title, SecondaryCheckDial
else if (style == CONFIRM_AND_RETRY) {
m_button_retry->Show();
m_button_cancel->Hide();
m_button_fn->Hide();
}
else if (style == DONE_AND_RETRY) {
m_button_retry->Show();
m_button_fn->Show();
m_button_cancel->Hide();
}
else {
m_button_retry->Hide();
@ -753,12 +765,6 @@ void SecondaryCheckDialog::update_title_style(wxString title, SecondaryCheckDial
Layout();
}
void SecondaryCheckDialog::update_func_btn(wxString func_btn_text)
{
m_button_fn->SetLabel(func_btn_text);
rescale();
}
void SecondaryCheckDialog::update_btn_label(wxString ok_btn_text, wxString cancel_btn_text)
{
m_button_ok->SetLabel(ok_btn_text);

View file

@ -40,7 +40,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_DONE, wxCommandEvent);
wxDECLARE_EVENT(EVT_SECONDARY_CHECK_RETRY, wxCommandEvent);
class ReleaseNoteDialog : public DPIDialog
@ -107,9 +107,10 @@ public:
enum ButtonStyle {
ONLY_CONFIRM = 0,
CONFIRM_AND_CANCEL = 1,
CONFIRM_AND_FUNC = 2,
CONFIRM_AND_DONE = 2,
CONFIRM_AND_RETRY = 3,
MAX_STYLE_NUM = 4
DONE_AND_RETRY = 4,
MAX_STYLE_NUM = 5
};
SecondaryCheckDialog(
wxWindow* parent,
@ -126,13 +127,15 @@ public:
void on_hide();
void update_btn_label(wxString ok_btn_text, wxString cancel_btn_text);
void update_title_style(wxString title, SecondaryCheckDialog::ButtonStyle style, wxWindow* parent = nullptr);
void update_func_btn(wxString func_btn_text);
void post_event(wxCommandEvent&& event);
void rescale();
~SecondaryCheckDialog();
void on_dpi_changed(const wxRect& suggested_rect);
void msw_rescale();
StateColor btn_bg_green;
StateColor btn_bg_white;
Label* m_staticText_release_note {nullptr};
wxBoxSizer* m_sizer_main;
wxScrolledWindow *m_vebview_release_note {nullptr};

View file

@ -1654,7 +1654,7 @@ StatusPanel::StatusPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, co
Bind(EVT_AMS_GUIDE_WIKI, &StatusPanel::on_ams_guide, this);
Bind(EVT_AMS_RETRY, &StatusPanel::on_ams_retry, this);
Bind(EVT_FAN_CHANGED, &StatusPanel::on_fan_changed, this);
Bind(EVT_SECONDARY_CHECK_FUNC, &StatusPanel::on_print_error_func, this);
Bind(EVT_SECONDARY_CHECK_DONE, &StatusPanel::on_print_error_done, 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);
@ -2024,9 +2024,12 @@ void StatusPanel::show_error_message(MachineObject* obj, wxString msg, std::stri
if (m_print_error_dlg == nullptr) {
m_print_error_dlg = new SecondaryCheckDialog(this->GetParent(), wxID_ANY, _L("Warning"), SecondaryCheckDialog::ButtonStyle::ONLY_CONFIRM);
}
if (it_done != message_containing_done.end()) {
m_print_error_dlg->update_func_btn(_L("Done"));
m_print_error_dlg->update_title_style(_L("Warning"), SecondaryCheckDialog::ButtonStyle::CONFIRM_AND_FUNC, this);
if (it_done != message_containing_done.end() && it_retry != message_containing_retry.end()) {
m_print_error_dlg->update_title_style(_L("Warning"), SecondaryCheckDialog::ButtonStyle::DONE_AND_RETRY, this);
}
else if (it_done != message_containing_done.end()) {
m_print_error_dlg->update_title_style(_L("Warning"), SecondaryCheckDialog::ButtonStyle::CONFIRM_AND_DONE, this);
}
else if (it_retry != message_containing_retry.end()) {
m_print_error_dlg->update_title_style(_L("Warning"), SecondaryCheckDialog::ButtonStyle::CONFIRM_AND_RETRY, this);
@ -3513,9 +3516,9 @@ void StatusPanel::on_ams_retry(wxCommandEvent& event)
}
}
void StatusPanel::on_print_error_func(wxCommandEvent& event)
void StatusPanel::on_print_error_done(wxCommandEvent& event)
{
BOOST_LOG_TRIVIAL(info) << "on_print_error_func";
BOOST_LOG_TRIVIAL(info) << "on_print_error_done";
if (obj) {
obj->command_ams_control("done");
if (m_print_error_dlg) {

View file

@ -537,7 +537,7 @@ protected:
void on_ams_selected(wxCommandEvent &event);
void on_ams_guide(wxCommandEvent &event);
void on_ams_retry(wxCommandEvent &event);
void on_print_error_func(wxCommandEvent& event);
void on_print_error_done(wxCommandEvent& event);
void on_fan_changed(wxCommandEvent& event);
void on_cham_temp_kill_focus(wxFocusEvent& event);