ENH: Optimize Makerlab WebLoad

JIRA: none
Change-Id: I2761610be8d6d173dbcc37147e67cfb682cd4440
This commit is contained in:
zorro.zhang 2024-12-23 22:16:21 +08:00 committed by Lane.Wei
parent 15ed292c31
commit 9878569913
3 changed files with 15 additions and 10 deletions

View File

@ -352,7 +352,7 @@ function SendWXMessage( strMsg )
if(bCheck!=null) if(bCheck!=null)
{ {
window.wx.postMessage(strMsg); setTimeout("window.wx.postMessage("+strMsg+")",1);
} }
} }

View File

@ -4131,11 +4131,11 @@ std::string GUI_App::handle_web_request(std::string cmd)
} }
} }
else if (command_str.compare("modelmall_model_advise_get") == 0) { else if (command_str.compare("modelmall_model_advise_get") == 0) {
CallAfter([this] {
if (mainframe && this->app_config->get("staff_pick_switch") == "true") { if (mainframe && this->app_config->get("staff_pick_switch") == "true") {
if (mainframe->m_webview) { if (mainframe->m_webview) { mainframe->m_webview->SendDesignStaffpick(has_model_mall()); }
mainframe->m_webview->SendDesignStaffpick(has_model_mall());
} }
} });
} }
else if (command_str.compare("modelmall_model_open") == 0) { else if (command_str.compare("modelmall_model_open") == 0) {
if (root.get_child_optional("data") != boost::none) { 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) { else if (command_str.compare("homepage_makerlab_get") == 0) {
CallAfter([this] {
if (mainframe && mainframe->m_webview) { mainframe->m_webview->SendMakerlabList(); } if (mainframe && mainframe->m_webview) { mainframe->m_webview->SendMakerlabList(); }
});
} }
else if (command_str.compare("homepage_makerlab_open") == 0) { else if (command_str.compare("homepage_makerlab_open") == 0) {
if (root.get_child_optional("url") != boost::none) { 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) else if (command_str.compare("homepage_printhistory_get")==0)
{ {
if (mainframe && mainframe->m_webview) { CallAfter([this] {
mainframe->m_webview->ShowUserPrintTask(true); if (mainframe && mainframe->m_webview) { mainframe->m_webview->ShowUserPrintTask(true); }
} });
} }
else if (command_str.compare("homepage_leftmenu_change_width") == 0) { else if (command_str.compare("homepage_leftmenu_change_width") == 0) {
int NewWidth = 214; int NewWidth = 214;

View File

@ -279,8 +279,6 @@ WebViewPanel::WebViewPanel(wxWindow *parent)
SendDesignStaffpick(true); SendDesignStaffpick(true);
} }
}); });
SwitchWebContent("home");
} }
WebViewPanel::~WebViewPanel() 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(); //m_browser->Show();
Layout(); Layout();
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << ": " << evt.GetTarget().ToUTF8().data(); BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << ": " << evt.GetTarget().ToUTF8().data();