diff --git a/resources/web/data/text.js b/resources/web/data/text.js
index b8160fabd0..930ce4d2d9 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",
@@ -543,6 +545,7 @@ var LangText = {
t104: "Profilname",
t105: "Profilautor",
t106: "Profilbeschreibung",
+ t126: "Laden……",
orca1: "Edit Project Info",
orca2: "no model information",
},
@@ -645,6 +648,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",
},
@@ -750,6 +754,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",
@@ -875,6 +880,7 @@ var LangText = {
t111: "新建",
t112: "加入该计划",
t113: "您可以随时更改您的偏好。",
+ t126: "正在加载……",
wk1: "快速入门指南",
wk2: "本文介绍了Orca Slicer的最基本用法。它指导用户配置软件,创建项目,并逐步完成第一个打印任务。",
wk3: "基于项目的工作流",
@@ -1105,6 +1111,7 @@ var LangText = {
t111: "Создать новый",
t112: "Присоединяйтесь к программе",
t113: "Вы можете изменить свой выбор в любое время.",
+ t126: "Загрузка идёт……",
orca1: "Редактировать информацию о проекте",
orca2: "Информации о модели отсутствует",
orca3: "Режим конфиденциальности",
@@ -1199,6 +1206,7 @@ var LangText = {
t92: "Bambu Christmas Cabin",
t93: "프린터 연결",
t94: "장치를 보려면 프린터 연결을 설정하세요.",
+ t126: "로딩 중……",
orca1: "Edit Project Info",
orca2: "no model information",
},
@@ -1308,6 +1316,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",
},
@@ -1417,6 +1426,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»",
@@ -1529,6 +1539,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",
orca3: "Modo Furtivo",
diff --git a/resources/web/guide/0/index.html b/resources/web/guide/0/index.html
new file mode 100644
index 0000000000..efa703fd36
--- /dev/null
+++ b/resources/web/guide/0/index.html
@@ -0,0 +1,23 @@
+
+
+
+
+
+loading
+
+
+
+
+
+
+
+
+
+
+
+
+

+
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..d5618ccb7c
--- /dev/null
+++ b/resources/web/guide/0/load.css
@@ -0,0 +1,36 @@
+@keyframes rotate {
+ from {
+ transform: rotate(0deg);
+ }
+ to {
+ transform: rotate(360deg);
+ }
+}
+
+body
+{
+ display:flex;
+ align-content: center;
+ justify-content: center;
+}
+
+#LoadBlock
+{
+ display:flex;
+ align-items: center;
+ justify-content: center;
+}
+
+#LoadingSvg
+{
+ 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
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..0526e76bc8
--- /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 3cc8374bcf..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));
@@ -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);
@@ -193,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;
@@ -214,43 +214,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,9 +301,17 @@ void GuideFrame::OnNavigationRequest(wxWebViewEvent &evt)
void GuideFrame::OnNavigationComplete(wxWebViewEvent &evt)
{
//wxLogMessage("%s", "Navigation complete; url='" + evt.GetURL() + "'");
+ if (!bFirstComplete) {
+ 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();
@@ -509,7 +517,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)
@@ -928,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"];
@@ -976,8 +984,7 @@ int GuideFrame::GetFilamentInfo( std::string VendorDirectory, json & pFilaList,
return 0;
}
-
-int GuideFrame::LoadProfile()
+int GuideFrame::LoadProfileData()
{
try {
m_ProfileJson = json::parse("{}");
@@ -986,7 +993,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
@@ -1028,6 +1035,8 @@ int GuideFrame::LoadProfile()
LoadProfileFamily(w2s(strVendor), iter->path().string());
loaded_vendors.insert(w2s(strVendor));
}
+ if (m_destroy)
+ return 0;
}
boost::filesystem::directory_iterator others_endIter;
@@ -1043,10 +1052,37 @@ int GuideFrame::LoadProfile()
LoadProfileFamily(w2s(strVendor), iter->path().string());
loaded_vendors.insert(w2s(strVendor));
}
+ if (m_destroy)
+ return 0;
}
+ //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));
+ if (!m_destroy)
+ wxGetApp().CallAfter([this, strJS] { RunScript(strJS); });
+ //sync to appconfig
+ if (!m_destroy)
+ 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);
@@ -1119,9 +1155,6 @@ int GuideFrame::LoadProfile()
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ", error: "<< e.what() <