ENH:display error msg when connecting to the printer fails

Change-Id: I483d6c00bdd623e34bce5b087bfbcb9a5e876fa3
This commit is contained in:
tao wang 2023-05-22 15:07:33 +08:00 committed by Lane.Wei
parent 4fd8a2b957
commit 6f2839b641
25 changed files with 378 additions and 127 deletions

View File

@ -0,0 +1,5 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g opacity="0.88">
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.4053 8.05654C11.6669 8.26376 12.0482 8.24649 12.2899 8.00474C12.5503 7.74439 12.5503 7.32228 12.2899 7.06193L8.51868 3.29069L8.46053 3.23889C8.19886 3.03167 7.81763 3.04894 7.57587 3.29069L3.80464 7.06193L3.75283 7.12008C3.54562 7.38176 3.56288 7.76299 3.80464 8.00474L3.86278 8.05654C4.12446 8.26376 4.50569 8.24649 4.74745 8.00474L8.04734 4.70491L11.3471 8.00474L11.4053 8.05654ZM11.4053 12.0565C11.6669 12.2638 12.0482 12.2465 12.2899 12.0047C12.5503 11.7444 12.5503 11.3223 12.2899 11.0619L8.51868 7.29069L8.46054 7.23889C8.19886 7.03167 7.81763 7.04894 7.57587 7.29069L3.80464 11.0619L3.75283 11.1201C3.54562 11.3818 3.56288 11.763 3.80464 12.0047L3.86278 12.0565C4.12446 12.2638 4.50569 12.2465 4.74745 12.0047L8.04734 8.70491L11.3471 12.0047L11.4053 12.0565Z" fill="white"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 962 B

View File

@ -0,0 +1,5 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g opacity="0.88">
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.59474 7.94346C4.33306 7.73624 3.95184 7.75351 3.71008 7.99526C3.44973 8.25561 3.44973 8.67772 3.71008 8.93807L7.48132 12.7093L7.53947 12.7611C7.80114 12.9683 8.18237 12.9511 8.42413 12.7093L12.1954 8.93807L12.2472 8.87992C12.4544 8.61824 12.4371 8.23701 12.1954 7.99526L12.1372 7.94346C11.8755 7.73624 11.4943 7.75351 11.2526 7.99526L7.95266 11.2951L4.65289 7.99526L4.59474 7.94346ZM4.59474 3.94346C4.33307 3.73624 3.95184 3.75351 3.71008 3.99526C3.44973 4.25561 3.44973 4.67772 3.71008 4.93807L7.48132 8.70931L7.53946 8.76111C7.80114 8.96833 8.18237 8.95106 8.42413 8.70931L12.1954 4.93807L12.2472 4.87992C12.4544 4.61824 12.4371 4.23701 12.1954 3.99526L12.1372 3.94346C11.8755 3.73624 11.4943 3.75351 11.2526 3.99526L7.95266 7.29509L4.65289 3.99526L4.59474 3.94346Z" fill="white"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 963 B

View File

@ -36,14 +36,26 @@ BBLStatusBarSend::BBLStatusBarSend(wxWindow *parent, int id)
m_prog->SetMinSize(wxSize(m_self->FromDIP(300),m_self->FromDIP(6)));
m_prog->SetValue(0);
StateColor btn_bd_white(std::pair<wxColour, int>(*wxWHITE, StateColor::Disabled), std::pair<wxColour, int>(wxColour(38, 46, 48), StateColor::Enabled));
//StateColor btn_bd_white(std::pair<wxColour, int>(*wxWHITE, StateColor::Disabled), std::pair<wxColour, int>(wxColour(38, 46, 48), StateColor::Enabled));
StateColor btn_bt_white(std::pair<wxColour, int>(wxColour(0x90, 0x90, 0x90), StateColor::Disabled),
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));
StateColor btn_bd_white(std::pair<wxColour, int>(wxColour(255, 255, 254), StateColor::Disabled),
std::pair<wxColour, int>(wxColour(38, 46, 48), StateColor::Enabled));
StateColor btn_txt_white(std::pair<wxColour, int>(wxColour("#FFFFFE"), StateColor::Disabled), std::pair<wxColour, int>(wxColour(38, 46, 48), StateColor::Normal));
m_cancelbutton = new Button(m_self, _L("Cancel"));
m_cancelbutton->SetSize(wxSize(m_self->FromDIP(58), m_self->FromDIP(22)));
m_cancelbutton->SetMinSize(wxSize(m_self->FromDIP(58), m_self->FromDIP(22)));
m_cancelbutton->SetMaxSize(wxSize(m_self->FromDIP(58), m_self->FromDIP(22)));
m_cancelbutton->SetBackgroundColor(wxColour(255, 255, 255));
m_cancelbutton->SetBackgroundColor(btn_bt_white);
m_cancelbutton->SetBorderColor(btn_bd_white);
m_cancelbutton->SetTextColor(btn_txt_white);
m_cancelbutton->SetCornerRadius(m_self->FromDIP(12));
m_cancelbutton->Bind(wxEVT_BUTTON,
[this](wxCommandEvent &evt) {
@ -332,6 +344,7 @@ void BBLStatusBarSend::reset()
m_static_bitmap_show_error->Hide();
m_prog->Show();
m_stext_percent->Show();
m_cancelbutton->Enable();
m_cancelbutton->Show();
m_was_cancelled = false;
@ -362,4 +375,14 @@ void BBLStatusBarSend::change_button_label(wxString name)
m_cancelbutton->SetLabel(name);
}
void BBLStatusBarSend::disable_cancel_button()
{
m_cancelbutton->Disable();
}
void BBLStatusBarSend::enable_cancel_button()
{
m_cancelbutton->Enable();
}
}

View File

@ -84,6 +84,8 @@ public:
void hide_cancel_button();
void change_button_label(wxString name);
void disable_cancel_button();
void enable_cancel_button();
private:
bool m_show_error_info_state = false;
bool m_busy = false;

View File

@ -39,7 +39,10 @@ wxString get_fail_reason(int code)
return _L("Failed to post ticket to server");
else if (code == BAMBU_NETWORK_ERR_BIND_PARSE_LOGIN_REPORT_FAILED)
return _L("Failed to parse login report reason");
return _L("Failed to parse login report reason");
else if (code == BAMBU_NETWORK_ERR_BIND_ECODE_LOGIN_REPORT_FAILED)
return _L("Failed to parse login report reason111");
else if (code == BAMBU_NETWORK_ERR_BIND_RECEIVE_LOGIN_REPORT_TIMEOUT)
return _L("Receive login report timeout");
@ -331,7 +334,7 @@ wxString get_fail_reason(int code)
m_link_network_state = new Label(m_sw_bind_failed_info, _L("Check the status of current system services"));
m_link_network_state->SetForegroundColour(0x00AE42);
m_link_network_state->SetFont(::Label::Body_12);
m_link_network_state->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {link_to_network_check(); });
m_link_network_state->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {wxGetApp().link_to_network_check(); });
m_link_network_state->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {m_link_network_state->SetCursor(wxCURSOR_HAND); });
m_link_network_state->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {m_link_network_state->SetCursor(wxCURSOR_ARROW); });
@ -486,33 +489,6 @@ wxString get_fail_reason(int code)
this->Disconnect(EVT_BIND_UPDATE_MESSAGE, wxCommandEventHandler(BindMachineDialog::on_update_message), NULL, this);
}
void BindMachineDialog::link_to_network_check()
{
std::string url;
std::string country_code = Slic3r::GUI::wxGetApp().app_config->get_country_code();
if (country_code == "US") {
url = "https://status.bambulab.com";
}
else if (country_code == "CN") {
url = "https://status.bambulab.cn";
}
else if (country_code == "ENV_CN_DEV") {
url = "https://status.bambu-lab.com";
}
else if (country_code == "ENV_CN_QA") {
url = "https://status.bambu-lab.com";
}
else if (country_code == "ENV_CN_PRE") {
url = "https://status.bambu-lab.com";
}
else {
url = "https://status.bambu-lab.com";
}
wxLaunchDefaultBrowser(url);
}
void BindMachineDialog::show_bind_failed_info(bool show, int code, wxString description, wxString extra)
{
if (show) {
@ -523,9 +499,9 @@ wxString get_fail_reason(int code)
m_st_txt_error_desc->SetLabelText( wxGetApp().filter_string(m_result_info));
m_st_txt_extra_info->SetLabelText( wxGetApp().filter_string(m_result_extra));
m_st_txt_error_code->Wrap(FromDIP(260));
m_st_txt_error_desc->Wrap(FromDIP(260));
m_st_txt_extra_info->Wrap(FromDIP(260));
m_st_txt_error_code->Wrap(FromDIP(330));
m_st_txt_error_desc->Wrap(FromDIP(330));
m_st_txt_extra_info->Wrap(FromDIP(330));
}
else {
m_sw_bind_failed_info->Show(false);

View File

@ -83,7 +83,6 @@ public:
BindMachineDialog(Plater *plater = nullptr);
~BindMachineDialog();
void link_to_network_check();
void show_bind_failed_info(bool show, int code = 0, wxString description = wxEmptyString, wxString extra = wxEmptyString);
void on_cancel(wxCommandEvent& event);
void on_bind_fail(wxCommandEvent &event);

View File

@ -149,7 +149,9 @@ void ConnectPrinterDialog::on_button_confirm(wxCommandEvent &event)
}
if (m_obj) {
m_obj->set_user_access_code(code.ToStdString());
wxGetApp().getDeviceManager()->set_selected_machine(m_obj->dev_id);
if (m_need_connect) {
wxGetApp().getDeviceManager()->set_selected_machine(m_obj->dev_id);
}
}
EndModal(wxID_OK);
}

View File

@ -25,6 +25,7 @@ class ConnectPrinterDialog : public DPIDialog
{
private:
protected:
bool m_need_connect{true};
wxStaticText * m_staticText_connection_code;
TextInput * m_textCtrl_code;
Button * m_button_confirm;
@ -45,6 +46,7 @@ public:
~ConnectPrinterDialog();
void go_connect_printer(bool need) {m_need_connect = need;};
void end_modal(wxStandardID id);
void init_bitmap();
void set_machine_object(MachineObject* obj);

View File

@ -1406,12 +1406,17 @@ void MachineObject::parse_version_func()
is_support_ams_humidity = true;
}
if (firmware_type == PrinterFirmwareType::FIRMWARE_TYPE_ENGINEER) {
/*if (firmware_type == PrinterFirmwareType::FIRMWARE_TYPE_ENGINEER) {
local_use_ssl_for_mqtt = false;
local_use_ssl_for_ftp = true;
}else {
}
else {
local_use_ssl_for_mqtt = ota_version->second.sw_ver.compare("01.03.01.04") >= 0;
local_use_ssl_for_ftp = true;
}*/
if (firmware_type == PrinterFirmwareType::FIRMWARE_TYPE_PRODUCTION) {
local_use_ssl_for_mqtt = ota_version->second.sw_ver.compare("01.03.01.04") >= 0;
}
is_support_remote_tunnel = true;
@ -1422,14 +1427,6 @@ void MachineObject::parse_version_func()
file_proto = 2;
}
} else if (printer_type == "C11") {
if (firmware_type == PrinterFirmwareType::FIRMWARE_TYPE_ENGINEER) {
local_use_ssl_for_mqtt = false;
local_use_ssl_for_ftp = false;
} else {
local_use_ssl_for_mqtt = true;
local_use_ssl_for_ftp = true;
}
is_cloud_print_only = true;
if (ota_version != module_vers.end()) {
is_support_send_to_sdcard = ota_version->second.sw_ver.compare("01.02.00.00") >= 0;
@ -4444,7 +4441,11 @@ bool DeviceManager::set_selected_machine(std::string dev_id, bool need_disconnec
if (m_agent) {
if (!need_disconnect) {m_agent->disconnect_printer();}
it->second->reset();
#if !BBL_RELEASE_TO_PUBLIC
it->second->connect(false, Slic3r::GUI::wxGetApp().app_config->get("enable_ssl_for_mqtt") == "true" ? true : false);
#else
it->second->connect(false, it->second->local_use_ssl_for_mqtt);
#endif
it->second->set_lan_mode_connection_state(true);
}
}
@ -4460,7 +4461,12 @@ bool DeviceManager::set_selected_machine(std::string dev_id, bool need_disconnec
}
} else {
it->second->reset();
#if !BBL_RELEASE_TO_PUBLIC
it->second->connect(false, Slic3r::GUI::wxGetApp().app_config->get("enable_ssl_for_mqtt") == "true" ? true : false);
#else
it->second->connect(false, it->second->local_use_ssl_for_mqtt);
#endif
it->second->set_lan_mode_connection_state(true);
}
}

View File

@ -1934,6 +1934,10 @@ void GUI_App::init_networking_callbacks()
event.SetInt(1);
event.SetString(obj->dev_id);
}
else if(msg == "5") {
event.SetInt(5);
event.SetString(obj->dev_id);
}
else {
event.SetInt(-2);
event.SetString(obj->dev_id);
@ -3243,6 +3247,33 @@ void GUI_App::set_side_menu_popup_status(bool status)
m_side_popup_status = status;
}
void GUI_App::link_to_network_check()
{
std::string url;
std::string country_code = app_config->get_country_code();
if (country_code == "US") {
url = "https://status.bambulab.com";
}
else if (country_code == "CN") {
url = "https://status.bambulab.cn";
}
else if (country_code == "ENV_CN_DEV") {
url = "https://status.bambu-lab.com";
}
else if (country_code == "ENV_CN_QA") {
url = "https://status.bambu-lab.com";
}
else if (country_code == "ENV_CN_PRE") {
url = "https://status.bambu-lab.com";
}
else {
url = "https://status.bambu-lab.com";
}
wxLaunchDefaultBrowser(url);
}
bool GUI_App::tabs_as_menu() const
{
return false;

View File

@ -353,6 +353,8 @@ public:
//update side popup status
bool get_side_menu_popup_status();
void set_side_menu_popup_status(bool status);
void link_to_network_check();
const wxColour& get_label_clr_modified(){ return m_color_label_modified; }
const wxColour& get_label_clr_sys() { return m_color_label_sys; }

View File

@ -106,6 +106,18 @@ void BindJob::process()
if (result < 0) {
BOOST_LOG_TRIVIAL(trace) << "login: result = " << result;
int error_code;
wxString error_msg;
try
{
error_code = stoi(result_info);
result_info = wxGetApp().get_hms_query()->query_print_error_msg(error_code).ToStdString();
}
catch (...) {
;
}
post_fail_event(result_code, result_info);
return;
}

View File

@ -182,7 +182,7 @@ void PrintJob::process()
params.password = m_access_code;
// check access code and ip address
if (this->connection_type == "lan") {
if (this->connection_type == "lan" && m_print_type == "from_normal") {
params.dev_id = m_dev_id;
params.project_name = "verify_job";
params.filename = job_data._temp_path.string();
@ -495,4 +495,10 @@ void PrintJob::on_check_ip_address_success(std::function<void()> func)
m_enter_ip_address_fun_success = func;
}
void PrintJob::connect_to_local_mqtt()
{
this->update_status(0, "1111111");
}
}} // namespace Slic3r::GUI

View File

@ -97,6 +97,7 @@ public:
void set_project_name(std::string name);
void on_check_ip_address_fail(std::function<void()> func);
void on_check_ip_address_success(std::function<void()> func);
void connect_to_local_mqtt();
};
}} // namespace Slic3r::GUI

View File

@ -171,7 +171,7 @@ MonitorPanel::~MonitorPanel()
wxBoxSizer *sizer_boxh = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *sizer_boxv = new wxBoxSizer(wxHORIZONTAL);*/
m_connection_info = new Button(this, "Failed to connect to the printer");
m_connection_info = new Button(this, wxEmptyString);
m_connection_info->SetBackgroundColor(wxColour(255, 111, 0));
m_connection_info->SetBorderColor(wxColour(255, 111, 0));
m_connection_info->SetTextColor(*wxWHITE);
@ -181,18 +181,139 @@ MonitorPanel::~MonitorPanel()
m_connection_info->SetMinSize(wxSize(FromDIP(-1), FromDIP(25)));
m_connection_info->SetMaxSize(wxSize(FromDIP(-1), FromDIP(25)));
wxBoxSizer* connection_sizer = new wxBoxSizer(wxVERTICAL);
m_hyperlink = new wxHyperlinkCtrl(m_connection_info, wxID_ANY, _L("Failed to connect to the server"), wxT("https://wiki.bambulab.com/en/software/bambu-studio/failed-to-connect-printer"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
connection_sizer->Add(m_hyperlink, 0, wxALIGN_CENTER | wxALL, 5);
m_hyperlink->SetBackgroundColour(wxColour(255, 111, 0));
m_connection_info->SetSizer(connection_sizer);
m_connection_info->Layout();
connection_sizer->Fit(m_connection_info);
wxBoxSizer* connection_sizer_V = new wxBoxSizer(wxVERTICAL);
wxBoxSizer* connection_sizer_H = new wxBoxSizer(wxHORIZONTAL);
m_hyperlink = new wxHyperlinkCtrl(m_connection_info, wxID_ANY, _L("Failed to connect to the server"), wxT("https://wiki.bambulab.com/en/software/bambu-studio/failed-to-connect-printer"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
m_hyperlink->SetBackgroundColour(wxColour(255, 111, 0));
m_more_err_open = ScalableBitmap(this, "monitir_err_open", 16);
m_more_err_close = ScalableBitmap(this, "monitir_err_close", 16);
m_more_button = new ScalableButton(m_connection_info, wxID_ANY, "monitir_err_open");
m_more_button->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_HAND); });
m_more_button->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_ARROW); });
m_more_button->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {
if (!m_more_err_state) {
m_more_button->SetBitmap(m_more_err_close.bmp());
Freeze();
m_side_error_panel->Show();
m_more_err_state = true;
m_tabpanel->Refresh();
m_tabpanel->Layout();
Thaw();
}
else {
m_more_button->SetBitmap(m_more_err_open.bmp());
Freeze();
m_side_error_panel->Hide();
m_more_err_state = false;
m_tabpanel->Refresh();
m_tabpanel->Layout();
Thaw();
}
});
connection_sizer_H->Add(m_hyperlink, 0, wxALIGN_CENTER | wxALL, 5);
connection_sizer_H->Add(m_more_button, 0, wxALIGN_CENTER | wxALL, 3);
connection_sizer_V->Add(connection_sizer_H, 0, wxALIGN_CENTER, 0);
m_connection_info->SetSizer(connection_sizer_V);
m_connection_info->Layout();
connection_sizer_V->Fit(m_connection_info);
m_side_error_panel = new wxWindow(this,wxID_ANY);
m_side_error_panel->SetBackgroundColour(wxColour(255,232,214));
m_side_error_panel->SetMinSize(wxSize(-1, -1));
m_side_error_panel->SetMaxSize(wxSize(-1, -1));
m_side_error_panel->Hide();
m_more_button->Hide();
m_connection_info->Hide();
wxBoxSizer* sizer_print_failed_info = new wxBoxSizer(wxVERTICAL);
m_side_error_panel->SetSizer(sizer_print_failed_info);
wxBoxSizer* sizer_error_code = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* sizer_error_desc = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* sizer_extra_info = new wxBoxSizer(wxHORIZONTAL);
m_link_network_state = new Label(m_side_error_panel, _L("Check cloud service status"), wxALIGN_CENTER_HORIZONTAL|wxST_ELLIPSIZE_END);
m_link_network_state->SetMinSize(wxSize(FromDIP(220), -1));
m_link_network_state->SetMaxSize(wxSize(FromDIP(220), -1));
m_link_network_state->SetForegroundColour(0x00AE42);
m_link_network_state->SetFont(::Label::Body_12);
m_link_network_state->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {wxGetApp().link_to_network_check(); });
m_link_network_state->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {m_link_network_state->SetCursor(wxCURSOR_HAND); });
m_link_network_state->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {m_link_network_state->SetCursor(wxCURSOR_ARROW); });
auto st_title_error_code = new wxStaticText(m_side_error_panel, wxID_ANY, _L("code"),wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END);
auto st_title_error_code_doc = new wxStaticText(m_side_error_panel, wxID_ANY, ": ");
m_st_txt_error_code = new Label(m_side_error_panel, wxEmptyString);
st_title_error_code->SetForegroundColour(0x909090);
st_title_error_code_doc->SetForegroundColour(0x909090);
m_st_txt_error_code->SetForegroundColour(0x909090);
st_title_error_code->SetFont(::Label::Body_12);
st_title_error_code_doc->SetFont(::Label::Body_12);
m_st_txt_error_code->SetFont(::Label::Body_12);
st_title_error_code->SetMinSize(wxSize(FromDIP(32), -1));
st_title_error_code->SetMaxSize(wxSize(FromDIP(32), -1));
m_st_txt_error_code->SetMinSize(wxSize(FromDIP(175), -1));
m_st_txt_error_code->SetMaxSize(wxSize(FromDIP(175), -1));
sizer_error_code->Add(st_title_error_code, 0, wxALL, 0);
sizer_error_code->Add(st_title_error_code_doc, 0, wxALL, 0);
sizer_error_code->Add(m_st_txt_error_code, 0, wxALL, 0);
auto st_title_error_desc = new wxStaticText(m_side_error_panel, wxID_ANY, wxT("desc"),wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END);
auto st_title_error_desc_doc = new wxStaticText(m_side_error_panel, wxID_ANY, ": ");
m_st_txt_error_desc = new Label(m_side_error_panel, wxEmptyString);
st_title_error_desc->SetForegroundColour(0x909090);
st_title_error_desc_doc->SetForegroundColour(0x909090);
m_st_txt_error_desc->SetForegroundColour(0x909090);
st_title_error_desc->SetFont(::Label::Body_12);
st_title_error_desc_doc->SetFont(::Label::Body_12);
m_st_txt_error_desc->SetFont(::Label::Body_12);
st_title_error_desc->SetMinSize(wxSize(FromDIP(32), -1));
st_title_error_desc->SetMaxSize(wxSize(FromDIP(32), -1));
m_st_txt_error_desc->SetMinSize(wxSize(FromDIP(175), -1));
m_st_txt_error_desc->SetMaxSize(wxSize(FromDIP(175), -1));
sizer_error_desc->Add(st_title_error_desc, 0, wxALL, 0);
sizer_error_desc->Add(st_title_error_desc_doc, 0, wxALL, 0);
sizer_error_desc->Add(m_st_txt_error_desc, 0, wxALL, 0);
auto st_title_extra_info = new wxStaticText(m_side_error_panel, wxID_ANY, wxT("info"),wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END);
auto st_title_extra_info_doc = new wxStaticText(m_side_error_panel, wxID_ANY, ": ");
m_st_txt_extra_info = new Label(m_side_error_panel, wxEmptyString);
st_title_extra_info->SetForegroundColour(0x909090);
st_title_extra_info_doc->SetForegroundColour(0x909090);
m_st_txt_extra_info->SetForegroundColour(0x909090);
st_title_extra_info->SetFont(::Label::Body_12);
st_title_extra_info_doc->SetFont(::Label::Body_12);
m_st_txt_extra_info->SetFont(::Label::Body_12);
st_title_extra_info->SetMinSize(wxSize(FromDIP(32), -1));
st_title_extra_info->SetMaxSize(wxSize(FromDIP(32), -1));
m_st_txt_extra_info->SetMinSize(wxSize(FromDIP(175), -1));
m_st_txt_extra_info->SetMaxSize(wxSize(FromDIP(175), -1));
sizer_extra_info->Add(st_title_extra_info, 0, wxALL, 0);
sizer_extra_info->Add(st_title_extra_info_doc, 0, wxALL, 0);
sizer_extra_info->Add(m_st_txt_extra_info, 0, wxALL, 0);
sizer_print_failed_info->Add(m_link_network_state, 0, wxALIGN_CENTER, 3);
sizer_print_failed_info->Add(sizer_error_code, 0, wxLEFT, 5);
sizer_print_failed_info->Add(0, 0, 0, wxTOP, FromDIP(3));
sizer_print_failed_info->Add(sizer_error_desc, 0, wxLEFT, 5);
sizer_print_failed_info->Add(0, 0, 0, wxTOP, FromDIP(3));
sizer_print_failed_info->Add(sizer_extra_info, 0, wxLEFT, 5);
m_st_txt_error_desc->SetLabel("");
m_st_txt_error_desc->Wrap(FromDIP(170));
sizer_side_tools->Add(m_connection_info, 0, wxEXPAND, 0);
sizer_side_tools->Add(m_side_error_panel, 0, wxEXPAND, 0);
sizer_side_tools->Add(m_side_tools, 1, wxEXPAND, 0);
m_tabpanel = new Tabbook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, sizer_side_tools, wxNB_LEFT | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME);
m_tabpanel->SetBackgroundColour(wxColour("#FEFFFF"));
@ -223,6 +344,24 @@ MonitorPanel::~MonitorPanel()
show_status((int)MonitorStatus::MONITOR_NO_PRINTER);
}
void MonitorPanel::update_connect_err_info(int code, wxString desc, wxString info)
{
m_st_txt_error_code->SetLabelText(wxString::Format("%d", code));
m_st_txt_error_desc->SetLabelText(desc);
m_st_txt_extra_info->SetLabelText(info);
m_st_txt_error_code->Wrap(FromDIP(175));
m_st_txt_error_desc->Wrap(FromDIP(175));
m_st_txt_extra_info->Wrap(FromDIP(175));
if (code == BAMBU_NETWORK_ERR_CONNECTION_TO_PRINTER_FAILED) {
m_link_network_state->Hide();
}
else if(code == BAMBU_NETWORK_ERR_CONNECTION_TO_SERVER_FAILED){
m_link_network_state->Show();
}
}
void MonitorPanel::set_default()
{
obj = nullptr;
@ -544,29 +683,43 @@ void MonitorPanel::show_status(int status)
BOOST_LOG_TRIVIAL(info) << "monitor: show_status = " << status;
if (((status & (int) MonitorStatus::MONITOR_DISCONNECTED) != 0) || ((status & (int) MonitorStatus::MONITOR_DISCONNECTED_SERVER) != 0)) {
if ((status & (int) MonitorStatus::MONITOR_DISCONNECTED_SERVER))
if ((status & (int)MonitorStatus::MONITOR_DISCONNECTED_SERVER)) {
m_hyperlink->SetLabel(_L("Failed to connect to the server"));
//m_connection_info->SetLabel(_L("Failed to connect to the server"));
else
update_connect_err_info(BAMBU_NETWORK_ERR_CONNECTION_TO_SERVER_FAILED,
_L("Failed to connect to cloud service"),
_L("Please click on the hyperlink above to view the cloud service status"));
}
else {
m_hyperlink->SetLabel(_L("Failed to connect to the printer"));
//m_connection_info->SetLabel(_L("Failed to connect to the printer"));
update_connect_err_info(BAMBU_NETWORK_ERR_CONNECTION_TO_PRINTER_FAILED,
_L("Connection to printer failed"),
_L("Please check the network connection of the printer and Studio."));
}
m_hyperlink->Show();
m_connection_info->SetLabel(wxEmptyString);
m_connection_info->SetBackgroundColor(0xFF6F00);
m_connection_info->SetBorderColor(0xFF6F00);
m_connection_info->Show();
m_connection_info->SetBackgroundColor(wxColour(255, 111, 0));
m_connection_info->SetBorderColor(wxColour(255, 111, 0));
m_more_button->Show();
#if !BBL_RELEASE_TO_PUBLIC
m_upgrade_panel->update(nullptr);
#endif
} else if ((status & (int) MonitorStatus::MONITOR_NORMAL) != 0) {
m_connection_info->Hide();
m_more_button->Hide();
m_side_error_panel->Hide();
} else if ((status & (int) MonitorStatus::MONITOR_CONNECTING) != 0) {
m_hyperlink->Hide();
m_connection_info->SetLabel(_L("Connecting..."));
m_connection_info->SetBackgroundColor(wxColour(0, 174, 66));
m_connection_info->SetBorderColor(wxColour(0, 174, 66));
m_connection_info->SetBackgroundColor(0x00AE42);
m_connection_info->SetBorderColor(0x00AE42);
m_connection_info->Show();
m_more_button->Hide();
m_side_error_panel->Hide();
}
Freeze();
@ -581,6 +734,8 @@ void MonitorPanel::show_status(int status)
set_default();
m_side_tools->set_none_printer_mode();
m_connection_info->Hide();
m_side_error_panel->Hide();
m_more_button->Hide();
m_tabpanel->Refresh();
m_tabpanel->Layout();
#if !BBL_RELEASE_TO_PUBLIC

View File

@ -84,6 +84,7 @@ private:
UpgradePanel* m_upgrade_panel;
HMSPanel* m_hms_panel;
Button * m_connection_info{nullptr};
wxWindow * m_side_error_panel{nullptr};
wxHyperlinkCtrl* m_hyperlink{nullptr};
/* side tools */
@ -94,6 +95,10 @@ private:
wxStaticBitmap* m_bitmap_wifi_signal;
wxBoxSizer * m_side_tools_sizer;
Label* m_link_network_state;
Label* m_st_txt_error_code;
Label* m_st_txt_error_desc;
Label* m_st_txt_extra_info;
SelectMachinePopup m_select_machine;
@ -105,6 +110,11 @@ private:
wxBitmap m_printer_img;
wxBitmap m_arrow_img;
ScalableButton* m_more_button;
bool m_more_err_state{false};
ScalableBitmap m_more_err_open;
ScalableBitmap m_more_err_close;
int last_wifi_signal = -1;
wxTimer* m_refresh_timer = nullptr;
int last_status;
@ -126,6 +136,7 @@ public:
void init_bitmap();
void init_timer();
void init_tabpanel();
void update_connect_err_info(int code, wxString desc, wxString info);
Tabbook* get_tabpanel() { return m_tabpanel; };
void set_default();
wxWindow* create_side_tools();

View File

@ -1119,6 +1119,9 @@ wxWindow* PreferencesDialog::create_debug_page()
wxBoxSizer *bSizer = new wxBoxSizer(wxVERTICAL);
auto enable_ssl_for_mqtt = create_item_checkbox(_L("Enable SSL(MQTT)"), page, _L("Enable SSL(MQTT)"), 50, "enable_ssl_for_mqtt");
auto enable_ssl_for_ftp = create_item_checkbox(_L("Enable SSL(FTP)"), page, _L("Enable SSL(MQTT)"), 50, "enable_ssl_for_ftp");
auto item_internal_developer = create_item_checkbox(_L("Internal developer mode"), page, _L("Internal developer mode"), 50, "internal_developer_mode");
auto title_log_level = create_item_title(_L("Log Level"), page, _L("Log Level"));
@ -1233,6 +1236,9 @@ wxWindow* PreferencesDialog::create_debug_page()
});
bSizer->Add(enable_ssl_for_mqtt, 0, wxTOP, FromDIP(3));
bSizer->Add(enable_ssl_for_ftp, 0, wxTOP, FromDIP(3));
bSizer->Add(item_internal_developer, 0, wxTOP, FromDIP(3));
bSizer->Add(title_log_level, 0, wxTOP| wxEXPAND, FromDIP(20));
bSizer->Add(loglevel_combox, 0, wxTOP, FromDIP(3));

View File

@ -1334,8 +1334,16 @@ void InputIpAddressDialog::on_ok(wxMouseEvent& evt)
m_send_job = std::make_shared<SendJob>(m_status_bar, wxGetApp().plater(), m_obj->dev_id);
m_send_job->m_dev_ip = ip.ToStdString();
m_send_job->m_access_code = str_access_code.ToStdString();
#if !BBL_RELEASE_TO_PUBLIC
m_send_job->m_local_use_ssl_for_mqtt = wxGetApp().app_config->get("enable_ssl_for_mqtt") == "true"?true:false;
m_send_job->m_local_use_ssl_for_ftp = wxGetApp().app_config->get("enable_ssl_for_ftp") == "true"?true:false;
#else
m_send_job->m_local_use_ssl_for_mqtt = m_obj->local_use_ssl_for_mqtt;
m_send_job->m_local_use_ssl_for_ftp = m_obj->local_use_ssl_for_ftp;
#endif
m_send_job->connection_type = m_obj->connection_type();
m_send_job->cloud_print_only = true;
m_send_job->has_sdcard = m_obj->has_sdcard();

View File

@ -1364,7 +1364,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
m_link_network_state = new Label(m_sw_print_failed_info, _L("Check the status of current system services"));
m_link_network_state->SetForegroundColour(0x00AE42);
m_link_network_state->SetFont(::Label::Body_12);
m_link_network_state->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {link_to_network_check();});
m_link_network_state->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {wxGetApp().link_to_network_check();});
m_link_network_state->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {m_link_network_state->SetCursor(wxCURSOR_HAND);});
m_link_network_state->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {m_link_network_state->SetCursor(wxCURSOR_ARROW);});
@ -1456,9 +1456,24 @@ void SelectMachineDialog::init_bind()
on_send_print();
}
else if (e.GetInt() == -2) {
show_status(PrintDialogStatus::PrintStatusSendingCanceled);
prepare_mode();
MessageDialog msg_wingow(nullptr, _L("Printer local connection failed, please try again."), "", wxAPPLY | wxOK);
msg_wingow.ShowModal();
}
else if (e.GetInt() == 5) {
show_status(PrintDialogStatus::PrintStatusSendingCanceled);
prepare_mode();
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev) return;
ConnectPrinterDialog dlg(wxGetApp().mainframe, wxID_ANY, _L("Input access code"));
dlg.go_connect_printer(false);
dlg.set_machine_object(dev->get_selected_machine());
if (dlg.ShowModal() == wxID_OK) {
this->connect_printer_mqtt();
}
}
});
m_bitmap_last_plate->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {
@ -1485,33 +1500,6 @@ void SelectMachineDialog::check_focus(wxWindow* window)
}
}
void SelectMachineDialog::link_to_network_check()
{
std::string url;
std::string country_code = Slic3r::GUI::wxGetApp().app_config->get_country_code();
if (country_code == "US") {
url = "https://status.bambulab.com";
}
else if (country_code == "CN") {
url = "https://status.bambulab.cn";
}
else if (country_code == "ENV_CN_DEV") {
url = "https://status.bambu-lab.com";
}
else if (country_code == "ENV_CN_QA") {
url = "https://status.bambu-lab.com";
}
else if (country_code == "ENV_CN_PRE") {
url = "https://status.bambu-lab.com";
}
else {
url = "https://status.bambu-lab.com";
}
wxLaunchDefaultBrowser(url);
}
void SelectMachineDialog::show_print_failed_info(bool show, int code, wxString description, wxString extra)
{
@ -2388,7 +2376,15 @@ void SelectMachineDialog::connect_printer_mqtt()
MachineObject* obj_ = dev->get_selected_machine();
if (obj_->connection_type() == "cloud") {
show_status(PrintDialogStatus::PrintStatusSending);
m_status_bar->disable_cancel_button();
m_status_bar->set_status_text("Connecting to the printer. Unable to cancel during the connection process.");
#if !BBL_RELEASE_TO_PUBLIC
obj_->connect(false, wxGetApp().app_config->get("enable_ssl_for_mqtt") == "true" ? true : false);
#else
obj_->connect(false, obj_->local_use_ssl_for_mqtt);
#endif
}
else {
on_send_print();
@ -2400,7 +2396,8 @@ void SelectMachineDialog::on_send_print()
BOOST_LOG_TRIVIAL(info) << "print_job: on_ok to send";
m_is_canceled = false;
Enable_Send_Button(false);
if (m_is_in_sending_mode)
if (m_print_type == PrintFromType::FROM_NORMAL && m_is_in_sending_mode)
return;
int result = 0;
@ -2444,6 +2441,7 @@ void SelectMachineDialog::on_send_print()
// enter sending mode
sending_mode();
m_status_bar->enable_cancel_button();
// get ams_mapping_result
std::string ams_mapping_array;
@ -2502,8 +2500,14 @@ void SelectMachineDialog::on_send_print()
m_print_job->m_dev_ip = obj_->dev_ip;
m_print_job->m_ftp_folder = obj_->get_ftp_folder();
m_print_job->m_access_code = obj_->get_access_code();
#if !BBL_RELEASE_TO_PUBLIC
m_print_job->m_local_use_ssl_for_ftp = wxGetApp().app_config->get("enable_ssl_for_mqtt") == "true" ? true : false;
m_print_job->m_local_use_ssl_for_mqtt = wxGetApp().app_config->get("enable_ssl_for_ftp") == "true" ? true : false;
#else
m_print_job->m_local_use_ssl_for_ftp = obj_->local_use_ssl_for_ftp;
m_print_job->m_local_use_ssl_for_mqtt = obj_->local_use_ssl_for_mqtt;
#endif
m_print_job->connection_type = obj_->connection_type();
m_print_job->cloud_print_only = obj_->is_cloud_print_only;
@ -3801,7 +3805,10 @@ bool SelectMachineDialog::Show(bool show)
if (dev) {
MachineObject* obj_ = dev->get_selected_machine();
if (obj_ && obj_->connection_type() == "cloud" && m_print_type == FROM_SDCARD_VIEW) {
obj_->disconnect();
if (obj_->is_connected()) {
obj_->disconnect();
}
}
}
}

View File

@ -389,7 +389,6 @@ public:
void init_bind();
void init_timer();
void check_focus(wxWindow* window);
void link_to_network_check();
void show_print_failed_info(bool show, int code = 0, wxString description = wxEmptyString, wxString extra = wxEmptyString);
void check_fcous_state(wxWindow* window);
void popup_filament_backup();

View File

@ -383,7 +383,7 @@ SendToPrinterDialog::SendToPrinterDialog(Plater *plater)
m_link_network_state = new Label(m_sw_print_failed_info, _L("Check the status of current system services"));
m_link_network_state->SetForegroundColour(0x00AE42);
m_link_network_state->SetFont(::Label::Body_12);
m_link_network_state->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {link_to_network_check(); });
m_link_network_state->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {wxGetApp().link_to_network_check(); });
m_link_network_state->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {m_link_network_state->SetCursor(wxCURSOR_HAND); });
m_link_network_state->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {m_link_network_state->SetCursor(wxCURSOR_ARROW); });
@ -591,33 +591,6 @@ void SendToPrinterDialog::sending_mode()
}
}
void SendToPrinterDialog::link_to_network_check()
{
std::string url;
std::string country_code = Slic3r::GUI::wxGetApp().app_config->get_country_code();
if (country_code == "US") {
url = "https://status.bambulab.com";
}
else if (country_code == "CN") {
url = "https://status.bambulab.cn";
}
else if (country_code == "ENV_CN_DEV") {
url = "https://status.bambu-lab.com";
}
else if (country_code == "ENV_CN_QA") {
url = "https://status.bambu-lab.com";
}
else if (country_code == "ENV_CN_PRE") {
url = "https://status.bambu-lab.com";
}
else {
url = "https://status.bambu-lab.com";
}
wxLaunchDefaultBrowser(url);
}
void SendToPrinterDialog::prepare(int print_plate_idx)
{
m_print_plate_idx = print_plate_idx;
@ -793,6 +766,15 @@ void SendToPrinterDialog::on_ok(wxCommandEvent &event)
m_send_job->m_access_code = obj_->get_access_code();
m_send_job->m_local_use_ssl_for_ftp = obj_->local_use_ssl_for_ftp;
m_send_job->m_local_use_ssl_for_mqtt = obj_->local_use_ssl_for_mqtt;
#if !BBL_RELEASE_TO_PUBLIC
m_send_job->m_local_use_ssl_for_ftp = wxGetApp().app_config->get("enable_ssl_for_mqtt") == "true" ? true : false;
m_send_job->m_local_use_ssl_for_mqtt = wxGetApp().app_config->get("enable_ssl_for_ftp") == "true" ? true : false;
#else
m_send_job->m_local_use_ssl_for_ftp = obj_->local_use_ssl_for_ftp;
m_send_job->m_local_use_ssl_for_mqtt = obj_->local_use_ssl_for_mqtt;
#endif
m_send_job->connection_type = obj_->connection_type();
m_send_job->cloud_print_only = true;
m_send_job->has_sdcard = obj_->has_sdcard();

View File

@ -128,7 +128,6 @@ public:
void stripWhiteSpace(std::string& str);
void prepare_mode();
void sending_mode();
void link_to_network_check();
void reset_timeout();
void update_user_printer();
void update_show_status();

View File

@ -618,8 +618,15 @@ void CalibUtils::send_to_print(const std::string& dev_id, const std::string& sel
print_job->m_dev_ip = obj_->dev_ip;
print_job->m_ftp_folder = obj_->get_ftp_folder();
print_job->m_access_code = obj_->get_access_code();
#if !BBL_RELEASE_TO_PUBLIC
print_job->m_local_use_ssl_for_ftp = wxGetApp().app_config->get("enable_ssl_for_mqtt") == "true" ? true : false;
print_job->m_local_use_ssl_for_mqtt = wxGetApp().app_config->get("enable_ssl_for_ftp") == "true" ? true : false;
#else
print_job->m_local_use_ssl_for_ftp = obj_->local_use_ssl_for_ftp;
print_job->m_local_use_ssl_for_mqtt = obj_->local_use_ssl_for_mqtt;
#endif
print_job->connection_type = obj_->connection_type();
print_job->cloud_print_only = obj_->is_cloud_print_only;
print_job->set_print_job_finished_event(wxGetApp().plater()->get_send_calibration_finished_event());

View File

@ -35,8 +35,9 @@ namespace BBL {
#define BAMBU_NETWORK_ERR_BIND_GET_PRINTER_TICKET_TIMEOUT -1040 //timeout to get ticket from printer
#define BAMBU_NETWORK_ERR_BIND_GET_CLOUD_TICKET_TIMEOUT -1050 //timeout to get ticket from cloud server
#define BAMBU_NETWORK_ERR_BIND_POST_TICKET_TO_CLOUD_FAILED -1060 //failed to post ticket to cloud server
#define BAMBU_NETWORK_ERR_BIND_PARSE_LOGIN_REPORT_FAILED -1070 //failed to parse login report reason
#define BAMBU_NETWORK_ERR_BIND_RECEIVE_LOGIN_REPORT_TIMEOUT -1080 //timeout to receive login report
#define BAMBU_NETWORK_ERR_BIND_PARSE_LOGIN_REPORT_FAILED -1070 //failed to parse login report reason no error code
#define BAMBU_NETWORK_ERR_BIND_ECODE_LOGIN_REPORT_FAILED -1080 //failed to parse login report reason has error code
#define BAMBU_NETWORK_ERR_BIND_RECEIVE_LOGIN_REPORT_TIMEOUT -1090 //timeout to receive login report
//start_local_print_with_record error
#define BAMBU_NETWORK_ERR_PRINT_WR_REQUEST_PROJECT_ID_FAILED -2010 //failed to request project id
@ -76,6 +77,10 @@ namespace BBL {
//start_send_gcode_to_sdcard error
#define BAMBU_NETWORK_ERR_PRINT_SG_UPLOAD_FTP_FAILED -5010 //failed to upload ftp
//connection to printer failed
#define BAMBU_NETWORK_ERR_CONNECTION_TO_PRINTER_FAILED -6010 //Connection to printer failed
#define BAMBU_NETWORK_ERR_CONNECTION_TO_SERVER_FAILED -6020 //Connection to server failed
#define BAMBU_NETWORK_LIBRARY "bambu_networking"
#define BAMBU_NETWORK_AGENT_NAME "bambu_network_agent"

View File

@ -12,4 +12,4 @@ set(BBL_INTERNAL_TESTING "1")
endif()
# The build_version should start from 50 in master branch
set(SLIC3R_VERSION "01.06.07.51")
set(SLIC3R_VERSION "01.06.08.51")