mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-13 02:59:03 +08:00
SPE-2575:: Do not allow busy cursor logic in webview on linux
Allow changes of cursor only when panel is shown.
This commit is contained in:
parent
47bba48b34
commit
c8cac7f678
@ -106,13 +106,24 @@ void ConfigWizardWebViewPage::load_error_page() {
|
||||
m_load_error_page = true;
|
||||
}
|
||||
|
||||
constexpr bool is_linux =
|
||||
#if defined(__linux__)
|
||||
true;
|
||||
#else
|
||||
false;
|
||||
#endif
|
||||
|
||||
void ConfigWizardWebViewPage::on_idle(wxIdleEvent &WXUNUSED(evt)) {
|
||||
if (!m_browser)
|
||||
return;
|
||||
if (m_browser->IsBusy()) {
|
||||
wxSetCursor(wxCURSOR_ARROWWAIT);
|
||||
if constexpr (!is_linux) {
|
||||
wxSetCursor(wxCURSOR_ARROWWAIT);
|
||||
}
|
||||
} else {
|
||||
wxSetCursor(wxNullCursor);
|
||||
if constexpr (!is_linux) {
|
||||
wxSetCursor(wxNullCursor);
|
||||
}
|
||||
|
||||
if (!m_vetoed && m_load_error_page) {
|
||||
m_load_error_page = false;
|
||||
|
@ -148,14 +148,25 @@ WebViewDialog::~WebViewDialog()
|
||||
{
|
||||
}
|
||||
|
||||
constexpr bool is_linux =
|
||||
#if defined(__linux__)
|
||||
true;
|
||||
#else
|
||||
false;
|
||||
#endif
|
||||
|
||||
void WebViewDialog::on_idle(wxIdleEvent& WXUNUSED(evt))
|
||||
{
|
||||
if (!m_browser)
|
||||
return;
|
||||
if (m_browser->IsBusy()) {
|
||||
wxSetCursor(wxCURSOR_ARROWWAIT);
|
||||
} else {
|
||||
wxSetCursor(wxNullCursor);
|
||||
if constexpr (!is_linux) {
|
||||
wxSetCursor(wxCURSOR_ARROWWAIT);
|
||||
}
|
||||
} else {
|
||||
if constexpr (!is_linux) {
|
||||
wxSetCursor(wxNullCursor);
|
||||
}
|
||||
if (m_load_error_page) {
|
||||
m_load_error_page = false;
|
||||
m_browser->LoadURL(GUI::format_wxstr("file://%1%/web/error_no_reload.html", boost::filesystem::path(resources_dir()).generic_string()));
|
||||
|
@ -218,6 +218,7 @@ void WebViewPanel::on_show(wxShowEvent& evt)
|
||||
{
|
||||
m_shown = evt.IsShown();
|
||||
if (!m_shown) {
|
||||
wxSetCursor(wxNullCursor);
|
||||
return;
|
||||
}
|
||||
if (m_do_late_webview_create) {
|
||||
@ -238,29 +239,36 @@ void WebViewPanel::on_idle(wxIdleEvent& WXUNUSED(evt))
|
||||
{
|
||||
if (!m_browser || m_do_late_webview_create)
|
||||
return;
|
||||
if (m_browser->IsBusy()) {
|
||||
wxSetCursor(wxCURSOR_ARROWWAIT);
|
||||
} else {
|
||||
wxSetCursor(wxNullCursor);
|
||||
|
||||
if (m_shown && m_load_error_page) {
|
||||
m_load_error_page = false;
|
||||
if (m_load_default_url_on_next_error) {
|
||||
m_load_default_url_on_next_error = false;
|
||||
load_default_url();
|
||||
} else {
|
||||
load_url(GUI::format_wxstr("file://%1%/web/%2%.html", boost::filesystem::path(resources_dir()).generic_string(), m_error_html));
|
||||
// This is a fix of broken message handling after error.
|
||||
// F.e. if there is an error but we do AddUserScript & Reload, the handling will break.
|
||||
// So we just reset the handler here.
|
||||
if (!m_script_message_hadler_names.empty()) {
|
||||
m_browser->RemoveScriptMessageHandler(Slic3r::GUI::from_u8(m_script_message_hadler_names.front()));
|
||||
m_browser->AddScriptMessageHandler(Slic3r::GUI::from_u8(m_script_message_hadler_names.front()));
|
||||
}
|
||||
|
||||
}
|
||||
// The busy cursor on webview is switched off on Linux.
|
||||
// Because m_browser->IsBusy() is almost always true on Printables / Connect.
|
||||
#ifndef __linux__
|
||||
if (m_shown) {
|
||||
if (m_browser->IsBusy()) {
|
||||
wxSetCursor(wxCURSOR_ARROWWAIT);
|
||||
} else {
|
||||
wxSetCursor(wxNullCursor);
|
||||
}
|
||||
}
|
||||
#endif // !__linux__
|
||||
|
||||
if (m_shown && m_load_error_page && !m_browser->IsBusy()) {
|
||||
m_load_error_page = false;
|
||||
if (m_load_default_url_on_next_error) {
|
||||
m_load_default_url_on_next_error = false;
|
||||
load_default_url();
|
||||
} else {
|
||||
load_url(GUI::format_wxstr("file://%1%/web/%2%.html", boost::filesystem::path(resources_dir()).generic_string(), m_error_html));
|
||||
// This is a fix of broken message handling after error.
|
||||
// F.e. if there is an error but we do AddUserScript & Reload, the handling will break.
|
||||
// So we just reset the handler here.
|
||||
if (!m_script_message_hadler_names.empty()) {
|
||||
m_browser->RemoveScriptMessageHandler(Slic3r::GUI::from_u8(m_script_message_hadler_names.front()));
|
||||
m_browser->AddScriptMessageHandler(Slic3r::GUI::from_u8(m_script_message_hadler_names.front()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_URL_PANEL
|
||||
m_button_stop->Enable(m_browser->IsBusy());
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user