diff --git a/src/slic3r/GUI/DownloadProgressDialog.cpp b/src/slic3r/GUI/DownloadProgressDialog.cpp index 5d6d07681..e33dd0aa9 100644 --- a/src/slic3r/GUI/DownloadProgressDialog.cpp +++ b/src/slic3r/GUI/DownloadProgressDialog.cpp @@ -16,7 +16,6 @@ #include "libslic3r/Utils.hpp" #include "GUI.hpp" #include "I18N.hpp" -//#include "ConfigWizard.hpp" #include "wxExtensions.hpp" #include "slic3r/GUI/MainFrame.hpp" #include "GUI_App.hpp" @@ -26,10 +25,9 @@ namespace Slic3r { namespace GUI { - - -DownloadProgressDialog::DownloadProgressDialog(wxString title) +DownloadProgressDialog::DownloadProgressDialog(wxString title, bool post_login) : DPIDialog(static_cast(wxGetApp().mainframe), wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX) + , m_post_login(post_login) { wxString download_failed_url = wxT("https://wiki.bambulab.com/en/software/bambu-studio/failed-to-get-network-plugin"); wxString install_failed_url = wxT("https://wiki.bambulab.com/en/software/bambu-studio/failed-to-get-network-plugin"); @@ -148,19 +146,16 @@ bool DownloadProgressDialog::Show(bool show) m_upgrade_job->set_event_handle(this); m_status_bar->set_progress(0); Bind(EVT_UPGRADE_NETWORK_SUCCESS, [this](wxCommandEvent& evt) { - if (wxGetApp().check_networking_version()) { - m_status_bar->change_button_label(_L("OK")); - on_finish(); + m_status_bar->change_button_label(_L("OK")); + on_finish(); + if (m_post_login) { m_status_bar->set_cancel_callback_fina( [this]() { this->Close(); wxGetApp().request_login(); } ); - } - else { - on_finish(); - m_status_bar->change_button_label(_L("Close")); + } else { m_status_bar->set_cancel_callback_fina( [this]() { this->Close(); diff --git a/src/slic3r/GUI/DownloadProgressDialog.hpp b/src/slic3r/GUI/DownloadProgressDialog.hpp index 938d2706a..07b0a6966 100644 --- a/src/slic3r/GUI/DownloadProgressDialog.hpp +++ b/src/slic3r/GUI/DownloadProgressDialog.hpp @@ -30,6 +30,7 @@ class wxStaticBitmap; namespace Slic3r { namespace GUI { + class DownloadProgressDialog : public DPIDialog { protected: @@ -37,7 +38,7 @@ protected: void on_close(wxCloseEvent& event); public: - DownloadProgressDialog(wxString title); + DownloadProgressDialog(wxString title, bool post_login = false); wxString format_text(wxStaticText* st, wxString str, int warp); ~DownloadProgressDialog(); @@ -53,6 +54,8 @@ public: protected: virtual std::shared_ptr make_job(std::shared_ptr pri); virtual void on_finish(); + + bool m_post_login { false }; }; diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 5ec74dffc..9bc4f90ef 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -3694,14 +3694,15 @@ void GUI_App::ShowUserGuide() { } } -void GUI_App::ShowDownNetPluginDlg() { +void GUI_App::ShowDownNetPluginDlg(bool post_login) +{ try { auto iter = std::find_if(dialogStack.begin(), dialogStack.end(), [](auto dialog) { return dynamic_cast(dialog) != nullptr; }); if (iter != dialogStack.end()) return; - DownloadProgressDialog dlg(_L("Downloading Bambu Network Plug-in")); + DownloadProgressDialog dlg(_L("Downloading Bambu Network Plug-in"), post_login); dlg.ShowModal(); } catch (std::exception &e) { ; @@ -4234,17 +4235,18 @@ std::string GUI_App::handle_web_request(std::string cmd) if (mainframe && mainframe->m_webview) { mainframe->m_webview->OpenOneMakerlab(strUrl); } } } - else if (command_str.compare("homepage_need_networkplugin") == 0){ - if (mainframe){ + else if (command_str.compare("homepage_need_networkplugin") == 0) { + bool post_login = true; + if (mainframe) { if (mainframe->m_confirm_download_plugin_dlg == nullptr) { mainframe->m_confirm_download_plugin_dlg = new SecondaryCheckDialog(mainframe, wxID_ANY, _L("Install network plug-in"), SecondaryCheckDialog::ButtonStyle::ONLY_CONFIRM); mainframe->m_confirm_download_plugin_dlg->SetSize(wxSize(270, 158)); mainframe->m_confirm_download_plugin_dlg->update_text(_L("Please Install network plug-in before log in.")); mainframe->m_confirm_download_plugin_dlg->update_btn_label(_L("Install Network Plug-in"), _L("")); - mainframe->m_confirm_download_plugin_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this](wxCommandEvent& e) { + mainframe->m_confirm_download_plugin_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this, post_login](wxCommandEvent& e) { mainframe->m_confirm_download_plugin_dlg->Close(); - ShowDownNetPluginDlg(); + ShowDownNetPluginDlg(post_login); return; }); } diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index be70a1b59..435d99d22 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -427,7 +427,7 @@ public: wxString transition_tridid(int trid_id); void ShowUserGuide(); - void ShowDownNetPluginDlg(); + void ShowDownNetPluginDlg(bool post_login = false); void ShowUserLogin(bool show = true); void ShowOnlyFilament(); //BBS