diff --git a/resources/web/include/globalapi.js b/resources/web/include/globalapi.js index 563fb1f7c..6a0ed3d3b 100644 --- a/resources/web/include/globalapi.js +++ b/resources/web/include/globalapi.js @@ -352,7 +352,7 @@ function SendWXMessage( strMsg ) if(bCheck!=null) { - window.wx.postMessage(strMsg); + setTimeout("window.wx.postMessage("+strMsg+")",1); } } diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 9bf645529..4b9e350c3 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -4131,11 +4131,11 @@ std::string GUI_App::handle_web_request(std::string cmd) } } else if (command_str.compare("modelmall_model_advise_get") == 0) { + CallAfter([this] { if (mainframe && this->app_config->get("staff_pick_switch") == "true") { - if (mainframe->m_webview) { - mainframe->m_webview->SendDesignStaffpick(has_model_mall()); - } - } + if (mainframe->m_webview) { mainframe->m_webview->SendDesignStaffpick(has_model_mall()); } + } + }); } else if (command_str.compare("modelmall_model_open") == 0) { if (root.get_child_optional("data") != boost::none) { @@ -4256,7 +4256,9 @@ std::string GUI_App::handle_web_request(std::string cmd) } } else if (command_str.compare("homepage_makerlab_get") == 0) { + CallAfter([this] { if (mainframe && mainframe->m_webview) { mainframe->m_webview->SendMakerlabList(); } + }); } else if (command_str.compare("homepage_makerlab_open") == 0) { if (root.get_child_optional("url") != boost::none) { @@ -4323,9 +4325,9 @@ std::string GUI_App::handle_web_request(std::string cmd) } else if (command_str.compare("homepage_printhistory_get")==0) { - if (mainframe && mainframe->m_webview) { - mainframe->m_webview->ShowUserPrintTask(true); - } + CallAfter([this] { + if (mainframe && mainframe->m_webview) { mainframe->m_webview->ShowUserPrintTask(true); } + }); } else if (command_str.compare("homepage_leftmenu_change_width") == 0) { int NewWidth = 214; diff --git a/src/slic3r/GUI/WebViewDialog.cpp b/src/slic3r/GUI/WebViewDialog.cpp index 5f62b68f5..76c9f18fa 100644 --- a/src/slic3r/GUI/WebViewDialog.cpp +++ b/src/slic3r/GUI/WebViewDialog.cpp @@ -279,8 +279,6 @@ WebViewPanel::WebViewPanel(wxWindow *parent) SendDesignStaffpick(true); } }); - - SwitchWebContent("home"); } WebViewPanel::~WebViewPanel() @@ -1293,6 +1291,11 @@ void WebViewPanel::OnNavigationComplete(wxWebViewEvent& evt) } } + if (m_browser != nullptr && evt.GetId() == m_browser->GetId()) + { + SwitchWebContent("home"); + } + //m_browser->Show(); Layout(); BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << ": " << evt.GetTarget().ToUTF8().data();