mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 19:33:47 +00:00
FIX: delete old error code
Jira: [STUDIO-14160] Change-Id: I70b2928ffcf84fa864e0906efb079857b3e69e81 (cherry picked from commit f2e5ed1a1aaaa6a1c17637377dd65e48e09591c8)
This commit is contained in:
@@ -14,33 +14,14 @@ static std::unordered_set<std::string> message_containing_retry{
|
|||||||
"0701-8004",
|
"0701-8004",
|
||||||
"0701-8005",
|
"0701-8005",
|
||||||
"0701-8006",
|
"0701-8006",
|
||||||
"0701-8006",
|
|
||||||
"0701-8007",
|
"0701-8007",
|
||||||
"0700-8012",
|
|
||||||
"0701-8012",
|
"0701-8012",
|
||||||
"0702-8012",
|
"0702-8012",
|
||||||
"0703-8012",
|
"0703-8012",
|
||||||
"07FF-8003",
|
|
||||||
"07FF-8004",
|
|
||||||
"07FF-8005",
|
|
||||||
"07FF-8006",
|
|
||||||
"07FF-8007",
|
|
||||||
"07FF-8010",
|
|
||||||
"07FF-8011",
|
|
||||||
"07FF-8012",
|
"07FF-8012",
|
||||||
"07FF-8013",
|
"07FF-8013",
|
||||||
"12FF-8007",
|
|
||||||
"1200-8006"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::unordered_set<std::string> message_containing_done{
|
|
||||||
"07FF-8007",
|
|
||||||
"12FF-8007"
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::unordered_set<std::string> message_containing_resume{
|
|
||||||
"0300-8013"
|
|
||||||
};
|
|
||||||
|
|
||||||
DeviceErrorDialog::DeviceErrorDialog(MachineObject* obj, wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style)
|
DeviceErrorDialog::DeviceErrorDialog(MachineObject* obj, wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style)
|
||||||
:DPIDialog(parent, id, title, pos, size, style), m_obj(obj)
|
:DPIDialog(parent, id, title, pos, size, style), m_obj(obj)
|
||||||
@@ -206,6 +187,17 @@ void DeviceErrorDialog::on_dpi_changed(const wxRect& suggested_rect)
|
|||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxString DeviceErrorDialog::parse_error_level(int error_code)
|
||||||
|
{
|
||||||
|
int level = (error_code & 0x0000F000) >> 12;
|
||||||
|
switch (level) {
|
||||||
|
case 0x4: return _L("Error");
|
||||||
|
case 0x8: return _L("Warning");
|
||||||
|
case 0xC: return _L("Info");
|
||||||
|
default: return _L("Unknown");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static const std::unordered_set<string> s_jump_liveview_error_codes = { "0300-8003", "0300-8002", "0300-800A"};
|
static const std::unordered_set<string> s_jump_liveview_error_codes = { "0300-8003", "0300-8002", "0300-800A"};
|
||||||
wxString DeviceErrorDialog::show_error_code(int error_code)
|
wxString DeviceErrorDialog::show_error_code(int error_code)
|
||||||
{
|
{
|
||||||
@@ -219,13 +211,16 @@ wxString DeviceErrorDialog::show_error_code(int error_code)
|
|||||||
wxString error_msg = wxGetApp().get_hms_query()->query_print_error_msg(m_obj, error_code);
|
wxString error_msg = wxGetApp().get_hms_query()->query_print_error_msg(m_obj, error_code);
|
||||||
if (error_msg.IsEmpty()) { error_msg = _L("Unknown error.");}
|
if (error_msg.IsEmpty()) { error_msg = _L("Unknown error.");}
|
||||||
|
|
||||||
|
/* parse error level */
|
||||||
|
wxString error_level = parse_error_level(error_code);
|
||||||
|
|
||||||
/* error_str is old error code*/
|
/* error_str is old error code*/
|
||||||
if (message_containing_retry.count(error_str) || message_containing_done.count(error_str) || message_containing_resume.count(error_str)) {
|
if (message_containing_retry.count(error_str)) {
|
||||||
/* convert old error code to pseudo buttons*/
|
/* convert old error code to pseudo buttons*/
|
||||||
std::vector<int> pseudo_button = convert_to_pseudo_buttons(error_str);
|
std::vector<int> pseudo_button = convert_to_pseudo_buttons(error_str);
|
||||||
|
|
||||||
/* do update*/
|
/* do update*/
|
||||||
update_contents(_L("Warning"), error_msg, error_str, wxEmptyString, pseudo_button);
|
update_contents(error_level, error_msg, error_str, wxEmptyString, pseudo_button);
|
||||||
} else {
|
} else {
|
||||||
/* action buttons*/
|
/* action buttons*/
|
||||||
std::vector<int> used_button;
|
std::vector<int> used_button;
|
||||||
@@ -233,7 +228,7 @@ wxString DeviceErrorDialog::show_error_code(int error_code)
|
|||||||
if (s_jump_liveview_error_codes.count(error_str)) { used_button.emplace_back(DeviceErrorDialog::JUMP_TO_LIVEVIEW); } // special case
|
if (s_jump_liveview_error_codes.count(error_str)) { used_button.emplace_back(DeviceErrorDialog::JUMP_TO_LIVEVIEW); } // special case
|
||||||
|
|
||||||
/* do update*/
|
/* do update*/
|
||||||
update_contents(_L("Error"), error_msg, error_str, error_image_url, used_button);
|
update_contents(error_level, error_msg, error_str, error_image_url, used_button);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGetApp().UpdateDlgDarkUI(this);
|
wxGetApp().UpdateDlgDarkUI(this);
|
||||||
@@ -248,22 +243,9 @@ wxString DeviceErrorDialog::show_error_code(int error_code)
|
|||||||
std::vector<int> DeviceErrorDialog::convert_to_pseudo_buttons(std::string error_str)
|
std::vector<int> DeviceErrorDialog::convert_to_pseudo_buttons(std::string error_str)
|
||||||
{
|
{
|
||||||
std::vector<int> pseudo_button;
|
std::vector<int> pseudo_button;
|
||||||
if (message_containing_done.count(error_str) && message_containing_retry.count(error_str)) {
|
|
||||||
pseudo_button.emplace_back(DBL_CHECK_RETRY);
|
pseudo_button.emplace_back(DBL_CHECK_RETRY);
|
||||||
pseudo_button.emplace_back(DBL_CHECK_DONE);
|
pseudo_button.emplace_back(DBL_CHECK_OK);
|
||||||
pseudo_button.emplace_back(DBL_CHECK_OK);
|
|
||||||
} else if (message_containing_done.count(error_str)) {
|
|
||||||
pseudo_button.emplace_back(DBL_CHECK_DONE);
|
|
||||||
pseudo_button.emplace_back(DBL_CHECK_OK);
|
|
||||||
} else if (message_containing_retry.count(error_str)) {
|
|
||||||
pseudo_button.emplace_back(DBL_CHECK_RETRY);
|
|
||||||
pseudo_button.emplace_back(DBL_CHECK_OK);
|
|
||||||
} else if (message_containing_resume.count(error_str)) {
|
|
||||||
pseudo_button.emplace_back(DBL_CHECK_RESUME);
|
|
||||||
pseudo_button.emplace_back(DBL_CHECK_OK);
|
|
||||||
} else {
|
|
||||||
pseudo_button.emplace_back(DBL_CHECK_OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pseudo_button;
|
return pseudo_button;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ protected:
|
|||||||
void init_button_list();
|
void init_button_list();
|
||||||
void init_button(ActionButton style, wxString buton_text);
|
void init_button(ActionButton style, wxString buton_text);
|
||||||
|
|
||||||
|
wxString parse_error_level(int error_code);
|
||||||
std::vector<int> convert_to_pseudo_buttons(std::string error_str);
|
std::vector<int> convert_to_pseudo_buttons(std::string error_str);
|
||||||
|
|
||||||
void update_contents(const wxString& title, const wxString& text, const wxString& error_code,const wxString& image_url, const std::vector<int>& btns);
|
void update_contents(const wxString& title, const wxString& text, const wxString& error_code,const wxString& image_url, const std::vector<int>& btns);
|
||||||
|
|||||||
Reference in New Issue
Block a user