From f1cba23976f08c4db6402dfb6ac246097d6f048a Mon Sep 17 00:00:00 2001 From: "zorro.zhang" Date: Thu, 26 Dec 2024 17:07:43 +0800 Subject: [PATCH 1/6] ENH: Ignore Not Exist Profile Json JIRA: none Change-Id: Ied94cdadf0097b819328284cbc773ffe3c47d32b (cherry picked from commit a081818b0c03170e749ae1461c57e24dae75bc94) --- src/slic3r/GUI/WebGuideDialog.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/slic3r/GUI/WebGuideDialog.cpp b/src/slic3r/GUI/WebGuideDialog.cpp index 3cc8374bcf..0f98845eea 100644 --- a/src/slic3r/GUI/WebGuideDialog.cpp +++ b/src/slic3r/GUI/WebGuideDialog.cpp @@ -1169,6 +1169,8 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath std::string s2 = OneModel["sub_path"]; boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred(); + if (!boost::filesystem::exists(sub_path)) continue; + std::string sub_file = sub_path.string(); // wxLogMessage("GUIDE: json_path2 %s", w2s(ModelFilePath)); @@ -1211,6 +1213,8 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath // wxString ModelFilePath = wxString::Format("%s\\%s\\%s", strFolder, strVendor, s2); boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred(); + if (!boost::filesystem::exists(sub_path)) continue; + std::string sub_file = sub_path.string(); LoadFile(sub_file, contents); json pm = json::parse(contents); @@ -1252,6 +1256,8 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath if (!m_ProfileJson["filament"].contains(s1)) { // wxString ModelFilePath = wxString::Format("%s\\%s\\%s", strFolder, strVendor, s2); boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred(); + if (!boost::filesystem::exists(sub_path)) continue; + std::string sub_file = sub_path.string(); LoadFile(sub_file, contents); json pm = json::parse(contents); @@ -1312,6 +1318,8 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath std::string s2 = OneProcess["sub_path"]; // wxString ModelFilePath = wxString::Format("%s\\%s\\%s", strFolder, strVendor, s2); boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred(); + if (!boost::filesystem::exists(sub_path)) continue; + std::string sub_file = sub_path.string(); LoadFile(sub_file, contents); json pm = json::parse(contents); From df6516e3e394eccda69c00b1c4425833dee25244 Mon Sep 17 00:00:00 2001 From: "zorro.zhang" Date: Thu, 26 Dec 2024 20:04:59 +0800 Subject: [PATCH 2/6] NEW: UserGuide Add Loading Tip JIRA: none Change-Id: I43d79d740b9180a16d02c54c0c9d6e11c23b1ce7 (cherry picked from commit 03d8d58fad95199236ee7a5f931d3f395ee8dc1d) --- resources/web/guide/0/index.html | 20 +++++++++++++++ resources/web/guide/0/load.css | 21 ++++++++++++++++ resources/web/guide/0/load.js | 24 ++++++++++++++++++ resources/web/guide/0/loading.svg | 9 +++++++ src/slic3r/GUI/WebGuideDialog.cpp | 41 ++++++++++++++++++------------- src/slic3r/GUI/WebGuideDialog.hpp | 3 +++ 6 files changed, 101 insertions(+), 17 deletions(-) create mode 100644 resources/web/guide/0/index.html create mode 100644 resources/web/guide/0/load.css create mode 100644 resources/web/guide/0/load.js create mode 100644 resources/web/guide/0/loading.svg diff --git a/resources/web/guide/0/index.html b/resources/web/guide/0/index.html new file mode 100644 index 0000000000..b1caa07a5f --- /dev/null +++ b/resources/web/guide/0/index.html @@ -0,0 +1,20 @@ + + + + + +loading + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/web/guide/0/load.css b/resources/web/guide/0/load.css new file mode 100644 index 0000000000..8f8ce536b5 --- /dev/null +++ b/resources/web/guide/0/load.css @@ -0,0 +1,21 @@ +@keyframes rotate { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} + +body +{ + display:flex; + align-content: center; + justify-content: center; +} + +#LoadingSvg +{ + animation: rotate 5s infinite linear; + height: 60%; +} \ No newline at end of file diff --git a/resources/web/guide/0/load.js b/resources/web/guide/0/load.js new file mode 100644 index 0000000000..4cb2729da8 --- /dev/null +++ b/resources/web/guide/0/load.js @@ -0,0 +1,24 @@ + +var TargetPage=null; + +function OnInit() +{ + TargetPage=GetQueryString("target"); + + //setTimeout("JumpToTarget()",20*1000); +} + +function HandleStudio( pVal ) +{ + let strCmd=pVal['command']; + + if(strCmd=='userguide_profile_load_finish') + { + JumpToTarget(); + } +} + +function JumpToTarget() +{ + window.open('../'+TargetPage+'/index.html','_self'); +} \ No newline at end of file diff --git a/resources/web/guide/0/loading.svg b/resources/web/guide/0/loading.svg new file mode 100644 index 0000000000..7566bb0921 --- /dev/null +++ b/resources/web/guide/0/loading.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/slic3r/GUI/WebGuideDialog.cpp b/src/slic3r/GUI/WebGuideDialog.cpp index 0f98845eea..00d5346661 100644 --- a/src/slic3r/GUI/WebGuideDialog.cpp +++ b/src/slic3r/GUI/WebGuideDialog.cpp @@ -178,12 +178,6 @@ GuideFrame::GuideFrame(GUI_App *pGUI, long style) // Bind(wxEVT_IDLE, &GuideFrame::OnIdle, this); // Bind(wxEVT_CLOSE_WINDOW, &GuideFrame::OnClose, this); - auto start = std::chrono::high_resolution_clock::now(); - LoadProfile(); - auto end = std::chrono::high_resolution_clock::now(); - auto duration = std::chrono::duration_cast(end - start); - BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << ": LoadProfile() took " << duration.count() << " milliseconds"; - // UI SetStartPage(BBL_REGION); @@ -214,43 +208,43 @@ wxString GuideFrame::SetStartPage(GuidePage startpage, bool load) m_page = startpage; BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format(" enter, load=%1%, start_page=%2%")%load%int(startpage); //wxLogMessage("GUIDE: webpage_1 %s", (boost::filesystem::path(resources_dir()) / "web\\guide\\1\\index.html").make_preferred().string().c_str() ); - wxString TargetUrl = from_u8( (boost::filesystem::path(resources_dir()) / "web/guide/1/index.html").make_preferred().string() ); + wxString TargetUrl = from_u8( (boost::filesystem::path(resources_dir()) / "web/guide/0/index.html?target=1").make_preferred().string() ); //wxLogMessage("GUIDE: webpage_2 %s", TargetUrl.mb_str()); if (startpage == BBL_WELCOME){ SetTitle(_L("Setup Wizard")); - TargetUrl = from_u8((boost::filesystem::path(resources_dir()) / "web/guide/1/index.html").make_preferred().string()); + TargetUrl = from_u8((boost::filesystem::path(resources_dir()) / "web/guide/0/index.html?target=1").make_preferred().string()); } else if (startpage == BBL_REGION) { SetTitle(_L("Setup Wizard")); - TargetUrl = from_u8((boost::filesystem::path(resources_dir()) / "web/guide/11/index.html").make_preferred().string()); + TargetUrl = from_u8((boost::filesystem::path(resources_dir()) / "web/guide/0/index.html?target=11").make_preferred().string()); } else if (startpage == BBL_MODELS) { SetTitle(_L("Setup Wizard")); - TargetUrl = from_u8((boost::filesystem::path(resources_dir()) / "web/guide/21/index.html").make_preferred().string()); + TargetUrl = from_u8((boost::filesystem::path(resources_dir()) / "web/guide/0/index.html?target=21").make_preferred().string()); } else if (startpage == BBL_FILAMENTS) { SetTitle(_L("Setup Wizard")); int nSize = m_ProfileJson["model"].size(); if (nSize>0) - TargetUrl = from_u8((boost::filesystem::path(resources_dir()) / "web/guide/22/index.html").make_preferred().string()); + TargetUrl = from_u8((boost::filesystem::path(resources_dir()) / "web/guide/0/index.html?target=22").make_preferred().string()); else - TargetUrl = from_u8((boost::filesystem::path(resources_dir()) / "web/guide/21/index.html").make_preferred().string()); + TargetUrl = from_u8((boost::filesystem::path(resources_dir()) / "web/guide/0/index.html?target=21").make_preferred().string()); } else if (startpage == BBL_FILAMENT_ONLY) { SetTitle(""); - TargetUrl = from_u8((boost::filesystem::path(resources_dir()) / "web/guide/23/index.html").make_preferred().string()); + TargetUrl = from_u8((boost::filesystem::path(resources_dir()) / "web/guide/0/index.html?target=23").make_preferred().string()); } else if (startpage == BBL_MODELS_ONLY) { SetTitle(""); - TargetUrl = from_u8((boost::filesystem::path(resources_dir()) / "web/guide/24/index.html").make_preferred().string()); + TargetUrl = from_u8((boost::filesystem::path(resources_dir()) / "web/guide/0/index.html?target=24").make_preferred().string()); } else { SetTitle(_L("Setup Wizard")); - TargetUrl = from_u8((boost::filesystem::path(resources_dir()) / "web/guide/21/index.html").make_preferred().string()); + TargetUrl = from_u8((boost::filesystem::path(resources_dir()) / "web/guide/0/index.html?target=21").make_preferred().string()); } wxString strlang = wxGetApp().current_language_code_safe(); BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format(", strlang=%1%") % into_u8(strlang); if (strlang != "") - TargetUrl = wxString::Format("%s?lang=%s", w2s(TargetUrl), strlang); + TargetUrl = wxString::Format("%s&lang=%s", w2s(TargetUrl), strlang); TargetUrl = "file://" + TargetUrl; if (load) @@ -301,6 +295,13 @@ void GuideFrame::OnNavigationRequest(wxWebViewEvent &evt) void GuideFrame::OnNavigationComplete(wxWebViewEvent &evt) { //wxLogMessage("%s", "Navigation complete; url='" + evt.GetURL() + "'"); + if (!bFirstComplete) { + boost::thread LoadProfileThread(boost::bind(&GuideFrame::LoadProfile, this)); + LoadProfileThread.detach(); + + bFirstComplete = true; + } + m_browser->Show(); Layout(); @@ -509,7 +510,7 @@ void GuideFrame::OnScriptMessage(wxWebViewEvent &evt) BOOST_LOG_TRIVIAL(trace) << "GuideFrame::OnScriptMessage;Error:" << e.what(); } - wxString strAll = m_ProfileJson.dump(-1,' ',false, json::error_handler_t::ignore); + //wxString strAll = m_ProfileJson.dump(-1,' ',false, json::error_handler_t::ignore); } void GuideFrame::RunScript(const wxString &javascript) @@ -1122,6 +1123,12 @@ int GuideFrame::LoadProfile() std::string strAll = m_ProfileJson.dump(-1, ' ', false, json::error_handler_t::ignore); BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", finished, json contents: "<< std::endl< Date: Fri, 27 Dec 2024 12:04:44 +0800 Subject: [PATCH 3/6] ENH: Update UserGuide Load UI JIRA: none Change-Id: Ifc8cdd59a61dfece6c497ed50fcad9663d380be3 (cherry picked from commit 37918c4463fe6bdced742d5d81d756fa811510b7) (cherry picked from commit cea5bc967c3c2e8ed538903823ffb3cd70d62584) --- resources/web/data/text.js | 11 +++++++++++ resources/web/guide/0/index.html | 5 ++++- resources/web/guide/0/load.css | 19 +++++++++++++++++-- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/resources/web/data/text.js b/resources/web/data/text.js index fd9c28df1a..0c6a748e6b 100644 --- a/resources/web/data/text.js +++ b/resources/web/data/text.js @@ -105,6 +105,7 @@ var LangText = { t111: "Create New", t112: "Join the Program", t113: "You may change your choice in preference anytime.", + t126: "Loading……", orca1: "Edit Project Info", orca2: "no model information", orca3: "Stealth Mode", @@ -326,6 +327,7 @@ var LangText = { t111: "Crear nuevo", t112: "Unirse al programa", t113: "Puede cambiar su elección en preferencias en cualquier momento.", + t126: "Carga en progreso……", orca1: "Editar información del proyecto", orca2: "No hay información sobre el modelo", orca3: "Modo Invisible", @@ -431,6 +433,7 @@ var LangText = { t104: "Profilname", t105: "Profilautor", t106: "Profilbeschreibung", + t126: "Laden……", orca1: "Edit Project Info", orca2: "no model information", }, @@ -533,6 +536,7 @@ var LangText = { t104: "Název profilu", t105: "Autor profilu", t106: "Popis profilu", + t126: "Načtení probíhá……", orca1: "Edit Project Info", orca2: "no model information", }, @@ -638,6 +642,7 @@ var LangText = { t109: "Filaments du système", t110: "Filaments personnalisés", t111: "Créer un nouveau filament", + t126: "Chargement en cours……", orca1: "Modifier les informations du projet", orca2: "pas d'information sur le modèle", wk1: "Démarrage rapide", @@ -763,6 +768,7 @@ var LangText = { t111: "新建", t112: "加入该计划", t113: "您可以随时更改您的偏好。", + t126: "正在加载……", wk1: "快速入门指南", wk2: "本文介绍了Orca Slicer的最基本用法。它指导用户配置软件,创建项目,并逐步完成第一个打印任务。", wk3: "基于项目的工作流", @@ -993,6 +999,7 @@ var LangText = { t111: "Создать новый", t112: "Присоединяйтесь к программе", t113: "Вы можете изменить свой выбор в любое время.", + t126: "Загрузка идёт……", orca1: "Редактировать информацию о проекте", orca2: "Информации о модели отсутствует", orca3: "Режим конфиденциальности", @@ -1087,6 +1094,7 @@ var LangText = { t92: "Bambu Christmas Cabin", t93: "프린터 연결", t94: "장치를 보려면 프린터 연결을 설정하세요.", + t126: "로딩 중……", orca1: "Edit Project Info", orca2: "no model information", }, @@ -1196,6 +1204,7 @@ var LangText = { t111: "Yeni Oluştur", t112: "Programa Katılın", t113: "Tercihinizi istediğiniz zaman değiştirebilirsiniz.", + t126: "Yükleme devam ediyor……", orca1: "Proje Bilgilerini Düzenle", orca2: "model bilgisi yok", }, @@ -1305,6 +1314,7 @@ var LangText = { t111: "Utwórz nowy", t112: "Dołącz do programu", t113: "Możesz zmienić swój wybór w preferencjach w dowolnym momencie.", + t126: "Ładowanie trwa……", orca1: "Edytuj informacje o projekcie", orca2: "brak informacji o modelu", orca3: "Tryb «Niewidzialny»", @@ -1417,6 +1427,7 @@ var LangText = { t111: "Criar Novo", t112: "Junte-se ao Programa", t113: "Você pode alterar sua escolha nas Preferências a qualquer momento", + t126: "Carregamento em andamento……", orca1: "Editar Info do Projeto", orca2: "Sem informação do modelo", }, diff --git a/resources/web/guide/0/index.html b/resources/web/guide/0/index.html index b1caa07a5f..efa703fd36 100644 --- a/resources/web/guide/0/index.html +++ b/resources/web/guide/0/index.html @@ -15,6 +15,9 @@ - +
+ +
Loading……
+
\ No newline at end of file diff --git a/resources/web/guide/0/load.css b/resources/web/guide/0/load.css index 8f8ce536b5..d5618ccb7c 100644 --- a/resources/web/guide/0/load.css +++ b/resources/web/guide/0/load.css @@ -14,8 +14,23 @@ body justify-content: center; } +#LoadBlock +{ + display:flex; + align-items: center; + justify-content: center; +} + #LoadingSvg { - animation: rotate 5s infinite linear; - height: 60%; + animation: rotate 1.2s infinite linear; + margin-right: 8px; + height: 120%; +} + +#LoadTip +{ + font-size: 15px; + font-weight: 700; + color: #262E30; } \ No newline at end of file From 5e79e9196fa1324131cee566265c90fae05df86c Mon Sep 17 00:00:00 2001 From: "zorro.zhang" Date: Tue, 7 Jan 2025 17:02:13 +0800 Subject: [PATCH 4/6] ENH: SaveProfileData to AppConfig in MainThread JIRA: none Change-Id: I22ae3dac5e2bed42a2edfb848d627cd5092ef171 (cherry picked from commit c2042d7e20ab03001e4b38f366d0f129f2ee0918) (cherry picked from commit d027e098acf37330076273799d2ff873a07044b5) --- src/slic3r/GUI/WebGuideDialog.cpp | 39 ++++++++++++++++++++----------- src/slic3r/GUI/WebGuideDialog.hpp | 3 ++- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/slic3r/GUI/WebGuideDialog.cpp b/src/slic3r/GUI/WebGuideDialog.cpp index 00d5346661..ce9e3e20d9 100644 --- a/src/slic3r/GUI/WebGuideDialog.cpp +++ b/src/slic3r/GUI/WebGuideDialog.cpp @@ -296,7 +296,7 @@ void GuideFrame::OnNavigationComplete(wxWebViewEvent &evt) { //wxLogMessage("%s", "Navigation complete; url='" + evt.GetURL() + "'"); if (!bFirstComplete) { - boost::thread LoadProfileThread(boost::bind(&GuideFrame::LoadProfile, this)); + boost::thread LoadProfileThread(boost::bind(&GuideFrame::LoadProfileData, this)); LoadProfileThread.detach(); bFirstComplete = true; @@ -977,8 +977,7 @@ int GuideFrame::GetFilamentInfo( std::string VendorDirectory, json & pFilaList, return 0; } - -int GuideFrame::LoadProfile() +int GuideFrame::LoadProfileData() { try { m_ProfileJson = json::parse("{}"); @@ -987,7 +986,7 @@ int GuideFrame::LoadProfile() m_ProfileJson["filament"] = json::object(); m_ProfileJson["process"] = json::array(); - vendor_dir = (boost::filesystem::path(Slic3r::data_dir()) / PRESET_SYSTEM_DIR ).make_preferred(); + vendor_dir = (boost::filesystem::path(Slic3r::data_dir()) / PRESET_SYSTEM_DIR).make_preferred(); rsrc_vendor_dir = (boost::filesystem::path(resources_dir()) / "profiles").make_preferred(); // Orca: add custom as default @@ -1046,8 +1045,31 @@ int GuideFrame::LoadProfile() } } + //sync to web + std::string strAll = m_ProfileJson.dump(-1, ' ', false, json::error_handler_t::ignore); + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", finished, json contents: " << std::endl << strAll; + json m_Res = json::object(); + m_Res["command"] = "userguide_profile_load_finish"; + m_Res["sequence_id"] = "10001"; + wxString strJS = wxString::Format("HandleStudio(%s)", m_Res.dump(-1, ' ', true)); + wxGetApp().CallAfter([this, strJS] { RunScript(strJS); }); + //sync to appconfig + wxGetApp().CallAfter([this] { SaveProfileData(); }); + + } catch (std::exception &e) { + // wxLogMessage("GUIDE: load_profile_error %s ", e.what()); + // wxMessageBox(e.what(), "", MB_OK); + BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ", error: " << e.what() << std::endl; + } + + return 0; +} + +int GuideFrame::SaveProfileData() +{ + try { const auto enabled_filaments = wxGetApp().app_config->has_section(AppConfig::SECTION_FILAMENTS) ? wxGetApp().app_config->get_section(AppConfig::SECTION_FILAMENTS) : std::map(); m_appconfig_new.set_vendors(*wxGetApp().app_config); m_appconfig_new.set_section(AppConfig::SECTION_FILAMENTS, enabled_filaments); @@ -1120,15 +1142,6 @@ int GuideFrame::LoadProfile() BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ", error: "<< e.what() < Date: Fri, 17 Jan 2025 20:23:29 +0800 Subject: [PATCH 5/6] FIX: gui: fix the crash issue when close guide frame at the beginning jira: STUDIO-9941 Change-Id: I47e189e838ae606d294d0c0b4ccffc6f833a27c3 (cherry picked from commit 093a7c25cb7507d0d6af228c2efa3410e1184c27) --- src/slic3r/GUI/WebGuideDialog.cpp | 41 ++++++++++++++++++++----------- src/slic3r/GUI/WebGuideDialog.hpp | 2 ++ 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/slic3r/GUI/WebGuideDialog.cpp b/src/slic3r/GUI/WebGuideDialog.cpp index ce9e3e20d9..7ec50b6b1f 100644 --- a/src/slic3r/GUI/WebGuideDialog.cpp +++ b/src/slic3r/GUI/WebGuideDialog.cpp @@ -48,7 +48,7 @@ static wxString update_custom_filaments() json m_CustomFilaments = json::array(); PresetBundle * preset_bundle = wxGetApp().preset_bundle; std::map> temp_filament_id_to_presets = preset_bundle->filaments.get_filament_presets(); - + std::vector> need_sort; bool need_delete_some_filament = false; for (std::pair> filament_id_to_presets : temp_filament_id_to_presets) { @@ -72,7 +72,7 @@ static wxString update_custom_filaments() auto filament_vendor = dynamic_cast(const_cast(preset)->config.option("filament_vendor", false)); if (filament_vendor && filament_vendor->values.size() && filament_vendor->values[0] == "Generic") not_need_show = true; } - + if (filament_name.empty()) { std::string preset_name = preset->name; size_t index_at = preset_name.find(" @"); @@ -132,7 +132,7 @@ GuideFrame::GuideFrame(GUI_App *pGUI, long style) } m_browser->Hide(); m_browser->SetSize(0, 0); - + SetSizer(topsizer); topsizer->Add(m_browser, wxSizerFlags().Expand().Proportion(1)); @@ -187,6 +187,12 @@ GuideFrame::GuideFrame(GUI_App *pGUI, long style) GuideFrame::~GuideFrame() { + m_destroy = true; + if (m_load_task && m_load_task->joinable()) { + m_load_task->join(); + delete m_load_task; + m_load_task = nullptr; + } if (m_browser) { delete m_browser; m_browser = nullptr; @@ -296,15 +302,16 @@ void GuideFrame::OnNavigationComplete(wxWebViewEvent &evt) { //wxLogMessage("%s", "Navigation complete; url='" + evt.GetURL() + "'"); if (!bFirstComplete) { - boost::thread LoadProfileThread(boost::bind(&GuideFrame::LoadProfileData, this)); - LoadProfileThread.detach(); + m_load_task = new boost::thread(boost::bind(&GuideFrame::LoadProfileData, this)); + // boost::thread LoadProfileThread(boost::bind(&GuideFrame::LoadProfileData, this)); + //LoadProfileThread.detach(); bFirstComplete = true; } m_browser->Show(); Layout(); - + wxString NewUrl = evt.GetURL(); UpdateState(); @@ -929,9 +936,9 @@ int GuideFrame::GetFilamentInfo( std::string VendorDirectory, json & pFilaList, if (jLocal.contains("inherits")) { std::string FName = jLocal["inherits"]; - if (!pFilaList.contains(FName)) { + if (!pFilaList.contains(FName)) { BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "pFilaList - Not Contains inherits filaments: " << FName; - return -1; + return -1; } std::string FPath = pFilaList[FName]["sub_path"]; @@ -1028,6 +1035,8 @@ int GuideFrame::LoadProfileData() LoadProfileFamily(w2s(strVendor), iter->path().string()); loaded_vendors.insert(w2s(strVendor)); } + if (m_destroy) + return 0; } boost::filesystem::directory_iterator others_endIter; @@ -1043,6 +1052,8 @@ int GuideFrame::LoadProfileData() LoadProfileFamily(w2s(strVendor), iter->path().string()); loaded_vendors.insert(w2s(strVendor)); } + if (m_destroy) + return 0; } //sync to web @@ -1053,12 +1064,14 @@ int GuideFrame::LoadProfileData() m_Res["command"] = "userguide_profile_load_finish"; m_Res["sequence_id"] = "10001"; wxString strJS = wxString::Format("HandleStudio(%s)", m_Res.dump(-1, ' ', true)); - wxGetApp().CallAfter([this, strJS] { RunScript(strJS); }); + if (!m_destroy) + wxGetApp().CallAfter([this, strJS] { RunScript(strJS); }); //sync to appconfig - wxGetApp().CallAfter([this] { SaveProfileData(); }); + if (!m_destroy) + wxGetApp().CallAfter([this] { SaveProfileData(); }); - } catch (std::exception &e) { + } catch (std::exception& e) { // wxLogMessage("GUIDE: load_profile_error %s ", e.what()); // wxMessageBox(e.what(), "", MB_OK); BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ", error: " << e.what() << std::endl; @@ -1281,7 +1294,7 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath std::string sub_file = sub_path.string(); LoadFile(sub_file, contents); json pm = json::parse(contents); - + std::string strInstant = pm["instantiation"]; BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "Load Filament:" << s1 << ",Path:" << sub_file << ",instantiation?" << strInstant; @@ -1290,9 +1303,9 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath std::string sT; int nRet = GetFilamentInfo(vendor_dir.string(),tFilaList, sub_file, sV, sT); - if (nRet != 0) { + if (nRet != 0) { BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "Load Filament:" << s1 << ",GetFilamentInfo Failed, Vendor:" << sV << ",Type:"<< sT; - continue; + continue; } OneFF["vendor"] = sV; diff --git a/src/slic3r/GUI/WebGuideDialog.hpp b/src/slic3r/GUI/WebGuideDialog.hpp index f2f75445ae..d2ab468fcc 100644 --- a/src/slic3r/GUI/WebGuideDialog.hpp +++ b/src/slic3r/GUI/WebGuideDialog.hpp @@ -110,6 +110,8 @@ private: //First Load bool bFirstComplete{false}; + bool m_destroy{false}; + boost::thread* m_load_task{ nullptr }; // User Config bool PrivacyUse; From 41c3a059a76514f09375a757a1e2ded07466d2f1 Mon Sep 17 00:00:00 2001 From: Noisyfox Date: Fri, 28 Mar 2025 23:21:02 +0800 Subject: [PATCH 6/6] Use Orca color --- resources/web/guide/0/loading.svg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/web/guide/0/loading.svg b/resources/web/guide/0/loading.svg index 7566bb0921..0526e76bc8 100644 --- a/resources/web/guide/0/loading.svg +++ b/resources/web/guide/0/loading.svg @@ -2,8 +2,8 @@ - - + +