diff --git a/resources/web/homepage2/manual.html b/resources/web/homepage2/manual.html
index 48a64b4eb..d5466e308 100644
--- a/resources/web/homepage2/manual.html
+++ b/resources/web/homepage2/manual.html
@@ -18,7 +18,7 @@
-
+
diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp
index 832ae9edf..aa6bf3775 100644
--- a/src/slic3r/GUI/GUI_App.cpp
+++ b/src/slic3r/GUI/GUI_App.cpp
@@ -3143,9 +3143,8 @@ void GUI_App::update_label_colours_from_appconfig()
void GUI_App::update_publish_status()
{
mainframe->show_publish_button(has_model_mall());
- if (app_config->get("staff_pick_switch") == "true") {
- mainframe->m_webview->SendDesignStaffpick(has_model_mall());
- }
+
+ mainframe->m_webview->ResetWholePage();
}
bool GUI_App::has_model_mall()
diff --git a/src/slic3r/GUI/WebViewDialog.cpp b/src/slic3r/GUI/WebViewDialog.cpp
index 0c287ec4a..8722c5177 100644
--- a/src/slic3r/GUI/WebViewDialog.cpp
+++ b/src/slic3r/GUI/WebViewDialog.cpp
@@ -112,7 +112,11 @@ WebViewPanel::WebViewPanel(wxWindow *parent)
m_onlinefirst = false;
m_online_spec_id = "";
auto host = wxGetApp().get_model_http_url(wxGetApp().app_config->get_country_code());
- std::string mwurl = (boost::format("%1%studio/webview?from=bambustudio") % host).str();
+
+
+ wxString language_code = wxGetApp().current_language_code().BeforeFirst('_');
+ language_code = language_code.ToStdString();
+ std::string mwurl = (boost::format("%1%%2%/studio/webview?from=bambustudio") % host % language_code.mb_str()).str();
//std::string mwurl = (boost::format("%1%?from=bambustudio") % host).str();
m_browserMW = WebView::CreateWebView(this, mwurl);
if (m_browserMW == nullptr) {
@@ -269,6 +273,10 @@ WebViewPanel::~WebViewPanel()
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << " End";
}
+void WebViewPanel::ResetWholePage()
+{
+ if (m_browserLeft != nullptr) m_browserLeft->Reload();
+}
void WebViewPanel::load_url(wxString& url)
{
@@ -520,6 +528,7 @@ void WebViewPanel::SendDesignStaffpick(bool on)
body2.insert(1, "\"command\": \"modelmall_model_advise_get\", ");
RunScript(wxString::Format("window.postMessage(%s)", body2));
+ m_online_type = "browse";
//Show Online Menu
SetLeftMenuShow("online", 1);
});
@@ -536,6 +545,7 @@ void WebViewPanel::SendDesignStaffpick(bool on)
body2.insert(1, "\"command\": \"modelmall_model_customized_get\", ");
RunScript(wxString::Format("window.postMessage(%s)", body2));
+ m_online_type = "recommend";
//Show Online Menu
SetLeftMenuShow("online", 1);
});
@@ -558,6 +568,7 @@ void WebViewPanel::SendDesignStaffpick(bool on)
body2.insert(1, "\"command\": \"modelmall_model_advise_get\", ");
RunScript(wxString::Format("window.postMessage(%s)", body2));
+ m_online_type = "browse";
//Show Online Menu
SetLeftMenuShow("online", 1);
});
@@ -567,6 +578,9 @@ void WebViewPanel::SendDesignStaffpick(bool on)
std::string body2 = "{\"total\":0, \"hits\":[]}";
body2.insert(1, "\"command\": \"modelmall_model_advise_get\", ");
RunScript(wxString::Format("window.postMessage(%s)", body2));
+
+ m_online_type = "";
+ SetLeftMenuShow("online", 0);
}
} catch (nlohmann::detail::parse_error &err) {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": parse got a nlohmann::detail::parse_error, reason = " << err.what();
@@ -796,6 +810,7 @@ void WebViewPanel::SetMakerworldPageLoginStatus(bool login ,wxString ticket)
std::string h = wxGetApp().get_model_http_url(wxGetApp().app_config->get_country_code());
wxString mw_currenturl = m_browserMW->GetCurrentURL();
+ mw_currenturl.Replace("modelid=", "");
wxString mw_jumpurl = "";
bool b = GetJumpUrl(login, ticket, mw_currenturl, mw_jumpurl);
@@ -1236,7 +1251,7 @@ void WebViewPanel::OnError(wxWebViewEvent& evt)
wxLogMessage("%s", "Error; url='" + evt.GetURL() + "', error='" + category + " (" + evt.GetString() + ")'");
// Show the info bar with an error
- m_info->ShowMessage(_L("An error occurred loading ") + evt.GetURL() + "\n" + "'" + category + "'", wxICON_ERROR);
+ //m_info->ShowMessage(_L("An error occurred loading ") + evt.GetURL() + "\n" + "'" + category + "'", wxICON_ERROR);
}
if (evt.GetInt() == wxWEBVIEW_NAV_ERR_CONNECTION && evt.GetId() == m_browserMW->GetId())
@@ -1300,10 +1315,16 @@ void WebViewPanel::SwitchWebContent(std::string modelname,int refresh)
if (m_online_spec_id != "")
{
auto host = wxGetApp().get_model_http_url(wxGetApp().app_config->get_country_code());
- std::string mwurl = (boost::format("%1%studio/webview?modelid=%2%&from=bambustudio") % host % m_online_spec_id).str();
+
+ wxString language_code = wxGetApp().current_language_code().BeforeFirst('_');
+ language_code = language_code.ToStdString();
+
+ std::string mwurl = (boost::format("%1%%2%/studio/webview?modelid=%3%&from=%4%") % host % language_code.mb_str() % m_online_spec_id % m_online_type.mb_str()).str();
m_onlinefirst = true;
m_browserMW->LoadURL(mwurl);
+ m_browserMW->Show();
+ m_browser->Hide();
m_online_spec_id = "";
}
@@ -1326,7 +1347,7 @@ void WebViewPanel::SwitchWebContent(std::string modelname,int refresh)
GetSizer()->Layout();
// conf save
- wxGetApp().app_config->set_str("homepage", "makerlab_clicked", "1");
+ wxGetApp().app_config->set_str("homepage", "online_clicked", "1");
wxGetApp().app_config->save();
}
else if (modelname.compare("home") == 0 || modelname.compare("recent") == 0 || modelname.compare("manual") == 0 )
diff --git a/src/slic3r/GUI/WebViewDialog.hpp b/src/slic3r/GUI/WebViewDialog.hpp
index 26876696f..badc1aeab 100644
--- a/src/slic3r/GUI/WebViewDialog.hpp
+++ b/src/slic3r/GUI/WebViewDialog.hpp
@@ -94,6 +94,8 @@ public:
void OnFreshLoginStatus(wxTimerEvent &event);
public:
+ void ResetWholePage();
+
void SwitchWebContent(std::string modelname, int refresh=0);
void SwitchLeftMenu(std::string strMenu);
void OpenOneMakerlab(std::string url);
@@ -130,8 +132,9 @@ private:
wxWebView* m_browserLeft;
wxWebView * m_browserMW;
std::string m_contentname;
- bool m_onlinefirst;
- std::string m_online_spec_id;
+ bool m_onlinefirst; //Online Page First Load
+ std::string m_online_spec_id; //Online Page Spec_ID
+ wxString m_online_type; //recommend & browse
wxBoxSizer *bSizer_toolbar;
wxButton * m_button_back;
diff --git a/src/slic3r/GUI/Widgets/WebView.cpp b/src/slic3r/GUI/Widgets/WebView.cpp
index 54d2ef5ea..38d451d0a 100644
--- a/src/slic3r/GUI/Widgets/WebView.cpp
+++ b/src/slic3r/GUI/Widgets/WebView.cpp
@@ -207,9 +207,13 @@ wxWebView* WebView::CreateWebView(wxWindow * parent, wxString const & url)
#endif
if (webView) {
webView->SetBackgroundColour(StateColor::darkModeColorFor(*wxWHITE));
+
+ wxString language_code = Slic3r::GUI::wxGetApp().current_language_code().BeforeFirst('_');
+ language_code = language_code.ToStdString();
#ifdef __WIN32__
- webView->SetUserAgent(wxString::Format("BBL-Slicer/v%s (%s) Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
- "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.52", SLIC3R_VERSION,
+ webView->SetUserAgent(wxString::Format("BBL-Slicer/v%s BBL-Language/%s (%s) Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
+ "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.52",
+ SLIC3R_VERSION, language_code.mb_str(),
Slic3r::GUI::wxGetApp().dark_mode() ? "dark" : "light"));
webView->Create(parent, wxID_ANY, url2, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
// We register the wxfs:// protocol for testing purposes
@@ -222,7 +226,8 @@ wxWebView* WebView::CreateWebView(wxWindow * parent, wxString const & url)
// And the memory: file system
webView->RegisterHandler(wxSharedPtr(new wxWebViewFSHandler("memory")));
webView->Create(parent, wxID_ANY, url2, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
- webView->SetUserAgent(wxString::Format("BBL-Slicer/v%s (%s) Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)", SLIC3R_VERSION,
+ webView->SetUserAgent(wxString::Format("BBL-Slicer/v%s BBL-Language/%s (%s) Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)",
+ SLIC3R_VERSION, language_code.mb_str(),
Slic3r::GUI::wxGetApp().dark_mode() ? "dark" : "light"));
#endif
#ifdef __WXMAC__
@@ -312,8 +317,11 @@ bool WebView::RunScript(wxWebView *webView, wxString const &javascript)
void WebView::RecreateAll()
{
auto dark = Slic3r::GUI::wxGetApp().dark_mode();
+ wxString language_code = Slic3r::GUI::wxGetApp().current_language_code().BeforeFirst('_');
+ language_code = language_code.ToStdString();
for (auto webView : g_webviews) {
- webView->SetUserAgent(wxString::Format("BBL-Slicer/v%s (%s) Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)", SLIC3R_VERSION,
+ webView->SetUserAgent(wxString::Format("BBL-Slicer/v%s BBL-Language/%s (%s) Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)",
+ SLIC3R_VERSION, language_code.mb_str(),
dark ? "dark" : "light"));
webView->Reload();
}