ENH: HMS add action 39; modify display of 29

JIRA: [STUDIO-13191]
Change-Id: I411fb4c56b395d576aaca7b610aa613e4f6cf806
(cherry picked from commit 45f756d5353f84814a2c7baa3290879a7bef3d6f)
This commit is contained in:
xin.zhang 2025-07-24 11:18:06 +08:00 committed by Noisyfox
parent 6121a420f1
commit b39bc5bf8f
5 changed files with 36 additions and 7 deletions

View file

@ -156,7 +156,7 @@ void DeviceErrorDialog::init_button_list()
init_button(IGNORE_NO_REMINDER_NEXT_TIME, _L("Ignore. Don't Remind Next Time"));
init_button(IGNORE_RESUME, _L("Ignore this and Resume"));
init_button(PROBLEM_SOLVED_RESUME, _L("Problem Solved and Resume"));
init_button(STOP_BUZZER, _L("Stop Buzzer"));
init_button(TURN_OFF_FIRE_ALARM, _L("Got it, Turn off the Fire Alarm."));
init_button(RETRY_PROBLEM_SOLVED, _L("Retry (problem solved)"));
init_button(STOP_DRYING, _L("Stop Drying"));
}
@ -206,9 +206,12 @@ void DeviceErrorDialog::update_contents(const wxString& text, const wxString& er
m_used_button.clear();
// Show the used buttons
bool need_remove_close_btn = false;
std::unordered_set<int> shown_btns;
for (int button_id : btns)
{
need_remove_close_btn |= (button_id == REMOVE_CLOSE_BTN); // special case, do not show close button
auto iter = m_button_list.find(button_id);
if (iter != m_button_list.end())
{
@ -218,6 +221,16 @@ void DeviceErrorDialog::update_contents(const wxString& text, const wxString& er
}
}
// Special case, do not show close button
if (need_remove_close_btn)
{
SetWindowStyle(GetWindowStyle() & ~wxCLOSE_BOX);
}
else
{
SetWindowStyle(GetWindowStyle() | wxCLOSE_BOX);
}
// Hide unused buttons
for (const auto& pair : m_button_list)
{
@ -355,7 +368,7 @@ void DeviceErrorDialog::on_button_click(ActionButton btn_id)
m_obj->command_hms_resume(std::to_string(m_error_code), m_obj->job_id_);
break;
}
case DeviceErrorDialog::STOP_BUZZER: {
case DeviceErrorDialog::TURN_OFF_FIRE_ALARM: {
m_obj->command_stop_buzzer();
break;
}

View file

@ -38,10 +38,11 @@ public:
//LOAD_FILAMENT = 26*/
IGNORE_RESUME = 27,
PROBLEM_SOLVED_RESUME = 28,
STOP_BUZZER = 29,
TURN_OFF_FIRE_ALARM = 29,
RETRY_PROBLEM_SOLVED = 34,
STOP_DRYING = 35,
REMOVE_CLOSE_BTN = 39, // special case, do not show close button
ERROR_BUTTON_COUNT
};

View file

@ -1072,17 +1072,31 @@ void PrintErrorDialog::update_title_style(wxString title, std::vector<int> butto
m_button_list[used_button_id]->Hide();
}
}
m_sizer_button->Clear();
m_used_button = button_style;
bool need_remove_close_btn = false;
for (int button_id : button_style) {
if (m_button_list.find(button_id) != m_button_list.end()) {
m_sizer_button->Add(m_button_list[button_id], 0, wxALL, FromDIP(5));
m_button_list[button_id]->Show();
}
need_remove_close_btn |= (button_id == REMOVE_CLOSE_BTN); // special case, do not show close button
}
// Special case, do not show close button
if (need_remove_close_btn)
{
SetWindowStyle(GetWindowStyle() & ~wxCLOSE_BOX);
}
else
{
SetWindowStyle(GetWindowStyle() | wxCLOSE_BOX);
}
Layout();
Fit();
}
void PrintErrorDialog::init_button(PrintErrorButton style,wxString buton_text)
@ -1124,7 +1138,7 @@ void PrintErrorDialog::init_button_list()
init_button(IGNORE_NO_REMINDER_NEXT_TIME, _L("Ignore. Don't Remind Next Time"));
init_button(IGNORE_RESUME, _L("Ignore this and Resume"));
init_button(PROBLEM_SOLVED_RESUME, _L("Problem Solved and Resume"));
init_button(STOP_BUZZER, _L("Stop Buzzer"));
init_button(TURN_OFF_FIRE_ALARM, _L("Got it, Turn off the Fire Alarm."));
init_button(RETRY_PROBLEM_SOLVED, _L("Retry (problem solved)"));
init_button(STOP_DRYING, _L("Stop Drying"));
}

View file

@ -185,10 +185,11 @@ public:
//LOAD_FILAMENT = 26*/
IGNORE_RESUME = 27,
PROBLEM_SOLVED_RESUME = 28,
STOP_BUZZER = 29,
TURN_OFF_FIRE_ALARM = 29,
RETRY_PROBLEM_SOLVED = 34,
STOP_DRYING = 35,
REMOVE_CLOSE_BTN = 39, // special case, do not show close button
ERROR_BUTTON_COUNT
};

View file

@ -4764,7 +4764,7 @@ void StatusPanel::on_print_error_dlg_btn_clicked(wxCommandEvent& event)
obj->command_hms_resume(std::to_string(before_error_code), obj->job_id_);
break;
}
case Slic3r::GUI::PrintErrorDialog::STOP_BUZZER: {
case Slic3r::GUI::PrintErrorDialog::TURN_OFF_FIRE_ALARM: {
obj->command_stop_buzzer();
break;
}