ENH: support login after downloading the plug-in
JIRA: STUDIO-8268 Change-Id: Ib0c200d79cd5b7e8d2272ce69f3ea6b797d33968 Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
parent
c4a68a74d7
commit
fb8f801514
|
@ -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<wxWindow *>(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();
|
||||
|
|
|
@ -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<UpgradeNetworkJob> make_job(std::shared_ptr<ProgressIndicator> pri);
|
||||
virtual void on_finish();
|
||||
|
||||
bool m_post_login { false };
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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<DownloadProgressDialog *>(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;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue