mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 17:27:52 -06:00
ENH:Show ErrorCode to the Device screen
Change-Id: I481b08a439d07a99f6c06c558e0a7fb3467a7d51
This commit is contained in:
parent
6eb4d671b5
commit
7a041ac2a0
11 changed files with 322 additions and 16 deletions
|
@ -44,6 +44,41 @@ static const std::string MODELS_STR = "models";
|
||||||
const std::string AppConfig::SECTION_FILAMENTS = "filaments";
|
const std::string AppConfig::SECTION_FILAMENTS = "filaments";
|
||||||
const std::string AppConfig::SECTION_MATERIALS = "sla_materials";
|
const std::string AppConfig::SECTION_MATERIALS = "sla_materials";
|
||||||
|
|
||||||
|
std::string AppConfig::get_langauge_code()
|
||||||
|
{
|
||||||
|
std::string get_lang = get("language");
|
||||||
|
if (get_lang.empty()) return "";
|
||||||
|
|
||||||
|
if (get_lang == "zh_CN")
|
||||||
|
{
|
||||||
|
get_lang = "zh-cn";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (get_lang.length() >= 2) { get_lang = get_lang.substr(0, 2); }
|
||||||
|
}
|
||||||
|
|
||||||
|
return get_lang;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string AppConfig::get_hms_host()
|
||||||
|
{
|
||||||
|
std::string sel = get("iot_environment");
|
||||||
|
std::string host = "";
|
||||||
|
#if !BBL_RELEASE_TO_PUBLIC
|
||||||
|
if (sel == ENV_DEV_HOST)
|
||||||
|
host = "e-dev.bambu-lab.com";
|
||||||
|
else if (sel == ENV_QAT_HOST)
|
||||||
|
host = "e-qa.bambu-lab.com";
|
||||||
|
else if (sel == ENV_PRE_HOST)
|
||||||
|
host = "e-pre.bambu-lab.com";
|
||||||
|
else if (sel == ENV_PRODUCT_HOST)
|
||||||
|
host = "e.bambulab.com";
|
||||||
|
return host;
|
||||||
|
#else
|
||||||
|
return "e.bambulab.com";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void AppConfig::reset()
|
void AppConfig::reset()
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,6 +39,9 @@ public:
|
||||||
this->reset();
|
this->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string get_langauge_code();
|
||||||
|
std::string get_hms_host();
|
||||||
|
|
||||||
// Clear and reset to defaults.
|
// Clear and reset to defaults.
|
||||||
void reset();
|
void reset();
|
||||||
// Override missing or keys with their defaults.
|
// Override missing or keys with their defaults.
|
||||||
|
|
|
@ -68,6 +68,8 @@ set(SLIC3R_GUI_SOURCES
|
||||||
GUI/Widgets/SideTools.hpp
|
GUI/Widgets/SideTools.hpp
|
||||||
GUI/Widgets/WebView.cpp
|
GUI/Widgets/WebView.cpp
|
||||||
GUI/Widgets/WebView.hpp
|
GUI/Widgets/WebView.hpp
|
||||||
|
GUI/Widgets/wxStaticText2.cpp
|
||||||
|
GUI/Widgets/wxStaticText2.hpp
|
||||||
GUI/AboutDialog.cpp
|
GUI/AboutDialog.cpp
|
||||||
GUI/AboutDialog.hpp
|
GUI/AboutDialog.hpp
|
||||||
GUI/AuxiliaryDialog.cpp
|
GUI/AuxiliaryDialog.cpp
|
||||||
|
@ -213,6 +215,8 @@ set(SLIC3R_GUI_SOURCES
|
||||||
GUI/MonitorPage.hpp
|
GUI/MonitorPage.hpp
|
||||||
GUI/StatusPanel.cpp
|
GUI/StatusPanel.cpp
|
||||||
GUI/StatusPanel.hpp
|
GUI/StatusPanel.hpp
|
||||||
|
GUI/UpdateErrorMessage.cpp
|
||||||
|
GUI/UpdateErrorMessage.hpp
|
||||||
GUI/SliceInfoPanel.cpp
|
GUI/SliceInfoPanel.cpp
|
||||||
GUI/SliceInfoPanel.hpp
|
GUI/SliceInfoPanel.hpp
|
||||||
GUI/CameraPopup.cpp
|
GUI/CameraPopup.cpp
|
||||||
|
|
|
@ -336,6 +336,7 @@ MachineObject::MachineObject(NetworkAgent* agent, std::string name, std::string
|
||||||
/* printing */
|
/* printing */
|
||||||
mc_print_stage = 0;
|
mc_print_stage = 0;
|
||||||
mc_print_error_code = 0;
|
mc_print_error_code = 0;
|
||||||
|
print_error = 0;
|
||||||
mc_print_line_number = 0;
|
mc_print_line_number = 0;
|
||||||
mc_print_percent = 0;
|
mc_print_percent = 0;
|
||||||
mc_print_sub_stage = 0;
|
mc_print_sub_stage = 0;
|
||||||
|
@ -1680,8 +1681,6 @@ int MachineObject::parse_json(std::string payload)
|
||||||
mc_print_stage = jj["mc_print_stage"].get<int>();
|
mc_print_stage = jj["mc_print_stage"].get<int>();
|
||||||
}
|
}
|
||||||
if (jj.contains("mc_print_error_code")) {
|
if (jj.contains("mc_print_error_code")) {
|
||||||
if (jj["mc_print_error_code"].is_string())
|
|
||||||
mc_print_error_code = atoi(jj["mc_print_error_code"].get<std::string>().c_str());
|
|
||||||
if (jj["mc_print_error_code"].is_number())
|
if (jj["mc_print_error_code"].is_number())
|
||||||
mc_print_error_code = jj["mc_print_error_code"].get<int>();
|
mc_print_error_code = jj["mc_print_error_code"].get<int>();
|
||||||
|
|
||||||
|
@ -1690,6 +1689,11 @@ int MachineObject::parse_json(std::string payload)
|
||||||
if (jj["mc_print_line_number"].is_string() && !jj["mc_print_line_number"].is_null())
|
if (jj["mc_print_line_number"].is_string() && !jj["mc_print_line_number"].is_null())
|
||||||
mc_print_line_number = atoi(jj["mc_print_line_number"].get<std::string>().c_str());
|
mc_print_line_number = atoi(jj["mc_print_line_number"].get<std::string>().c_str());
|
||||||
}
|
}
|
||||||
|
if (jj.contains("print_error")) {
|
||||||
|
if (jj["print_error"].is_number())
|
||||||
|
print_error = jj["print_error"].get<int>();
|
||||||
|
}
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
#pragma region print_task
|
#pragma region print_task
|
||||||
|
@ -1750,6 +1754,8 @@ int MachineObject::parse_json(std::string payload)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
#pragma region status
|
#pragma region status
|
||||||
|
|
|
@ -426,6 +426,7 @@ public:
|
||||||
int mc_left_time; /* left time in seconds */
|
int mc_left_time; /* left time in seconds */
|
||||||
int last_mc_print_stage;
|
int last_mc_print_stage;
|
||||||
bool is_system_printing();
|
bool is_system_printing();
|
||||||
|
int print_error;
|
||||||
|
|
||||||
std::vector<int> stage_list_info;
|
std::vector<int> stage_list_info;
|
||||||
int stage_curr = 0;
|
int stage_curr = 0;
|
||||||
|
|
|
@ -7,6 +7,10 @@
|
||||||
#include "BitmapCache.hpp"
|
#include "BitmapCache.hpp"
|
||||||
#include "GUI_App.hpp"
|
#include "GUI_App.hpp"
|
||||||
|
|
||||||
|
#include "slic3r/Utils/Http.hpp"
|
||||||
|
#include "libslic3r/Thread.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
#define TEMP_THRESHOLD_VAL 2
|
#define TEMP_THRESHOLD_VAL 2
|
||||||
|
@ -105,6 +109,7 @@ StatusBasePanel::StatusBasePanel(wxWindow *parent, wxWindowID id, const wxPoint
|
||||||
|
|
||||||
m_project_task_panel = new wxPanel(this);
|
m_project_task_panel = new wxPanel(this);
|
||||||
m_project_task_panel->SetBackgroundColour(*wxWHITE);
|
m_project_task_panel->SetBackgroundColour(*wxWHITE);
|
||||||
|
|
||||||
auto m_project_task_sizer = create_project_task_page(m_project_task_panel);
|
auto m_project_task_sizer = create_project_task_page(m_project_task_panel);
|
||||||
m_project_task_panel->SetSizer(m_project_task_sizer);
|
m_project_task_panel->SetSizer(m_project_task_sizer);
|
||||||
m_project_task_panel->Layout();
|
m_project_task_panel->Layout();
|
||||||
|
@ -145,7 +150,6 @@ StatusBasePanel::StatusBasePanel(wxWindow *parent, wxWindowID id, const wxPoint
|
||||||
m_panel_separotor_bottom->SetBackgroundColour(STATUS_PANEL_BG);
|
m_panel_separotor_bottom->SetBackgroundColour(STATUS_PANEL_BG);
|
||||||
|
|
||||||
bSizer_status->Add(m_panel_separotor_bottom, 0, wxEXPAND | wxALL, 0);
|
bSizer_status->Add(m_panel_separotor_bottom, 0, wxEXPAND | wxALL, 0);
|
||||||
|
|
||||||
this->SetSizerAndFit(bSizer_status);
|
this->SetSizerAndFit(bSizer_status);
|
||||||
this->Layout();
|
this->Layout();
|
||||||
}
|
}
|
||||||
|
@ -392,14 +396,11 @@ wxBoxSizer *StatusBasePanel::create_project_task_page(wxWindow *parent)
|
||||||
m_staticText_progress_percent->SetFont(::Label::Head_13);
|
m_staticText_progress_percent->SetFont(::Label::Head_13);
|
||||||
m_staticText_progress_percent->SetForegroundColour(wxColour(0, 174, 66));
|
m_staticText_progress_percent->SetForegroundColour(wxColour(0, 174, 66));
|
||||||
|
|
||||||
|
|
||||||
m_staticText_progress_left = new wxStaticText(penel_text, wxID_ANY, _L("N/A"), wxDefaultPosition, wxDefaultSize, 0);
|
m_staticText_progress_left = new wxStaticText(penel_text, wxID_ANY, _L("N/A"), wxDefaultPosition, wxDefaultSize, 0);
|
||||||
m_staticText_progress_left->Wrap(-1);
|
m_staticText_progress_left->Wrap(-1);
|
||||||
m_staticText_progress_left->SetFont(wxFont(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("HarmonyOS Sans SC")));
|
m_staticText_progress_left->SetFont(wxFont(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("HarmonyOS Sans SC")));
|
||||||
m_staticText_progress_left->SetForegroundColour(wxColour(146, 146, 146));
|
m_staticText_progress_left->SetForegroundColour(wxColour(146, 146, 146));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//fgSizer_task->Add(bSizer_buttons, 0, wxEXPAND, 0);
|
//fgSizer_task->Add(bSizer_buttons, 0, wxEXPAND, 0);
|
||||||
//fgSizer_task->Add(0, 0, 0, wxEXPAND, FromDIP(5));
|
//fgSizer_task->Add(0, 0, 0, wxEXPAND, FromDIP(5));
|
||||||
|
|
||||||
|
@ -417,7 +418,6 @@ wxBoxSizer *StatusBasePanel::create_project_task_page(wxWindow *parent)
|
||||||
penel_text->SetSizer(bSizer_text);
|
penel_text->SetSizer(bSizer_text);
|
||||||
penel_text->Layout();
|
penel_text->Layout();
|
||||||
|
|
||||||
|
|
||||||
bSizer_buttons->Add(penel_text, 1, wxEXPAND | wxALL, 0);
|
bSizer_buttons->Add(penel_text, 1, wxEXPAND | wxALL, 0);
|
||||||
bSizer_buttons->Add(panel_button_block, 0, wxALIGN_CENTER | wxALL, 0);
|
bSizer_buttons->Add(panel_button_block, 0, wxALIGN_CENTER | wxALL, 0);
|
||||||
|
|
||||||
|
@ -431,6 +431,37 @@ wxBoxSizer *StatusBasePanel::create_project_task_page(wxWindow *parent)
|
||||||
|
|
||||||
sizer->Add(m_printing_sizer, 0, wxEXPAND | wxALL, 0);
|
sizer->Add(m_printing_sizer, 0, wxEXPAND | wxALL, 0);
|
||||||
|
|
||||||
|
m_staticline = new wxPanel( parent, wxID_ANY);
|
||||||
|
m_staticline->SetBackgroundColour(wxColour(238,238,238));
|
||||||
|
m_staticline->Layout();
|
||||||
|
m_staticline->Hide();
|
||||||
|
|
||||||
|
sizer->Add(0, 0, 0, wxTOP, FromDIP(15));
|
||||||
|
sizer->Add(m_staticline, 0, wxEXPAND|wxALL, FromDIP(10));
|
||||||
|
|
||||||
|
m_panel_error_txt = new wxPanel(parent, wxID_ANY);
|
||||||
|
m_panel_error_txt->SetBackgroundColour(*wxWHITE);
|
||||||
|
|
||||||
|
wxBoxSizer *static_text_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
wxBoxSizer *text_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
|
||||||
|
m_error_text = new wxStaticText2(m_panel_error_txt);
|
||||||
|
m_error_text->SetForegroundColour(PAGE_TITLE_FONT_COL);
|
||||||
|
text_sizer->Add(m_error_text, 1, wxEXPAND|wxLEFT, FromDIP(17));
|
||||||
|
m_button_clean = new Button(m_panel_error_txt, _L("Clean"));
|
||||||
|
m_button_clean->SetBackgroundColor(abort_bg);
|
||||||
|
m_button_clean->SetBorderColor(abort_bd);
|
||||||
|
m_button_clean->SetTextColor(abort_text);
|
||||||
|
m_button_clean->SetFont(Label::Body_10);
|
||||||
|
m_button_clean->SetMinSize(TASK_BUTTON_SIZE2);
|
||||||
|
|
||||||
|
static_text_sizer->Add(text_sizer, 1, wxEXPAND|wxTOP, FromDIP(7));
|
||||||
|
static_text_sizer->Add( FromDIP(10), 0, 0, 0, 0 );
|
||||||
|
static_text_sizer->Add(m_button_clean, 0, wxALIGN_CENTRE_VERTICAL|wxRIGHT,FromDIP(5));
|
||||||
|
|
||||||
|
m_panel_error_txt->SetSizer(static_text_sizer);
|
||||||
|
m_panel_error_txt->Hide();
|
||||||
|
sizer->Add(m_panel_error_txt, 0, wxEXPAND | wxALL,0);
|
||||||
sizer->Add(0, FromDIP(12), 0);
|
sizer->Add(0, FromDIP(12), 0);
|
||||||
|
|
||||||
m_tasklist_sizer = new wxBoxSizer(wxVERTICAL);
|
m_tasklist_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
@ -563,7 +594,6 @@ wxBoxSizer *StatusBasePanel::create_temp_control(wxWindow *parent)
|
||||||
m_tempCtrl_frame->SetBorderColor(StateColor(std::make_pair(*wxWHITE, (int) StateColor::Disabled), std::make_pair(BUTTON_HOVER_COL, (int) StateColor::Focused),
|
m_tempCtrl_frame->SetBorderColor(StateColor(std::make_pair(*wxWHITE, (int) StateColor::Disabled), std::make_pair(BUTTON_HOVER_COL, (int) StateColor::Focused),
|
||||||
std::make_pair(BUTTON_HOVER_COL, (int) StateColor::Hovered), std::make_pair(*wxWHITE, (int) StateColor::Normal)));
|
std::make_pair(BUTTON_HOVER_COL, (int) StateColor::Hovered), std::make_pair(*wxWHITE, (int) StateColor::Normal)));
|
||||||
sizer->Add(m_tempCtrl_frame, 0, wxEXPAND | wxALL, 1);
|
sizer->Add(m_tempCtrl_frame, 0, wxEXPAND | wxALL, 1);
|
||||||
|
|
||||||
line = new StaticLine(parent);
|
line = new StaticLine(parent);
|
||||||
line->SetLineColour(STATIC_BOX_LINE_COL);
|
line->SetLineColour(STATIC_BOX_LINE_COL);
|
||||||
sizer->Add(line, 0, wxEXPAND | wxLEFT | wxRIGHT, 12);
|
sizer->Add(line, 0, wxEXPAND | wxLEFT | wxRIGHT, 12);
|
||||||
|
@ -916,6 +946,7 @@ StatusPanel::StatusPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, co
|
||||||
m_buttons.push_back(m_button_pause_resume);
|
m_buttons.push_back(m_button_pause_resume);
|
||||||
m_buttons.push_back(m_button_abort);
|
m_buttons.push_back(m_button_abort);
|
||||||
m_buttons.push_back(m_button_unload);
|
m_buttons.push_back(m_button_unload);
|
||||||
|
m_buttons.push_back(m_button_clean);
|
||||||
m_buttons.push_back(m_bpButton_z_10);
|
m_buttons.push_back(m_bpButton_z_10);
|
||||||
m_buttons.push_back(m_bpButton_z_1);
|
m_buttons.push_back(m_bpButton_z_1);
|
||||||
m_buttons.push_back(m_bpButton_z_down_1);
|
m_buttons.push_back(m_bpButton_z_down_1);
|
||||||
|
@ -924,7 +955,6 @@ StatusPanel::StatusPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, co
|
||||||
m_buttons.push_back(m_bpButton_e_down_10);
|
m_buttons.push_back(m_bpButton_e_down_10);
|
||||||
|
|
||||||
obj = nullptr;
|
obj = nullptr;
|
||||||
|
|
||||||
/* set default values */
|
/* set default values */
|
||||||
m_switch_lamp->SetValue(false);
|
m_switch_lamp->SetValue(false);
|
||||||
m_switch_printing_fan->SetValue(false);
|
m_switch_printing_fan->SetValue(false);
|
||||||
|
@ -953,6 +983,7 @@ StatusPanel::StatusPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, co
|
||||||
|
|
||||||
m_button_pause_resume->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_subtask_pause_resume), NULL, this);
|
m_button_pause_resume->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_subtask_pause_resume), NULL, this);
|
||||||
m_button_abort->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_subtask_abort), NULL, this);
|
m_button_abort->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_subtask_abort), NULL, this);
|
||||||
|
m_button_clean->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_subtask_clean), NULL, this);
|
||||||
m_tempCtrl_bed->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_bed_temp_kill_focus), NULL, this);
|
m_tempCtrl_bed->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_bed_temp_kill_focus), NULL, this);
|
||||||
m_tempCtrl_bed->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_bed_temp_set_focus), NULL, this);
|
m_tempCtrl_bed->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_bed_temp_set_focus), NULL, this);
|
||||||
m_tempCtrl_nozzle->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this);
|
m_tempCtrl_nozzle->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this);
|
||||||
|
@ -974,6 +1005,7 @@ StatusPanel::StatusPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, co
|
||||||
Bind(EVT_AMS_REFRESH_RFID, &StatusPanel::on_ams_refresh_rfid, this);
|
Bind(EVT_AMS_REFRESH_RFID, &StatusPanel::on_ams_refresh_rfid, this);
|
||||||
Bind(EVT_AMS_ON_SELECTED, &StatusPanel::on_ams_selected, this);
|
Bind(EVT_AMS_ON_SELECTED, &StatusPanel::on_ams_selected, this);
|
||||||
Bind(EVT_AMS_ON_FILAMENT_EDIT, &StatusPanel::on_filament_edit, this);
|
Bind(EVT_AMS_ON_FILAMENT_EDIT, &StatusPanel::on_filament_edit, this);
|
||||||
|
Bind(EVT_UPDATE_ERROR_MESSAGE, &StatusPanel::on_update_error_message, this);
|
||||||
|
|
||||||
m_switch_speed->Connect(wxEVT_LEFT_DOWN, wxCommandEventHandler(StatusPanel::on_switch_speed), NULL, 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);
|
m_calibration_btn->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_start_calibration), NULL, this);
|
||||||
|
@ -987,6 +1019,7 @@ StatusPanel::~StatusPanel()
|
||||||
m_recording_button->Disconnect(wxEVT_LEFT_DOWN, wxMouseEventHandler(StatusPanel::on_switch_recording), NULL, this);
|
m_recording_button->Disconnect(wxEVT_LEFT_DOWN, wxMouseEventHandler(StatusPanel::on_switch_recording), NULL, this);
|
||||||
m_button_pause_resume->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_subtask_pause_resume), NULL, this);
|
m_button_pause_resume->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_subtask_pause_resume), NULL, this);
|
||||||
m_button_abort->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_subtask_abort), NULL, this);
|
m_button_abort->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_subtask_abort), NULL, this);
|
||||||
|
m_button_clean->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_subtask_clean), NULL, this);
|
||||||
m_tempCtrl_bed->Disconnect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_bed_temp_kill_focus), NULL, this);
|
m_tempCtrl_bed->Disconnect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_bed_temp_kill_focus), NULL, this);
|
||||||
m_tempCtrl_bed->Disconnect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_bed_temp_set_focus), NULL, this);
|
m_tempCtrl_bed->Disconnect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_bed_temp_set_focus), NULL, this);
|
||||||
m_tempCtrl_nozzle->Disconnect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this);
|
m_tempCtrl_nozzle->Disconnect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this);
|
||||||
|
@ -1014,6 +1047,8 @@ void StatusPanel::init_scaled_buttons()
|
||||||
m_button_pause_resume->SetCornerRadius(FromDIP(12));
|
m_button_pause_resume->SetCornerRadius(FromDIP(12));
|
||||||
m_button_abort->SetMinSize(wxSize(FromDIP(48), FromDIP(24)));
|
m_button_abort->SetMinSize(wxSize(FromDIP(48), FromDIP(24)));
|
||||||
m_button_abort->SetCornerRadius(FromDIP(12));
|
m_button_abort->SetCornerRadius(FromDIP(12));
|
||||||
|
m_button_clean->SetMinSize(wxSize(FromDIP(48), FromDIP(24)));
|
||||||
|
m_button_clean->SetCornerRadius(FromDIP(12));
|
||||||
m_button_unload->SetMinSize(wxSize(-1, FromDIP(24)));
|
m_button_unload->SetMinSize(wxSize(-1, FromDIP(24)));
|
||||||
m_button_unload->SetCornerRadius(FromDIP(10));
|
m_button_unload->SetCornerRadius(FromDIP(10));
|
||||||
m_bpButton_z_10->SetMinSize(Z_BUTTON_SIZE);
|
m_bpButton_z_10->SetMinSize(Z_BUTTON_SIZE);
|
||||||
|
@ -1066,6 +1101,7 @@ void StatusPanel::show_task_list_info(bool show)
|
||||||
m_tasklist_sizer->Hide(m_tasklist_caption_sizer);
|
m_tasklist_sizer->Hide(m_tasklist_caption_sizer);
|
||||||
}
|
}
|
||||||
Layout();
|
Layout();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusPanel::update_tasklist_info()
|
void StatusPanel::update_tasklist_info()
|
||||||
|
@ -1091,6 +1127,20 @@ void StatusPanel::on_subtask_abort(wxCommandEvent &event)
|
||||||
if (obj) obj->command_task_abort();
|
if (obj) obj->command_task_abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StatusPanel::error_info_reset()
|
||||||
|
{
|
||||||
|
m_error_text->SetLabel("");
|
||||||
|
before_error_code = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void StatusPanel::on_subtask_clean(wxCommandEvent &event)
|
||||||
|
{
|
||||||
|
m_staticline->Hide();
|
||||||
|
m_panel_error_txt->Hide();
|
||||||
|
m_panel_error_txt->GetParent()->Layout();
|
||||||
|
error_info_reset();
|
||||||
|
}
|
||||||
|
|
||||||
void StatusPanel::on_webrequest_state(wxWebRequestEvent &evt)
|
void StatusPanel::on_webrequest_state(wxWebRequestEvent &evt)
|
||||||
{
|
{
|
||||||
BOOST_LOG_TRIVIAL(trace) << "monitor: monitor_panel web request state = " << evt.GetState();
|
BOOST_LOG_TRIVIAL(trace) << "monitor: monitor_panel web request state = " << evt.GetState();
|
||||||
|
@ -1163,13 +1213,49 @@ void StatusPanel::update(MachineObject *obj)
|
||||||
calibration_dlg->update_machine_obj(obj);
|
calibration_dlg->update_machine_obj(obj);
|
||||||
}
|
}
|
||||||
calibration_dlg->update_cali(obj);
|
calibration_dlg->update_cali(obj);
|
||||||
|
|
||||||
|
if (print_options_dlg == nullptr) {
|
||||||
|
print_options_dlg = new PrintOptionsDialog(this);
|
||||||
|
print_options_dlg->update_machine_obj(obj);
|
||||||
|
} else {
|
||||||
|
print_options_dlg->update_machine_obj(obj);
|
||||||
|
}
|
||||||
|
print_options_dlg->update_options(obj);
|
||||||
|
update_error_message();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
upodate_camera_state(obj->has_recording(), obj->has_timelapse(), obj->has_sdcard());
|
upodate_camera_state(obj->has_recording(), obj->has_timelapse(), obj->has_sdcard());
|
||||||
m_machine_ctrl_panel->Thaw();
|
m_machine_ctrl_panel->Thaw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StatusPanel::on_update_error_message(wxCommandEvent &event)
|
||||||
|
{
|
||||||
|
m_error_text->SetLabel(event.GetString());
|
||||||
|
m_staticline->Show();
|
||||||
|
m_panel_error_txt->Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void StatusPanel::update_error_message()
|
||||||
|
{
|
||||||
|
if (obj->print_error <= 0) {
|
||||||
|
before_error_code = obj->print_error;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (before_error_code != obj->print_error) {
|
||||||
|
if (!get_error_message_thread) {
|
||||||
|
get_error_message_thread = new boost::thread(Slic3r::create_thread([&] {
|
||||||
|
std::string message = show_error_message(obj->print_error);
|
||||||
|
wxCommandEvent event(EVT_UPDATE_ERROR_MESSAGE);
|
||||||
|
event.SetString(wxString(message));
|
||||||
|
event.SetEventObject(this);
|
||||||
|
wxPostEvent(this, event);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
before_error_code = obj->print_error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void StatusPanel::show_printing_status(bool ctrl_area, bool temp_area)
|
void StatusPanel::show_printing_status(bool ctrl_area, bool temp_area)
|
||||||
{
|
{
|
||||||
if (!ctrl_area) {
|
if (!ctrl_area) {
|
||||||
|
@ -2113,6 +2199,9 @@ void StatusPanel::set_default()
|
||||||
m_ams_control->Hide();
|
m_ams_control->Hide();
|
||||||
m_ams_control->Reset();
|
m_ams_control->Reset();
|
||||||
clean_tasklist_info();
|
clean_tasklist_info();
|
||||||
|
m_staticline->Hide();
|
||||||
|
m_panel_error_txt->Hide();
|
||||||
|
error_info_reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusPanel::show_status(int status)
|
void StatusPanel::show_status(int status)
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
#include "Widgets/ProgressBar.hpp"
|
#include "Widgets/ProgressBar.hpp"
|
||||||
#include "Widgets/ImageSwitchButton.hpp"
|
#include "Widgets/ImageSwitchButton.hpp"
|
||||||
#include "Widgets/AMSControl.hpp"
|
#include "Widgets/AMSControl.hpp"
|
||||||
|
#include "UpdateErrorMessage.hpp"
|
||||||
|
#include "Widgets/wxStaticText2.hpp"
|
||||||
class StepIndicator;
|
class StepIndicator;
|
||||||
|
|
||||||
#define COMMAND_TIMEOUT_U0 15
|
#define COMMAND_TIMEOUT_U0 15
|
||||||
|
@ -119,6 +119,7 @@ protected:
|
||||||
Button * m_button_report;
|
Button * m_button_report;
|
||||||
Button * m_button_pause_resume;
|
Button * m_button_pause_resume;
|
||||||
Button * m_button_abort;
|
Button * m_button_abort;
|
||||||
|
Button * m_button_clean;
|
||||||
|
|
||||||
wxStaticText * m_text_tasklist_caption;
|
wxStaticText * m_text_tasklist_caption;
|
||||||
|
|
||||||
|
@ -165,6 +166,9 @@ protected:
|
||||||
wxBoxSizer * m_printing_sizer;
|
wxBoxSizer * m_printing_sizer;
|
||||||
wxBoxSizer * m_tasklist_sizer;
|
wxBoxSizer * m_tasklist_sizer;
|
||||||
wxBoxSizer * m_tasklist_caption_sizer;
|
wxBoxSizer * m_tasklist_caption_sizer;
|
||||||
|
wxPanel* m_panel_error_txt;
|
||||||
|
wxPanel* m_staticline;
|
||||||
|
wxStaticText2 * m_error_text;
|
||||||
wxStaticText* m_staticText_calibration_caption;
|
wxStaticText* m_staticText_calibration_caption;
|
||||||
wxStaticText* m_staticText_calibration_caption_top;
|
wxStaticText* m_staticText_calibration_caption_top;
|
||||||
wxStaticText* m_calibration_text;
|
wxStaticText* m_calibration_text;
|
||||||
|
@ -214,7 +218,7 @@ public:
|
||||||
wxBoxSizer *create_extruder_control(wxWindow *parent);
|
wxBoxSizer *create_extruder_control(wxWindow *parent);
|
||||||
|
|
||||||
void reset_temp_misc_control();
|
void reset_temp_misc_control();
|
||||||
|
int before_error_code = 0;
|
||||||
wxBoxSizer *create_ams_group(wxWindow *parent);
|
wxBoxSizer *create_ams_group(wxWindow *parent);
|
||||||
|
|
||||||
void show_ams_group(bool show = true);
|
void show_ams_group(bool show = true);
|
||||||
|
@ -240,7 +244,6 @@ protected:
|
||||||
bool m_start_loading_thumbnail = false;
|
bool m_start_loading_thumbnail = false;
|
||||||
bool m_load_sdcard_thumbnail = false;
|
bool m_load_sdcard_thumbnail = false;
|
||||||
wxWebRequest web_request;
|
wxWebRequest web_request;
|
||||||
|
|
||||||
bool bed_temp_input = false;
|
bool bed_temp_input = false;
|
||||||
bool nozzle_temp_input = false;
|
bool nozzle_temp_input = false;
|
||||||
int speed_lvl = 1; // 0 - 3
|
int speed_lvl = 1; // 0 - 3
|
||||||
|
@ -250,9 +253,8 @@ protected:
|
||||||
std::map<wxString, wxImage> img_list; // key: url, value: wxBitmap png Image
|
std::map<wxString, wxImage> img_list; // key: url, value: wxBitmap png Image
|
||||||
std::vector<Button *> m_buttons;
|
std::vector<Button *> m_buttons;
|
||||||
int last_status;
|
int last_status;
|
||||||
|
|
||||||
void init_scaled_buttons();
|
void init_scaled_buttons();
|
||||||
|
void update_error_message();
|
||||||
void create_tasklist_info();
|
void create_tasklist_info();
|
||||||
void clean_tasklist_info();
|
void clean_tasklist_info();
|
||||||
void show_task_list_info(bool show = true);
|
void show_task_list_info(bool show = true);
|
||||||
|
@ -260,6 +262,9 @@ protected:
|
||||||
|
|
||||||
void on_subtask_pause_resume(wxCommandEvent &event);
|
void on_subtask_pause_resume(wxCommandEvent &event);
|
||||||
void on_subtask_abort(wxCommandEvent &event);
|
void on_subtask_abort(wxCommandEvent &event);
|
||||||
|
void on_subtask_clean(wxCommandEvent &event);
|
||||||
|
void on_update_error_message(wxCommandEvent &event);
|
||||||
|
void error_info_reset();
|
||||||
|
|
||||||
/* axis control */
|
/* axis control */
|
||||||
void on_axis_ctrl_xy(wxCommandEvent &event);
|
void on_axis_ctrl_xy(wxCommandEvent &event);
|
||||||
|
@ -339,6 +344,7 @@ public:
|
||||||
long last_ams_version { -1 };
|
long last_ams_version { -1 };
|
||||||
|
|
||||||
std::vector<int> last_stage_list_info;
|
std::vector<int> last_stage_list_info;
|
||||||
|
boost::thread * get_error_message_thread{nullptr};
|
||||||
|
|
||||||
bool is_stage_list_info_changed(MachineObject* obj);
|
bool is_stage_list_info_changed(MachineObject* obj);
|
||||||
|
|
||||||
|
|
60
src/slic3r/GUI/UpdateErrorMessage.cpp
Normal file
60
src/slic3r/GUI/UpdateErrorMessage.cpp
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
#include "UpdateErrorMessage.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace Slic3r {
|
||||||
|
namespace GUI {
|
||||||
|
|
||||||
|
wxDEFINE_EVENT(EVT_UPDATE_ERROR_MESSAGE, wxCommandEvent);
|
||||||
|
|
||||||
|
std::string show_error_message(int error_code)
|
||||||
|
{
|
||||||
|
char buf[64];
|
||||||
|
std::string result_str = "";
|
||||||
|
std::sprintf(buf,"%08X",error_code);
|
||||||
|
std::string hms_host = wxGetApp().app_config->get_hms_host();
|
||||||
|
std::string get_lang = wxGetApp().app_config->get_langauge_code();
|
||||||
|
|
||||||
|
std::string url = (boost::format("https://%1%/query.php?lang=%2%&e=%3%")
|
||||||
|
%hms_host
|
||||||
|
%get_lang
|
||||||
|
%buf).str();
|
||||||
|
|
||||||
|
Slic3r::Http http = Slic3r::Http::get(url);
|
||||||
|
http.header("accept", "application/json")
|
||||||
|
.timeout_max(10)
|
||||||
|
.on_complete([get_lang, &result_str](std::string body, unsigned status) {
|
||||||
|
try {
|
||||||
|
json j = json::parse(body);
|
||||||
|
if (j.contains("result")) {
|
||||||
|
if (j["result"].get<int>() == 0) {
|
||||||
|
if (j.contains("data")) {
|
||||||
|
json jj = j["data"];
|
||||||
|
if (jj.contains("device_error")) {
|
||||||
|
if (jj["device_error"].contains(get_lang)) {
|
||||||
|
if (jj["device_error"][get_lang].size() > 0) {
|
||||||
|
if (!jj["device_error"][get_lang][0]["intro"].empty() || !jj["device_error"][get_lang][0]["ecode"].empty()) {
|
||||||
|
std::string error_info = jj["device_error"][get_lang][0]["intro"].get<std::string>();
|
||||||
|
std::string error_code = jj["device_error"][get_lang][0]["ecode"].get<std::string>();
|
||||||
|
error_code.insert(4, " ");
|
||||||
|
result_str = from_u8(error_info).ToStdString() + "[" + error_code + "]";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (...) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.on_error([](std::string body, std::string error, unsigned status) {
|
||||||
|
BOOST_LOG_TRIVIAL(trace) << boost::format("[BBL ErrorMessage]: status=%1%, error=%2%, body=%3%") % status % error % body;
|
||||||
|
}).perform_sync();
|
||||||
|
|
||||||
|
return result_str;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
26
src/slic3r/GUI/UpdateErrorMessage.hpp
Normal file
26
src/slic3r/GUI/UpdateErrorMessage.hpp
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#ifndef slic3r_UpdateErrorMessage_hpp_
|
||||||
|
#define slic3r_UpdateErrorMessage_hpp_
|
||||||
|
|
||||||
|
#include "GUI_App.hpp"
|
||||||
|
#include "GUI.hpp"
|
||||||
|
#include "I18N.hpp"
|
||||||
|
#include "Widgets/Label.hpp"
|
||||||
|
#include "Widgets/Button.hpp"
|
||||||
|
#include "Widgets/StepCtrl.hpp"
|
||||||
|
#include "BitmapCache.hpp"
|
||||||
|
#include "slic3r/Utils/Http.hpp"
|
||||||
|
#include "libslic3r/Thread.hpp"
|
||||||
|
|
||||||
|
namespace Slic3r {
|
||||||
|
namespace GUI {
|
||||||
|
|
||||||
|
|
||||||
|
std::string show_error_message(int error_code);
|
||||||
|
|
||||||
|
|
||||||
|
wxDECLARE_EVENT(EVT_UPDATE_ERROR_MESSAGE, wxCommandEvent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
54
src/slic3r/GUI/Widgets/wxStaticText2.cpp
Normal file
54
src/slic3r/GUI/Widgets/wxStaticText2.cpp
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
#include "wxStaticText2.hpp"
|
||||||
|
|
||||||
|
wxStaticText2::wxStaticText2() {}
|
||||||
|
|
||||||
|
wxStaticText2::wxStaticText2(wxWindow * parent,
|
||||||
|
wxWindowID id,
|
||||||
|
const wxPoint & pos,
|
||||||
|
const wxSize & size)
|
||||||
|
{
|
||||||
|
Create(parent, id, pos, size);
|
||||||
|
Bind(wxEVT_PAINT, &wxStaticText2::paintEvent, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxStaticText2::paintEvent(wxPaintEvent &evt)
|
||||||
|
{
|
||||||
|
auto size = GetSize();
|
||||||
|
wxPaintDC dc(this);
|
||||||
|
auto text_height = dc.GetCharHeight();
|
||||||
|
wxString out_txt = m_msg;
|
||||||
|
wxString count_txt = "";
|
||||||
|
int line_count = 1;
|
||||||
|
int new_line_pos = 0;
|
||||||
|
bool is_ch = false;
|
||||||
|
|
||||||
|
if (m_msg[0] > 0x80 && m_msg[1] > 0x80)is_ch = true;
|
||||||
|
|
||||||
|
for (int i = 0; i < m_msg.length(); i++) {
|
||||||
|
auto text_size = dc.GetTextExtent(count_txt);
|
||||||
|
if (text_size.x < (size.x)) {
|
||||||
|
count_txt += m_msg[i];
|
||||||
|
if (m_msg[i] == ' ' ||
|
||||||
|
m_msg[i] == ',' ||
|
||||||
|
m_msg[i] == '.' ||
|
||||||
|
m_msg[i] == '\n')
|
||||||
|
{
|
||||||
|
new_line_pos = i;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!is_ch)
|
||||||
|
{
|
||||||
|
out_txt[new_line_pos] = '\n';
|
||||||
|
i = new_line_pos;
|
||||||
|
} else {
|
||||||
|
out_txt.insert(i-1,'\n');
|
||||||
|
}
|
||||||
|
count_txt = "";
|
||||||
|
line_count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SetSize(wxSize(-1, line_count * text_height));
|
||||||
|
SetMinSize(wxSize(-1, line_count * text_height));
|
||||||
|
SetMaxSize(wxSize(-1, line_count * text_height));
|
||||||
|
dc.DrawText(out_txt, 0, 0);
|
||||||
|
}
|
22
src/slic3r/GUI/Widgets/wxStaticText2.hpp
Normal file
22
src/slic3r/GUI/Widgets/wxStaticText2.hpp
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
|
||||||
|
#ifndef _WX_STATTEXT2_H_
|
||||||
|
#define _WX_STATTEXT2_H_
|
||||||
|
|
||||||
|
#include "wx/stattext.h"
|
||||||
|
|
||||||
|
class WXDLLIMPEXP_CORE wxStaticText2 : public wxPanel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxString m_msg;
|
||||||
|
wxStaticText2();
|
||||||
|
wxStaticText2(wxWindow *parent,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxSize(200,200));
|
||||||
|
|
||||||
|
void paintEvent(wxPaintEvent &evt);
|
||||||
|
|
||||||
|
void SetLabel(wxString msg){m_msg = msg;};
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif
|
Loading…
Add table
Add a link
Reference in a new issue