mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-31 01:42:00 +08:00
Wizard login page error showing custom html page
This commit is contained in:
parent
c3ce42a35a
commit
e39f867af4
@ -47,7 +47,7 @@ ConfigWizardWebViewPage::ConfigWizardWebViewPage(ConfigWizard *parent)
|
||||
// Connect the webview events
|
||||
Bind(wxEVT_WEBVIEW_ERROR, &ConfigWizardWebViewPage::on_error, this, m_browser->GetId());
|
||||
Bind(wxEVT_WEBVIEW_NAVIGATING, &ConfigWizardWebViewPage::on_navigation_request, this, m_browser->GetId());
|
||||
|
||||
Bind(wxEVT_IDLE, &ConfigWizardWebViewPage::on_idle, this);
|
||||
}
|
||||
|
||||
bool ConfigWizardWebViewPage::login_changed()
|
||||
@ -85,9 +85,37 @@ case type: \
|
||||
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_OTHER);
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(error) << "WebViewPanel error: " << category;
|
||||
BOOST_LOG_TRIVIAL(error) << "ConfigWizardWebViewPage error: " << category;
|
||||
load_error_page();
|
||||
}
|
||||
|
||||
void ConfigWizardWebViewPage::load_error_page() {
|
||||
if (!m_browser)
|
||||
return;
|
||||
|
||||
m_browser->Stop();
|
||||
m_load_error_page = true;
|
||||
}
|
||||
|
||||
void ConfigWizardWebViewPage::on_idle(wxIdleEvent &WXUNUSED(evt)) {
|
||||
if (!m_browser)
|
||||
return;
|
||||
if (m_browser->IsBusy()) {
|
||||
wxSetCursor(wxCURSOR_ARROWWAIT);
|
||||
} else {
|
||||
wxSetCursor(wxNullCursor);
|
||||
|
||||
if (m_load_error_page) {
|
||||
m_load_error_page = false;
|
||||
m_browser->LoadURL(GUI::format_wxstr(
|
||||
"file://%1%/web/connection_failed.html",
|
||||
boost::filesystem::path(resources_dir()).generic_string()
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ConfigWizardWebViewPage::on_navigation_request(wxWebViewEvent &evt)
|
||||
{
|
||||
wxString url = evt.GetURL();
|
||||
|
@ -49,6 +49,8 @@ public:
|
||||
|
||||
void on_error(wxWebViewEvent &evt);
|
||||
void on_navigation_request(wxWebViewEvent &evt);
|
||||
void on_idle(wxIdleEvent &evt);
|
||||
void load_error_page();
|
||||
// returns true if logged in - wizard needs to update repos
|
||||
bool login_changed();
|
||||
|
||||
@ -57,6 +59,7 @@ private:
|
||||
UserAccount *p_user_account{nullptr};
|
||||
wxBoxSizer *m_browser_sizer{nullptr};
|
||||
wxStaticText *m_text{nullptr};
|
||||
bool m_load_error_page{false};
|
||||
};
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
|
Loading…
x
Reference in New Issue
Block a user