mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-24 07:03:59 -06:00
NEW: UserGuide Add Loading Tip
JIRA: none Change-Id: I43d79d740b9180a16d02c54c0c9d6e11c23b1ce7 (cherry picked from commit 03d8d58fad95199236ee7a5f931d3f395ee8dc1d)
This commit is contained in:
parent
f1cba23976
commit
df6516e3e3
6 changed files with 101 additions and 17 deletions
20
resources/web/guide/0/index.html
Normal file
20
resources/web/guide/0/index.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
<!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()">
|
||||
<img id="LoadingSvg" src="loading.svg" />
|
||||
</body>
|
||||
</html>
|
21
resources/web/guide/0/load.css
Normal file
21
resources/web/guide/0/load.css
Normal file
|
@ -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%;
|
||||
}
|
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="#00AE42"/>
|
||||
<stop offset="1" stop-color="#00AE42" 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_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
|
||||
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<<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); });
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,6 +107,9 @@ private:
|
|||
boost::filesystem::path vendor_dir;
|
||||
boost::filesystem::path rsrc_vendor_dir;
|
||||
|
||||
//First Load
|
||||
bool bFirstComplete{false};
|
||||
|
||||
// User Config
|
||||
bool PrivacyUse;
|
||||
bool StealthMode;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue