mirror of
https://git.mirrors.martin98.com/https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-06 18:05:17 +08:00
Async profile load on printer/filament selection screen (#9118)
The selection screen shows a loading indicator instead of frozen during the page loading process, during that time you will able to close the window if you want, instead of been stuck at this screen until it loaded:  Ported from BambuStudio, huge thanks to BambuLab!
This commit is contained in:
commit
697fc5b8d3
@ -105,6 +105,7 @@ var LangText = {
|
|||||||
t111: "Create New",
|
t111: "Create New",
|
||||||
t112: "Join the Program",
|
t112: "Join the Program",
|
||||||
t113: "You may change your choice in preference anytime.",
|
t113: "You may change your choice in preference anytime.",
|
||||||
|
t126: "Loading……",
|
||||||
orca1: "Edit Project Info",
|
orca1: "Edit Project Info",
|
||||||
orca2: "no model information",
|
orca2: "no model information",
|
||||||
orca3: "Stealth Mode",
|
orca3: "Stealth Mode",
|
||||||
@ -326,6 +327,7 @@ var LangText = {
|
|||||||
t111: "Crear nuevo",
|
t111: "Crear nuevo",
|
||||||
t112: "Unirse al programa",
|
t112: "Unirse al programa",
|
||||||
t113: "Puede cambiar su elección en preferencias en cualquier momento.",
|
t113: "Puede cambiar su elección en preferencias en cualquier momento.",
|
||||||
|
t126: "Carga en progreso……",
|
||||||
orca1: "Editar información del proyecto",
|
orca1: "Editar información del proyecto",
|
||||||
orca2: "No hay información sobre el modelo",
|
orca2: "No hay información sobre el modelo",
|
||||||
orca3: "Modo Invisible",
|
orca3: "Modo Invisible",
|
||||||
@ -543,6 +545,7 @@ var LangText = {
|
|||||||
t104: "Profilname",
|
t104: "Profilname",
|
||||||
t105: "Profilautor",
|
t105: "Profilautor",
|
||||||
t106: "Profilbeschreibung",
|
t106: "Profilbeschreibung",
|
||||||
|
t126: "Laden……",
|
||||||
orca1: "Edit Project Info",
|
orca1: "Edit Project Info",
|
||||||
orca2: "no model information",
|
orca2: "no model information",
|
||||||
},
|
},
|
||||||
@ -645,6 +648,7 @@ var LangText = {
|
|||||||
t104: "Název profilu",
|
t104: "Název profilu",
|
||||||
t105: "Autor profilu",
|
t105: "Autor profilu",
|
||||||
t106: "Popis profilu",
|
t106: "Popis profilu",
|
||||||
|
t126: "Načtení probíhá……",
|
||||||
orca1: "Edit Project Info",
|
orca1: "Edit Project Info",
|
||||||
orca2: "no model information",
|
orca2: "no model information",
|
||||||
},
|
},
|
||||||
@ -750,6 +754,7 @@ var LangText = {
|
|||||||
t109: "Filaments du système",
|
t109: "Filaments du système",
|
||||||
t110: "Filaments personnalisés",
|
t110: "Filaments personnalisés",
|
||||||
t111: "Créer un nouveau filament",
|
t111: "Créer un nouveau filament",
|
||||||
|
t126: "Chargement en cours……",
|
||||||
orca1: "Modifier les informations du projet",
|
orca1: "Modifier les informations du projet",
|
||||||
orca2: "pas d'information sur le modèle",
|
orca2: "pas d'information sur le modèle",
|
||||||
wk1: "Démarrage rapide",
|
wk1: "Démarrage rapide",
|
||||||
@ -875,6 +880,7 @@ var LangText = {
|
|||||||
t111: "新建",
|
t111: "新建",
|
||||||
t112: "加入该计划",
|
t112: "加入该计划",
|
||||||
t113: "您可以随时更改您的偏好。",
|
t113: "您可以随时更改您的偏好。",
|
||||||
|
t126: "正在加载……",
|
||||||
wk1: "快速入门指南",
|
wk1: "快速入门指南",
|
||||||
wk2: "本文介绍了Orca Slicer的最基本用法。它指导用户配置软件,创建项目,并逐步完成第一个打印任务。",
|
wk2: "本文介绍了Orca Slicer的最基本用法。它指导用户配置软件,创建项目,并逐步完成第一个打印任务。",
|
||||||
wk3: "基于项目的工作流",
|
wk3: "基于项目的工作流",
|
||||||
@ -1105,6 +1111,7 @@ var LangText = {
|
|||||||
t111: "Создать новый",
|
t111: "Создать новый",
|
||||||
t112: "Присоединяйтесь к программе",
|
t112: "Присоединяйтесь к программе",
|
||||||
t113: "Вы можете изменить свой выбор в любое время.",
|
t113: "Вы можете изменить свой выбор в любое время.",
|
||||||
|
t126: "Загрузка идёт……",
|
||||||
orca1: "Редактировать информацию о проекте",
|
orca1: "Редактировать информацию о проекте",
|
||||||
orca2: "Информации о модели отсутствует",
|
orca2: "Информации о модели отсутствует",
|
||||||
orca3: "Режим конфиденциальности",
|
orca3: "Режим конфиденциальности",
|
||||||
@ -1199,6 +1206,7 @@ var LangText = {
|
|||||||
t92: "Bambu Christmas Cabin",
|
t92: "Bambu Christmas Cabin",
|
||||||
t93: "프린터 연결",
|
t93: "프린터 연결",
|
||||||
t94: "장치를 보려면 프린터 연결을 설정하세요.",
|
t94: "장치를 보려면 프린터 연결을 설정하세요.",
|
||||||
|
t126: "로딩 중……",
|
||||||
orca1: "Edit Project Info",
|
orca1: "Edit Project Info",
|
||||||
orca2: "no model information",
|
orca2: "no model information",
|
||||||
},
|
},
|
||||||
@ -1308,6 +1316,7 @@ var LangText = {
|
|||||||
t111: "Yeni Oluştur",
|
t111: "Yeni Oluştur",
|
||||||
t112: "Programa Katılın",
|
t112: "Programa Katılın",
|
||||||
t113: "Tercihinizi istediğiniz zaman değiştirebilirsiniz.",
|
t113: "Tercihinizi istediğiniz zaman değiştirebilirsiniz.",
|
||||||
|
t126: "Yükleme devam ediyor……",
|
||||||
orca1: "Proje Bilgilerini Düzenle",
|
orca1: "Proje Bilgilerini Düzenle",
|
||||||
orca2: "model bilgisi yok",
|
orca2: "model bilgisi yok",
|
||||||
},
|
},
|
||||||
@ -1417,6 +1426,7 @@ var LangText = {
|
|||||||
t111: "Utwórz nowy",
|
t111: "Utwórz nowy",
|
||||||
t112: "Dołącz do programu",
|
t112: "Dołącz do programu",
|
||||||
t113: "Możesz zmienić swój wybór w preferencjach w dowolnym momencie.",
|
t113: "Możesz zmienić swój wybór w preferencjach w dowolnym momencie.",
|
||||||
|
t126: "Ładowanie trwa……",
|
||||||
orca1: "Edytuj informacje o projekcie",
|
orca1: "Edytuj informacje o projekcie",
|
||||||
orca2: "brak informacji o modelu",
|
orca2: "brak informacji o modelu",
|
||||||
orca3: "Tryb «Niewidzialny»",
|
orca3: "Tryb «Niewidzialny»",
|
||||||
@ -1529,6 +1539,7 @@ var LangText = {
|
|||||||
t111: "Criar Novo",
|
t111: "Criar Novo",
|
||||||
t112: "Junte-se ao Programa",
|
t112: "Junte-se ao Programa",
|
||||||
t113: "Você pode alterar sua escolha nas Preferências a qualquer momento",
|
t113: "Você pode alterar sua escolha nas Preferências a qualquer momento",
|
||||||
|
t126: "Carregamento em andamento……",
|
||||||
orca1: "Editar Info do Projeto",
|
orca1: "Editar Info do Projeto",
|
||||||
orca2: "Sem informação do modelo",
|
orca2: "Sem informação do modelo",
|
||||||
orca3: "Modo Furtivo",
|
orca3: "Modo Furtivo",
|
||||||
|
23
resources/web/guide/0/index.html
Normal file
23
resources/web/guide/0/index.html
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="Cache-Control" content="max-age=7200" />
|
||||||
|
<title>loading</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/common.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="load.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/dark.css" />
|
||||||
|
<script type="text/javascript" src="../js/jquery-3.6.0.min.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/json2.js"></script>
|
||||||
|
<script type="text/javascript" src="../../data/text.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/globalapi.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/common.js"></script>
|
||||||
|
<script type="text/javascript" src="load.js"></script>
|
||||||
|
</head>
|
||||||
|
<body onLoad="OnInit()">
|
||||||
|
<div id="LoadBlock">
|
||||||
|
<img id="LoadingSvg" src="loading.svg" />
|
||||||
|
<div id="LoadTip" class="trans" tid="t126">Loading……</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
36
resources/web/guide/0/load.css
Normal file
36
resources/web/guide/0/load.css
Normal file
@ -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;
|
||||||
|
}
|
24
resources/web/guide/0/load.js
Normal file
24
resources/web/guide/0/load.js
Normal file
@ -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');
|
||||||
|
}
|
9
resources/web/guide/0/loading.svg
Normal file
9
resources/web/guide/0/loading.svg
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M11 19.2742C11 19.675 11.3555 20 11.7941 20C16.3261 20 20 16.6421 20 12.5C20 8.35786 16.3261 5 11.7941 5C11.3555 5 11 5.32496 11 5.72581C11 6.12666 11.3555 6.45161 11.7941 6.45161C15.4489 6.45161 18.4118 9.15957 18.4118 12.5C18.4118 15.8404 15.4489 18.5484 11.7941 18.5484C11.3555 18.5484 11 18.8733 11 19.2742Z" fill="url(#paint0_linear_2417_1599)"/>
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="paint0_linear_2417_1599" x1="11.9338" y1="19.2801" x2="11" y2="5.79458" gradientUnits="userSpaceOnUse">
|
||||||
|
<stop stop-color="#009688"/>
|
||||||
|
<stop offset="1" stop-color="#009688" stop-opacity="0"/>
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 747 B |
@ -178,12 +178,6 @@ GuideFrame::GuideFrame(GUI_App *pGUI, long style)
|
|||||||
// Bind(wxEVT_IDLE, &GuideFrame::OnIdle, this);
|
// Bind(wxEVT_IDLE, &GuideFrame::OnIdle, this);
|
||||||
// Bind(wxEVT_CLOSE_WINDOW, &GuideFrame::OnClose, 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<std::chrono::milliseconds>(end - start);
|
|
||||||
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << ": LoadProfile() took " << duration.count() << " milliseconds";
|
|
||||||
|
|
||||||
// UI
|
// UI
|
||||||
SetStartPage(BBL_REGION);
|
SetStartPage(BBL_REGION);
|
||||||
|
|
||||||
@ -193,6 +187,12 @@ GuideFrame::GuideFrame(GUI_App *pGUI, long style)
|
|||||||
|
|
||||||
GuideFrame::~GuideFrame()
|
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) {
|
if (m_browser) {
|
||||||
delete m_browser;
|
delete m_browser;
|
||||||
m_browser = nullptr;
|
m_browser = nullptr;
|
||||||
@ -214,43 +214,43 @@ wxString GuideFrame::SetStartPage(GuidePage startpage, bool load)
|
|||||||
m_page = startpage;
|
m_page = startpage;
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format(" enter, load=%1%, start_page=%2%")%load%int(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() );
|
//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());
|
//wxLogMessage("GUIDE: webpage_2 %s", TargetUrl.mb_str());
|
||||||
|
|
||||||
if (startpage == BBL_WELCOME){
|
if (startpage == BBL_WELCOME){
|
||||||
SetTitle(_L("Setup Wizard"));
|
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) {
|
} else if (startpage == BBL_REGION) {
|
||||||
SetTitle(_L("Setup Wizard"));
|
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) {
|
} else if (startpage == BBL_MODELS) {
|
||||||
SetTitle(_L("Setup Wizard"));
|
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) {
|
} else if (startpage == BBL_FILAMENTS) {
|
||||||
SetTitle(_L("Setup Wizard"));
|
SetTitle(_L("Setup Wizard"));
|
||||||
|
|
||||||
int nSize = m_ProfileJson["model"].size();
|
int nSize = m_ProfileJson["model"].size();
|
||||||
|
|
||||||
if (nSize>0)
|
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
|
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) {
|
} else if (startpage == BBL_FILAMENT_ONLY) {
|
||||||
SetTitle("");
|
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) {
|
} else if (startpage == BBL_MODELS_ONLY) {
|
||||||
SetTitle("");
|
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 {
|
else {
|
||||||
SetTitle(_L("Setup Wizard"));
|
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();
|
wxString strlang = wxGetApp().current_language_code_safe();
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format(", strlang=%1%") % into_u8(strlang);
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format(", strlang=%1%") % into_u8(strlang);
|
||||||
if (strlang != "")
|
if (strlang != "")
|
||||||
TargetUrl = wxString::Format("%s?lang=%s", w2s(TargetUrl), strlang);
|
TargetUrl = wxString::Format("%s&lang=%s", w2s(TargetUrl), strlang);
|
||||||
|
|
||||||
TargetUrl = "file://" + TargetUrl;
|
TargetUrl = "file://" + TargetUrl;
|
||||||
if (load)
|
if (load)
|
||||||
@ -301,6 +301,14 @@ void GuideFrame::OnNavigationRequest(wxWebViewEvent &evt)
|
|||||||
void GuideFrame::OnNavigationComplete(wxWebViewEvent &evt)
|
void GuideFrame::OnNavigationComplete(wxWebViewEvent &evt)
|
||||||
{
|
{
|
||||||
//wxLogMessage("%s", "Navigation complete; url='" + evt.GetURL() + "'");
|
//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();
|
m_browser->Show();
|
||||||
Layout();
|
Layout();
|
||||||
|
|
||||||
@ -509,7 +517,7 @@ void GuideFrame::OnScriptMessage(wxWebViewEvent &evt)
|
|||||||
BOOST_LOG_TRIVIAL(trace) << "GuideFrame::OnScriptMessage;Error:" << e.what();
|
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)
|
void GuideFrame::RunScript(const wxString &javascript)
|
||||||
@ -976,8 +984,7 @@ int GuideFrame::GetFilamentInfo( std::string VendorDirectory, json & pFilaList,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GuideFrame::LoadProfileData()
|
||||||
int GuideFrame::LoadProfile()
|
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
m_ProfileJson = json::parse("{}");
|
m_ProfileJson = json::parse("{}");
|
||||||
@ -1028,6 +1035,8 @@ int GuideFrame::LoadProfile()
|
|||||||
LoadProfileFamily(w2s(strVendor), iter->path().string());
|
LoadProfileFamily(w2s(strVendor), iter->path().string());
|
||||||
loaded_vendors.insert(w2s(strVendor));
|
loaded_vendors.insert(w2s(strVendor));
|
||||||
}
|
}
|
||||||
|
if (m_destroy)
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::filesystem::directory_iterator others_endIter;
|
boost::filesystem::directory_iterator others_endIter;
|
||||||
@ -1043,10 +1052,37 @@ int GuideFrame::LoadProfile()
|
|||||||
LoadProfileFamily(w2s(strVendor), iter->path().string());
|
LoadProfileFamily(w2s(strVendor), iter->path().string());
|
||||||
loaded_vendors.insert(w2s(strVendor));
|
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<std::string, std::string>();
|
const auto enabled_filaments = wxGetApp().app_config->has_section(AppConfig::SECTION_FILAMENTS) ? wxGetApp().app_config->get_section(AppConfig::SECTION_FILAMENTS) : std::map<std::string, std::string>();
|
||||||
m_appconfig_new.set_vendors(*wxGetApp().app_config);
|
m_appconfig_new.set_vendors(*wxGetApp().app_config);
|
||||||
m_appconfig_new.set_section(AppConfig::SECTION_FILAMENTS, enabled_filaments);
|
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() <<std::endl;
|
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ", error: "<< e.what() <<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string strAll = m_ProfileJson.dump(-1, ' ', false, json::error_handler_t::ignore);
|
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", finished, json contents: "<< std::endl<<strAll;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1169,6 +1202,8 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath
|
|||||||
std::string s2 = OneModel["sub_path"];
|
std::string s2 = OneModel["sub_path"];
|
||||||
|
|
||||||
boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred();
|
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();
|
std::string sub_file = sub_path.string();
|
||||||
|
|
||||||
// wxLogMessage("GUIDE: json_path2 %s", w2s(ModelFilePath));
|
// wxLogMessage("GUIDE: json_path2 %s", w2s(ModelFilePath));
|
||||||
@ -1211,6 +1246,8 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath
|
|||||||
|
|
||||||
// wxString ModelFilePath = wxString::Format("%s\\%s\\%s", strFolder, strVendor, s2);
|
// wxString ModelFilePath = wxString::Format("%s\\%s\\%s", strFolder, strVendor, s2);
|
||||||
boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred();
|
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();
|
std::string sub_file = sub_path.string();
|
||||||
LoadFile(sub_file, contents);
|
LoadFile(sub_file, contents);
|
||||||
json pm = json::parse(contents);
|
json pm = json::parse(contents);
|
||||||
@ -1252,6 +1289,8 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath
|
|||||||
if (!m_ProfileJson["filament"].contains(s1)) {
|
if (!m_ProfileJson["filament"].contains(s1)) {
|
||||||
// wxString ModelFilePath = wxString::Format("%s\\%s\\%s", strFolder, strVendor, s2);
|
// wxString ModelFilePath = wxString::Format("%s\\%s\\%s", strFolder, strVendor, s2);
|
||||||
boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred();
|
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();
|
std::string sub_file = sub_path.string();
|
||||||
LoadFile(sub_file, contents);
|
LoadFile(sub_file, contents);
|
||||||
json pm = json::parse(contents);
|
json pm = json::parse(contents);
|
||||||
@ -1312,6 +1351,8 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath
|
|||||||
std::string s2 = OneProcess["sub_path"];
|
std::string s2 = OneProcess["sub_path"];
|
||||||
// wxString ModelFilePath = wxString::Format("%s\\%s\\%s", strFolder, strVendor, s2);
|
// wxString ModelFilePath = wxString::Format("%s\\%s\\%s", strFolder, strVendor, s2);
|
||||||
boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred();
|
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();
|
std::string sub_file = sub_path.string();
|
||||||
LoadFile(sub_file, contents);
|
LoadFile(sub_file, contents);
|
||||||
json pm = json::parse(contents);
|
json pm = json::parse(contents);
|
||||||
|
@ -73,7 +73,8 @@ public:
|
|||||||
bool IsFirstUse();
|
bool IsFirstUse();
|
||||||
|
|
||||||
//Model - Machine - Filaments
|
//Model - Machine - Filaments
|
||||||
int LoadProfile();
|
int LoadProfileData();
|
||||||
|
int SaveProfileData();
|
||||||
int LoadProfileFamily(std::string strVendor, std::string strFilePath);
|
int LoadProfileFamily(std::string strVendor, std::string strFilePath);
|
||||||
int SaveProfile();
|
int SaveProfile();
|
||||||
int GetFilamentInfo( std::string VendorDirectory,json & pFilaList, std::string filepath, std::string &sVendor, std::string &sType);
|
int GetFilamentInfo( std::string VendorDirectory,json & pFilaList, std::string filepath, std::string &sVendor, std::string &sType);
|
||||||
@ -107,6 +108,11 @@ private:
|
|||||||
boost::filesystem::path vendor_dir;
|
boost::filesystem::path vendor_dir;
|
||||||
boost::filesystem::path rsrc_vendor_dir;
|
boost::filesystem::path rsrc_vendor_dir;
|
||||||
|
|
||||||
|
//First Load
|
||||||
|
bool bFirstComplete{false};
|
||||||
|
bool m_destroy{false};
|
||||||
|
boost::thread* m_load_task{ nullptr };
|
||||||
|
|
||||||
// User Config
|
// User Config
|
||||||
bool PrivacyUse;
|
bool PrivacyUse;
|
||||||
bool StealthMode;
|
bool StealthMode;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user