diff --git a/resources/images/link_more_error_close.svg b/resources/images/link_more_error_close.svg
new file mode 100644
index 000000000..4fb473c65
--- /dev/null
+++ b/resources/images/link_more_error_close.svg
@@ -0,0 +1,3 @@
+
diff --git a/resources/images/link_more_error_open.svg b/resources/images/link_more_error_open.svg
new file mode 100644
index 000000000..06abce1fb
--- /dev/null
+++ b/resources/images/link_more_error_open.svg
@@ -0,0 +1,3 @@
+
diff --git a/src/slic3r/GUI/BBLStatusBar.cpp b/src/slic3r/GUI/BBLStatusBar.cpp
index fcf5205e8..7c3d640d6 100644
--- a/src/slic3r/GUI/BBLStatusBar.cpp
+++ b/src/slic3r/GUI/BBLStatusBar.cpp
@@ -128,7 +128,7 @@ void BBLStatusBar::clear_percent()
}
-void BBLStatusBar::show_networking_test(wxString msg)
+void BBLStatusBar::show_error_info(wxString msg, int code, wxString description, wxString extra)
{
}
diff --git a/src/slic3r/GUI/BBLStatusBar.hpp b/src/slic3r/GUI/BBLStatusBar.hpp
index 20cd96699..02a3af3ca 100644
--- a/src/slic3r/GUI/BBLStatusBar.hpp
+++ b/src/slic3r/GUI/BBLStatusBar.hpp
@@ -45,7 +45,7 @@ public:
int get_range() const override;
void set_range(int = 100) override;
void clear_percent() override;
- void show_networking_test(wxString msg) override;
+ void show_error_info(wxString msg, int code, wxString description, wxString extra) override;
void show_progress(bool);
void start_busy(int = 100);
void stop_busy();
diff --git a/src/slic3r/GUI/BBLStatusBarBind.cpp b/src/slic3r/GUI/BBLStatusBarBind.cpp
index 76eafce69..73151266b 100644
--- a/src/slic3r/GUI/BBLStatusBarBind.cpp
+++ b/src/slic3r/GUI/BBLStatusBarBind.cpp
@@ -24,19 +24,9 @@ BBLStatusBarBind::BBLStatusBarBind(wxWindow *parent, int id)
m_self->SetBackgroundColour(wxColour(255,255,255));
m_self->SetMinSize(wxSize(m_self->FromDIP(450), m_self->FromDIP(30)));
-
- //wxBoxSizer *m_sizer_bottom = new wxBoxSizer(wxHORIZONTAL);
-
- /* m_status_text = new wxStaticText(m_self, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 0);
- m_status_text->SetForegroundColour(wxColour(107, 107, 107));
- m_status_text->SetFont(::Label::Body_13);
- m_status_text->Wrap(-1);
- m_sizer_body->Add(m_status_text, 0, 0, 0);*/
-
m_prog = new wxGauge(m_self, wxID_ANY, 100, wxDefaultPosition, wxSize(m_self->FromDIP(400), m_self->FromDIP(6)), wxGA_HORIZONTAL);
m_prog->SetValue(0);
-
m_stext_percent = new wxStaticText(m_self, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 0);
m_stext_percent->SetForegroundColour(wxColour(107, 107, 107));
m_stext_percent->SetFont(::Label::Body_13);
@@ -46,13 +36,9 @@ BBLStatusBarBind::BBLStatusBarBind(wxWindow *parent, int id)
m_sizer->Add(0, 0, 1, wxEXPAND, 0);
m_sizer->Add(m_stext_percent, 1, wxALIGN_CENTER, 0);
-
- //m_sizer->Add(m_sizer_bottom, 1, wxALIGN_CENTER, 0);
-
m_self->SetSizer(m_sizer);
m_self->Layout();
m_sizer->Fit(m_self);
- //set_prog_block();
}
void BBLStatusBarBind::set_prog_block()
@@ -97,7 +83,7 @@ void BBLStatusBarBind::clear_percent()
}
-void BBLStatusBarBind::show_networking_test(wxString msg)
+void BBLStatusBarBind::show_error_info(wxString msg, int code, wxString description, wxString extra)
{
}
diff --git a/src/slic3r/GUI/BBLStatusBarBind.hpp b/src/slic3r/GUI/BBLStatusBarBind.hpp
index 2752a7bd4..ce7a39457 100644
--- a/src/slic3r/GUI/BBLStatusBarBind.hpp
+++ b/src/slic3r/GUI/BBLStatusBarBind.hpp
@@ -48,7 +48,7 @@ public:
int get_range() const override;
void set_range(int = 100) override;
void clear_percent() override;
- void show_networking_test(wxString msg) override;
+ void show_error_info(wxString msg, int code, wxString description, wxString extra) override;
void show_progress(bool);
void start_busy(int = 100);
void stop_busy();
diff --git a/src/slic3r/GUI/BBLStatusBarSend.cpp b/src/slic3r/GUI/BBLStatusBarSend.cpp
index b162412ac..d3b0a689b 100644
--- a/src/slic3r/GUI/BBLStatusBarSend.cpp
+++ b/src/slic3r/GUI/BBLStatusBarSend.cpp
@@ -16,6 +16,7 @@
namespace Slic3r {
+wxDEFINE_EVENT(EVT_SHOW_ERROR_INFO, wxCommandEvent);
BBLStatusBarSend::BBLStatusBarSend(wxWindow *parent, int id)
: m_self{new wxPanel(parent, id == -1 ? wxID_ANY : id)}
@@ -29,8 +30,7 @@ BBLStatusBarSend::BBLStatusBarSend(wxWindow *parent, int id)
m_status_text = new wxStaticText(m_self, wxID_ANY, wxEmptyString);
m_status_text->SetForegroundColour(wxColour(107, 107, 107));
m_status_text->SetFont(::Label::Body_13);
- m_status_text->SetSize(wxSize(m_self->FromDIP(300), m_self->FromDIP(46)));
- m_status_text->SetMaxSize(wxSize(m_self->FromDIP(300), m_self->FromDIP(46)));
+ m_status_text->SetMaxSize(wxSize(m_self->FromDIP(360), m_self->FromDIP(40)));
m_prog = new wxGauge(m_self, wxID_ANY, 100, wxDefaultPosition, wxSize(-1, m_self->FromDIP(6)), wxGA_HORIZONTAL);
m_prog->SetMinSize(wxSize(m_self->FromDIP(300),m_self->FromDIP(6)));
@@ -39,6 +39,7 @@ BBLStatusBarSend::BBLStatusBarSend(wxWindow *parent, int id)
StateColor btn_bd_white(std::pair(*wxWHITE, StateColor::Disabled), std::pair(wxColour(38, 46, 48), StateColor::Enabled));
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));
@@ -56,33 +57,62 @@ BBLStatusBarSend::BBLStatusBarSend(wxWindow *parent, int id)
m_stext_percent->SetFont(::Label::Body_13);
m_stext_percent->Wrap(-1);
- m_hyperlink = new Label(m_self, _L("Check the status of current system services"));
- m_hyperlink->SetForegroundColour(0x00AE42);
- m_hyperlink->SetFont(::Label::Body_12);
- m_hyperlink->Hide();
+ m_sizer_status_text = new wxBoxSizer(wxHORIZONTAL);
+ m_link_show_error = new Label(m_self, _L("Check the reason"));
+ m_link_show_error->SetForegroundColour(wxColour(0x6b6b6b));
+ m_link_show_error->SetFont(::Label::Head_13);
+
+ m_bitmap_show_error_close = create_scaled_bitmap("link_more_error_close", nullptr, 7);
+ m_bitmap_show_error_open = create_scaled_bitmap("link_more_error_open", nullptr, 7);
+ m_static_bitmap_show_error = new wxStaticBitmap(m_self, wxID_ANY, m_bitmap_show_error_open, wxDefaultPosition, wxSize(m_self->FromDIP(7), m_self->FromDIP(7)));
+
+ m_link_show_error->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {this->m_self->SetCursor(wxCURSOR_HAND); });
+ m_link_show_error->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {this->m_self->SetCursor(wxCURSOR_ARROW); });
+ m_link_show_error->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {
+ if (!m_show_error_info_state) { m_show_error_info_state = true; m_static_bitmap_show_error->SetBitmap(m_bitmap_show_error_close); }
+ else { m_show_error_info_state = false; m_static_bitmap_show_error->SetBitmap(m_bitmap_show_error_open); }
+ wxCommandEvent* evt = new wxCommandEvent(EVT_SHOW_ERROR_INFO);
+ wxQueueEvent(this->m_self->GetParent(), evt);
+ });
+
+
+ m_link_show_error->Hide();
+ m_static_bitmap_show_error->Hide();
+
+
+ m_static_bitmap_show_error->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {this->m_self->SetCursor(wxCURSOR_HAND); });
+ m_static_bitmap_show_error->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {this->m_self->SetCursor(wxCURSOR_ARROW); });
+ m_static_bitmap_show_error->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {
+ if (!m_show_error_info_state) {m_show_error_info_state = true;m_static_bitmap_show_error->SetBitmap(m_bitmap_show_error_close);}
+ else {m_show_error_info_state = false;m_static_bitmap_show_error->SetBitmap(m_bitmap_show_error_open);}
+ wxCommandEvent* evt = new wxCommandEvent(EVT_SHOW_ERROR_INFO);
+ wxQueueEvent(this->m_self->GetParent(), evt);
+ });
+
+
+ m_sizer_status_text->Add(m_link_show_error, 0, wxLEFT | wxALIGN_CENTER, 0);
+ m_sizer_status_text->Add(m_static_bitmap_show_error, 0, wxLEFT | wxTOP| wxALIGN_CENTER, m_self->FromDIP(2));
+
m_sizer_bottom->Add(m_prog, 1, wxALIGN_CENTER, 0);
m_sizer_bottom->Add(m_stext_percent, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, 10);
- m_sizer_bottom->Add(m_hyperlink, 0, wxALIGN_CENTER, 10);
+ m_sizer_bottom->Add(m_sizer_status_text, 0, wxALIGN_CENTER, 10);
m_sizer_bottom->Add(0, 0, 1, wxEXPAND, 0);
m_sizer_bottom->Add(m_cancelbutton, 0, wxALIGN_CENTER, 0);
-
- m_sizer_body->Add(m_status_text, 0, wxALL, 0);
- m_sizer_body->Add(0, 0, 0, wxTOP, 1);
- m_sizer_body->Add(m_sizer_bottom, 1, wxEXPAND, 0);
+ m_sizer_body->Add(0, 0, 1, wxEXPAND, 0);
+ m_sizer_body->Add(m_status_text, 0, wxEXPAND, 0);
+ m_sizer_body->Add(m_sizer_bottom, 0, wxEXPAND, 0);
+ m_sizer_body->Add(0, 0, 1, wxEXPAND, 0);
m_sizer->Add(m_sizer_body, 1, wxALIGN_CENTER, 0);
m_self->SetSizer(m_sizer);
m_self->Layout();
m_sizer->Fit(m_self);
- //set_prog_block();
}
void BBLStatusBarSend::set_prog_block()
{
- //block_left->SetPosition(wxPoint(0, 0));
- //block_right->SetPosition(wxPoint(m_prog->GetSize().GetWidth() - 2, 0));
}
int BBLStatusBarSend::get_progress() const
@@ -92,10 +122,7 @@ int BBLStatusBarSend::get_progress() const
void BBLStatusBarSend::set_progress(int val)
{
- //set_prog_block();
-
- if(val < 0)
- return;
+ if(val < 0) return;
//add the logic for arrange/orient jobs, which don't call stop_busy
if (!m_prog->IsShown()) {
@@ -126,48 +153,14 @@ void BBLStatusBarSend::clear_percent()
m_cancelbutton->Hide();
}
-void BBLStatusBarSend::show_networking_test(wxString msg)
+void BBLStatusBarSend::show_error_info(wxString msg, int code, wxString description, wxString extra)
{
- 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";
- }
-
-
- m_hyperlink->Bind(wxEVT_LEFT_DOWN, [this, url](auto& e) {
- wxLaunchDefaultBrowser(url);
- });
-
- m_hyperlink->Bind(wxEVT_ENTER_WINDOW, [this, url](auto& e) {
- m_hyperlink->SetCursor(wxCURSOR_HAND);
- });
-
- m_hyperlink->Bind(wxEVT_LEAVE_WINDOW, [this, url](auto& e) {
- m_hyperlink->SetCursor(wxCURSOR_ARROW);
- });
-
set_status_text(msg);
m_prog->Hide();
m_stext_percent->Hide();
- m_hyperlink->Show();
+ m_link_show_error->Show();
+ m_static_bitmap_show_error->Show();
+
m_cancelbutton->Show();
m_self->Layout();
m_sizer->Layout();
@@ -283,9 +276,15 @@ void BBLStatusBarSend::set_status_text(const wxString& txt)
//auto txtss = "Sending the printing task has timed out.\nPlease try again!";
//auto txtss = "The printing project is being uploaded... 25%%";
//m_status_text->SetLabelText(txtss);
- wxString str;
- format_text(m_status_text, m_self->FromDIP(300), txt, str);
- m_status_text->SetLabelText(str);
+ //wxString str;
+ //format_text(m_status_text, m_self->FromDIP(300), txt, str);
+
+ if (m_status_text->GetTextExtent(txt).x > m_self->FromDIP(360)) {
+ m_status_text->SetSize(m_self->FromDIP(360), m_self->FromDIP(40));
+ }
+ m_status_text->SetLabelText(txt);
+ m_status_text->Wrap(m_self->FromDIP(360));
+ m_status_text->Layout();
m_self->Layout();
//if (is_english_text(str)) m_status_text->Wrap(m_self->FromDIP(280));
}
@@ -317,9 +316,7 @@ wxString BBLStatusBarSend::get_status_text() const
bool BBLStatusBarSend::update_status(wxString &msg, bool &was_cancel, int percent, bool yield)
{
- //auto test_txt = _L("Unkown Error.") + _L("status=150, body=Timeout was reached: Connection timed out after 10009 milliseconds [Error 28]");
set_status_text(msg);
-
if (percent >= 0)
this->set_progress(percent);
@@ -331,7 +328,8 @@ bool BBLStatusBarSend::update_status(wxString &msg, bool &was_cancel, int percen
void BBLStatusBarSend::reset()
{
- m_hyperlink->Hide();
+ m_link_show_error->Hide();
+ m_static_bitmap_show_error->Hide();
m_prog->Show();
m_stext_percent->Show();
m_cancelbutton->Show();
diff --git a/src/slic3r/GUI/BBLStatusBarSend.hpp b/src/slic3r/GUI/BBLStatusBarSend.hpp
index 190e56e5e..f28cbf89a 100644
--- a/src/slic3r/GUI/BBLStatusBarSend.hpp
+++ b/src/slic3r/GUI/BBLStatusBarSend.hpp
@@ -30,7 +30,11 @@ class BBLStatusBarSend : public ProgressIndicator
{
wxPanel * m_self; // we cheat! It should be the base class but: perl!
wxGauge * m_prog;
- Label * m_hyperlink;
+ Label * m_link_show_error;
+ wxBoxSizer* m_sizer_status_text;
+ wxStaticBitmap* m_static_bitmap_show_error;
+ wxBitmap m_bitmap_show_error_close;
+ wxBitmap m_bitmap_show_error_open;
Button * m_cancelbutton;
wxStaticText *m_status_text;
wxStaticText *m_stext_percent;
@@ -51,7 +55,7 @@ public:
int get_range() const override;
void set_range(int = 100) override;
void clear_percent() override;
- void show_networking_test(wxString msg) override;
+ void show_error_info(wxString msg, int code, wxString description, wxString extra) override;
void show_progress(bool);
void start_busy(int = 100);
void stop_busy();
@@ -81,6 +85,7 @@ public:
void change_button_label(wxString name);
private:
+ bool m_show_error_info_state = false;
bool m_busy = false;
bool m_was_cancelled = false;
CancelFn m_cancel_cb;
@@ -91,6 +96,8 @@ namespace GUI {
using Slic3r::BBLStatusBarSend;
}
+wxDECLARE_EVENT(EVT_SHOW_ERROR_INFO, wxCommandEvent);
+
} // namespace Slic3r
#endif // BBLSTATUSBAR_HPP
diff --git a/src/slic3r/GUI/BindDialog.cpp b/src/slic3r/GUI/BindDialog.cpp
index cbc6b72c5..e24a41317 100644
--- a/src/slic3r/GUI/BindDialog.cpp
+++ b/src/slic3r/GUI/BindDialog.cpp
@@ -15,9 +15,44 @@
namespace Slic3r {
namespace GUI {
+wxString get_fail_reason(int code)
+{
+ if (code == BAMBU_NETWORK_ERR_BIND_CREATE_SOCKET_FAILED)
+ return _L("Failed to create socket");
+
+ else if (code == BAMBU_NETWORK_ERR_BIND_SOCKET_CONNECT_FAILED)
+ return _L("Failed to connect socket");
+
+ else if (code == BAMBU_NETWORK_ERR_BIND_PUBLISH_LOGIN_REQUEST)
+ return _L("Failed to publish login request");
+
+ else if (code == BAMBU_NETWORK_ERR_BIND_GET_PRINTER_TICKET_TIMEOUT)
+ return _L("Get ticket from device timeout");
+
+ else if (code == BAMBU_NETWORK_ERR_BIND_GET_CLOUD_TICKET_TIMEOUT)
+ return _L("Get ticket from server timeout");
+
+ else if (code == BAMBU_NETWORK_ERR_BIND_POST_TICKET_TO_CLOUD_FAILED)
+ 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");
+
+ else if (code == BAMBU_NETWORK_ERR_BIND_RECEIVE_LOGIN_REPORT_TIMEOUT)
+ return _L("Receive login report timeout");
+
+ else
+ return _L("Unknown Failure");
+}
+
BindMachineDialog::BindMachineDialog(Plater *plater /*= nullptr*/)
: DPIDialog(static_cast(wxGetApp().mainframe), wxID_ANY, _L("Log in printer"), wxDefaultPosition, wxDefaultSize, wxCAPTION)
{
+
+#ifdef __WINDOWS__
+ SetDoubleBuffered(true);
+#endif //__WINDOWS__
+
std::string icon_path = (boost::format("%1%/images/BambuStudioTitle.ico") % resources_dir()).str();
SetIcon(wxIcon(encode_path(icon_path.c_str()), wxBITMAP_TYPE_ICO));
@@ -116,12 +151,128 @@ namespace GUI {
m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(20));
- m_status_text = new wxStaticText(this, wxID_ANY, _L("Would you like to log in this printer with current account?"), wxDefaultPosition,
- wxSize(BIND_DIALOG_BUTTON_PANEL_SIZE.x, -1), wxST_ELLIPSIZE_END);
+
+ auto m_sizer_status_text = new wxBoxSizer(wxHORIZONTAL);
+ m_status_text = new wxStaticText(this, wxID_ANY, _L("Would you like to log in this printer with current account?"));
m_status_text->SetForegroundColour(wxColour(107, 107, 107));
m_status_text->SetFont(::Label::Body_13);
m_status_text->Wrap(-1);
+
+ m_link_show_error = new wxStaticText(this, wxID_ANY, _L("Check the reason"));
+ m_link_show_error->SetForegroundColour(wxColour(0x6b6b6b));
+ m_link_show_error->SetFont(::Label::Head_13);
+
+ m_bitmap_show_error_close = create_scaled_bitmap("link_more_error_close",nullptr, 7);
+ m_bitmap_show_error_open = create_scaled_bitmap("link_more_error_open",nullptr, 7);
+ m_static_bitmap_show_error = new wxStaticBitmap(this, wxID_ANY, m_bitmap_show_error_open, wxDefaultPosition, wxSize(FromDIP(7), FromDIP(7)));
+
+ m_link_show_error->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_HAND); });
+ m_link_show_error->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_ARROW); });
+ m_link_show_error->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {
+ if (!m_show_error_info_state) { m_show_error_info_state = true; m_static_bitmap_show_error->SetBitmap(m_bitmap_show_error_open); }
+ else { m_show_error_info_state = false; m_static_bitmap_show_error->SetBitmap(m_bitmap_show_error_close); }
+ show_bind_failed_info(true);}
+ );
+ m_static_bitmap_show_error->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_HAND); });
+ m_static_bitmap_show_error->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_ARROW); });
+ m_static_bitmap_show_error->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {
+ if (!m_show_error_info_state) { m_show_error_info_state = true; m_static_bitmap_show_error->SetBitmap(m_bitmap_show_error_open); }
+ else { m_show_error_info_state = false; m_static_bitmap_show_error->SetBitmap(m_bitmap_show_error_close); }
+ show_bind_failed_info(true);
+ });
+
+ m_link_show_error->Hide();
+ m_static_bitmap_show_error->Hide();
+
+ m_sizer_status_text->SetMinSize(wxSize(BIND_DIALOG_BUTTON_PANEL_SIZE.x, -1));
+ m_sizer_status_text->Add(m_status_text, 0, wxALIGN_CENTER, 0);
+ m_sizer_status_text->Add(m_link_show_error, 0, wxLEFT|wxALIGN_CENTER, FromDIP(8));
+ m_sizer_status_text->Add(m_static_bitmap_show_error, 0, wxLEFT|wxALIGN_CENTER, FromDIP(2));
+
+
+ //show bind failed info
+ m_sw_bind_failed_info = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(450), FromDIP(300)), wxVSCROLL);
+ m_sw_bind_failed_info->SetBackgroundColour(*wxWHITE);
+ m_sw_bind_failed_info->SetScrollRate(5, 5);
+ m_sw_bind_failed_info->SetMinSize(wxSize(FromDIP(450), FromDIP(90)));
+ m_sw_bind_failed_info->SetMaxSize(wxSize(FromDIP(450), FromDIP(90)));
+
+ wxBoxSizer* m_sizer_bind_failed_info = new wxBoxSizer(wxVERTICAL);
+ m_sw_bind_failed_info->SetSizer( m_sizer_bind_failed_info );
+
+ 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_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); });
+
+
+
+ wxBoxSizer* sizer_error_code = new wxBoxSizer(wxHORIZONTAL);
+ wxBoxSizer* sizer_error_desc = new wxBoxSizer(wxHORIZONTAL);
+ wxBoxSizer* sizer_extra_info = new wxBoxSizer(wxHORIZONTAL);
+
+ auto st_title_error_code = new wxStaticText(m_sw_bind_failed_info, wxID_ANY, _L("Error code"));
+ auto st_title_error_code_doc = new wxStaticText(m_sw_bind_failed_info, wxID_ANY, ": ");
+ m_st_txt_error_code = new Label(m_sw_bind_failed_info, 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_13);
+ st_title_error_code_doc->SetFont(::Label::Body_13);
+ m_st_txt_error_code->SetFont(::Label::Body_13);
+ st_title_error_code->SetMinSize(wxSize(FromDIP(80), -1));
+ st_title_error_code->SetMaxSize(wxSize(FromDIP(80), -1));
+ m_st_txt_error_code->SetMinSize(wxSize(FromDIP(340), -1));
+ m_st_txt_error_code->SetMaxSize(wxSize(FromDIP(340), -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_sw_bind_failed_info, wxID_ANY, wxT("Error desc"));
+ auto st_title_error_desc_doc = new wxStaticText(m_sw_bind_failed_info, wxID_ANY, ": ");
+ m_st_txt_error_desc = new Label(m_sw_bind_failed_info, 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_13);
+ st_title_error_desc_doc->SetFont(::Label::Body_13);
+ m_st_txt_error_desc->SetFont(::Label::Body_13);
+ st_title_error_desc->SetMinSize(wxSize(FromDIP(80), -1));
+ st_title_error_desc->SetMaxSize(wxSize(FromDIP(80), -1));
+ m_st_txt_error_desc->SetMinSize(wxSize(FromDIP(340), -1));
+ m_st_txt_error_desc->SetMaxSize(wxSize(FromDIP(340), -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_sw_bind_failed_info, wxID_ANY, wxT("Extra info"));
+ auto st_title_extra_info_doc = new wxStaticText(m_sw_bind_failed_info, wxID_ANY, ": ");
+ m_st_txt_extra_info = new Label(m_sw_bind_failed_info, 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_13);
+ st_title_extra_info_doc->SetFont(::Label::Body_13);
+ m_st_txt_extra_info->SetFont(::Label::Body_13);
+ st_title_extra_info->SetMinSize(wxSize(FromDIP(80), -1));
+ st_title_extra_info->SetMaxSize(wxSize(FromDIP(80), -1));
+ m_st_txt_extra_info->SetMinSize(wxSize(FromDIP(340), -1));
+ m_st_txt_extra_info->SetMaxSize(wxSize(FromDIP(340), -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);
+
+ m_sizer_bind_failed_info->Add(m_link_network_state, 0, wxLEFT, 0);
+ m_sizer_bind_failed_info->Add(sizer_error_code, 0, wxLEFT, 0);
+ m_sizer_bind_failed_info->Add(0, 0, 0, wxTOP, FromDIP(3));
+ m_sizer_bind_failed_info->Add(sizer_error_desc, 0, wxLEFT, 0);
+ m_sizer_bind_failed_info->Add(0, 0, 0, wxTOP, FromDIP(3));
+ m_sizer_bind_failed_info->Add(sizer_extra_info, 0, wxLEFT, 0);
+
m_simplebook = new wxSimplebook(this, wxID_ANY, wxDefaultPosition,BIND_DIALOG_BUTTON_PANEL_SIZE, 0);
m_simplebook->SetBackgroundColour(*wxWHITE);
@@ -165,8 +316,11 @@ namespace GUI {
//m_sizer_main->Add(m_sizer_button, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30));
- m_sizer_main->Add(m_status_text, 0, wxALIGN_CENTER, 0);
+ show_bind_failed_info(false);
+
+ m_sizer_main->Add(m_sizer_status_text, 0, wxALIGN_CENTER, FromDIP(40));
m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(10));
+ m_sizer_main->Add(m_sw_bind_failed_info, 0, wxALIGN_CENTER, 0);
m_sizer_main->Add(m_simplebook, 0, wxALIGN_CENTER, 0);
m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(20));
@@ -198,20 +352,64 @@ namespace GUI {
this->Disconnect(EVT_BIND_UPDATE_MESSAGE, wxCommandEventHandler(BindMachineDialog::on_update_message), NULL, this);
}
- //static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp)
- //{
- // register int realsize = size * nmemb;
- // struct MemoryStruct *mem = (struct MemoryStruct *) userp;
- // mem->memory = (char *) realloc(mem->memory, mem->size + realsize + 1);
- // if (mem->memory) {
- // memcpy(&(mem->memory[mem->size]), contents, realsize);
- // mem->size += realsize;
- // mem->memory[mem->size] = 0;
- // }
- // return realsize;
- //}
+ 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) {
+ if (!m_sw_bind_failed_info->IsShown()) {
+ m_sw_bind_failed_info->Show(true);
+
+ m_st_txt_error_code->SetLabelText(wxString::Format("%d", m_result_code));
+ m_st_txt_error_desc->SetLabelText(m_result_info);
+ m_st_txt_extra_info->SetLabelText(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));
+ }
+ else {
+ m_sw_bind_failed_info->Show(false);
+ }
+ Layout();
+ Fit();
+ }
+ else {
+ if (!m_sw_bind_failed_info->IsShown()) { return; }
+ m_sw_bind_failed_info->Show(false);
+ m_st_txt_error_code->SetLabelText(wxEmptyString);
+ m_st_txt_error_desc->SetLabelText(wxEmptyString);
+ m_st_txt_extra_info->SetLabelText(wxEmptyString);
+ Layout();
+ Fit();
+ }
+ }
+
void BindMachineDialog::on_cancel(wxCommandEvent &event)
{
on_destroy();
@@ -238,8 +436,15 @@ namespace GUI {
void BindMachineDialog::on_bind_fail(wxCommandEvent &event)
{
- //m_status_text->SetLabel(_L("Would you like to log in this printer with current account?"));
m_simplebook->SetSelection(1);
+ m_link_show_error->Show(true);
+ m_static_bitmap_show_error->Show(true);
+
+ m_result_code = event.GetInt();
+ m_result_info = get_fail_reason(event.GetInt()).ToStdString();
+ m_result_extra = event.GetString().ToStdString();
+
+ show_bind_failed_info(true, event.GetInt(), get_fail_reason(event.GetInt()), event.GetString());
}
void BindMachineDialog::on_update_message(wxCommandEvent &event)
@@ -256,6 +461,11 @@ namespace GUI {
void BindMachineDialog::on_bind_printer(wxCommandEvent &event)
{
+ m_result_code = 0;
+ m_result_extra = "";
+ m_result_info = "";
+ show_bind_failed_info(false);
+
//check isset info
if (m_machine_info == nullptr || m_machine_info == NULL) return;
@@ -281,6 +491,10 @@ void BindMachineDialog::on_dpi_changed(const wxRect &suggested_rect)
void BindMachineDialog::on_show(wxShowEvent &event)
{
+ m_result_code = 0;
+ m_result_extra = "";
+ m_result_info = "";
+
if (event.IsShown()) {
auto img = m_machine_info->get_printer_thumbnail_img_str();
if (wxGetApp().dark_mode()) { img += "_dark"; }
@@ -398,11 +612,9 @@ UnBindMachineDialog::UnBindMachineDialog(Plater *plater /*= nullptr*/)
m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(20));
- m_status_text = new wxStaticText(this, wxID_ANY, _L("Would you like to log out the printer?"), wxDefaultPosition,
- wxSize(BIND_DIALOG_BUTTON_PANEL_SIZE.x, -1), wxST_ELLIPSIZE_END);
+ m_status_text = new wxStaticText(this, wxID_ANY, _L("Would you like to log out the printer?"), wxDefaultPosition, wxSize(BIND_DIALOG_BUTTON_PANEL_SIZE.x, -1), wxST_ELLIPSIZE_END);
m_status_text->SetForegroundColour(wxColour(107, 107, 107));
m_status_text->SetFont(::Label::Body_13);
- m_status_text->Wrap(-1);
diff --git a/src/slic3r/GUI/BindDialog.hpp b/src/slic3r/GUI/BindDialog.hpp
index 6df81124f..ca9afc83a 100644
--- a/src/slic3r/GUI/BindDialog.hpp
+++ b/src/slic3r/GUI/BindDialog.hpp
@@ -51,12 +51,26 @@ private:
StaticBox * m_panel_left;
StaticBox * m_panel_right;
wxStaticText *m_status_text;
+ wxStaticText* m_link_show_error;
Button * m_button_bind;
Button * m_button_cancel;
wxSimplebook *m_simplebook;
wxStaticBitmap *m_avatar;
wxStaticBitmap *m_printer_img;
+ wxStaticBitmap *m_static_bitmap_show_error;
+ wxBitmap m_bitmap_show_error_close;
+ wxBitmap m_bitmap_show_error_open;
wxWebRequest web_request;
+ wxScrolledWindow* m_sw_bind_failed_info;
+ Label* m_bind_failed_info;
+ Label* m_st_txt_error_code{ nullptr };
+ Label* m_st_txt_error_desc{ nullptr };
+ Label* m_st_txt_extra_info{ nullptr };
+ Label* m_link_network_state{ nullptr };
+ std::string m_result_info;
+ std::string m_result_extra;
+ bool m_show_error_info_state = true;
+ int m_result_code;
MachineObject * m_machine_info{nullptr};
std::shared_ptr m_bind_job;
@@ -65,7 +79,9 @@ private:
public:
BindMachineDialog(Plater *plater = nullptr);
~BindMachineDialog();
- void on_cancel(wxCommandEvent &event);
+ 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);
void on_update_message(wxCommandEvent &event);
void on_bind_success(wxCommandEvent &event);
diff --git a/src/slic3r/GUI/Jobs/BindJob.cpp b/src/slic3r/GUI/Jobs/BindJob.cpp
index e28506268..469f6fcad 100644
--- a/src/slic3r/GUI/Jobs/BindJob.cpp
+++ b/src/slic3r/GUI/Jobs/BindJob.cpp
@@ -16,22 +16,6 @@ static wxString waiting_auth_str = _L("Logging in");
static wxString login_failed_str = _L("Login failed");
-wxString get_login_fail_reason(std::string fail_reason)
-{
- if (fail_reason == "NO Regions")
- return _L("The region parameter is incorrrect");
- else if (fail_reason == "Cloud Timeout")
- return _L("Failure of printer login");
- else if (fail_reason == "Ticket Failed")
- return _L("Failed to get ticket");
- else if (fail_reason == "Wait Auth Timeout")
- return _L("User authorization timeout");
- else if (fail_reason == "Bind Failure")
- return _L("Failure of bind");
- else
- return _L("Unknown Failure");
-}
-
BindJob::BindJob(std::shared_ptr pri, Plater *plater, std::string dev_id, std::string dev_ip, std::string sec_link)
: PlaterJob{std::move(pri), plater},
m_dev_id(dev_id),
@@ -59,7 +43,6 @@ void BindJob::on_success(std::function success)
void BindJob::update_status(int st, const wxString &msg)
{
GUI::Job::update_status(st, msg);
- //post_event(wxCommandEvent(EVT_BIND_UPDATE_MESSAGE), msg);
wxCommandEvent event(EVT_BIND_UPDATE_MESSAGE);
event.SetString(msg);
event.SetEventObject(m_event_handle);
@@ -68,6 +51,9 @@ void BindJob::update_status(int st, const wxString &msg)
void BindJob::process()
{
+ int result_code = 0;
+ std::string result_info;
+
/* display info */
wxString msg = waiting_auth_str;
int curr_percent = 0;
@@ -81,7 +67,11 @@ void BindJob::process()
std::string timezone = get_timezone_utc_hm(offset);
int result = m_agent->bind(m_dev_ip, m_dev_id, m_sec_link, timezone,
- [this, &curr_percent, &msg](int stage, int code, std::string info) {
+ [this, &curr_percent, &msg, &result_code, &result_info](int stage, int code, std::string info) {
+
+ result_code = code;
+ result_info = info;
+
if (stage == BBL::BindJobStage::LoginStageConnect) {
curr_percent = 15;
msg = _L("Logging in");
@@ -103,8 +93,9 @@ void BindJob::process()
} else {
msg = _L("Logging in");
}
+
if (code != 0) {
- msg = _L("Login failed") + wxString::Format("(code=%d,info=%s). ", code, info);
+ msg = _L("Login failed");
if (code == BAMBU_NETWORK_ERR_TIMEOUT) {
msg += _L("Please check the printer network connection.");
}
@@ -115,14 +106,14 @@ void BindJob::process()
if (result < 0) {
BOOST_LOG_TRIVIAL(trace) << "login: result = " << result;
- post_fail_event();
+ post_fail_event(result_code, result_info);
return;
}
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev) {
BOOST_LOG_TRIVIAL(trace) << "login: dev is null";
- post_fail_event();
+ post_fail_event(result_code, result_info);
return;
}
dev->update_user_machine_list_info();
@@ -145,9 +136,11 @@ void BindJob::set_event_handle(wxWindow *hanle)
m_event_handle = hanle;
}
-void BindJob::post_fail_event()
+void BindJob::post_fail_event(int code, std::string info)
{
wxCommandEvent event(EVT_BIND_MACHINE_FAIL);
+ event.SetInt(code);
+ event.SetString(info);
event.SetEventObject(m_event_handle);
wxPostEvent(m_event_handle, event);
}
diff --git a/src/slic3r/GUI/Jobs/BindJob.hpp b/src/slic3r/GUI/Jobs/BindJob.hpp
index 4fa9e1ea1..7f958b550 100644
--- a/src/slic3r/GUI/Jobs/BindJob.hpp
+++ b/src/slic3r/GUI/Jobs/BindJob.hpp
@@ -37,7 +37,7 @@ public:
void process() override;
void finalize() override;
void set_event_handle(wxWindow* hanle);
- void post_fail_event();
+ void post_fail_event(int code, std::string info);
};
wxDECLARE_EVENT(EVT_BIND_UPDATE_MESSAGE, wxCommandEvent);
diff --git a/src/slic3r/GUI/Jobs/Job.cpp b/src/slic3r/GUI/Jobs/Job.cpp
index 3cc0ae5aa..19c93643a 100644
--- a/src/slic3r/GUI/Jobs/Job.cpp
+++ b/src/slic3r/GUI/Jobs/Job.cpp
@@ -35,9 +35,9 @@ void GUI::Job::update_percent_finish()
m_progress->clear_percent();
}
-void GUI::Job::show_networking_test(wxString msg)
+void GUI::Job::show_error_info(wxString msg, int code, wxString description, wxString extra)
{
- m_progress->show_networking_test(msg);
+ m_progress->show_error_info(msg, code, description, extra);
}
GUI::Job::Job(std::shared_ptr pri)
diff --git a/src/slic3r/GUI/Jobs/Job.hpp b/src/slic3r/GUI/Jobs/Job.hpp
index 5c41bc717..a92dfbfbd 100644
--- a/src/slic3r/GUI/Jobs/Job.hpp
+++ b/src/slic3r/GUI/Jobs/Job.hpp
@@ -47,7 +47,7 @@ protected:
void update_percent_finish();
- void show_networking_test(wxString msg);
+ void show_error_info(wxString msg, int code, wxString description, wxString extra);
bool was_canceled() const { return m_canceled.load(); }
diff --git a/src/slic3r/GUI/Jobs/NotificationProgressIndicator.cpp b/src/slic3r/GUI/Jobs/NotificationProgressIndicator.cpp
index d6b4c2aca..13470f7ad 100644
--- a/src/slic3r/GUI/Jobs/NotificationProgressIndicator.cpp
+++ b/src/slic3r/GUI/Jobs/NotificationProgressIndicator.cpp
@@ -10,7 +10,7 @@ void NotificationProgressIndicator::clear_percent()
}
-void NotificationProgressIndicator::show_networking_test(wxString msg)
+void NotificationProgressIndicator::show_error_info(wxString msg, int code, wxString description, wxString extra)
{
}
diff --git a/src/slic3r/GUI/Jobs/NotificationProgressIndicator.hpp b/src/slic3r/GUI/Jobs/NotificationProgressIndicator.hpp
index f41659e3d..ba0e89916 100644
--- a/src/slic3r/GUI/Jobs/NotificationProgressIndicator.hpp
+++ b/src/slic3r/GUI/Jobs/NotificationProgressIndicator.hpp
@@ -15,7 +15,7 @@ public:
explicit NotificationProgressIndicator(NotificationManager *nm);
void clear_percent() override;
- void show_networking_test(wxString msg) override;
+ void show_error_info(wxString msg, int code, wxString description, wxString extra) override;
void set_range(int range) override;
void set_cancel_callback(CancelFn = CancelFn()) override;
void set_progress(int pr) override;
diff --git a/src/slic3r/GUI/Jobs/PrintJob.cpp b/src/slic3r/GUI/Jobs/PrintJob.cpp
index 3b931d652..218f6e4bb 100644
--- a/src/slic3r/GUI/Jobs/PrintJob.cpp
+++ b/src/slic3r/GUI/Jobs/PrintJob.cpp
@@ -2,27 +2,31 @@
#include "libslic3r/MTUtils.hpp"
#include "libslic3r/Model.hpp"
#include "libslic3r/PresetBundle.hpp"
-#include "bambu_networking.hpp"
#include "slic3r/GUI/Plater.hpp"
#include "slic3r/GUI/GUI.hpp"
#include "slic3r/GUI/GUI_App.hpp"
+#include "bambu_networking.hpp"
namespace Slic3r {
namespace GUI {
-static wxString check_gcode_failed_str = _L("Abnormal print file data. Please slice again");
-static wxString printjob_cancel_str = _L("Task canceled");
-static wxString timeout_to_upload_str = _L("Upload task timed out. Please check the network problem and try again");
+static wxString check_gcode_failed_str = _L("Abnormal print file data. Please slice again.");
+static wxString printjob_cancel_str = _L("Task canceled.");
+static wxString timeout_to_upload_str = _L("Upload task timed out. Please check the network status and try again.");
static wxString failed_in_cloud_service_str = _L("Cloud service connection failed. Please try again.");
-static wxString file_is_not_exists_str = _L("Print file not found, please slice again");
-static wxString file_over_size_str = _L("The print file exceeds the maximum allowable size (1GB). Please simplify the model and slice again");
-static wxString print_canceled_str = _L("Task canceled");
-static wxString upload_failed_str = _L("Failed uploading print file");
-static wxString upload_login_failed_str = _L("Wrong Access code");
+static wxString file_is_not_exists_str = _L("Print file not found. please slice again.");
+static wxString file_over_size_str = _L("The print file exceeds the maximum allowable size (1GB). Please simplify the model and slice again.");
+static wxString print_canceled_str = _L("Task canceled.");
+static wxString send_print_failed_str = _L("Failed to send the print job. Please try again.");
+static wxString upload_ftp_failed_str = _L("Failed to upload file to ftp. Please try again.");
+static wxString desc_network_error = _L("Check the current status of the bambu server by clicking on the link above.");
+static wxString desc_file_too_large = _L("The size of the print file is too large. Please adjust the file size and try again.");
+static wxString desc_fail_not_exist = _L("Print file not found, Please slice it again and send it for printing.");
+static wxString desc_upload_ftp_failed = _L("Failed to upload print file to FTP. Please check the network status and try again.");
-static wxString sending_over_lan_str = _L("Sending print job over LAN");
-static wxString sending_over_cloud_str = _L("Sending print job through cloud service");
+static wxString sending_over_lan_str = _L("Sending print job over LAN");
+static wxString sending_over_cloud_str = _L("Sending print job through cloud service");
PrintJob::PrintJob(std::shared_ptr pri, Plater* plater, std::string dev_id)
: PlaterJob{ std::move(pri), plater },
@@ -262,7 +266,16 @@ void PrintJob::process()
bool is_try_lan_mode = false;
bool is_try_lan_mode_failed = false;
- auto update_fn = [this, &is_try_lan_mode, &is_try_lan_mode_failed, &msg, &error_str, &curr_percent, &error_text, StagePercentPoint](int stage, int code, std::string info) {
+ auto update_fn = [this,
+ &is_try_lan_mode,
+ &is_try_lan_mode_failed,
+ &msg,
+ &error_str,
+ &curr_percent,
+ &error_text,
+ StagePercentPoint
+ ](int stage, int code, std::string info) {
+
if (stage == BBL::SendingPrintJobStage::PrintingStageCreate && !is_try_lan_mode_failed) {
if (this->connection_type == "lan") {
msg = _L("Sending print job over LAN");
@@ -318,13 +331,21 @@ void PrintJob::process()
}
}
- if (code > 100 || code < 0) {
- error_text = this->get_http_error_msg(code, info);
- error_str = wxString::Format("[%s]", error_text);
- } else {
- error_str = wxEmptyString;
+ //get errors
+ if (code > 100 || code < 0 || stage == BBL::SendingPrintJobStage::PrintingStageERROR) {
+ if (code == BAMBU_NETWORK_ERR_PRINT_WR_FILE_OVER_SIZE || code == BAMBU_NETWORK_ERR_PRINT_SP_FILE_OVER_SIZE) {
+ m_plater->update_print_error_info(code, desc_file_too_large.ToStdString(), info);
+ }else if (code == BAMBU_NETWORK_ERR_PRINT_WR_FILE_NOT_EXIST || code == BAMBU_NETWORK_ERR_PRINT_SP_FILE_NOT_EXIST){
+ m_plater->update_print_error_info(code, desc_fail_not_exist.ToStdString(), info);
+ }else if (code == BAMBU_NETWORK_ERR_PRINT_LP_UPLOAD_FTP_FAILED || code == BAMBU_NETWORK_ERR_PRINT_SG_UPLOAD_FTP_FAILED) {
+ m_plater->update_print_error_info(code, desc_upload_ftp_failed.ToStdString(), info);
+ }else {
+ m_plater->update_print_error_info(code, desc_network_error.ToStdString(), info);
+ }
+ }
+ else {
+ this->update_status(curr_percent, msg);
}
- this->update_status(curr_percent, msg + error_str);
};
auto cancel_fn = [this]() {
@@ -373,10 +394,7 @@ void PrintJob::process()
if (result == 0) {
params.comments = "";
}
- else if (result == BAMBU_NETWORK_ERR_FTP_LOGIN_DENIED) {
- params.comments = "wrong_code";
- }
- else if (result == BAMBU_NETWORK_ERR_FTP_UPLOAD_FAILED) {
+ else if (result == BAMBU_NETWORK_ERR_PRINT_WR_UPLOAD_FTP_FAILED) {
params.comments = "upload_failed";
}
else {
@@ -407,41 +425,27 @@ void PrintJob::process()
}
if (result < 0) {
- if (result == BAMBU_NETWORK_ERR_FTP_LOGIN_DENIED) {
- msg_text = _L("Failed to send the print job. Please try again.");
- } if (result == BAMBU_NETWORK_ERR_FILE_NOT_EXIST) {
+ curr_percent = -1;
+
+ if (result == BAMBU_NETWORK_ERR_PRINT_WR_FILE_NOT_EXIST || result == BAMBU_NETWORK_ERR_PRINT_SP_FILE_NOT_EXIST) {
msg_text = file_is_not_exists_str;
- } else if (result == BAMBU_NETWORK_ERR_FILE_OVER_SIZE) {
+ } else if (result == BAMBU_NETWORK_ERR_PRINT_SP_FILE_OVER_SIZE || result == BAMBU_NETWORK_ERR_PRINT_WR_FILE_OVER_SIZE) {
msg_text = file_over_size_str;
- } else if (result == BAMBU_NETWORK_ERR_CHECK_MD5_FAILED) {
+ } else if (result == BAMBU_NETWORK_ERR_PRINT_WR_CHECK_MD5_FAILED || result == BAMBU_NETWORK_ERR_PRINT_SP_CHECK_MD5_FAILED) {
msg_text = failed_in_cloud_service_str;
- } else if (result == BAMBU_NETWORK_ERR_INVALID_PARAMS) {
- msg_text = _L("Failed to send the print job. Please try again.");
+ } else if (result == BAMBU_NETWORK_ERR_PRINT_WR_GET_NOTIFICATION_TIMEOUT || result == BAMBU_NETWORK_ERR_PRINT_SP_GET_NOTIFICATION_TIMEOUT) {
+ msg_text = timeout_to_upload_str;
+ } else if (result == BAMBU_NETWORK_ERR_PRINT_LP_UPLOAD_FTP_FAILED || result == BAMBU_NETWORK_ERR_PRINT_SG_UPLOAD_FTP_FAILED) {
+ msg_text = upload_ftp_failed_str;
} else if (result == BAMBU_NETWORK_ERR_CANCELED) {
msg_text = print_canceled_str;
- } else if (result == BAMBU_NETWORK_ERR_TIMEOUT) {
- msg_text = timeout_to_upload_str;
- } else if (result == BAMBU_NETWORK_ERR_INVALID_RESULT) {
- msg_text = _L("Failed to send the print job. Please try again.");
- } else if (result == BAMBU_NETWORK_ERR_FTP_UPLOAD_FAILED) {
- msg_text = _L("Failed to send the print job. Please try again.");
} else {
- update_status(curr_percent, failed_in_cloud_service_str);
- }
- if (!error_text.IsEmpty()) {
- curr_percent = 0;
- msg_text += wxString::Format("[%d][%s]", result, error_text);
- }
-
-
- if (result == BAMBU_NETWORK_ERR_INVALID_RESULT) {
- this->show_networking_test(msg_text);
- }
- else {
- update_status(curr_percent, msg_text);
+ msg_text = send_print_failed_str;
}
+ this->show_error_info(msg_text, 0, "", "");
BOOST_LOG_TRIVIAL(error) << "print_job: failed, result = " << result;
+
} else {
BOOST_LOG_TRIVIAL(error) << "print_job: send ok.";
wxCommandEvent* evt = new wxCommandEvent(m_print_job_completed_id);
diff --git a/src/slic3r/GUI/Jobs/PrintJob.hpp b/src/slic3r/GUI/Jobs/PrintJob.hpp
index 588a6f84e..9ad27893d 100644
--- a/src/slic3r/GUI/Jobs/PrintJob.hpp
+++ b/src/slic3r/GUI/Jobs/PrintJob.hpp
@@ -33,9 +33,7 @@ class PrintJob : public PlaterJob
std::function m_enter_ip_address_fun_success{ nullptr };
protected:
-
void prepare() override;
-
void on_exception(const std::exception_ptr &) override;
public:
PrintJob(std::shared_ptr pri, Plater *plater, std::string dev_id = "");
@@ -43,17 +41,18 @@ public:
std::string m_project_name;
std::string m_dev_ip;
std::string m_ftp_folder;
- bool m_local_use_ssl { true };
std::string m_access_code;
std::string task_bed_type;
+ std::string task_ams_mapping;
+ std::string task_ams_mapping_info;
+ std::string connection_type;
+
+ bool m_local_use_ssl { true };
bool task_bed_leveling;
bool task_flow_cali;
bool task_vibration_cali;
bool task_record_timelapse;
bool task_layer_inspect;
- std::string task_ams_mapping;
- std::string task_ams_mapping_info;
- std::string connection_type;
bool cloud_print_only { false };
bool has_sdcard { false };
bool task_use_ams { true };
diff --git a/src/slic3r/GUI/Jobs/ProgressIndicator.hpp b/src/slic3r/GUI/Jobs/ProgressIndicator.hpp
index cee698596..7a0b88396 100644
--- a/src/slic3r/GUI/Jobs/ProgressIndicator.hpp
+++ b/src/slic3r/GUI/Jobs/ProgressIndicator.hpp
@@ -18,7 +18,7 @@ public:
virtual ~ProgressIndicator() = default;
virtual void clear_percent() = 0;
- virtual void show_networking_test(wxString msg) = 0;
+ virtual void show_error_info(wxString msg, int code, wxString description, wxString extra) = 0;
virtual void set_range(int range) = 0;
virtual void set_cancel_callback(CancelFn = CancelFn()) = 0;
virtual void set_progress(int pr) = 0;
diff --git a/src/slic3r/GUI/Jobs/SendJob.cpp b/src/slic3r/GUI/Jobs/SendJob.cpp
index 4746ab880..473727321 100644
--- a/src/slic3r/GUI/Jobs/SendJob.cpp
+++ b/src/slic3r/GUI/Jobs/SendJob.cpp
@@ -9,20 +9,23 @@
namespace Slic3r {
namespace GUI {
-static wxString check_gcode_failed_str = _L("Abnormal print file data. Please slice again");
-static wxString printjob_cancel_str = _L("Task canceled");
-static wxString timeout_to_upload_str = _L("Upload task timed out. Please check the network problem and try again");
-static wxString failed_in_cloud_service_str = _L("Send to Printer failed. Please try again.");
-static wxString file_is_not_exists_str = _L("Print file not found, please slice again");
-static wxString file_over_size_str = _L("The print file exceeds the maximum allowable size (1GB). Please simplify the model and slice again");
-static wxString print_canceled_str = _L("Task canceled");
-static wxString upload_failed_str = _L("Failed uploading print file");
-static wxString upload_login_failed_str = _L("Wrong Access code");
-static wxString upload_no_space_left_str = _L("No space left on Printer SD card");
+static wxString check_gcode_failed_str = _L("Abnormal print file data. Please slice again.");
+static wxString printjob_cancel_str = _L("Task canceled.");
+static wxString timeout_to_upload_str = _L("Upload task timed out. Please check the network status and try again.");
+static wxString failed_in_cloud_service_str = _L("Cloud service connection failed. Please try again.");
+static wxString file_is_not_exists_str = _L("Print file not found. please slice again.");
+static wxString file_over_size_str = _L("The print file exceeds the maximum allowable size (1GB). Please simplify the model and slice again.");
+static wxString print_canceled_str = _L("Task canceled.");
+static wxString send_print_failed_str = _L("Failed to send the print job. Please try again.");
+static wxString upload_ftp_failed_str = _L("Failed to upload file to ftp. Please try again.");
+static wxString desc_network_error = _L("Check the current status of the bambu server by clicking on the link above.");
+static wxString desc_file_too_large = _L("The size of the print file is too large. Please adjust the file size and try again.");
+static wxString desc_fail_not_exist = _L("Print file not found, Please slice it again and send it for printing.");
+static wxString desc_upload_ftp_failed = _L("Failed to upload print file to FTP. Please check the network status and try again.");
-static wxString sending_over_lan_str = _L("Sending gcode file over LAN");
-static wxString sending_over_cloud_str = _L("Sending gcode file through cloud service");
+static wxString sending_over_lan_str = _L("Sending print job over LAN");
+static wxString sending_over_cloud_str = _L("Sending print job through cloud service");
SendJob::SendJob(std::shared_ptr pri, Plater* plater, std::string dev_id)
: PlaterJob{ std::move(pri), plater },
@@ -271,11 +274,24 @@ void SendJob::process()
}
}
- if (code < 0 || code > 100) {
- error_text = this->get_http_error_msg(code, info);
- msg += wxString::Format("[%s]", error_text);
+ //get errors
+ if (code > 100 || code < 0 || stage == BBL::SendingPrintJobStage::PrintingStageERROR) {
+ if (code == BAMBU_NETWORK_ERR_PRINT_WR_FILE_OVER_SIZE || code == BAMBU_NETWORK_ERR_PRINT_SP_FILE_OVER_SIZE) {
+ m_plater->update_print_error_info(code, desc_file_too_large.ToStdString(), info);
+ }
+ else if (code == BAMBU_NETWORK_ERR_PRINT_WR_FILE_NOT_EXIST || code == BAMBU_NETWORK_ERR_PRINT_SP_FILE_NOT_EXIST) {
+ m_plater->update_print_error_info(code, desc_fail_not_exist.ToStdString(), info);
+ }
+ else if (code == BAMBU_NETWORK_ERR_PRINT_LP_UPLOAD_FTP_FAILED || code == BAMBU_NETWORK_ERR_PRINT_SG_UPLOAD_FTP_FAILED) {
+ m_plater->update_print_error_info(code, desc_upload_ftp_failed.ToStdString(), info);
+ }
+ else {
+ m_plater->update_print_error_info(code, desc_network_error.ToStdString(), info);
+ }
+ }
+ else {
+ this->update_status(curr_percent, msg);
}
- this->update_status(curr_percent, msg);
};
auto cancel_fn = [this]() {
@@ -300,9 +316,7 @@ void SendJob::process()
BOOST_LOG_TRIVIAL(info) << "send_job: try to send gcode to printer";
this->update_status(curr_percent, _L("Sending gcode file over LAN"));
result = m_agent->start_send_gcode_to_sdcard(params, update_fn, cancel_fn);
- if (result == BAMBU_NETWORK_ERR_FTP_LOGIN_DENIED) {
- params.comments = "wrong_code";
- } else if (result == BAMBU_NETWORK_ERR_FTP_UPLOAD_FAILED) {
+ if (result == BAMBU_NETWORK_ERR_FTP_UPLOAD_FAILED) {
params.comments = "upload_failed";
} else {
params.comments = (boost::format("failed(%1%)") % result).str();
@@ -332,50 +346,38 @@ void SendJob::process()
}
if (result < 0) {
- if (result == BAMBU_NETWORK_ERR_NO_SPACE_LEFT_ON_DEVICE) {
- msg_text = upload_no_space_left_str;
- } else if (result == BAMBU_NETWORK_ERR_FTP_LOGIN_DENIED) {
- msg_text = upload_login_failed_str;
- } else if (result == BAMBU_NETWORK_ERR_FILE_NOT_EXIST) {
+ curr_percent = -1;
+
+ if (result == BAMBU_NETWORK_ERR_PRINT_WR_FILE_NOT_EXIST || result == BAMBU_NETWORK_ERR_PRINT_SP_FILE_NOT_EXIST) {
msg_text = file_is_not_exists_str;
- } else if (result == BAMBU_NETWORK_ERR_FILE_OVER_SIZE) {
+ }
+ else if (result == BAMBU_NETWORK_ERR_PRINT_SP_FILE_OVER_SIZE || result == BAMBU_NETWORK_ERR_PRINT_WR_FILE_OVER_SIZE) {
msg_text = file_over_size_str;
- } else if (result == BAMBU_NETWORK_ERR_CHECK_MD5_FAILED) {
+ }
+ else if (result == BAMBU_NETWORK_ERR_PRINT_WR_CHECK_MD5_FAILED || result == BAMBU_NETWORK_ERR_PRINT_SP_CHECK_MD5_FAILED) {
msg_text = failed_in_cloud_service_str;
- } else if (result == BAMBU_NETWORK_ERR_INVALID_PARAMS) {
- msg_text = upload_failed_str;
- } else if (result == BAMBU_NETWORK_ERR_CANCELED) {
+ }
+ else if (result == BAMBU_NETWORK_ERR_PRINT_WR_GET_NOTIFICATION_TIMEOUT || result == BAMBU_NETWORK_ERR_PRINT_SP_GET_NOTIFICATION_TIMEOUT) {
+ msg_text = timeout_to_upload_str;
+ }
+ else if (result == BAMBU_NETWORK_ERR_PRINT_LP_UPLOAD_FTP_FAILED || result == BAMBU_NETWORK_ERR_PRINT_SG_UPLOAD_FTP_FAILED) {
+ msg_text = upload_ftp_failed_str;
+ }
+ else if (result == BAMBU_NETWORK_ERR_CANCELED) {
msg_text = print_canceled_str;
- } else if (result == BAMBU_NETWORK_ERR_TIMEOUT) {
- msg_text = timeout_to_upload_str;
- } else if (result == BAMBU_NETWORK_ERR_INVALID_RESULT) {
- msg_text = upload_failed_str;
- } else if (result == BAMBU_NETWORK_ERR_FTP_UPLOAD_FAILED) {
- msg_text = upload_failed_str;
- } else {
- update_status(curr_percent, failed_in_cloud_service_str);
+ }
+ else {
+ msg_text = send_print_failed_str;
}
- if (!error_text.IsEmpty()) {
- if (result == BAMBU_NETWORK_ERR_FTP_LOGIN_DENIED) {
- msg_text += ". ";
- msg_text += _L("Please log out and login to the printer again.");
- }
- else {
- msg_text += wxString::Format("[%s]", error_text);
- }
- }
-
- if (result == BAMBU_NETWORK_ERR_WRONG_IP_ADDRESS) {
- msg_text = timeout_to_upload_str;
- }
-
- update_status(curr_percent, msg_text);
+ this->show_error_info(msg_text, 0, "", "");
BOOST_LOG_TRIVIAL(error) << "send_job: failed, result = " << result;
- } else {
+
+ }
+ else {
BOOST_LOG_TRIVIAL(error) << "send_job: send ok.";
wxCommandEvent* evt = new wxCommandEvent(m_print_job_completed_id);
- evt->SetString(from_u8(params.project_name));
+ evt->SetString(m_dev_id);
wxQueueEvent(m_plater, evt);
m_job_finished = true;
}
diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp
index 33423a38b..ce426b2cb 100644
--- a/src/slic3r/GUI/Plater.cpp
+++ b/src/slic3r/GUI/Plater.cpp
@@ -10501,6 +10501,17 @@ std::vector Plater::get_colors_for_color_print(const GCodeProcessor
return colors;
}
+void Plater::update_print_error_info(int code, std::string msg, std::string extra)
+{
+ if (p->m_select_machine_dlg) {
+ p->m_select_machine_dlg->update_print_error_info(code, msg, extra);
+ }
+
+ if (p->m_send_to_sdcard_dlg) {
+ p->m_send_to_sdcard_dlg->update_print_error_info(code, msg, extra);
+ }
+}
+
wxString Plater::get_project_filename(const wxString& extension) const
{
return p->get_project_filename(extension);
diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp
index 00e1e5097..8f662b209 100644
--- a/src/slic3r/GUI/Plater.hpp
+++ b/src/slic3r/GUI/Plater.hpp
@@ -399,6 +399,7 @@ public:
wxString get_project_filename(const wxString& extension = wxEmptyString) const;
wxString get_export_gcode_filename(const wxString& extension = wxEmptyString, bool only_filename = false, bool export_all = false) const;
void set_project_filename(const wxString& filename);
+ void update_print_error_info(int code, std::string msg, std::string extra);
bool is_export_gcode_scheduled() const;
diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp
index f1145fece..0064b497e 100644
--- a/src/slic3r/GUI/SelectMachine.cpp
+++ b/src/slic3r/GUI/SelectMachine.cpp
@@ -1058,13 +1058,13 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
m_panel_image = new wxPanel(m_scrollable_region, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
m_panel_image->SetBackgroundColour(m_colour_def_color);
- sizer_thumbnail = new wxBoxSizer(wxVERTICAL);
+ m_sizer_thumbnail = new wxBoxSizer(wxVERTICAL);
m_thumbnailPanel = new ThumbnailPanel(m_panel_image);
m_thumbnailPanel->SetSize(wxSize(FromDIP(256), FromDIP(256)));
m_thumbnailPanel->SetMinSize(wxSize(FromDIP(256), FromDIP(256)));
m_thumbnailPanel->SetMaxSize(wxSize(FromDIP(256), FromDIP(256)));
- sizer_thumbnail->Add(m_thumbnailPanel, 0, wxEXPAND, 0);
- m_panel_image->SetSizer(sizer_thumbnail);
+ m_sizer_thumbnail->Add(m_thumbnailPanel, 0, wxEXPAND, 0);
+ m_panel_image->SetSizer(m_sizer_thumbnail);
m_panel_image->Layout();
wxBoxSizer *m_sizer_basic = new wxBoxSizer(wxHORIZONTAL);
@@ -1162,12 +1162,12 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
m_comboBox_printer->Bind(wxEVT_COMBOBOX, &SelectMachineDialog::on_selection_changed, this);
m_sizer_printer->Add(m_comboBox_printer, 1, wxEXPAND | wxRIGHT, FromDIP(5));
- btn_bg_enable = StateColor(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered),
+ m_btn_bg_enable = StateColor(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered),
std::pair(wxColour(0, 174, 66), StateColor::Normal));
m_button_refresh = new Button(this, _L("Refresh"));
- m_button_refresh->SetBackgroundColor(btn_bg_enable);
- m_button_refresh->SetBorderColor(btn_bg_enable);
+ m_button_refresh->SetBackgroundColor(m_btn_bg_enable);
+ m_button_refresh->SetBorderColor(m_btn_bg_enable);
m_button_refresh->SetTextColor(StateColor::darkModeColorFor("#FFFFFE"));
m_button_refresh->SetSize(SELECT_MACHINE_DIALOG_BUTTON_SIZE);
m_button_refresh->SetMinSize(SELECT_MACHINE_DIALOG_BUTTON_SIZE);
@@ -1202,13 +1202,11 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
m_line_schedule = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1));
m_line_schedule->SetBackgroundColour(wxColour(238, 238, 238));
- m_sizer_bottom = new wxBoxSizer(wxVERTICAL);
m_simplebook = new wxSimplebook(this, wxID_ANY, wxDefaultPosition, SELECT_MACHINE_DIALOG_SIMBOOK_SIZE, 0);
// perpare mode
m_panel_prepare = new wxPanel(m_simplebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
m_panel_prepare->SetBackgroundColour(m_colour_def_color);
- //m_panel_prepare->SetBackgroundColour(wxColour(135,206,250));
wxBoxSizer *m_sizer_prepare = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *m_sizer_pcont = new wxBoxSizer(wxHORIZONTAL);
@@ -1217,24 +1215,22 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
auto hyperlink_sizer = new wxBoxSizer( wxHORIZONTAL );
auto m_hyperlink = new wxHyperlinkCtrl(m_panel_prepare, wxID_ANY, _L("Can't find my devices?"), wxT("https://wiki.bambulab.com/en/software/bambu-studio/failed-to-connect-printer"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
- //auto linkimg = new wxStaticBitmap(m_panel_prepare, wxID_ANY, create_scaled_bitmap("link_wiki_img", this, 18), wxDefaultPosition, wxSize(FromDIP(18), FromDIP(18)), 0);
hyperlink_sizer->Add(m_hyperlink, 0, wxALIGN_CENTER | wxALL, 5);
- //hyperlink_sizer->Add(linkimg, 0, wxALIGN_CENTER | wxALL, FromDIP(5));
-
m_sizer_prepare->Add(hyperlink_sizer, 0, wxALIGN_CENTER | wxALL, 5);
m_button_ensure = new Button(m_panel_prepare, _L("Send"));
- m_button_ensure->SetBackgroundColor(btn_bg_enable);
- m_button_ensure->SetBorderColor(btn_bg_enable);
+ m_button_ensure->SetBackgroundColor(m_btn_bg_enable);
+ m_button_ensure->SetBorderColor(m_btn_bg_enable);
m_button_ensure->SetTextColor(StateColor::darkModeColorFor("#FFFFFE"));
m_button_ensure->SetSize(SELECT_MACHINE_DIALOG_BUTTON_SIZE);
m_button_ensure->SetMinSize(SELECT_MACHINE_DIALOG_BUTTON_SIZE);
+ m_button_ensure->SetMinSize(SELECT_MACHINE_DIALOG_BUTTON_SIZE);
m_button_ensure->SetCornerRadius(FromDIP(12));
m_button_ensure->Bind(wxEVT_BUTTON, &SelectMachineDialog::on_ok_btn, this);
m_sizer_pcont->Add(0, 0, 1, wxEXPAND, 0);
- m_sizer_pcont->Add(m_button_ensure, 0, wxEXPAND | wxBOTTOM, FromDIP(10));
+ m_sizer_pcont->Add(m_button_ensure, 0,wxRIGHT, 0);
m_sizer_prepare->Add(m_sizer_pcont, 0, wxEXPAND, 0);
@@ -1272,7 +1268,92 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
m_sizer_finish->Fit(m_panel_finish);
m_simplebook->AddPage(m_panel_finish, wxEmptyString, false);
+ //show bind failed info
+ m_sw_print_failed_info = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(380), FromDIP(125)), wxVSCROLL);
+ m_sw_print_failed_info->SetBackgroundColour(*wxWHITE);
+ m_sw_print_failed_info->SetScrollRate(0, 5);
+ m_sw_print_failed_info->SetMinSize(wxSize(FromDIP(380), FromDIP(125)));
+ m_sw_print_failed_info->SetMaxSize(wxSize(FromDIP(380), FromDIP(125)));
+
+ wxBoxSizer* sizer_print_failed_info = new wxBoxSizer(wxVERTICAL);
+ m_sw_print_failed_info->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);
+
+ auto st_title_error_code = new wxStaticText(m_sw_print_failed_info, wxID_ANY, _L("Error code"));
+ auto st_title_error_code_doc = new wxStaticText(m_sw_print_failed_info, wxID_ANY,": ");
+ m_st_txt_error_code = new Label(m_sw_print_failed_info, 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_13);
+ st_title_error_code_doc->SetFont(::Label::Body_13);
+ m_st_txt_error_code->SetFont(::Label::Body_13);
+ st_title_error_code->SetMinSize(wxSize(FromDIP(74), -1));
+ st_title_error_code->SetMaxSize(wxSize(FromDIP(74), -1));
+ m_st_txt_error_code->SetMinSize(wxSize(FromDIP(260), -1));
+ m_st_txt_error_code->SetMaxSize(wxSize(FromDIP(260), -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_sw_print_failed_info, wxID_ANY, wxT("Error desc"));
+ auto st_title_error_desc_doc = new wxStaticText(m_sw_print_failed_info, wxID_ANY,": ");
+ m_st_txt_error_desc = new Label(m_sw_print_failed_info, 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_13);
+ st_title_error_desc_doc->SetFont(::Label::Body_13);
+ m_st_txt_error_desc->SetFont(::Label::Body_13);
+ st_title_error_desc->SetMinSize(wxSize(FromDIP(74), -1));
+ st_title_error_desc->SetMaxSize(wxSize(FromDIP(74), -1));
+ m_st_txt_error_desc->SetMinSize(wxSize(FromDIP(260), -1));
+ m_st_txt_error_desc->SetMaxSize(wxSize(FromDIP(260), -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_sw_print_failed_info, wxID_ANY, wxT("Extra info"));
+ auto st_title_extra_info_doc = new wxStaticText(m_sw_print_failed_info, wxID_ANY, ": ");
+ m_st_txt_extra_info = new Label(m_sw_print_failed_info, 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_13);
+ st_title_extra_info_doc->SetFont(::Label::Body_13);
+ m_st_txt_extra_info->SetFont(::Label::Body_13);
+ st_title_extra_info->SetMinSize(wxSize(FromDIP(74), -1));
+ st_title_extra_info->SetMaxSize(wxSize(FromDIP(74), -1));
+ m_st_txt_extra_info->SetMinSize(wxSize(FromDIP(260), -1));
+ m_st_txt_extra_info->SetMaxSize(wxSize(FromDIP(260), -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);
+
+
+ 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_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);});
+
+ sizer_print_failed_info->Add(m_link_network_state, 0, wxLEFT, 5);
+ 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);
+
// bind
+ Bind(EVT_SHOW_ERROR_INFO, [this](auto& e) {
+ show_print_failed_info(true);
+ });
Bind(EVT_UPDATE_USER_MACHINE_LIST, &SelectMachineDialog::update_printer_combobox, this);
Bind(EVT_PRINT_JOB_CANCEL, &SelectMachineDialog::on_print_job_cancel, this);
Bind(EVT_SET_FINISH_MAPPING, &SelectMachineDialog::on_set_finish_mapping, this);
@@ -1317,29 +1398,30 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
m_sizer_scrollable_view->Add(m_scrollable_region, 0, wxEXPAND, 0);
m_sizer_main->Add(m_line_top, 0, wxEXPAND, 0);
- m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(22));
+ m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(13));
m_sizer_main->Add(m_scrollable_view, 0, wxALIGN_CENTER_HORIZONTAL, 0);
#ifdef FILAMENT_BACKUP
m_sizer_main->Add(m_sizer_backup, 0, wxALIGN_CENTER_HORIZONTAL, 0);
#endif
- m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(8));
+ m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(6));
m_sizer_main->Add(m_statictext_ams_msg, 0, wxALIGN_CENTER_HORIZONTAL, 0);
- m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(8));
+ m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(6));
m_sizer_main->Add(m_line_materia, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30));
- m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(14));
+ m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(12));
m_sizer_main->Add(m_sizer_printer, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30));
- m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(5));
- m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(8));
+ m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(11));
m_sizer_main->Add(m_statictext_printer_msg, 0, wxALIGN_CENTER_HORIZONTAL, 0);
- m_sizer_main->Add(0, 1, 0, wxTOP, FromDIP(20));
+ m_sizer_main->Add(0, 1, 0, wxTOP, FromDIP(16));
m_sizer_main->Add(m_sizer_select, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(40));
- m_sizer_main->Add(0, 1, 0, wxTOP, FromDIP(12));
+ m_sizer_main->Add(0, 1, 0, wxTOP, FromDIP(10));
m_sizer_main->Add(m_line_schedule, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30));
m_sizer_main->Add(m_simplebook, 0, wxALIGN_CENTER_HORIZONTAL, 0);
- m_sizer_main->Add(m_sizer_bottom, 0, wxALIGN_CENTER_HORIZONTAL);
- m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(15));
+ m_sizer_main->Add(m_sw_print_failed_info, 0, wxALIGN_CENTER, 0);
+ m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(13));
+
+ show_print_failed_info(false);
SetSizer(m_sizer_main);
Layout();
@@ -1359,6 +1441,65 @@ 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)
+{
+
+ if (show) {
+ if (!m_sw_print_failed_info->IsShown()) {
+ m_sw_print_failed_info->Show(true);
+
+ m_st_txt_error_code->SetLabelText(wxString::Format("%d", m_print_error_code));
+ m_st_txt_error_desc->SetLabelText(m_print_error_msg);
+ m_st_txt_extra_info->SetLabelText(m_print_error_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));
+ }
+ else {
+ m_sw_print_failed_info->Show(false);
+ }
+ Layout();
+ Fit();
+ }
+ else {
+ if (!m_sw_print_failed_info->IsShown()) {return;}
+ m_sw_print_failed_info->Show(false);
+ m_st_txt_error_code->SetLabelText(wxEmptyString);
+ m_st_txt_error_desc->SetLabelText(wxEmptyString);
+ m_st_txt_extra_info->SetLabelText(wxEmptyString);
+ Layout();
+ Fit();
+ }
+}
+
void SelectMachineDialog::check_fcous_state(wxWindow* window)
{
check_focus(window);
@@ -1387,9 +1528,9 @@ wxWindow *SelectMachineDialog::create_ams_checkbox(wxString title, wxWindow *par
wxBoxSizer *sizer_checkbox = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer *sizer_check = new wxBoxSizer(wxVERTICAL);
- ams_check = new ::CheckBox(checkbox);
+ m_ams_check = new ::CheckBox(checkbox);
- sizer_check->Add(ams_check, 0, wxBOTTOM | wxEXPAND | wxTOP, FromDIP(5));
+ sizer_check->Add(m_ams_check, 0, wxBOTTOM | wxEXPAND | wxTOP, FromDIP(5));
sizer_checkbox->Add(sizer_check, 0, wxEXPAND, FromDIP(5));
sizer_checkbox->Add(0, 0, 0, wxEXPAND | wxLEFT, FromDIP(11));
@@ -1429,11 +1570,11 @@ wxWindow *SelectMachineDialog::create_ams_checkbox(wxString title, wxWindow *par
text->SetToolTip(tooltip);
text->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& event) {
- ams_check->SetValue(ams_check->GetValue() ? false : true);
+ m_ams_check->SetValue(m_ams_check->GetValue() ? false : true);
});
checkbox->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& event) {
- ams_check->SetValue(ams_check->GetValue() ? false : true);
+ m_ams_check->SetValue(m_ams_check->GetValue() ? false : true);
});
return checkbox;
}
@@ -1541,6 +1682,7 @@ void SelectMachineDialog::prepare_mode()
{
// disable combobox
m_comboBox_printer->Enable();
+ show_print_failed_info(false);
m_is_in_sending_mode = false;
if (m_print_job) {
@@ -1820,6 +1962,13 @@ void SelectMachineDialog::update_print_status_msg(wxString msg, bool is_warning,
}
}
+void SelectMachineDialog::update_print_error_info(int code, std::string msg, std::string extra)
+{
+ m_print_error_code = code;
+ m_print_error_msg = msg;
+ m_print_error_extra = extra;
+}
+
bool SelectMachineDialog::has_tips(MachineObject* obj)
{
if (!obj) return false;
@@ -1993,27 +2142,6 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vectorAssociateModel(machine_model.get());
- m_dataViewListCtrl_machines->AppendTextColumn("Printer Name", MachineListModel::Col_MachineName, wxDATAVIEW_CELL_INERT, wxCOL_WIDTH_AUTOSIZE, wxALIGN_NOT,
- wxDATAVIEW_COL_SORTABLE);
-
- m_dataViewListCtrl_machines->AppendTextColumn("SN(dev_id)", MachineListModel::Col_MachineSN, wxDATAVIEW_CELL_INERT, wxCOL_WIDTH_AUTOSIZE, wxALIGN_NOT,
- wxDATAVIEW_COL_RESIZABLE);
-
- m_dataViewListCtrl_machines->AppendTextColumn("Status", MachineListModel::Col_MachinePrintingStatus, wxDATAVIEW_CELL_INERT, wxCOL_WIDTH_AUTOSIZE, wxALIGN_NOT,
- wxDATAVIEW_COL_RESIZABLE);
-
- m_dataViewListCtrl_machines->AppendTextColumn("TaskName", MachineListModel::Col_MachineTaskName, wxDATAVIEW_CELL_INERT, wxCOL_WIDTH_AUTOSIZE, wxALIGN_NOT,
- wxDATAVIEW_COL_RESIZABLE);
-
- m_dataViewListCtrl_machines->AppendTextColumn("Connection", MachineListModel::Col_MachineConnection, wxDATAVIEW_CELL_INERT, wxCOL_WIDTH_AUTOSIZE, wxALIGN_NOT,
- wxDATAVIEW_COL_RESIZABLE);
-}
-
void SelectMachineDialog::init_bind()
{
Bind(wxEVT_TIMER, &SelectMachineDialog::on_timer, this);
@@ -2156,7 +2284,7 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
}
}
- if (has_prohibited_filament && obj_->has_ams() && ams_check->GetValue()) {
+ if (has_prohibited_filament && obj_->has_ams() && m_ams_check->GetValue()) {
wxString tpu_tips = prohibited_error;
show_errors(tpu_tips);
return;
@@ -2251,7 +2379,7 @@ void SelectMachineDialog::on_ok()
// get ams_mapping_result
std::string ams_mapping_array;
std::string ams_mapping_info;
- if (ams_check->GetValue())
+ if (m_ams_check->GetValue())
get_ams_mapping_result(ams_mapping_array, ams_mapping_info);
else {
json mapping_info_json = json::array();
@@ -2329,7 +2457,7 @@ void SelectMachineDialog::on_ok()
true);
if (obj_->has_ams()) {
- m_print_job->task_use_ams = ams_check->GetValue();
+ m_print_job->task_use_ams = m_ams_check->GetValue();
} else {
m_print_job->task_use_ams = false;
}
@@ -2444,7 +2572,7 @@ std::vector SelectMachineDialog::sort_string(std::vector 15 * 1000 / LIST_REFRESH_INTERVAL) {
+ if (m_timeout_count > 15 * 1000 / LIST_REFRESH_INTERVAL) {
return true;
}
return false;
@@ -2452,7 +2580,7 @@ bool SelectMachineDialog::is_timeout()
void SelectMachineDialog::reset_timeout()
{
- timeout_count = 0;
+ m_timeout_count = 0;
}
void SelectMachineDialog::update_user_printer()
@@ -2662,9 +2790,9 @@ void SelectMachineDialog::on_selection_changed(wxCommandEvent &event)
{
/* reset timeout and reading printer info */
m_status_bar->reset();
- timeout_count = 0;
+ m_timeout_count = 0;
m_ams_mapping_res = false;
- ams_mapping_valid = false;
+ m_ams_mapping_valid = false;
m_ams_mapping_result.clear();
auto selection = m_comboBox_printer->GetSelection();
@@ -2785,7 +2913,7 @@ void SelectMachineDialog::update_show_status()
return;
}
else {
- timeout_count++;
+ m_timeout_count++;
show_status(PrintDialogStatus::PrintStatusReading);
return;
}
@@ -2805,7 +2933,7 @@ void SelectMachineDialog::update_show_status()
bool clean_ams_mapping = false;
if (obj_->has_ams() && m_ams_mapping_result.empty()) {
if (obj_->ams_support_use_ams) {
- if (ams_check->GetValue()) {
+ if (m_ams_check->GetValue()) {
do_ams_mapping(obj_);
} else {
clean_ams_mapping = true;
@@ -2813,7 +2941,7 @@ void SelectMachineDialog::update_show_status()
}
}
- if (!obj_->has_ams() || !ams_check->GetValue()) {
+ if (!obj_->has_ams() || !m_ams_check->GetValue()) {
clean_ams_mapping = true;
}
@@ -2861,14 +2989,14 @@ void SelectMachineDialog::update_show_status()
}
// no ams
- if (!obj_->has_ams() || !ams_check->GetValue()) {
+ if (!obj_->has_ams() || !m_ams_check->GetValue()) {
if (!has_tips(obj_))
show_status(PrintDialogStatus::PrintStatusReadingFinished);
return;
}
if (obj_->ams_support_use_ams) {
- if (!ams_check->GetValue()) {
+ if (!m_ams_check->GetValue()) {
m_ams_mapping_result.clear();
sync_ams_mapping_result(m_ams_mapping_result);
show_status(PrintDialogStatus::PrintStatusDisableAms);
@@ -2994,8 +3122,8 @@ void SelectMachineDialog::Enable_Refresh_Button(bool en)
} else {
if (!m_button_refresh->IsEnabled()) {
m_button_refresh->Enable();
- m_button_refresh->SetBackgroundColor(btn_bg_enable);
- m_button_refresh->SetBorderColor(btn_bg_enable);
+ m_button_refresh->SetBackgroundColor(m_btn_bg_enable);
+ m_button_refresh->SetBorderColor(m_btn_bg_enable);
}
}
}
@@ -3011,8 +3139,8 @@ void SelectMachineDialog::Enable_Send_Button(bool en)
} else {
if (!m_button_ensure->IsEnabled()) {
m_button_ensure->Enable();
- m_button_ensure->SetBackgroundColor(btn_bg_enable);
- m_button_ensure->SetBorderColor(btn_bg_enable);
+ m_button_ensure->SetBackgroundColor(m_btn_bg_enable);
+ m_button_ensure->SetBorderColor(m_btn_bg_enable);
}
}
}
@@ -3126,7 +3254,7 @@ void SelectMachineDialog::set_default()
} else {
m_checkbox_list["timelapse"]->SetValue(true);
}
- ams_check->SetValue(true);
+ m_ams_check->SetValue(true);
// thumbmail
//wxBitmap bitmap;
@@ -3148,7 +3276,7 @@ void SelectMachineDialog::set_default()
}
//m_staticbitmap->SetBitmap(bitmap);
- //sizer_thumbnail->Layout();
+ //m_sizer_thumbnail->Layout();
std::vector materials;
std::vector brands;
@@ -3244,7 +3372,7 @@ void SelectMachineDialog::set_default()
if (obj_ &&
obj_->has_ams() &&
- ams_check->GetValue() &&
+ m_ams_check->GetValue() &&
obj_->dev_id == m_printer_last_select)
{
m_mapping_popup.set_parent_item(item);
diff --git a/src/slic3r/GUI/SelectMachine.hpp b/src/slic3r/GUI/SelectMachine.hpp
index 28f03eb0e..913fdff06 100644
--- a/src/slic3r/GUI/SelectMachine.hpp
+++ b/src/slic3r/GUI/SelectMachine.hpp
@@ -229,8 +229,8 @@ private:
wxWindow *create_title_panel(wxString text);
};
-#define SELECT_MACHINE_DIALOG_BUTTON_SIZE wxSize(FromDIP(68), FromDIP(24))
-#define SELECT_MACHINE_DIALOG_SIMBOOK_SIZE wxSize(FromDIP(360), FromDIP(70))
+#define SELECT_MACHINE_DIALOG_BUTTON_SIZE wxSize(FromDIP(68), FromDIP(23))
+#define SELECT_MACHINE_DIALOG_SIMBOOK_SIZE wxSize(FromDIP(370), FromDIP(64))
enum PrintDialogStatus {
@@ -270,179 +270,162 @@ std::string get_print_status_info(PrintDialogStatus status);
class SelectMachineDialog : public DPIDialog
{
private:
- void init_model();
- void init_bind();
- void init_timer();
+ int m_current_filament_id{0};
+ int m_print_plate_idx{0};
+ int m_timeout_count{0};
+ bool m_is_in_sending_mode{ false };
+ bool m_ams_mapping_res{ false };
+ bool m_ams_mapping_valid{ false };
+ bool m_need_adaptation_screen{ false };
+ bool m_export_3mf_cancel{ false };
+ bool m_is_canceled{ false };
+ bool m_is_rename_mode{ false };
+
+ std::string m_printer_last_select;
+ std::string m_print_info;
+ wxString m_current_project_name;
+ PrintDialogStatus m_print_status { PrintStatusInit };
- int m_print_plate_idx;
-
- std::string m_printer_last_select;
- PrintDialogStatus m_print_status { PrintStatusInit };
+ wxColour m_colour_def_color{wxColour(255, 255, 255)};
+ wxColour m_colour_bold_color{wxColour(38, 46, 48)};
+ StateColor m_btn_bg_enable;
std::vector m_bedtype_list;
std::map m_checkbox_list;
std::map m_checkbox_state_list;
- wxColour m_colour_def_color{wxColour(255, 255, 255)};
- wxColour m_colour_bold_color{wxColour(38, 46, 48)};
-
- //SecondaryCheckDialog* confirm_dlg = nullptr;
-
protected:
- MaterialHash m_materialList;
- std::vector m_filaments;
- std::vector m_ams_mapping_result; /* ams mapping data */
- bool m_ams_mapping_res { false }; /* ams mapping result */
- bool ams_mapping_valid { false };
- Plater * m_plater{nullptr};
- wxPanel * m_line_top{nullptr};
- wxPanel * m_panel_image{nullptr};
- wxStaticText *m_stext_time{nullptr};
- wxStaticText *m_stext_weight{nullptr};
- wxPanel * m_line_materia{nullptr};
- wxStaticText *m_stext_printer_title{nullptr};
+ AmsMapingPopup m_mapping_popup{ nullptr };
+ AmsMapingTipPopup m_mapping_tip_popup{ nullptr };
+ AmsTutorialPopup m_mapping_tutorial_popup{ nullptr };
+ MaterialHash m_materialList;
+ Plater * m_plater{nullptr};
+ wxWrapSizer* m_sizer_select{ nullptr };
+ wxBoxSizer* m_sizer_thumbnail{ nullptr };
+ wxGridSizer* m_sizer_material{ nullptr };
+ wxBoxSizer* m_sizer_main{ nullptr };
+ wxBoxSizer* m_sizer_scrollable_view{ nullptr };
+ wxBoxSizer* m_sizer_scrollable_region{ nullptr };
+ wxBoxSizer* rename_sizer_v{ nullptr };
+ wxBoxSizer* rename_sizer_h{ nullptr };
+ Button* m_button_refresh{ nullptr };
+ Button* m_button_ensure{ nullptr };
+ Button* m_rename_button{nullptr};
+ CheckBox* m_ams_check{ nullptr };
+ ComboBox* m_comboBox_printer{ nullptr };
+ ComboBox* m_comboBox_bed{ nullptr };
+ wxStaticBitmap* m_staticbitmap{ nullptr };
+ ThumbnailPanel* m_thumbnailPanel{ nullptr };
+ wxWindow* select_bed{ nullptr };
+ wxWindow* select_flow{ nullptr };
+ wxWindow* select_timelapse{ nullptr };
+ wxWindow* select_use_ams{ nullptr };
+ wxPanel* m_panel_status{ nullptr };
+ wxPanel* m_scrollable_region;
+ wxPanel* m_rename_normal_panel{nullptr};
+ wxPanel* m_line_schedule{nullptr};
+ wxPanel* m_panel_sending{nullptr};
+ wxPanel* m_panel_prepare{nullptr};
+ wxPanel* m_panel_finish{nullptr};
+ wxPanel* m_line_top{ nullptr };
+ wxPanel* m_panel_image{ nullptr };
+ wxPanel* m_line_materia{ nullptr };
+ Label* m_st_txt_error_code{nullptr};
+ Label* m_st_txt_error_desc{nullptr};
+ Label* m_st_txt_extra_info{nullptr};
+ Label * m_link_network_state;
+ wxSimplebook* m_rename_switch_panel{nullptr};
+ wxSimplebook* m_simplebook{nullptr};
+ wxStaticText* m_rename_text{nullptr};
+ wxStaticText* m_stext_printer_title{nullptr};
+ wxStaticText* m_stext_time{ nullptr };
+ wxStaticText* m_stext_weight{ nullptr };
+ wxStaticText* m_statictext_ams_msg{ nullptr };
+ wxStaticText* m_statictext_printer_msg{ nullptr };
+ wxStaticText* m_staticText_bed_title{ nullptr };
+ wxStaticText* m_stext_sending{ nullptr };
+ wxStaticText* m_statictext_finish{nullptr};
+ TextInput* m_rename_input{nullptr};
+ wxTimer* m_refresh_timer{ nullptr };
+ std::shared_ptr m_print_job;
+ wxScrolledWindow* m_scrollable_view;
+ wxScrolledWindow* m_sw_print_failed_info{nullptr};
- wxBoxSizer* rename_sizer_v{ nullptr };
- wxBoxSizer* rename_sizer_h{ nullptr };
- wxStaticText* m_rename_text{nullptr};
- TextInput* m_rename_input{nullptr};
- Button* m_rename_button{nullptr};
- wxPanel* m_rename_normal_panel{nullptr};
- wxSimplebook* m_rename_switch_panel{nullptr};
+ /* model */
+ wxObjectDataPtr m_machine_model;
+ std::shared_ptr m_status_bar;
- wxStaticText *m_statictext_ams_msg{nullptr};
- wxStaticText * m_statictext_printer_msg{nullptr};
- wxStaticBitmap* m_staticbitmap {nullptr};
- ThumbnailPanel *m_thumbnailPanel {nullptr};
-
- ::ComboBox * m_comboBox_printer{nullptr};
- ::ComboBox * m_comboBox_bed{nullptr};
- wxStaticText *m_staticText_bed_title{nullptr};
- wxPanel * m_line_schedule{nullptr};
- wxPanel * m_panel_sending{nullptr};
- wxStaticText *m_stext_sending{nullptr};
- wxPanel * m_panel_prepare{nullptr};
- Button * m_button_refresh{nullptr};
- Button * m_button_ensure{nullptr};
- wxPanel * m_panel_finish{nullptr};
- wxSimplebook *m_simplebook{nullptr};
- wxStaticText *m_statictext_finish{nullptr};
-
- StateColor btn_bg_enable;
- int m_current_filament_id;
- bool m_is_in_sending_mode { false };
-
- //wxGridSizer *m_sizer_select;
- wxWrapSizer *m_sizer_select;
- wxBoxSizer * sizer_thumbnail;
- wxGridSizer *m_sizer_material;
- wxBoxSizer * m_sizer_main;
- wxBoxSizer * m_sizer_bottom;
-
- bool m_need_adaptation_screen {false};
- wxScrolledWindow * m_scrollable_view;
- wxBoxSizer * m_sizer_scrollable_view;
-
- wxPanel* m_scrollable_region;
- wxBoxSizer* m_sizer_scrollable_region;
-
- wxWindow *select_bed{nullptr};
- wxWindow *select_flow{nullptr};
- wxWindow *select_timelapse { nullptr };
- wxWindow *select_use_ams{nullptr};
- CheckBox *ams_check{nullptr};
-
-
- void stripWhiteSpace(std::string& str);
- wxString format_text(wxString &m_msg);
- void update_ams_status_msg(wxString msg, bool is_warning = false);
- void update_priner_status_msg(wxString msg, bool is_warning = false);
- void update_print_status_msg(wxString msg, bool is_warning = false, bool is_printer = true);
+ /*error info*/
+ int m_print_error_code;
+ std::string m_print_error_msg;
+ std::string m_print_error_extra;
+ std::vector m_list;
+ std::vector m_filaments;
+ std::vector m_ams_mapping_result; /* ams mapping data */
public:
SelectMachineDialog(Plater *plater = nullptr);
~SelectMachineDialog();
-
+ 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();
- wxWindow* create_ams_checkbox(wxString title, wxWindow* parent, wxString tooltip);
- wxWindow* create_item_checkbox(wxString title, wxWindow* parent, wxString tooltip, std::string param);
- void update_select_layout(MachineObject *obj);
- void prepare_mode();
- void sending_mode();
- void finish_mode();
+ void update_select_layout(MachineObject *obj);
+ void prepare_mode();
+ void sending_mode();
+ void finish_mode();
+ void sync_ams_mapping_result(std::vector& result);
+ void prepare(int print_plate_idx);
+ void show_status(PrintDialogStatus status, std::vector params = std::vector());
+ void sys_color_changed();
+ void reset_timeout();
+ void update_user_printer();
+ void reset_ams_material();
+ void update_show_status();
+ void update_ams_check(MachineObject* obj);
+ void on_rename_click(wxCommandEvent& event);
+ void on_rename_enter();
+ void update_printer_combobox(wxCommandEvent& event);
+ void on_cancel(wxCloseEvent& event);
+ void show_errors(wxString& info);
+ void on_ok_btn(wxCommandEvent& event);
+ void on_ok();
+ void clear_ip_address_config(wxCommandEvent& e);
+ void on_refresh(wxCommandEvent& event);
+ void on_set_finish_mapping(wxCommandEvent& evt);
+ void on_print_job_cancel(wxCommandEvent& evt);
+ void set_default();
+ void on_timer(wxTimerEvent& event);
+ void on_selection_changed(wxCommandEvent& event);
+ void Enable_Refresh_Button(bool en);
+ void Enable_Send_Button(bool en);
+ void on_dpi_changed(const wxRect& suggested_rect) override;
+ void update_user_machine_list();
+ void update_lan_machine_list();
+ void stripWhiteSpace(std::string& str);
+ void update_ams_status_msg(wxString msg, bool is_warning = false);
+ void update_priner_status_msg(wxString msg, bool is_warning = false);
+ void update_print_status_msg(wxString msg, bool is_warning = false, bool is_printer = true);
+ void update_print_error_info(int code, std::string msg, std::string extra);
+ void set_flow_calibration_state(bool state);
+ bool is_show_timelapse();
+ bool is_same_printer_model();
+ bool has_tips(MachineObject* obj);
+ bool is_timeout();
+ bool Show(bool show);
+ bool do_ams_mapping(MachineObject* obj_);
+ bool get_ams_mapping_result(std::string& mapping_array_str, std::string& ams_mapping_info);
- void sync_ams_mapping_result(std::vector& result);
- bool do_ams_mapping(MachineObject *obj_);
- bool get_ams_mapping_result(std::string &mapping_array_str, std::string &ams_mapping_info);
- void prepare(int print_plate_idx);
- bool has_tips(MachineObject* obj);
- void show_status(PrintDialogStatus status, std::vector params = std::vector());
+ wxString format_text(wxString &m_msg);
+ wxWindow* create_ams_checkbox(wxString title, wxWindow* parent, wxString tooltip);
+ wxWindow* create_item_checkbox(wxString title, wxWindow* parent, wxString tooltip, std::string param);
+ wxImage * LoadImageFromBlob(const unsigned char *data, int size);
PrintDialogStatus get_status() { return m_print_status; }
-
- bool is_same_printer_model();
- void sys_color_changed();
- bool Show(bool show);
-
- /* model */
- wxObjectDataPtr machine_model;
- std::shared_ptr m_status_bar;
- bool m_export_3mf_cancel{false};
- bool m_is_canceled { false };
-
-protected:
- std::vector m_list;
- wxDataViewCtrl * m_dataViewListCtrl_machines{nullptr};
- wxStaticText * m_staticText_left{nullptr};
- wxHyperlinkCtrl * m_hyperlink_add_machine{nullptr};
- wxGauge * m_gauge_job_progress{nullptr};
- wxPanel * m_panel_status{nullptr};
- wxButton * m_button_cancel{nullptr};
- AmsMapingPopup m_mapping_popup{nullptr};
- AmsMapingTipPopup m_mapping_tip_popup{nullptr};
- AmsTutorialPopup m_mapping_tutorial_popup{nullptr};
- wxString m_current_project_name;
- std::string m_print_info;
- int timeout_count = 0;
- bool m_is_rename_mode{false};
- bool is_timeout();
- void reset_timeout();
- void update_user_printer();
- void reset_ams_material();
- void update_show_status();
- void update_ams_check(MachineObject* obj);
- bool is_show_timelapse();
-
- wxTimer *m_refresh_timer { nullptr };
-
- std::shared_ptr m_print_job;
-
- // Virtual event handlers, overide them in your derived class
- void on_rename_click(wxCommandEvent &event);
- void on_rename_enter();
-
- void update_printer_combobox(wxCommandEvent &event);
- void on_cancel(wxCloseEvent &event);
- void show_errors(wxString &info);
- void on_ok_btn(wxCommandEvent &event);
- void on_ok();
- void clear_ip_address_config(wxCommandEvent& e);
- void on_refresh(wxCommandEvent& event);
- void on_set_finish_mapping(wxCommandEvent &evt);
- void on_print_job_cancel(wxCommandEvent &evt);
- void set_default();
- void on_timer(wxTimerEvent& event);
- void on_selection_changed(wxCommandEvent &event);
- void Enable_Refresh_Button(bool en);
- void Enable_Send_Button(bool en);
- void on_dpi_changed(const wxRect &suggested_rect) override;
- void update_user_machine_list();
- void update_lan_machine_list();
- void set_flow_calibration_state(bool state);
- wxImage * LoadImageFromBlob(const unsigned char *data, int size);
std::vector sort_string(std::vector strArray);
};
diff --git a/src/slic3r/GUI/SendToPrinter.cpp b/src/slic3r/GUI/SendToPrinter.cpp
index 738a819eb..46dc52a8a 100644
--- a/src/slic3r/GUI/SendToPrinter.cpp
+++ b/src/slic3r/GUI/SendToPrinter.cpp
@@ -256,8 +256,6 @@ SendToPrinterDialog::SendToPrinterDialog(Plater *plater)
// line schedule
m_line_schedule = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1));
m_line_schedule->SetBackgroundColour(wxColour(238, 238, 238));
-
- m_sizer_bottom = new wxBoxSizer(wxVERTICAL);
m_simplebook = new wxSimplebook(this, wxID_ANY, wxDefaultPosition, SELECT_MACHINE_DIALOG_SIMBOOK_SIZE, 0);
// perpare mode
@@ -314,6 +312,93 @@ SendToPrinterDialog::SendToPrinterDialog(Plater *plater)
m_sizer_finish->Fit(m_panel_finish);
m_simplebook->AddPage(m_panel_finish, wxEmptyString, false);
+ //show bind failed info
+ m_sw_print_failed_info = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(380), FromDIP(125)), wxVSCROLL);
+ m_sw_print_failed_info->SetBackgroundColour(*wxWHITE);
+ m_sw_print_failed_info->SetScrollRate(0, 5);
+ m_sw_print_failed_info->SetMinSize(wxSize(FromDIP(380), FromDIP(125)));
+ m_sw_print_failed_info->SetMaxSize(wxSize(FromDIP(380), FromDIP(125)));
+
+ wxBoxSizer* sizer_print_failed_info = new wxBoxSizer(wxVERTICAL);
+ m_sw_print_failed_info->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);
+
+ auto st_title_error_code = new wxStaticText(m_sw_print_failed_info, wxID_ANY, _L("Error code"));
+ auto st_title_error_code_doc = new wxStaticText(m_sw_print_failed_info, wxID_ANY, ": ");
+ m_st_txt_error_code = new Label(m_sw_print_failed_info, 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_13);
+ st_title_error_code_doc->SetFont(::Label::Body_13);
+ m_st_txt_error_code->SetFont(::Label::Body_13);
+ st_title_error_code->SetMinSize(wxSize(FromDIP(74), -1));
+ st_title_error_code->SetMaxSize(wxSize(FromDIP(74), -1));
+ m_st_txt_error_code->SetMinSize(wxSize(FromDIP(260), -1));
+ m_st_txt_error_code->SetMaxSize(wxSize(FromDIP(260), -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_sw_print_failed_info, wxID_ANY, wxT("Error desc"));
+ auto st_title_error_desc_doc = new wxStaticText(m_sw_print_failed_info, wxID_ANY, ": ");
+ m_st_txt_error_desc = new Label(m_sw_print_failed_info, 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_13);
+ st_title_error_desc_doc->SetFont(::Label::Body_13);
+ m_st_txt_error_desc->SetFont(::Label::Body_13);
+ st_title_error_desc->SetMinSize(wxSize(FromDIP(74), -1));
+ st_title_error_desc->SetMaxSize(wxSize(FromDIP(74), -1));
+ m_st_txt_error_desc->SetMinSize(wxSize(FromDIP(260), -1));
+ m_st_txt_error_desc->SetMaxSize(wxSize(FromDIP(260), -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_sw_print_failed_info, wxID_ANY, wxT("Extra info"));
+ auto st_title_extra_info_doc = new wxStaticText(m_sw_print_failed_info, wxID_ANY, ": ");
+ m_st_txt_extra_info = new Label(m_sw_print_failed_info, 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_13);
+ st_title_extra_info_doc->SetFont(::Label::Body_13);
+ m_st_txt_extra_info->SetFont(::Label::Body_13);
+ st_title_extra_info->SetMinSize(wxSize(FromDIP(74), -1));
+ st_title_extra_info->SetMaxSize(wxSize(FromDIP(74), -1));
+ m_st_txt_extra_info->SetMinSize(wxSize(FromDIP(260), -1));
+ m_st_txt_extra_info->SetMaxSize(wxSize(FromDIP(260), -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);
+
+
+ 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_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); });
+
+ sizer_print_failed_info->Add(m_link_network_state, 0, wxLEFT, 5);
+ 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);
+
+ // bind
+ Bind(EVT_SHOW_ERROR_INFO, [this](auto& e) {
+ show_print_failed_info(true);
+ });
+
// bind
Bind(EVT_UPDATE_USER_MACHINE_LIST, &SendToPrinterDialog::update_printer_combobox, this);
Bind(EVT_PRINT_JOB_CANCEL, &SendToPrinterDialog::on_print_job_cancel, this);
@@ -411,22 +496,23 @@ SendToPrinterDialog::SendToPrinterDialog(Plater *plater)
});
m_sizer_main->Add(m_line_top, 0, wxEXPAND, 0);
- m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(22));
+ m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(10));
m_sizer_main->Add(m_scrollable_region, 0, wxALIGN_CENTER_HORIZONTAL, 0);
- m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(8));
+ m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(6));
m_sizer_main->Add(m_rename_switch_panel, 0, wxALIGN_CENTER_HORIZONTAL, 0);
- m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(8));
+ m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(6));
m_sizer_main->Add(m_line_materia, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30));
- m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(15));
+ m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(12));
m_sizer_main->Add(m_sizer_printer, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30));
- m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(13));
+ m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(11));
m_sizer_main->Add(m_statictext_printer_msg, 0, wxALIGN_CENTER_HORIZONTAL, 0);
- m_sizer_main->Add(0, 1, 0, wxTOP, FromDIP(32));
+ m_sizer_main->Add(0, 1, 0, wxTOP, FromDIP(22));
m_sizer_main->Add(m_line_schedule, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30));
m_sizer_main->Add(m_simplebook, 0, wxALIGN_CENTER_HORIZONTAL, 0);
- m_sizer_main->Add(m_sizer_bottom, 0, wxALIGN_CENTER_HORIZONTAL);
- m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(15));
+ m_sizer_main->Add(m_sw_print_failed_info, 0, wxALIGN_CENTER, 0);
+ m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(13));
+ show_print_failed_info(false);
SetSizer(m_sizer_main);
Layout();
Fit();
@@ -439,6 +525,44 @@ SendToPrinterDialog::SendToPrinterDialog(Plater *plater)
wxGetApp().UpdateDlgDarkUI(this);
}
+void SendToPrinterDialog::update_print_error_info(int code, std::string msg, std::string extra)
+{
+ m_print_error_code = code;
+ m_print_error_msg = msg;
+ m_print_error_extra = extra;
+}
+
+void SendToPrinterDialog::show_print_failed_info(bool show, int code, wxString description, wxString extra)
+{
+ if (show) {
+ if (!m_sw_print_failed_info->IsShown()) {
+ m_sw_print_failed_info->Show(true);
+
+ m_st_txt_error_code->SetLabelText(wxString::Format("%d", m_print_error_code));
+ m_st_txt_error_desc->SetLabelText(m_print_error_msg);
+ m_st_txt_extra_info->SetLabelText(m_print_error_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));
+ }
+ else {
+ m_sw_print_failed_info->Show(false);
+ }
+ Layout();
+ Fit();
+ }
+ else {
+ if (!m_sw_print_failed_info->IsShown()) { return; }
+ m_sw_print_failed_info->Show(false);
+ m_st_txt_error_code->SetLabelText(wxEmptyString);
+ m_st_txt_error_desc->SetLabelText(wxEmptyString);
+ m_st_txt_extra_info->SetLabelText(wxEmptyString);
+ Layout();
+ Fit();
+ }
+}
+
void SendToPrinterDialog::prepare_mode()
{
m_is_in_sending_mode = false;
@@ -449,6 +573,7 @@ void SendToPrinterDialog::prepare_mode()
if (wxIsBusy())
wxEndBusyCursor();
Enable_Send_Button(true);
+ show_print_failed_info(false);
m_status_bar->reset();
if (m_simplebook->GetSelection() != 0) {
@@ -466,6 +591,33 @@ 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;
@@ -516,26 +668,6 @@ void SendToPrinterDialog::update_print_status_msg(wxString msg, bool is_warning,
}
-void SendToPrinterDialog::init_model()
-{
- machine_model = new MachineListModel;
- m_dataViewListCtrl_machines->AssociateModel(machine_model.get());
- m_dataViewListCtrl_machines->AppendTextColumn("Printer Name", MachineListModel::Col_MachineName, wxDATAVIEW_CELL_INERT, wxCOL_WIDTH_AUTOSIZE, wxALIGN_NOT,
- wxDATAVIEW_COL_SORTABLE);
-
- m_dataViewListCtrl_machines->AppendTextColumn("SN(dev_id)", MachineListModel::Col_MachineSN, wxDATAVIEW_CELL_INERT, wxCOL_WIDTH_AUTOSIZE, wxALIGN_NOT,
- wxDATAVIEW_COL_RESIZABLE);
-
- m_dataViewListCtrl_machines->AppendTextColumn("Status", MachineListModel::Col_MachinePrintingStatus, wxDATAVIEW_CELL_INERT, wxCOL_WIDTH_AUTOSIZE, wxALIGN_NOT,
- wxDATAVIEW_COL_RESIZABLE);
-
- m_dataViewListCtrl_machines->AppendTextColumn("TaskName", MachineListModel::Col_MachineTaskName, wxDATAVIEW_CELL_INERT, wxCOL_WIDTH_AUTOSIZE, wxALIGN_NOT,
- wxDATAVIEW_COL_RESIZABLE);
-
- m_dataViewListCtrl_machines->AppendTextColumn("Connection", MachineListModel::Col_MachineConnection, wxDATAVIEW_CELL_INERT, wxCOL_WIDTH_AUTOSIZE, wxALIGN_NOT,
- wxDATAVIEW_COL_RESIZABLE);
-}
-
void SendToPrinterDialog::init_bind()
{
Bind(wxEVT_TIMER, &SendToPrinterDialog::on_timer, this);
@@ -689,13 +821,6 @@ void SendToPrinterDialog::clear_ip_address_config(wxCommandEvent& e)
{
enable_prepare_mode = true;
prepare_mode();
- /*DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
- if (!dev) return;
- if (!dev->get_selected_machine()) return;
- auto obj = dev->get_selected_machine();
- Slic3r::GUI::wxGetApp().app_config->set_str("ip_address", obj->dev_id, "");
- Slic3r::GUI::wxGetApp().app_config->save();
- wxGetApp().show_ip_address_enter_dialog();*/
}
void SendToPrinterDialog::update_user_machine_list()
diff --git a/src/slic3r/GUI/SendToPrinter.hpp b/src/slic3r/GUI/SendToPrinter.hpp
index 85d200585..8ebe11bea 100644
--- a/src/slic3r/GUI/SendToPrinter.hpp
+++ b/src/slic3r/GUI/SendToPrinter.hpp
@@ -45,129 +45,115 @@ namespace GUI {
class SendToPrinterDialog : public DPIDialog
{
private:
- void init_model();
void init_bind();
void init_timer();
- int m_print_plate_idx;
- PrintDialogStatus m_print_status { PrintStatusInit };
+ int m_print_plate_idx;
+ int m_current_filament_id;
+ int m_print_error_code;
+ int timeout_count = 0;
+ bool m_is_in_sending_mode{ false };
+ bool m_is_rename_mode{ false };
+ bool enable_prepare_mode{ true };
+ bool m_need_adaptation_screen{ false };
+ bool m_export_3mf_cancel{ false };
+ bool m_is_canceled{ false };
+ std::string m_print_error_msg;
+ std::string m_print_error_extra;
+ std::string m_print_info;
+ std::string m_printer_last_select;
+ wxString m_current_project_name;
- std::string m_printer_last_select;
- std::vector m_bedtype_list;
- std::map m_checkbox_list;
+ TextInput* m_rename_input{ nullptr };
+ wxSimplebook* m_rename_switch_panel{ nullptr };
+ Plater* m_plater{ nullptr };
+ wxStaticBitmap* m_staticbitmap{ nullptr };
+ ThumbnailPanel* m_thumbnailPanel{ nullptr };
+ ComboBox* m_comboBox_printer{ nullptr };
+ ComboBox* m_comboBox_bed{ nullptr };
+ Button* m_rename_button{ nullptr };
+ Button* m_button_refresh{ nullptr };
+ Button* m_button_ensure{ nullptr };
+ wxPanel* m_scrollable_region;
+ wxPanel* m_line_schedule{ nullptr };
+ wxPanel* m_panel_sending{ nullptr };
+ wxPanel* m_panel_prepare{ nullptr };
+ wxPanel* m_panel_finish{ nullptr };
+ wxPanel* m_line_top{ nullptr };
+ wxPanel* m_panel_image{ nullptr };
+ wxPanel* m_rename_normal_panel{ nullptr };
+ wxPanel* m_line_materia{ nullptr };
+ wxSimplebook* m_simplebook{ nullptr };
+ wxStaticText* m_statictext_finish{ nullptr };
+ wxStaticText* m_stext_sending{ nullptr };
+ wxStaticText* m_staticText_bed_title{ nullptr };
+ wxStaticText* m_statictext_printer_msg{ nullptr };
+ wxStaticText* m_stext_printer_title{ nullptr };
+ wxStaticText* m_rename_text{ nullptr };
+ wxStaticText* m_stext_time{ nullptr };
+ wxStaticText* m_stext_weight{ nullptr };
+ Label* m_st_txt_error_code{ nullptr };
+ Label* m_st_txt_error_desc{ nullptr };
+ Label* m_st_txt_extra_info{ nullptr };
+ Label * m_link_network_state;
+ StateColor btn_bg_enable;
+ wxBoxSizer* rename_sizer_v{ nullptr };
+ wxBoxSizer* rename_sizer_h{ nullptr };
+ wxBoxSizer* sizer_thumbnail;
+ wxBoxSizer* m_sizer_scrollable_region;
+ wxBoxSizer* m_sizer_main;
+ wxStaticText* m_file_name;
+ PrintDialogStatus m_print_status{ PrintStatusInit };
- wxColour m_colour_def_color{ wxColour(255, 255, 255) };
- wxColour m_colour_bold_color{ wxColour(38, 46, 48) };
-
-protected:
- wxString m_current_project_name;
- wxBoxSizer* rename_sizer_v{ nullptr };
- wxBoxSizer* rename_sizer_h{ nullptr };
- wxStaticText* m_rename_text{ nullptr };
- TextInput* m_rename_input{ nullptr };
- Button* m_rename_button{ nullptr };
- wxPanel* m_rename_normal_panel{ nullptr };
- wxSimplebook* m_rename_switch_panel{ nullptr };
- Plater* m_plater{ nullptr };
- wxPanel* m_line_top{ nullptr };
- wxPanel* m_panel_image{ nullptr };
- wxStaticText* m_stext_time{ nullptr };
- wxStaticText* m_stext_weight{ nullptr };
- wxPanel* m_line_materia{ nullptr };
- wxStaticText* m_stext_printer_title{ nullptr };
-
- wxStaticText* m_statictext_printer_msg{ nullptr };
- wxStaticBitmap* m_staticbitmap{ nullptr };
- ThumbnailPanel* m_thumbnailPanel{ nullptr };
-
- ::ComboBox* m_comboBox_printer{ nullptr };
- ::ComboBox* m_comboBox_bed{ nullptr };
- wxStaticText* m_staticText_bed_title{ nullptr };
- wxPanel* m_line_schedule{ nullptr };
- wxPanel* m_panel_sending{ nullptr };
- wxStaticText* m_stext_sending{ nullptr };
- wxPanel* m_panel_prepare{ nullptr };
- Button* m_button_refresh{ nullptr };
- Button* m_button_ensure{ nullptr };
- wxPanel* m_panel_finish{ nullptr };
- wxSimplebook* m_simplebook{ nullptr };
- wxStaticText* m_statictext_finish{ nullptr };
-
- StateColor btn_bg_enable;
- int m_current_filament_id;
- bool m_is_in_sending_mode{ false };
-
- wxBoxSizer* sizer_thumbnail;
- wxBoxSizer* m_sizer_main;
- wxBoxSizer* m_sizer_bottom;
- wxStaticText* m_file_name;
-
- bool m_is_rename_mode{false};
- bool enable_prepare_mode{true};
- bool m_need_adaptation_screen{ false };
- wxPanel* m_scrollable_region;
- wxBoxSizer* m_sizer_scrollable_region;
-
- void on_rename_click(wxCommandEvent& event);
- void on_rename_enter();
-
- void stripWhiteSpace(std::string& str);
- wxString format_text(wxString& m_msg);
- void check_focus(wxWindow* window);
- void check_fcous_state(wxWindow* window);
- void update_priner_status_msg(wxString msg, bool is_warning = false);
- void update_print_status_msg(wxString msg, bool is_warning = false, bool is_printer = true);
+ std::shared_ptr m_send_job{nullptr};
+ std::vector m_bedtype_list;
+ std::map m_checkbox_list;
+ std::vector m_list;
+ wxColour m_colour_def_color{ wxColour(255, 255, 255) };
+ wxColour m_colour_bold_color{ wxColour(38, 46, 48) };
+ wxTimer* m_refresh_timer{ nullptr };
+ wxObjectDataPtr machine_model;
+ std::shared_ptr m_status_bar;
+ wxScrolledWindow* m_sw_print_failed_info{nullptr};
+
public:
SendToPrinterDialog(Plater* plater = nullptr);
- ~SendToPrinterDialog();
+ ~SendToPrinterDialog();
- void prepare_mode();
- void sending_mode();
- void prepare(int print_plate_idx);
- bool Show(bool show);
-
- /* model */
- wxObjectDataPtr machine_model;
- std::shared_ptr m_status_bar;
- bool m_export_3mf_cancel{ false };
- bool m_is_canceled{ false };
-
-protected:
- std::vector m_list;
- wxDataViewCtrl* m_dataViewListCtrl_machines{ nullptr };
- wxStaticText* m_staticText_left{ nullptr };
- wxHyperlinkCtrl* m_hyperlink_add_machine{ nullptr };
- wxGauge* m_gauge_job_progress{ nullptr };
- wxPanel* m_panel_status{ nullptr };
- wxButton* m_button_cancel{ nullptr };
-
- std::string m_print_info;
- int timeout_count = 0;
- bool is_timeout();
- void reset_timeout();
- void update_user_printer();
- void update_show_status();
-
- wxTimer* m_refresh_timer{ nullptr };
-
- std::shared_ptr m_send_job{nullptr};
-
- // Virtual event handlers, overide them in your derived class
- void update_printer_combobox(wxCommandEvent& event);
- void on_cancel(wxCloseEvent& event);
- void on_ok(wxCommandEvent& event);
- void clear_ip_address_config(wxCommandEvent& e);
- void on_refresh(wxCommandEvent& event);
- void on_print_job_cancel(wxCommandEvent& evt);
- void set_default();
- void on_timer(wxTimerEvent& event);
- void on_selection_changed(wxCommandEvent& event);
- void Enable_Refresh_Button(bool en);
- void show_status(PrintDialogStatus status, std::vector params = std::vector());
- void Enable_Send_Button(bool en);
- void on_dpi_changed(const wxRect& suggested_rect) override;
- void update_user_machine_list();
+ bool Show(bool show);
+ bool is_timeout();
+ void on_rename_click(wxCommandEvent& event);
+ void on_rename_enter();
+ 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();
+ void prepare(int print_plate_idx);
+ void check_focus(wxWindow* window);
+ void check_fcous_state(wxWindow* window);
+ void update_priner_status_msg(wxString msg, bool is_warning = false);
+ void update_print_status_msg(wxString msg, bool is_warning = false, bool is_printer = true);
+ void update_printer_combobox(wxCommandEvent& event);
+ void on_cancel(wxCloseEvent& event);
+ void on_ok(wxCommandEvent& event);
+ void clear_ip_address_config(wxCommandEvent& e);
+ void on_refresh(wxCommandEvent& event);
+ void on_print_job_cancel(wxCommandEvent& evt);
+ void set_default();
+ void on_timer(wxTimerEvent& event);
+ void on_selection_changed(wxCommandEvent& event);
+ void Enable_Refresh_Button(bool en);
+ void show_status(PrintDialogStatus status, std::vector params = std::vector());
+ void Enable_Send_Button(bool en);
+ void on_dpi_changed(const wxRect& suggested_rect) override;
+ void update_user_machine_list();
+ void show_print_failed_info(bool show, int code = 0, wxString description = wxEmptyString, wxString extra = wxEmptyString);
+ void update_print_error_info(int code, std::string msg, std::string extra);
+ wxString format_text(wxString& m_msg);
std::vector sort_string(std::vector strArray);
};
diff --git a/src/slic3r/Utils/bambu_networking.hpp b/src/slic3r/Utils/bambu_networking.hpp
index a8f91583e..cc243215e 100644
--- a/src/slic3r/Utils/bambu_networking.hpp
+++ b/src/slic3r/Utils/bambu_networking.hpp
@@ -13,30 +13,68 @@ namespace BBL {
#define BAMBU_NETWORK_ERR_SEND_MSG_FAILED -4
#define BAMBU_NETWORK_ERR_BIND_FAILED -5
#define BAMBU_NETWORK_ERR_UNBIND_FAILED -6
-#define BAMBU_NETWORK_ERR_PRINT_FAILED -7
-#define BAMBU_NETWORK_ERR_LOCAL_PRINT_FAILED -8
-#define BAMBU_NETWORK_ERR_REQUEST_SETTING_FAILED -9
-#define BAMBU_NETWORK_ERR_PUT_SETTING_FAILED -10
-#define BAMBU_NETWORK_ERR_GET_SETTING_LIST_FAILED -11
-#define BAMBU_NETWORK_ERR_DEL_SETTING_FAILED -12
-#define BAMBU_NETWORK_ERR_GET_USER_PRINTINFO_FAILED -13
-#define BAMBU_NETWORK_ERR_GET_PRINTER_FIRMWARE_FAILED -14
-#define BAMBU_NETWORK_ERR_QUERY_BIND_INFO_FAILED -15
-#define BAMBU_NETWORK_ERR_MODIFY_PRINTER_NAME_FAILED -16
-#define BAMBU_NETWORK_ERR_FILE_NOT_EXIST -17
-#define BAMBU_NETWORK_ERR_FILE_OVER_SIZE -18
-#define BAMBU_NETWORK_ERR_CHECK_MD5_FAILED -19
-#define BAMBU_NETWORK_ERR_TIMEOUT -20
-#define BAMBU_NETWORK_ERR_CANCELED -21
-#define BAMBU_NETWORK_ERR_INVALID_PARAMS -22
-#define BAMBU_NETWORK_ERR_INVALID_RESULT -23
-#define BAMBU_NETWORK_ERR_FTP_UPLOAD_FAILED -24
-#define BAMBU_NETWORK_ERR_FTP_LOGIN_DENIED -25
-#define BAMBU_NETWORK_ERR_GET_MODEL_PUBLISH_PAGE -26
-#define BAMBU_NETWORK_ERR_GET_MODEL_MALL_HOME_PAGE -27
-#define BAMBU_NETWORK_ERR_GET_USER_INFO -28
-#define BAMBU_NETWORK_ERR_WRONG_IP_ADDRESS -29
-#define BAMBU_NETWORK_ERR_NO_SPACE_LEFT_ON_DEVICE -30
+#define BAMBU_NETWORK_ERR_REQUEST_SETTING_FAILED -7
+#define BAMBU_NETWORK_ERR_PUT_SETTING_FAILED -8
+#define BAMBU_NETWORK_ERR_GET_SETTING_LIST_FAILED -9
+#define BAMBU_NETWORK_ERR_DEL_SETTING_FAILED -10
+#define BAMBU_NETWORK_ERR_GET_USER_PRINTINFO_FAILED -11
+#define BAMBU_NETWORK_ERR_QUERY_BIND_INFO_FAILED -12
+#define BAMBU_NETWORK_ERR_MODIFY_PRINTER_NAME_FAILED -13
+#define BAMBU_NETWORK_ERR_FILE_NOT_EXIST -14
+#define BAMBU_NETWORK_ERR_FILE_OVER_SIZE -15
+#define BAMBU_NETWORK_ERR_CHECK_MD5_FAILED -16
+#define BAMBU_NETWORK_ERR_TIMEOUT -17
+#define BAMBU_NETWORK_ERR_CANCELED -18
+#define BAMBU_NETWORK_ERR_INVALID_RESULT -19
+#define BAMBU_NETWORK_ERR_FTP_UPLOAD_FAILED -20
+
+ //bind error
+#define BAMBU_NETWORK_ERR_BIND_CREATE_SOCKET_FAILED -1010 //failed to create socket
+#define BAMBU_NETWORK_ERR_BIND_SOCKET_CONNECT_FAILED -1020 //failed to socket connect
+#define BAMBU_NETWORK_ERR_BIND_PUBLISH_LOGIN_REQUEST -1030 //failed to publish login request
+#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
+
+//start_local_print_with_record error
+#define BAMBU_NETWORK_ERR_PRINT_WR_REQUEST_PROJECT_ID_FAILED -2010 //failed to request project id
+#define BAMBU_NETWORK_ERR_PRINT_WR_CHECK_MD5_FAILED -2020 //failed to check md5 for upload 3mf to oss
+#define BAMBU_NETWORK_ERR_PRINT_WR_UPLOAD_3MF_CONFIG_TO_OSS_FAILED -2030 //failed to upload 3mf config to oss
+#define BAMBU_NETWORK_ERR_PRINT_WR_FILE_OVER_SIZE -2040 //the size of the uploaded file cannot exceed 1 GB
+#define BAMBU_NETWORK_ERR_PRINT_WR_PUT_NOTIFICATION_FAILED -2050 //timeout to get notification
+#define BAMBU_NETWORK_ERR_PRINT_WR_GET_NOTIFICATION_TIMEOUT -2060 //timeout to get notification
+#define BAMBU_NETWORK_ERR_PRINT_WR_GET_NOTIFICATION_FAILED -2070 //failed to get notification
+#define BAMBU_NETWORK_ERR_PRINT_WR_PATCH_PROJECT_FAILED -2080 //failed to patch project
+#define BAMBU_NETWORK_ERR_PRINT_WR_GET_MY_SETTING_FAILED -2090 //failed to get my setting
+#define BAMBU_NETWORK_ERR_PRINT_WR_FILE_NOT_EXIST -2100 //3mf file is not exists
+#define BAMBU_NETWORK_ERR_PRINT_WR_UPLOAD_3MF_TO_OSS_FAILED -2110 //failed to upload 3mf to oss
+#define BAMBU_NETWORK_ERR_PRINT_WR_POST_TASK_FAILED -2120 //failed to post task
+#define BAMBU_NETWORK_ERR_PRINT_WR_UPLOAD_FTP_FAILED -2130 //failed to upload to ftp
+#define BAMBU_NETWORK_ERR_PRINT_WR_GET_USER_UPLOAD_FAILED -2140 //failed to get_user_upload
+
+//start_print error
+#define BAMBU_NETWORK_ERR_PRINT_SP_REQUEST_PROJECT_ID_FAILED -3010 //failed to request project id
+#define BAMBU_NETWORK_ERR_PRINT_SP_CHECK_MD5_FAILED -3020 //failed to check md5 for upload 3mf to oss
+#define BAMBU_NETWORK_ERR_PRINT_SP_UPLOAD_3MF_CONFIG_TO_OSS_FAILED -3030 //failed to upload 3mf config to oss
+#define BAMBU_NETWORK_ERR_PRINT_SP_PUT_NOTIFICATION_FAILED -3040 //failed to put notification
+#define BAMBU_NETWORK_ERR_PRINT_SP_GET_NOTIFICATION_TIMEOUT -3050 //timeout to get notification
+#define BAMBU_NETWORK_ERR_PRINT_SP_GET_NOTIFICATION_FAILED -3060 //failed to get notification
+#define BAMBU_NETWORK_ERR_PRINT_SP_FILE_NOT_EXIST -3070 //3mf file is not exists
+#define BAMBU_NETWORK_ERR_PRINT_SP_GET_USER_UPLOAD_FAILED -3080 //failed to get_user_upload
+#define BAMBU_NETWORK_ERR_PRINT_SP_FILE_OVER_SIZE -3090 //the size of the uploaded file cannot exceed 1 GB
+#define BAMBU_NETWORK_ERR_PRINT_SP_UPLOAD_3MF_TO_OSS_FAILED -3100 //failed to upload 3mf to oss
+#define BAMBU_NETWORK_ERR_PRINT_SP_PATCH_PROJECT_FAILED -3110 //failed to patch project
+#define BAMBU_NETWORK_ERR_PRINT_SP_POST_TASK_FAILED -3120 //failed to post task
+
+//start_local_print error
+#define BAMBU_NETWORK_ERR_PRINT_LP_FILE_OVER_SIZE -4010 //the size of the uploaded file cannot exceed 1 GB
+#define BAMBU_NETWORK_ERR_PRINT_LP_UPLOAD_FTP_FAILED -4020 //failed to upload ftp
+#define BAMBU_NETWORK_ERR_PRINT_LP_PUBLISH_MSG_FAILED -4030 //failed to send mqtt message to device
+
+//start_send_gcode_to_sdcard error
+#define BAMBU_NETWORK_ERR_PRINT_SG_UPLOAD_FTP_FAILED -5010 //failed to upload ftp
#define BAMBU_NETWORK_LIBRARY "bambu_networking"
@@ -87,6 +125,7 @@ enum SendingPrintJobStage {
PrintingStageSending = 3,
PrintingStageRecord = 4,
PrintingStageFinished = 5,
+ PrintingStageERROR = 6,
};
enum PublishingStage {