FIX: fix the crash issue when network plugin installing on mac
Change-Id: I766d186fa116986ce4805e71dc5f1899f5901294
This commit is contained in:
parent
6d219574a9
commit
2723ee747c
|
@ -390,8 +390,12 @@ void GuideFrame::OnScriptMessage(wxWebViewEvent &evt)
|
||||||
else if (strCmd == "network_plugin_install") {
|
else if (strCmd == "network_plugin_install") {
|
||||||
std::string sAction = j["data"]["action"];
|
std::string sAction = j["data"]["action"];
|
||||||
|
|
||||||
if (sAction == "yes")
|
if (sAction == "yes") {
|
||||||
InstallNetplugin = true;
|
if (!network_plugin_ready)
|
||||||
|
InstallNetplugin = true;
|
||||||
|
else //already ready
|
||||||
|
InstallNetplugin = false;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
InstallNetplugin = false;
|
InstallNetplugin = false;
|
||||||
}
|
}
|
||||||
|
@ -882,8 +886,8 @@ int GuideFrame::GetFilamentInfo( std::string VendorDirectory, json & pFilaList,
|
||||||
{
|
{
|
||||||
if (jLocal.contains("inherits")) {
|
if (jLocal.contains("inherits")) {
|
||||||
std::string FName = jLocal["inherits"];
|
std::string FName = jLocal["inherits"];
|
||||||
|
|
||||||
if (!pFilaList.contains(FName))
|
if (!pFilaList.contains(FName))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
std::string FPath = pFilaList[FName]["sub_path"];
|
std::string FPath = pFilaList[FName]["sub_path"];
|
||||||
|
@ -1088,6 +1092,7 @@ int GuideFrame::LoadProfile()
|
||||||
|
|
||||||
m_ProfileJson["network_plugin_install"] = wxGetApp().app_config->get("app","installed_networking");
|
m_ProfileJson["network_plugin_install"] = wxGetApp().app_config->get("app","installed_networking");
|
||||||
m_ProfileJson["network_plugin_compability"] = wxGetApp().is_compatibility_version() ? "1" : "0";
|
m_ProfileJson["network_plugin_compability"] = wxGetApp().is_compatibility_version() ? "1" : "0";
|
||||||
|
network_plugin_ready = wxGetApp().is_compatibility_version();
|
||||||
}
|
}
|
||||||
catch (std::exception &e) {
|
catch (std::exception &e) {
|
||||||
//wxLogMessage("GUIDE: load_profile_error %s ", e.what());
|
//wxLogMessage("GUIDE: load_profile_error %s ", e.what());
|
||||||
|
@ -1379,12 +1384,12 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath
|
||||||
json tFilaList = json::object();
|
json tFilaList = json::object();
|
||||||
nsize = pFilament.size();
|
nsize = pFilament.size();
|
||||||
|
|
||||||
for (int n = 0; n < nsize; n++) {
|
for (int n = 0; n < nsize; n++) {
|
||||||
json OneFF = pFilament.at(n);
|
json OneFF = pFilament.at(n);
|
||||||
|
|
||||||
std::string s1 = OneFF["name"];
|
std::string s1 = OneFF["name"];
|
||||||
std::string s2 = OneFF["sub_path"];
|
std::string s2 = OneFF["sub_path"];
|
||||||
|
|
||||||
tFilaList[s1] = OneFF;
|
tFilaList[s1] = OneFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1519,7 +1524,7 @@ bool GuideFrame::LoadFile(std::string jPath, std::string &sContent)
|
||||||
int GuideFrame::DownloadPlugin()
|
int GuideFrame::DownloadPlugin()
|
||||||
{
|
{
|
||||||
return wxGetApp().download_plugin(
|
return wxGetApp().download_plugin(
|
||||||
"plugins", "network_plugin.zip",
|
"plugins", "network_plugin.zip",
|
||||||
[this](int status, int percent, bool& cancel) {
|
[this](int status, int percent, bool& cancel) {
|
||||||
return ShowPluginStatus(status, percent, cancel);
|
return ShowPluginStatus(status, percent, cancel);
|
||||||
}
|
}
|
||||||
|
@ -1528,7 +1533,7 @@ int GuideFrame::DownloadPlugin()
|
||||||
|
|
||||||
int GuideFrame::InstallPlugin()
|
int GuideFrame::InstallPlugin()
|
||||||
{
|
{
|
||||||
return wxGetApp().install_plugin("plugins", "network_plugin.zip",
|
return wxGetApp().install_plugin("plugins", "network_plugin.zip",
|
||||||
[this](int status, int percent, bool &cancel) {
|
[this](int status, int percent, bool &cancel) {
|
||||||
return ShowPluginStatus(status, percent, cancel);
|
return ShowPluginStatus(status, percent, cancel);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
virtual ~GuideFrame();
|
virtual ~GuideFrame();
|
||||||
|
|
||||||
enum GuidePage {
|
enum GuidePage {
|
||||||
BBL_WELCOME,
|
BBL_WELCOME,
|
||||||
BBL_REGION,
|
BBL_REGION,
|
||||||
BBL_MODELS,
|
BBL_MODELS,
|
||||||
BBL_FILAMENTS,
|
BBL_FILAMENTS,
|
||||||
|
@ -93,7 +93,7 @@ public:
|
||||||
int ShowPluginStatus(int status, int percent, bool &cancel);
|
int ShowPluginStatus(int status, int percent, bool &cancel);
|
||||||
|
|
||||||
void on_dpi_changed(const wxRect &suggested_rect) {}
|
void on_dpi_changed(const wxRect &suggested_rect) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GUI_App *m_MainPtr;
|
GUI_App *m_MainPtr;
|
||||||
AppConfig m_appconfig_new;
|
AppConfig m_appconfig_new;
|
||||||
|
@ -112,6 +112,7 @@ private:
|
||||||
std::string m_Region;
|
std::string m_Region;
|
||||||
|
|
||||||
bool InstallNetplugin;
|
bool InstallNetplugin;
|
||||||
|
bool network_plugin_ready {false};
|
||||||
|
|
||||||
#if wxUSE_WEBVIEW_IE
|
#if wxUSE_WEBVIEW_IE
|
||||||
wxMenuItem *m_script_object_el;
|
wxMenuItem *m_script_object_el;
|
||||||
|
|
Loading…
Reference in New Issue