ENH: add more tips dialog

JIRA: STUDIO-7801

Change-Id: I672082d97c5afa144f704959c0c56d70fddd3a6a
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
Stone Li 2024-12-19 14:46:41 +08:00 committed by Lane.Wei
parent 9878569913
commit bcdbf267fb
5 changed files with 78 additions and 19 deletions

View File

@ -5511,8 +5511,6 @@ void DeviceManager::on_machine_alive(std::string json_str)
Slic3r::GUI::wxGetApp().app_config->set_str("ip_address", obj->dev_id, obj->dev_ip);
Slic3r::GUI::wxGetApp().app_config->save();
}*/
BOOST_LOG_TRIVIAL(info) << "SsdpDiscovery::New Machine, ip = " << Slic3r::GUI::wxGetApp().format_IP(dev_ip) << ", printer_name= " << dev_name << ", printer_type = " << printer_type_str << ", signal = " << printer_signal;
}
}

View File

@ -2031,6 +2031,8 @@ void GUI_App::init_networking_callbacks()
obj->command_get_version();
obj->erase_user_access_code();
obj->command_get_access_code();
if (m_agent)
m_agent->install_device_cert(obj->dev_id, obj->is_lan_mode_printer());
if (!is_enable_multi_machine()) {
GUI::wxGetApp().sidebar().load_ams_list(obj->dev_id, obj);
}
@ -2129,6 +2131,8 @@ void GUI_App::init_networking_callbacks()
CallAfter([this, dev_id, msg] {
if (m_is_closing)
return;
this->process_network_msg(dev_id, msg);
MachineObject* obj = this->m_device_manager->get_user_machine(dev_id);
if (obj) {
obj->is_ams_need_update = false;
@ -2181,6 +2185,7 @@ void GUI_App::init_networking_callbacks()
if (m_is_closing)
return;
this->process_network_msg(dev_id, msg);
MachineObject* obj = m_device_manager->get_my_machine(dev_id);
if (!obj || !obj->is_lan_mode_printer()) {
obj = m_device_manager->get_local_machine(dev_id);
@ -4491,14 +4496,12 @@ void GUI_App::on_http_error(wxCommandEvent &evt)
// Version limit
if (code == HttpErrorVersionLimited) {
if (!m_show_http_errpr_msgdlg) {
if (!m_show_error_msgdlg) {
MessageDialog msg_dlg(nullptr, _L("The Bambu Studio version is too old to enable cloud service. Please download the latest version from Bambu Lab website."), "", wxAPPLY | wxOK);
m_show_http_errpr_msgdlg = true;
m_show_error_msgdlg = true;
auto modal_result = msg_dlg.ShowModal();
if (modal_result == wxOK || modal_result == wxCLOSE) {
m_show_http_errpr_msgdlg = false;
return;
}
m_show_error_msgdlg = false;
return;
}
}
@ -4508,15 +4511,12 @@ void GUI_App::on_http_error(wxCommandEvent &evt)
if (m_agent) {
if (m_agent->is_user_login()) {
this->request_user_logout();
if (!m_show_http_errpr_msgdlg) {
if (!m_show_error_msgdlg) {
MessageDialog msg_dlg(nullptr, _L("Login information expired. Please login again."), "", wxAPPLY | wxOK);
m_show_http_errpr_msgdlg = true;
m_show_error_msgdlg = true;
auto modal_result = msg_dlg.ShowModal();
if (modal_result == wxOK || modal_result == wxCLOSE) {
m_show_http_errpr_msgdlg = false;
return;
}
m_show_error_msgdlg = false;
return;
}
}
}
@ -4826,6 +4826,63 @@ void GUI_App::check_cert()
BOOST_LOG_TRIVIAL(info) << "check_cert";
}
void GUI_App::process_network_msg(std::string dev_id, std::string msg)
{
if (dev_id.empty()) {
if (msg == "wait_info") {
BOOST_LOG_TRIVIAL(info) << "process_network_msg, wait_info";
Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev)
return;
MachineObject* obj = dev->get_selected_machine();
if (obj)
m_agent->install_device_cert(obj->dev_id, obj->is_lan_mode_printer());
if (!m_show_error_msgdlg) {
MessageDialog msg_dlg(nullptr, _L("Retrieving printer information, please try again later."), "", wxAPPLY | wxOK);
m_show_error_msgdlg = true;
auto modal_result = msg_dlg.ShowModal();
m_show_error_msgdlg = false;
}
}
else if (msg == "update_studio") {
BOOST_LOG_TRIVIAL(info) << "process_network_msg, update_studio";
if (!m_show_error_msgdlg) {
MessageDialog msg_dlg(nullptr, _L("Please try updating Bambu Studio and then try again."), "", wxAPPLY | wxOK);
m_show_error_msgdlg = true;
auto modal_result = msg_dlg.ShowModal();
m_show_error_msgdlg = false;
}
}
else if (msg == "update_fixed_studio") {
BOOST_LOG_TRIVIAL(info) << "process_network_msg, update_fixed_studio";
if (!m_show_error_msgdlg) {
MessageDialog msg_dlg(nullptr, _L("Please try updating Bambu Studio and then try again."), "", wxAPPLY | wxOK);
m_show_error_msgdlg = true;
auto modal_result = msg_dlg.ShowModal();
m_show_error_msgdlg = false;
}
}
else if (msg == "cert_expired") {
BOOST_LOG_TRIVIAL(info) << "process_network_msg, cert_expired";
if (!m_show_error_msgdlg) {
MessageDialog msg_dlg(nullptr, _L("The certificate has expired. Please check the time settings or update Bambu Studio and try again."), "", wxAPPLY | wxOK);
m_show_error_msgdlg = true;
auto modal_result = msg_dlg.ShowModal();
m_show_error_msgdlg = false;
}
}
else if (msg == "cert_revoked") {
BOOST_LOG_TRIVIAL(info) << "process_network_msg, cert_revoked";
if (!m_show_error_msgdlg) {
MessageDialog msg_dlg(nullptr, _L("The certificate has been revoked. Please check the time settings or update Bambu Studio and try again."), "", wxAPPLY | wxOK);
m_show_error_msgdlg = true;
auto modal_result = msg_dlg.ShowModal();
m_show_error_msgdlg = false;
}
}
}
}
//BBS pop up a dialog and download files
void GUI_App::request_new_version(int by_user)
{

View File

@ -304,7 +304,7 @@ private:
bool m_is_dark_mode{ false };
bool m_adding_script_handler { false };
bool m_side_popup_status{false};
bool m_show_http_errpr_msgdlg{false};
bool m_show_error_msgdlg{false};
wxString m_info_dialog_content;
HttpServer m_http_server;
@ -457,8 +457,9 @@ public:
void check_update(bool show_tips, int by_user);
void check_new_version(bool show_tips = false, int by_user = 0);
void check_beta_version();
void check_cert();
void process_network_msg(std::string dev_id, std::string msg);
void check_beta_version();
void request_new_version(int by_user);
void enter_force_upgrade();
void set_skip_version(bool skip = true);

View File

@ -593,8 +593,10 @@ void PrintJob::process()
if (result < 0) {
curr_percent = -1;
if (result == BAMBU_NETWORK_ERR_PRINT_WR_FILE_NOT_EXIST || result == BAMBU_NETWORK_ERR_PRINT_SP_FILE_NOT_EXIST) {
if (result == BAMBU_NETOWRK_ERR_PRINT_SP_ENC_FLAG_NOT_READY) {
msg_text = _L("Retrieving printer information, please try again later.");
}
else 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_PRINT_SP_FILE_OVER_SIZE || result == BAMBU_NETWORK_ERR_PRINT_WR_FILE_OVER_SIZE) {
msg_text = file_over_size_str;

View File

@ -78,6 +78,7 @@ namespace BBL {
#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
#define BAMBU_NETWORK_ERR_PRINT_SP_WAIT_PRINTER_FAILED -3130 //failed to wait the ack from printer
#define BAMBU_NETOWRK_ERR_PRINT_SP_ENC_FLAG_NOT_READY -3140 //failed to get flag info
//start_local_print error
#define BAMBU_NETWORK_ERR_PRINT_LP_FILE_OVER_SIZE -4010 //the size of the uploaded file cannot exceed 1 GB