From fd72249a35d8ab92e7ab121a8b4e7d907384b8d6 Mon Sep 17 00:00:00 2001 From: ExPikaPaka Date: Fri, 3 Jul 2026 08:17:25 +0200 Subject: [PATCH] Save device url in all cases and load printer url after hot-reload finishes --- src/slic3r/GUI/GUI_App.cpp | 9 +++++++++ src/slic3r/GUI/PrinterWebView.cpp | 12 ++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index fb9aeb339e..a35c1cc1e1 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -4238,6 +4238,15 @@ void GUI_App::recreate_GUI(const wxString &msg_name) update_publish_status(); + // The Device tab's PrinterWebView is recreated during this GUI rebuild. Re-issue + // the printer URL once the new window is realized and the webview backend is ready, + // otherwise the tab can stay blank until the next real restart (non-Bambu/webui + // printers only; load_printer_url() is a no-op for the Bambu device tab). + CallAfter([this] { + if (mainframe) + mainframe->load_printer_url(); + }); + m_is_recreating_gui = false; BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "recreate_GUI exit"; diff --git a/src/slic3r/GUI/PrinterWebView.cpp b/src/slic3r/GUI/PrinterWebView.cpp index 0d6c0bcedf..9777783abe 100644 --- a/src/slic3r/GUI/PrinterWebView.cpp +++ b/src/slic3r/GUI/PrinterWebView.cpp @@ -179,13 +179,13 @@ void PrinterWebView::load_url(wxString& url, wxString apikey) m_apikey_sent = false; m_handler = create_printer_webview_handler(*this); - if (this->IsShown()) { - //ORCA: m_url_deferred will be cleared on load success - //m_url_deferred.clear(); + // Always remember the requested URL as a fallback. If the immediate load + // below is dropped (e.g. the webview backend is not ready yet right after + // recreate_GUI on a language switch), Show() will retry it. OnLoaded clears + // m_url_deferred once the page actually finishes loading. + m_url_deferred = url; + if (this->IsShown()) m_browser->LoadURL(url); - } else { - m_url_deferred = url; - } //m_browser->SetFocus(); UpdateState(); }