From ab9a4db1854859ba4deb7e26ed42c3c48df1a27e Mon Sep 17 00:00:00 2001 From: womendoushihaoyin Date: Sun, 29 Sep 2024 17:04:02 +0800 Subject: [PATCH] 1.change the useragent from "BBL-Slicer" to "SM-Slicer" 2.add the default filament of j1 3.fix the default filament selected when choosing the nozzle --- resources/profiles/Snapmaker/machine/Snapmaker J1.json | 3 ++- resources/web/guide/22/22.js | 2 +- resources/web/guide/js/globalapi.js | 2 +- resources/web/homepage/js/globalapi.js | 2 +- resources/web/include/globalapi.js | 2 +- resources/web/login/js/globalapi.js | 2 +- src/libslic3r/PresetBundle.cpp | 2 +- src/slic3r/GUI/WebGuideDialog.hpp | 2 +- src/slic3r/GUI/WebUserLoginDialog.cpp | 2 +- src/slic3r/GUI/WebUserLoginDialog.hpp | 2 +- src/slic3r/GUI/Widgets/WebView.cpp | 6 +++--- 11 files changed, 14 insertions(+), 13 deletions(-) diff --git a/resources/profiles/Snapmaker/machine/Snapmaker J1.json b/resources/profiles/Snapmaker/machine/Snapmaker J1.json index 15b54203090..c9a8afd67de 100644 --- a/resources/profiles/Snapmaker/machine/Snapmaker J1.json +++ b/resources/profiles/Snapmaker/machine/Snapmaker J1.json @@ -7,5 +7,6 @@ "model_id": "199828459", "bed_model": "Snapmaker J1_bed.stl", "bed_texture": "Snapmaker J1_texture.svg", - "nozzle_diameter": "0.2;0.4;0.6;0.8" + "nozzle_diameter": "0.2;0.4;0.6;0.8", + "default_materials": "PolyLite J1 PLA;PolyTerra J1 PLA;Snapmaker J1 ABS;Snapmaker J1 ABS Benchy;Snapmaker J1 ASA;Snapmaker J1 PA-CF;Snapmaker J1 PET;Snapmaker J1 PETG;Snapmaker J1 PETG-CF;Snapmaker J1 PLA;Snapmaker J1 PLA Eco;Snapmaker J1 PLA Matte;Snapmaker J1 PLA Metal;Snapmaker J1 PLA Silk;Snapmaker J1 PLA-CF;Snapmaker J1 PVA;Snapmaker J1 TPE;Snapmaker J1 TPU;Snapmaker J1 TPU High-Flow" } \ No newline at end of file diff --git a/resources/web/guide/22/22.js b/resources/web/guide/22/22.js index a335e757345..0edac7b1e35 100644 --- a/resources/web/guide/22/22.js +++ b/resources/web/guide/22/22.js @@ -469,7 +469,7 @@ function ChooseDefaultFilament() let OneFF=OneNode.getElementsByTagName("input")[0]; $(OneFF).prop("checked",false); - let filamentList=OneFF.getAttribute("filalist"); + let filamentList=GetFilamentShortname(OneFF.getAttribute("filalist")); //alert(filamentList); let filamentArray=filamentList.split(';') diff --git a/resources/web/guide/js/globalapi.js b/resources/web/guide/js/globalapi.js index 2463dbe5376..2d62ae0a286 100644 --- a/resources/web/guide/js/globalapi.js +++ b/resources/web/guide/js/globalapi.js @@ -260,7 +260,7 @@ function clearCookie(name) { /*--------Studio WX Message-------*/ function IsInSlicer() { - let bMatch=navigator.userAgent.match( RegExp('BBL-Slicer','i') ); + let bMatch=navigator.userAgent.match( RegExp('SM-Slicer','i') ); return bMatch; } diff --git a/resources/web/homepage/js/globalapi.js b/resources/web/homepage/js/globalapi.js index 80bbaa01d5f..f7dfdf5c7ae 100644 --- a/resources/web/homepage/js/globalapi.js +++ b/resources/web/homepage/js/globalapi.js @@ -260,7 +260,7 @@ function clearCookie(name) { /*--------Studio WX Message-------*/ function IsInSlicer() { - let bMatch=navigator.userAgent.match( RegExp('BBL-Slicer','i') ); + let bMatch=navigator.userAgent.match( RegExp('SM-Slicer','i') ); return bMatch; } diff --git a/resources/web/include/globalapi.js b/resources/web/include/globalapi.js index 0553483e1aa..dcd8cf4afef 100644 --- a/resources/web/include/globalapi.js +++ b/resources/web/include/globalapi.js @@ -327,7 +327,7 @@ function clearCookie(name) { /*--------Studio WX Message-------*/ function IsInSlicer() { - let bMatch=navigator.userAgent.match( RegExp('BBL-Slicer','i') ); + let bMatch=navigator.userAgent.match( RegExp('SM-Slicer','i') ); return bMatch; } diff --git a/resources/web/login/js/globalapi.js b/resources/web/login/js/globalapi.js index 3d560150186..bb5b90a50fb 100644 --- a/resources/web/login/js/globalapi.js +++ b/resources/web/login/js/globalapi.js @@ -260,7 +260,7 @@ function clearCookie(name) { /*--------Studio WX Message-------*/ function IsInSlicer() { - let bMatch=navigator.userAgent.match( RegExp('BBL-Slicer','i') ); + let bMatch=navigator.userAgent.match( RegExp('SM-Slicer','i') ); return bMatch; } diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index 28ca595f80c..917c3186952 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -53,7 +53,7 @@ static std::vector s_project_options { const char* PresetBundle::SM_BUNDLE = "Snapmaker"; const char* PresetBundle::SM_DEFAULT_PRINTER_MODEL = "Snapmaker J1 (0.4 nozzle)"; const char* PresetBundle::SM_DEFAULT_PRINTER_VARIANT = "0.4"; -const char* PresetBundle::SM_DEFAULT_FILAMENT = "Snapmaker ABS"; +const char* PresetBundle::SM_DEFAULT_FILAMENT = "Snapmaker J1 ABS"; PresetBundle::PresetBundle() : prints(Preset::TYPE_PRINT, Preset::print_options(), static_cast(FullPrintConfig::defaults())) diff --git a/src/slic3r/GUI/WebGuideDialog.hpp b/src/slic3r/GUI/WebGuideDialog.hpp index 2b44d252ff2..35b69788aa0 100644 --- a/src/slic3r/GUI/WebGuideDialog.hpp +++ b/src/slic3r/GUI/WebGuideDialog.hpp @@ -123,7 +123,7 @@ class GuideFrame : public DPIDialog wxString m_javascript; wxString m_response_js; - wxString m_bbl_user_agent; + wxString m_sm_user_agent; std::string m_editing_filament_id; }; diff --git a/src/slic3r/GUI/WebUserLoginDialog.cpp b/src/slic3r/GUI/WebUserLoginDialog.cpp index 7a73023f529..dd14f3d890b 100644 --- a/src/slic3r/GUI/WebUserLoginDialog.cpp +++ b/src/slic3r/GUI/WebUserLoginDialog.cpp @@ -84,7 +84,7 @@ ZUserLogin::ZUserLogin() : wxDialog((wxWindow *) (wxGetApp().mainframe), wxID_AN BOOST_LOG_TRIVIAL(info) << "login url = " << TargetUrl.ToStdString(); - m_bbl_user_agent = wxString::Format("BBL-Slicer/v%s", SLIC3R_VERSION); + m_sm_user_agent = wxString::Format("SM-Slicer/v%s", SLIC3R_VERSION); // set the frame icon diff --git a/src/slic3r/GUI/WebUserLoginDialog.hpp b/src/slic3r/GUI/WebUserLoginDialog.hpp index 3d0e2629db3..b4fca88b48a 100644 --- a/src/slic3r/GUI/WebUserLoginDialog.hpp +++ b/src/slic3r/GUI/WebUserLoginDialog.hpp @@ -81,7 +81,7 @@ class ZUserLogin : public wxDialog wxString m_javascript; wxString m_response_js; - wxString m_bbl_user_agent; + wxString m_sm_user_agent; DECLARE_EVENT_TABLE() }; diff --git a/src/slic3r/GUI/Widgets/WebView.cpp b/src/slic3r/GUI/Widgets/WebView.cpp index 68a5785a8c1..6f0b926ba5b 100644 --- a/src/slic3r/GUI/Widgets/WebView.cpp +++ b/src/slic3r/GUI/Widgets/WebView.cpp @@ -265,7 +265,7 @@ wxWebView* WebView::CreateWebView(wxWindow * parent, wxString const & url) if (webView) { webView->SetBackgroundColour(StateColor::darkModeColorFor(*wxWHITE)); #ifdef __WIN32__ - webView->SetUserAgent(wxString::Format("BBL-Slicer/v%s (%s) Mozilla/5.0 (Windows NT 10.0; Win64; x64) " + webView->SetUserAgent(wxString::Format("SM-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, Slic3r::GUI::wxGetApp().dark_mode() ? "dark" : "light")); webView->Create(parent, wxID_ANY, url2, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE); @@ -279,7 +279,7 @@ 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("SM-Slicer/v%s (%s) Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)", SLIC3R_VERSION, Slic3r::GUI::wxGetApp().dark_mode() ? "dark" : "light")); #endif #ifdef __WXMAC__ @@ -383,7 +383,7 @@ void WebView::RecreateAll() { auto dark = Slic3r::GUI::wxGetApp().dark_mode(); 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("SM-Slicer/v%s (%s) Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)", SLIC3R_VERSION, dark ? "dark" : "light")); webView->Reload(); }