mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-23 16:51:21 -06:00
Feature/home page improve (#4602)
* Add new MyRRF custom printer * hide user panel when networking plugin is not installed/used * Fixed a bug that promption of installing plugin notification was not displayed when trying to switch to Bambu device tab * replay missing_connection animated image when switching to device tab
This commit is contained in:
parent
2d737f62b5
commit
1e08b855df
37 changed files with 710 additions and 814 deletions
|
@ -1434,7 +1434,7 @@ int GUI_App::install_plugin(std::string name, std::string package_name, InstallP
|
|||
if (pro_fn)
|
||||
pro_fn(InstallStatusInstallCompleted, 100, cancel);
|
||||
if (name == "plugins")
|
||||
app_config->set_str("app", "installed_networking", "1");
|
||||
app_config->set_bool("installed_networking", true);
|
||||
BOOST_LOG_TRIVIAL(info) << "[install_plugin] success";
|
||||
return 0;
|
||||
}
|
||||
|
@ -2616,6 +2616,11 @@ void GUI_App::copy_network_if_available()
|
|||
|
||||
bool GUI_App::on_init_network(bool try_backup)
|
||||
{
|
||||
auto should_load_networking_plugin = app_config->get_bool("installed_networking");
|
||||
if(!should_load_networking_plugin) {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "Don't load plugin as installed_networking is false";
|
||||
return false;
|
||||
}
|
||||
int load_agent_dll = Slic3r::NetworkAgent::initialize_network_module();
|
||||
bool create_network_agent = false;
|
||||
__retry:
|
||||
|
@ -2627,7 +2632,7 @@ __retry:
|
|||
if (!bambu_source) {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": can not get bambu source module!";
|
||||
m_networking_compatible = false;
|
||||
if (app_config->get("installed_networking") == "1") {
|
||||
if (should_load_networking_plugin) {
|
||||
m_networking_need_update = true;
|
||||
}
|
||||
}
|
||||
|
@ -2642,13 +2647,13 @@ __retry:
|
|||
goto __retry;
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": on_init_network, version dismatch, need upload network module";
|
||||
if (app_config->get("installed_networking") == "1") {
|
||||
if (should_load_networking_plugin) {
|
||||
m_networking_need_update = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": on_init_network, load dll failed";
|
||||
if (app_config->get("installed_networking") == "1") {
|
||||
if (should_load_networking_plugin) {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": on_init_network, need upload network module";
|
||||
m_networking_need_update = true;
|
||||
}
|
||||
|
@ -3208,9 +3213,9 @@ void GUI_App::ShowUserGuide() {
|
|||
try {
|
||||
bool res = false;
|
||||
GuideFrame GuideDlg(this);
|
||||
//if (GuideDlg.IsFirstUse())
|
||||
//if (GuideDlg.IsFirstUse())
|
||||
res = GuideDlg.run();
|
||||
if (res) {
|
||||
if (res) {
|
||||
load_current_presets();
|
||||
update_publish_status();
|
||||
// BBS: remove SLA related message
|
||||
|
@ -3462,6 +3467,7 @@ void GUI_App::get_login_info()
|
|||
wxString strJS = wxString::Format("window.postMessage(%s)", logout_cmd);
|
||||
GUI::wxGetApp().run_script(strJS);
|
||||
}
|
||||
mainframe->m_webview->SetLoginPanelVisibility(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -989,30 +989,6 @@ void MainFrame::init_tabpanel() {
|
|||
m_tabpanel->Hide();
|
||||
m_settings_dialog.set_tabpanel(m_tabpanel);
|
||||
|
||||
m_tabpanel->Bind(wxEVT_NOTEBOOK_PAGE_CHANGING, [this](wxBookCtrlEvent &e) {
|
||||
int old_sel = e.GetOldSelection();
|
||||
int new_sel = e.GetSelection();
|
||||
if (wxGetApp().preset_bundle && wxGetApp().preset_bundle->is_bbl_vendor() && new_sel == tpMonitor) {
|
||||
if (!wxGetApp().getAgent()) {
|
||||
e.Veto();
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("skipped tab switch from %1% to %2%, lack of network plugins") % old_sel % new_sel;
|
||||
if (m_plater) {
|
||||
wxCommandEvent *evt = new wxCommandEvent(EVT_INSTALL_PLUGIN_HINT);
|
||||
wxQueueEvent(m_plater, evt);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (new_sel == tpMonitor && wxGetApp().preset_bundle != nullptr) {
|
||||
auto cfg = wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
wxString url = cfg.opt_string("print_host_webui").empty() ? cfg.opt_string("print_host") : cfg.opt_string("print_host_webui");
|
||||
if (url.empty()) {
|
||||
wxString url = wxString::Format("file://%s/web/orca/missing_connection.html", from_u8(resources_dir()));
|
||||
m_printer_view->load_url(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
#ifdef __WXMSW__
|
||||
m_tabpanel->Bind(wxEVT_BOOKCTRL_PAGE_CHANGED, [this](wxBookCtrlEvent& e) {
|
||||
#else
|
||||
|
|
|
@ -93,7 +93,7 @@ wxBoxSizer* NetworkTestDialog::create_info_sizer(wxWindow* parent)
|
|||
sizer->Add(text_basic_info, 0, wxALL, 5);
|
||||
|
||||
wxBoxSizer* version_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
text_version_title = new wxStaticText(this, wxID_ANY, _L("Studio Version:"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
text_version_title = new wxStaticText(this, wxID_ANY, _L("OrcaSlicer Version:"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
text_version_title->Wrap(-1);
|
||||
version_sizer->Add(text_version_title, 0, wxALL, 5);
|
||||
|
||||
|
@ -139,11 +139,11 @@ wxBoxSizer* NetworkTestDialog::create_content_sizer(wxWindow* parent)
|
|||
grid_sizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
|
||||
|
||||
StateColor btn_bg(std::pair<wxColour, int>(wxColour(0, 137, 123), StateColor::Pressed),std::pair<wxColour, int>(wxColour(38, 166, 154), StateColor::Hovered), std::pair<wxColour, int>(wxColour(255,255,255), StateColor::Enabled));
|
||||
btn_link = new Button(this, _L("Test BambuLab"));
|
||||
btn_link = new Button(this, _L("Test OrcaSlicer(GitHub)"));
|
||||
btn_link->SetBackgroundColor(btn_bg);
|
||||
grid_sizer->Add(btn_link, 0, wxEXPAND | wxALL, 5);
|
||||
|
||||
text_link_title = new wxStaticText(this, wxID_ANY, _L("Test BambuLab:"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
text_link_title = new wxStaticText(this, wxID_ANY, _L("Test OrcaSlicer(GitHub):"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
text_link_title->Wrap(-1);
|
||||
grid_sizer->Add(text_link_title, 0, wxALIGN_RIGHT | wxALL, 5);
|
||||
|
||||
|
@ -163,114 +163,16 @@ wxBoxSizer* NetworkTestDialog::create_content_sizer(wxWindow* parent)
|
|||
text_bing_val = new wxStaticText(this, wxID_ANY, _L("N/A"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
text_bing_val->Wrap(-1);
|
||||
grid_sizer->Add(text_bing_val, 0, wxALL, 5);
|
||||
|
||||
btn_iot = new Button(this, _L("Test HTTP"));
|
||||
btn_iot->SetBackgroundColor(btn_bg);
|
||||
grid_sizer->Add(btn_iot, 0, wxEXPAND | wxALL, 5);
|
||||
|
||||
text_iot_title = new wxStaticText(this, wxID_ANY, _L("Test HTTP Service:"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
text_iot_title->Wrap(-1);
|
||||
grid_sizer->Add(text_iot_title, 0, wxALIGN_RIGHT | wxALL, 5);
|
||||
|
||||
text_iot_value = new wxStaticText(this, wxID_ANY, _L("N/A"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
text_iot_value->Wrap(-1);
|
||||
grid_sizer->Add(text_iot_value, 0, wxALL, 5);
|
||||
|
||||
btn_oss = new Button(this, _L("Test storage"));
|
||||
btn_oss->SetBackgroundColor(btn_bg);
|
||||
grid_sizer->Add(btn_oss, 0, wxEXPAND | wxALL, 5);
|
||||
|
||||
text_oss_title = new wxStaticText(this, wxID_ANY, _L("Test Storage Upload:"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
text_oss_title->Wrap(-1);
|
||||
grid_sizer->Add(text_oss_title, 0, wxALIGN_RIGHT | wxALL, 5);
|
||||
|
||||
text_oss_value = new wxStaticText(this, wxID_ANY, _L("N/A"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
text_oss_value->Wrap(-1);
|
||||
grid_sizer->Add(text_oss_value, 0, wxALL, 5);
|
||||
|
||||
btn_oss_upgrade = new Button(this, _L("Test storage upgrade"));
|
||||
btn_oss_upgrade->SetBackgroundColor(btn_bg);
|
||||
grid_sizer->Add(btn_oss_upgrade, 0, wxEXPAND | wxALL, 5);
|
||||
|
||||
text_oss_upgrade_title = new wxStaticText(this, wxID_ANY, _L("Test Storage Upgrade:"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
text_oss_upgrade_title->Wrap(-1);
|
||||
grid_sizer->Add(text_oss_upgrade_title, 0, wxALIGN_RIGHT | wxALL, 5);
|
||||
|
||||
text_oss_upgrade_value = new wxStaticText(this, wxID_ANY, _L("N/A"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
text_oss_upgrade_value->Wrap(-1);
|
||||
grid_sizer->Add(text_oss_upgrade_value, 0, wxALL, 5);
|
||||
|
||||
btn_oss_download = new Button(this, _L("Test storage download"));
|
||||
btn_oss_download->SetBackgroundColor(btn_bg);
|
||||
grid_sizer->Add(btn_oss_download, 0, wxEXPAND | wxALL, 5);
|
||||
|
||||
text_oss_download_title = new wxStaticText(this, wxID_ANY, _L("Test Storage Download:"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
text_oss_download_title->Wrap(-1);
|
||||
grid_sizer->Add(text_oss_download_title, 0, wxALIGN_RIGHT | wxALL, 5);
|
||||
|
||||
text_oss_download_value = new wxStaticText(this, wxID_ANY, _L("N/A"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
text_oss_download_value->Wrap(-1);
|
||||
grid_sizer->Add(text_oss_download_value, 0, wxALL, 5);
|
||||
|
||||
btn_network_plugin=new Button(this, _L("Test plugin download"));
|
||||
btn_network_plugin->SetBackgroundColor(btn_bg);
|
||||
grid_sizer->Add(btn_network_plugin, 0, wxEXPAND | wxALL, 5);
|
||||
|
||||
text_network_plugin_title=new wxStaticText(this, wxID_ANY, _L("Test Plugin Download:"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
text_network_plugin_title->Wrap(-1);
|
||||
grid_sizer->Add(text_network_plugin_title, 0, wxALIGN_RIGHT | wxALL, 5);
|
||||
|
||||
text_network_plugin_value=new wxStaticText(this, wxID_ANY, _L("N/A"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
text_network_plugin_value->Wrap(-1);
|
||||
grid_sizer->Add(text_network_plugin_value, 0, wxALL, 5);
|
||||
|
||||
|
||||
btn_oss_upload = new Button(this, _L("Test Storage Upload"));
|
||||
btn_oss_upload->SetBackgroundColor(btn_bg);
|
||||
grid_sizer->Add(btn_oss_upload, 0, wxEXPAND | wxALL, 5);
|
||||
|
||||
text_oss_upload_title = new wxStaticText(this, wxID_ANY, _L("Test Storage Upload:"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
text_oss_upload_title->Wrap(-1);
|
||||
grid_sizer->Add(text_oss_upload_title, 0, wxALIGN_RIGHT | wxALL, 5);
|
||||
|
||||
text_oss_upload_value = new wxStaticText(this, wxID_ANY, _L("N/A"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
text_oss_upload_value->Wrap(-1);
|
||||
grid_sizer->Add(text_oss_upload_value, 0, wxALL, 5);
|
||||
|
||||
btn_oss_upload->Hide();
|
||||
text_oss_upload_title->Hide();
|
||||
text_oss_upload_value->Hide();
|
||||
|
||||
sizer->Add(grid_sizer, 1, wxEXPAND, 5);
|
||||
|
||||
btn_link->Bind(wxEVT_BUTTON, [this](wxCommandEvent& evt) {
|
||||
start_test_bambulab_thread();
|
||||
start_test_github_thread();
|
||||
});
|
||||
|
||||
btn_bing->Bind(wxEVT_BUTTON, [this](wxCommandEvent& evt) {
|
||||
start_test_bing_thread();
|
||||
});
|
||||
|
||||
btn_iot->Bind(wxEVT_BUTTON, [this](wxCommandEvent& evt) {
|
||||
start_test_iot_thread();
|
||||
});
|
||||
|
||||
btn_oss->Bind(wxEVT_BUTTON, [this](wxCommandEvent& evt) {
|
||||
start_test_oss_thread();
|
||||
});
|
||||
|
||||
btn_oss_upgrade->Bind(wxEVT_BUTTON, [this](wxCommandEvent& evt) {
|
||||
start_test_oss_upgrade_thread();
|
||||
});
|
||||
|
||||
btn_oss_download->Bind(wxEVT_BUTTON, [this](wxCommandEvent& evt) {
|
||||
start_test_oss_download_thread();
|
||||
});
|
||||
|
||||
btn_network_plugin->Bind(wxEVT_BUTTON, [this](wxCommandEvent &evt) {
|
||||
start_test_plugin_download_thread();
|
||||
});
|
||||
|
||||
return sizer;
|
||||
}
|
||||
wxBoxSizer* NetworkTestDialog::create_result_sizer(wxWindow* parent)
|
||||
|
@ -293,23 +195,11 @@ NetworkTestDialog::~NetworkTestDialog()
|
|||
void NetworkTestDialog::init_bind()
|
||||
{
|
||||
Bind(EVT_UPDATE_RESULT, [this](wxCommandEvent& evt) {
|
||||
if (evt.GetInt() == TEST_BAMBULAB_JOB) {
|
||||
if (evt.GetInt() == TEST_ORCA_JOB) {
|
||||
text_link_val->SetLabelText(evt.GetString());
|
||||
} else if (evt.GetInt() == TEST_BING_JOB) {
|
||||
text_bing_val->SetLabelText(evt.GetString());
|
||||
} else if (evt.GetInt() == TEST_IOT_JOB) {
|
||||
text_iot_value->SetLabelText(evt.GetString());
|
||||
} else if (evt.GetInt() == TEST_OSS_JOB) {
|
||||
text_oss_value->SetLabelText(evt.GetString());
|
||||
} else if (evt.GetInt() == TEST_OSS_UPGRADE_JOB) {
|
||||
text_oss_upgrade_value->SetLabelText(evt.GetString());
|
||||
} else if (evt.GetInt() == TEST_OSS_DOWNLOAD_JOB) {
|
||||
text_oss_download_value->SetLabelText(evt.GetString());
|
||||
} else if (evt.GetInt() == TEST_OSS_UPLOAD_JOB) {
|
||||
text_oss_upload_value->SetLabelText(evt.GetString());
|
||||
} else if (evt.GetInt() == TEST_PLUGIN_JOB){
|
||||
text_network_plugin_value->SetLabelText(evt.GetString());
|
||||
}
|
||||
}
|
||||
|
||||
std::time_t t = std::time(0);
|
||||
std::tm* now_time = std::localtime(&t);
|
||||
|
@ -350,46 +240,35 @@ wxString NetworkTestDialog::get_dns_info()
|
|||
|
||||
void NetworkTestDialog::start_all_job()
|
||||
{
|
||||
start_test_bambulab_thread();
|
||||
start_test_github_thread();
|
||||
start_test_bing_thread();
|
||||
|
||||
start_test_iot_thread();
|
||||
start_test_oss_thread();
|
||||
start_test_oss_upgrade_thread();
|
||||
start_test_oss_download_thread();
|
||||
start_test_plugin_download_thread();
|
||||
start_test_ping_thread();
|
||||
}
|
||||
|
||||
void NetworkTestDialog::start_all_job_sequence()
|
||||
{
|
||||
m_sequence_job = new boost::thread([this] {
|
||||
update_status(-1, "start_test_sequence");
|
||||
start_test_bing();
|
||||
start_test_url(TEST_BING_JOB, "Bing", "http://www.bing.com");
|
||||
if (m_closing) return;
|
||||
start_test_url(TEST_ORCA_JOB, "OrcaSlicer(GitHub)", "https://github.com/SoftFever/OrcaSlicer");
|
||||
if (m_closing) return;
|
||||
start_test_bambulab();
|
||||
if (m_closing) return;
|
||||
start_test_oss();
|
||||
if (m_closing) return;
|
||||
start_test_oss_upgrade();
|
||||
if (m_closing) return;
|
||||
start_test_oss_download();
|
||||
if (m_closing) return;
|
||||
start_test_plugin_download();
|
||||
update_status(-1, "end_test_sequence");
|
||||
});
|
||||
}
|
||||
|
||||
void NetworkTestDialog::start_test_bing()
|
||||
void NetworkTestDialog::start_test_url(TestJob job, wxString name, wxString url)
|
||||
{
|
||||
m_in_testing[TEST_BING_JOB] = true;
|
||||
update_status(TEST_BING_JOB, "test bing start...");
|
||||
m_in_testing[job] = true;
|
||||
wxString info = wxString::Format("test %s start...", name);
|
||||
|
||||
std::string url = "http://www.bing.com/";
|
||||
Slic3r::Http http = Slic3r::Http::get(url);
|
||||
update_status(-1, "[test_bing]: url=" + url);
|
||||
update_status(job, info);
|
||||
|
||||
int result = -1;
|
||||
Slic3r::Http http = Slic3r::Http::get(url.ToStdString());
|
||||
info = wxString::Format("[test %s]: url=%s", name,url);
|
||||
|
||||
update_status(-1, info);
|
||||
|
||||
int result = -1;
|
||||
http.timeout_max(10)
|
||||
.on_complete([this, &result](std::string body, unsigned status) {
|
||||
try {
|
||||
|
@ -401,477 +280,19 @@ void NetworkTestDialog::start_test_bing()
|
|||
;
|
||||
}
|
||||
})
|
||||
.on_ip_resolve([this](std::string ip) {
|
||||
wxString ip_report = wxString::Format("test bing ip resolved = %s", ip);
|
||||
update_status(TEST_BING_JOB, ip_report);
|
||||
.on_ip_resolve([this,name,job](std::string ip) {
|
||||
wxString ip_report = wxString::Format("test %s ip resolved = %s", name, ip);
|
||||
update_status(job, ip_report);
|
||||
})
|
||||
.on_error([this](std::string body, std::string error, unsigned int status) {
|
||||
.on_error([this,name,job](std::string body, std::string error, unsigned int status) {
|
||||
wxString info = wxString::Format("status=%u, body=%s, error=%s", status, body, error);
|
||||
this->update_status(TEST_BING_JOB, "test bing failed");
|
||||
this->update_status(-1, info);
|
||||
this->update_status(job, wxString::Format("test %s failed", name));
|
||||
this->update_status(-1, info);
|
||||
}).perform_sync();
|
||||
if (result == 0) {
|
||||
update_status(TEST_BING_JOB, "test bing ok");
|
||||
}
|
||||
m_in_testing[TEST_BING_JOB] = false;
|
||||
}
|
||||
|
||||
void NetworkTestDialog::start_test_bambulab()
|
||||
{
|
||||
m_in_testing[TEST_BAMBULAB_JOB] = true;
|
||||
update_status(TEST_BAMBULAB_JOB, "test bambulab start...");
|
||||
|
||||
std::string platform = "windows";
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
platform = "windows";
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
platform = "macos";
|
||||
#endif
|
||||
#ifdef __LINUX__
|
||||
platform = "linux";
|
||||
#endif
|
||||
std::string query_params = (boost::format("?name=slicer&version=%1%&guide_version=%2%")
|
||||
% VersionInfo::convert_full_version(SLIC3R_VERSION)
|
||||
% VersionInfo::convert_full_version("0.0.0.1")
|
||||
).str();
|
||||
|
||||
AppConfig* app_config = wxGetApp().app_config;
|
||||
std::string url = wxGetApp().get_http_url(app_config->get_country_code()) + query_params;
|
||||
Slic3r::Http http = Slic3r::Http::get(url);
|
||||
update_status(-1, "[test_bambulab]: url=" + url);
|
||||
int result = -1;
|
||||
http.header("accept", "application/json")
|
||||
.timeout_max(10)
|
||||
.on_complete([this, &result](std::string body, unsigned status) {
|
||||
try {
|
||||
if (status == 200) {
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
;
|
||||
}
|
||||
})
|
||||
.on_ip_resolve([this](std::string ip) {
|
||||
wxString ip_report = wxString::Format("test bambulab ip resolved = %s", ip);
|
||||
update_status(TEST_BAMBULAB_JOB, ip_report);
|
||||
})
|
||||
.on_error([this](std::string body, std::string error, unsigned int status) {
|
||||
wxString info = wxString::Format("status=%u, body=%s, error=%s", status, body, error);
|
||||
this->update_status(TEST_BAMBULAB_JOB, "test bambulab failed");
|
||||
this->update_status(-1, info);
|
||||
}).perform_sync();
|
||||
if (result == 0) {
|
||||
update_status(TEST_BAMBULAB_JOB, "test bambulab ok");
|
||||
}
|
||||
m_in_testing[TEST_BAMBULAB_JOB] = false;
|
||||
}
|
||||
|
||||
void NetworkTestDialog::start_test_iot()
|
||||
{
|
||||
m_in_testing[TEST_IOT_JOB] = true;
|
||||
update_status(TEST_IOT_JOB, "test http start...");
|
||||
NetworkAgent* agent = wxGetApp().getAgent();
|
||||
if (agent) {
|
||||
unsigned int http_code;
|
||||
std::string http_body;
|
||||
if (!agent->is_user_login()) {
|
||||
update_status(TEST_IOT_JOB, "please login first");
|
||||
} else {
|
||||
int result = agent->get_user_print_info(&http_code, &http_body);
|
||||
if (result == 0) {
|
||||
update_status(TEST_IOT_JOB, "test http ok");
|
||||
} else {
|
||||
update_status(TEST_IOT_JOB, "test http failed");
|
||||
wxString info = wxString::Format("test http failed, status = %u, error = %s", http_code, http_body);
|
||||
update_status(-1, info);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
update_status(TEST_IOT_JOB, "please install network module first");
|
||||
}
|
||||
m_in_testing[TEST_IOT_JOB] = false;
|
||||
}
|
||||
|
||||
void NetworkTestDialog::start_test_oss()
|
||||
{
|
||||
m_in_testing[TEST_OSS_JOB] = true;
|
||||
update_status(TEST_OSS_JOB, "test storage start...");
|
||||
|
||||
std::string url = "http://upload-file.bambulab.com";
|
||||
|
||||
AppConfig* config = wxGetApp().app_config;
|
||||
if (config) {
|
||||
if (config->get_country_code() == "CN")
|
||||
url = "http://upload-file.bambulab.cn";
|
||||
}
|
||||
|
||||
Slic3r::Http http = Slic3r::Http::get(url);
|
||||
update_status(-1, "[test_oss]: url=" + url);
|
||||
|
||||
int result = -1;
|
||||
http.timeout_max(15)
|
||||
.on_complete([this, &result](std::string body, unsigned status) {
|
||||
try {
|
||||
if (status == 200) {
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
;
|
||||
}
|
||||
})
|
||||
.on_ip_resolve([this](std::string ip) {
|
||||
wxString ip_report = wxString::Format("test oss ip resolved = %s", ip);
|
||||
update_status(TEST_OSS_JOB, ip_report);
|
||||
})
|
||||
.on_error([this, &result](std::string body, std::string error, unsigned int status) {
|
||||
if (status == 403) {
|
||||
result = 0;
|
||||
} else {
|
||||
wxString info = wxString::Format("status=%u, body=%s, error=%s", status, body, error);
|
||||
this->update_status(TEST_OSS_JOB, "test storage failed");
|
||||
this->update_status(-1, info);
|
||||
}
|
||||
}).perform_sync();
|
||||
if (result == 0) {
|
||||
update_status(TEST_OSS_JOB, "test storage ok");
|
||||
}
|
||||
m_in_testing[TEST_OSS_JOB] = false;
|
||||
}
|
||||
|
||||
void NetworkTestDialog::start_test_oss_upgrade()
|
||||
{
|
||||
m_in_testing[TEST_OSS_UPGRADE_JOB] = true;
|
||||
update_status(TEST_OSS_UPGRADE_JOB, "test storage upgrade start...");
|
||||
|
||||
std::string url = "http://upgrade-file.bambulab.com";
|
||||
|
||||
AppConfig* config = wxGetApp().app_config;
|
||||
if (config) {
|
||||
if (config->get_country_code() == "CN")
|
||||
url = "http://upgrade-file.bambulab.cn";
|
||||
}
|
||||
|
||||
Slic3r::Http http = Slic3r::Http::get(url);
|
||||
update_status(-1, "[test_oss_upgrade]: url=" + url);
|
||||
|
||||
int result = -1;
|
||||
http.timeout_max(15)
|
||||
.on_complete([this, &result](std::string body, unsigned status) {
|
||||
try {
|
||||
if (status == 200) {
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
;
|
||||
}
|
||||
})
|
||||
.on_ip_resolve([this](std::string ip) {
|
||||
wxString ip_report = wxString::Format("test storage upgrade ip resolved = %s", ip);
|
||||
update_status(TEST_OSS_UPGRADE_JOB, ip_report);
|
||||
})
|
||||
.on_error([this, &result](std::string body, std::string error, unsigned int status) {
|
||||
if (status == 403) {
|
||||
result = 0;
|
||||
}
|
||||
else {
|
||||
wxString info = wxString::Format("status=%u, body=%s, error=%s", status, body, error);
|
||||
this->update_status(TEST_OSS_UPGRADE_JOB, "test storage upgrade failed");
|
||||
this->update_status(-1, info);
|
||||
}
|
||||
}).perform_sync();
|
||||
|
||||
if (result == 0) {
|
||||
update_status(TEST_OSS_UPGRADE_JOB, "test storage upgrade ok");
|
||||
}
|
||||
m_in_testing[TEST_OSS_UPGRADE_JOB] = false;
|
||||
}
|
||||
|
||||
void NetworkTestDialog::start_test_oss_download()
|
||||
{
|
||||
int result = 0;
|
||||
// get country_code
|
||||
AppConfig* app_config = wxGetApp().app_config;
|
||||
if (!app_config) {
|
||||
update_status(TEST_OSS_DOWNLOAD_JOB, "app config is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
m_in_testing[TEST_OSS_DOWNLOAD_JOB] = true;
|
||||
update_status(TEST_OSS_DOWNLOAD_JOB, "test storage download start...");
|
||||
m_download_cancel = false;
|
||||
// get temp path
|
||||
fs::path target_file_path = (fs::temp_directory_path() / "test_storage_download.zip");
|
||||
fs::path tmp_path = target_file_path;
|
||||
tmp_path += (boost::format(".%1%%2%") % get_current_pid() % ".tmp").str();
|
||||
|
||||
// get_url
|
||||
std::string url = wxGetApp().get_plugin_url("plugins", app_config->get_country_code());
|
||||
std::string download_url;
|
||||
Slic3r::Http http_url = Slic3r::Http::get(url);
|
||||
update_status(-1, "[test_oss_download]: url=" + url);
|
||||
|
||||
http_url.on_complete(
|
||||
[&download_url](std::string body, unsigned status) {
|
||||
try {
|
||||
json j = json::parse(body);
|
||||
std::string message = j["message"].get<std::string>();
|
||||
|
||||
if (message == "success") {
|
||||
json resource = j.at("resources");
|
||||
if (resource.is_array()) {
|
||||
for (auto iter = resource.begin(); iter != resource.end(); iter++) {
|
||||
Semver version;
|
||||
std::string url;
|
||||
std::string type;
|
||||
std::string vendor;
|
||||
std::string description;
|
||||
for (auto sub_iter = iter.value().begin(); sub_iter != iter.value().end(); sub_iter++) {
|
||||
if (boost::iequals(sub_iter.key(), "type")) {
|
||||
type = sub_iter.value();
|
||||
BOOST_LOG_TRIVIAL(info) << "[test_storage_download]: get version of settings's type, " << sub_iter.value();
|
||||
}
|
||||
else if (boost::iequals(sub_iter.key(), "version")) {
|
||||
version = *(Semver::parse(sub_iter.value()));
|
||||
}
|
||||
else if (boost::iequals(sub_iter.key(), "description")) {
|
||||
description = sub_iter.value();
|
||||
}
|
||||
else if (boost::iequals(sub_iter.key(), "url")) {
|
||||
url = sub_iter.value();
|
||||
}
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(info) << "[test_storage_download]: get type " << type << ", version " << version.to_string() << ", url " << url;
|
||||
download_url = url;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
BOOST_LOG_TRIVIAL(info) << "[test_storage_download]: get version of plugin failed, body=" << body;
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
BOOST_LOG_TRIVIAL(error) << "[test_storage_download]: catch unknown exception";
|
||||
;
|
||||
}
|
||||
}).on_error(
|
||||
[&result, this](std::string body, std::string error, unsigned int status) {
|
||||
BOOST_LOG_TRIVIAL(error) << "[test_storage_download] on_error: " << error << ", body = " << body;
|
||||
wxString info = wxString::Format("status=%u, body=%s, error=%s", status, body, error);
|
||||
this->update_status(TEST_OSS_DOWNLOAD_JOB, "test storage download failed");
|
||||
this->update_status(-1, info);
|
||||
result = -1;
|
||||
}).perform_sync();
|
||||
|
||||
if (result < 0) {
|
||||
this->update_status(TEST_OSS_DOWNLOAD_JOB, "test storage download failed");
|
||||
m_in_testing[TEST_OSS_DOWNLOAD_JOB] = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (download_url.empty()) {
|
||||
BOOST_LOG_TRIVIAL(info) << "[test_oss_download]: no availaible plugin found for this app version: " << SLIC3R_VERSION;
|
||||
this->update_status(TEST_OSS_DOWNLOAD_JOB, "test storage download failed");
|
||||
m_in_testing[TEST_OSS_DOWNLOAD_JOB] = false;
|
||||
return;
|
||||
}
|
||||
if (m_download_cancel) {
|
||||
this->update_status(TEST_OSS_DOWNLOAD_JOB, "test storage download canceled");
|
||||
m_in_testing[TEST_OSS_DOWNLOAD_JOB] = false;
|
||||
return;
|
||||
}
|
||||
|
||||
bool cancel = false;
|
||||
BOOST_LOG_TRIVIAL(info) << "[test_storage_download] get_url = " << download_url;
|
||||
|
||||
// download
|
||||
Slic3r::Http http = Slic3r::Http::get(download_url);
|
||||
int reported_percent = 0;
|
||||
http.on_progress(
|
||||
[this, &result, &reported_percent](Slic3r::Http::Progress progress, bool& cancel) {
|
||||
int percent = 0;
|
||||
if (progress.dltotal != 0) {
|
||||
percent = progress.dlnow * 100 / progress.dltotal;
|
||||
}
|
||||
if (percent - reported_percent >= 10) {
|
||||
reported_percent = percent;
|
||||
std::string download_progress_info = (boost::format("downloading %1%%%") % percent).str();
|
||||
this->update_status(TEST_OSS_DOWNLOAD_JOB, download_progress_info);
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "[test_storage_download] progress: " << reported_percent;
|
||||
cancel = m_download_cancel;
|
||||
|
||||
if (cancel)
|
||||
result = -1;
|
||||
})
|
||||
.on_complete([this, tmp_path, target_file_path](std::string body, unsigned status) {
|
||||
BOOST_LOG_TRIVIAL(info) << "[test_storage_download] completed";
|
||||
bool cancel = false;
|
||||
fs::fstream file(tmp_path, std::ios::out | std::ios::binary | std::ios::trunc);
|
||||
file.write(body.c_str(), body.size());
|
||||
file.close();
|
||||
fs::rename(tmp_path, target_file_path);
|
||||
//this->update_status(TEST_OSS_DOWNLOAD_JOB, "test storage download ok");
|
||||
})
|
||||
.on_error([this, &result](std::string body, std::string error, unsigned int status) {
|
||||
BOOST_LOG_TRIVIAL(error) << "[test_oss_download] downloading... on_error: " << error << ", body = " << body;
|
||||
wxString info = wxString::Format("status=%u, body=%s, error=%s", status, body, error);
|
||||
this->update_status(TEST_OSS_DOWNLOAD_JOB, "test storage download failed");
|
||||
this->update_status(-1, info);
|
||||
result = -1;
|
||||
});
|
||||
http.perform_sync();
|
||||
if (result < 0) {
|
||||
this->update_status(TEST_OSS_DOWNLOAD_JOB, "test storage download failed");
|
||||
} else {
|
||||
this->update_status(TEST_OSS_DOWNLOAD_JOB, "test storage download ok");
|
||||
}
|
||||
m_in_testing[TEST_OSS_DOWNLOAD_JOB] = false;
|
||||
return;
|
||||
}
|
||||
|
||||
void NetworkTestDialog::start_test_oss_upload()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void NetworkTestDialog:: start_test_plugin_download(){
|
||||
int result = 0;
|
||||
// get country_code
|
||||
AppConfig *app_config = wxGetApp().app_config;
|
||||
if (!app_config) {
|
||||
update_status(TEST_PLUGIN_JOB, "app config is nullptr");
|
||||
return;
|
||||
update_status(job, wxString::Format("test %s ok", name));
|
||||
}
|
||||
|
||||
m_in_testing[TEST_PLUGIN_JOB] = true;
|
||||
update_status(TEST_PLUGIN_JOB, "test plugin download start...");
|
||||
m_download_cancel = false;
|
||||
// get temp path
|
||||
fs::path target_file_path = (fs::temp_directory_path() / "test_plugin_download.zip");
|
||||
fs::path tmp_path = target_file_path;
|
||||
tmp_path += (boost::format(".%1%%2%") % get_current_pid() % ".tmp").str();
|
||||
|
||||
// get_url
|
||||
std::string url = wxGetApp().get_plugin_url("plugins", app_config->get_country_code());
|
||||
std::string download_url;
|
||||
Slic3r::Http http_url = Slic3r::Http::get(url);
|
||||
http_url
|
||||
.on_complete([&download_url,this](std::string body, unsigned status) {
|
||||
try {
|
||||
json j = json::parse(body);
|
||||
std::string message = j["message"].get<std::string>();
|
||||
|
||||
if (message == "success") {
|
||||
json resource = j.at("resources");
|
||||
if (resource.is_array()) {
|
||||
for (auto iter = resource.begin(); iter != resource.end(); iter++) {
|
||||
Semver version;
|
||||
std::string url;
|
||||
std::string type;
|
||||
std::string vendor;
|
||||
std::string description;
|
||||
for (auto sub_iter = iter.value().begin(); sub_iter != iter.value().end(); sub_iter++) {
|
||||
if (boost::iequals(sub_iter.key(), "type")) {
|
||||
type = sub_iter.value();
|
||||
BOOST_LOG_TRIVIAL(info) << "[test_plugin_download]: get version of settings's type, " << sub_iter.value();
|
||||
} else if (boost::iequals(sub_iter.key(), "version")) {
|
||||
version = *(Semver::parse(sub_iter.value()));
|
||||
} else if (boost::iequals(sub_iter.key(), "description")) {
|
||||
description = sub_iter.value();
|
||||
} else if (boost::iequals(sub_iter.key(), "url")) {
|
||||
url = sub_iter.value();
|
||||
}
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(info) << "[test_plugin_download]: get type " << type << ", version " << version.to_string() << ", url " << url;
|
||||
download_url = url;
|
||||
this->update_status(-1, "[test_plugin_download]: downloadurl=" + download_url);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(info) << "[test_plugin_download]: get version of plugin failed, body=" << body;
|
||||
}
|
||||
} catch (...) {
|
||||
BOOST_LOG_TRIVIAL(error) << "[test_plugin_download]: catch unknown exception";
|
||||
;
|
||||
}
|
||||
})
|
||||
.on_error([&result, this](std::string body, std::string error, unsigned int status) {
|
||||
BOOST_LOG_TRIVIAL(error) << "[test_plugin_download] on_error: " << error << ", body = " << body;
|
||||
wxString info = wxString::Format("status=%u, body=%s, error=%s", status, body, error);
|
||||
this->update_status(TEST_PLUGIN_JOB, "test plugin download failed");
|
||||
this->update_status(-1, info);
|
||||
result = -1;
|
||||
})
|
||||
.perform_sync();
|
||||
|
||||
|
||||
if (result < 0) {
|
||||
this->update_status(TEST_PLUGIN_JOB, "test plugin download failed");
|
||||
m_in_testing[TEST_PLUGIN_JOB] = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (download_url.empty()) {
|
||||
BOOST_LOG_TRIVIAL(info) << "[test_plugin_download]: no availaible plugin found for this app version: " << SLIC3R_VERSION;
|
||||
this->update_status(TEST_PLUGIN_JOB, "test plugin download failed");
|
||||
m_in_testing[TEST_PLUGIN_JOB] = false;
|
||||
return;
|
||||
}
|
||||
if (m_download_cancel) {
|
||||
this->update_status(TEST_PLUGIN_JOB, "test plugin download canceled");
|
||||
m_in_testing[TEST_PLUGIN_JOB] = false;
|
||||
return;
|
||||
}
|
||||
|
||||
bool cancel = false;
|
||||
BOOST_LOG_TRIVIAL(info) << "[test_plugin_download] get_url = " << download_url;
|
||||
|
||||
// download
|
||||
Slic3r::Http http = Slic3r::Http::get(download_url);
|
||||
int reported_percent = 0;
|
||||
http.on_progress([this, &result, &reported_percent](Slic3r::Http::Progress progress, bool &cancel) {
|
||||
int percent = 0;
|
||||
if (progress.dltotal != 0) { percent = progress.dlnow * 100 / progress.dltotal; }
|
||||
if (percent - reported_percent >= 5) {
|
||||
reported_percent = percent;
|
||||
std::string download_progress_info = (boost::format("downloading %1%%%") % percent).str();
|
||||
this->update_status(TEST_PLUGIN_JOB, download_progress_info);
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "[test_plugin_download] progress: " << reported_percent;
|
||||
cancel = m_download_cancel;
|
||||
|
||||
if (cancel) result = -1;
|
||||
})
|
||||
.on_complete([this, tmp_path, target_file_path](std::string body, unsigned status) {
|
||||
BOOST_LOG_TRIVIAL(info) << "[test_plugin_download] completed";
|
||||
bool cancel = false;
|
||||
fs::fstream file(tmp_path, std::ios::out | std::ios::binary | std::ios::trunc);
|
||||
file.write(body.c_str(), body.size());
|
||||
file.close();
|
||||
fs::rename(tmp_path, target_file_path);
|
||||
})
|
||||
.on_error([this, &result](std::string body, std::string error, unsigned int status) {
|
||||
BOOST_LOG_TRIVIAL(error) << "[test_plugin_download] downloading... on_error: " << error << ", body = " << body;
|
||||
wxString info = wxString::Format("status=%u, body=%s, error=%s", status, body, error);
|
||||
this->update_status(TEST_PLUGIN_JOB, "test plugin download failed");
|
||||
this->update_status(-1, info);
|
||||
result = -1;
|
||||
});
|
||||
http.perform_sync();
|
||||
if (result < 0) {
|
||||
this->update_status(TEST_PLUGIN_JOB, "test plugin download failed");
|
||||
} else {
|
||||
this->update_status(TEST_PLUGIN_JOB, "test plugin download ok");
|
||||
}
|
||||
m_in_testing[TEST_PLUGIN_JOB] = false;
|
||||
return;
|
||||
m_in_testing[job] = false;
|
||||
}
|
||||
|
||||
void NetworkTestDialog::start_test_ping_thread()
|
||||
|
@ -882,63 +303,19 @@ void NetworkTestDialog::start_test_ping_thread()
|
|||
m_in_testing[TEST_PING_JOB] = false;
|
||||
});
|
||||
}
|
||||
|
||||
void NetworkTestDialog::start_test_github_thread()
|
||||
{
|
||||
if (m_in_testing[TEST_ORCA_JOB])
|
||||
return;
|
||||
test_job[TEST_ORCA_JOB] = new boost::thread([this] {
|
||||
start_test_url(TEST_ORCA_JOB, "OrcaSlicer(GitHub)", "https://github.com/SoftFever/OrcaSlicer");
|
||||
});
|
||||
}
|
||||
void NetworkTestDialog::start_test_bing_thread()
|
||||
{
|
||||
test_job[TEST_BING_JOB] = new boost::thread([this] {
|
||||
start_test_bing();
|
||||
});
|
||||
}
|
||||
|
||||
void NetworkTestDialog::start_test_bambulab_thread()
|
||||
{
|
||||
if (m_in_testing[TEST_BAMBULAB_JOB]) return;
|
||||
test_job[TEST_BAMBULAB_JOB] = new boost::thread([this] {
|
||||
start_test_bambulab();
|
||||
});
|
||||
}
|
||||
|
||||
void NetworkTestDialog::start_test_iot_thread()
|
||||
{
|
||||
if (m_in_testing[TEST_IOT_JOB]) return;
|
||||
test_job[TEST_IOT_JOB] = new boost::thread([this] {
|
||||
start_test_iot();
|
||||
});
|
||||
}
|
||||
|
||||
void NetworkTestDialog::start_test_oss_thread()
|
||||
{
|
||||
test_job[TEST_OSS_JOB] = new boost::thread([this] {
|
||||
start_test_oss();
|
||||
});
|
||||
}
|
||||
|
||||
void NetworkTestDialog::start_test_oss_upgrade_thread()
|
||||
{
|
||||
test_job[TEST_OSS_UPGRADE_JOB] = new boost::thread([this] {
|
||||
start_test_oss_upgrade();
|
||||
});
|
||||
}
|
||||
|
||||
void NetworkTestDialog::start_test_oss_download_thread()
|
||||
{
|
||||
test_job[TEST_OSS_DOWNLOAD_JOB] = new boost::thread([this] {
|
||||
start_test_oss_download();
|
||||
});
|
||||
}
|
||||
|
||||
void NetworkTestDialog::start_test_oss_upload_thread()
|
||||
{
|
||||
test_job[TEST_OSS_UPLOAD_JOB] = new boost::thread([this] {
|
||||
start_test_oss_upload();
|
||||
});
|
||||
}
|
||||
|
||||
void NetworkTestDialog:: start_test_plugin_download_thread(){
|
||||
|
||||
test_job[TEST_PLUGIN_JOB] = new boost::thread([this] {
|
||||
start_test_plugin_download();
|
||||
});
|
||||
test_job[TEST_BING_JOB] = new boost::thread([this] {
|
||||
start_test_url(TEST_BING_JOB, "Bing", "http://www.bing.com");
|
||||
});
|
||||
}
|
||||
|
||||
void NetworkTestDialog::on_close(wxCloseEvent& event)
|
||||
|
@ -958,7 +335,7 @@ void NetworkTestDialog::on_close(wxCloseEvent& event)
|
|||
|
||||
wxString NetworkTestDialog::get_studio_version()
|
||||
{
|
||||
return wxString(SLIC3R_VERSION);
|
||||
return wxString(SoftFever_VERSION);
|
||||
}
|
||||
|
||||
void NetworkTestDialog::set_default()
|
||||
|
@ -975,13 +352,6 @@ void NetworkTestDialog::set_default()
|
|||
txt_dns_info_value->SetLabelText(get_dns_info());
|
||||
text_link_val->SetLabelText(NA_STR);
|
||||
text_bing_val->SetLabelText(NA_STR);
|
||||
text_iot_value->SetLabelText(NA_STR);
|
||||
text_oss_value->SetLabelText(NA_STR);
|
||||
text_oss_upgrade_value->SetLabelText(NA_STR);
|
||||
text_oss_download_value->SetLabelText(NA_STR);
|
||||
text_oss_upload_value->SetLabelText(NA_STR);
|
||||
text_network_plugin_value->SetLabelText(NA_STR);
|
||||
//text_ping_value->SetLabelText(NA_STR);
|
||||
m_download_cancel = false;
|
||||
m_closing = false;
|
||||
}
|
||||
|
|
|
@ -35,15 +35,9 @@ namespace GUI {
|
|||
|
||||
enum TestJob {
|
||||
TEST_BING_JOB = 0,
|
||||
TEST_BAMBULAB_JOB = 1,
|
||||
TEST_IOT_JOB = 2,
|
||||
TEST_OSS_JOB = 3,
|
||||
TEST_OSS_UPGRADE_JOB = 4,
|
||||
TEST_OSS_DOWNLOAD_JOB = 5,
|
||||
TEST_OSS_UPLOAD_JOB = 6,
|
||||
TEST_PING_JOB = 7,
|
||||
TEST_PLUGIN_JOB = 8,
|
||||
TEST_JOB_MAX = 9
|
||||
TEST_ORCA_JOB = 1,
|
||||
TEST_PING_JOB,
|
||||
TEST_JOB_MAX
|
||||
};
|
||||
|
||||
class NetworkTestDialog : public DPIDialog
|
||||
|
@ -65,24 +59,6 @@ protected:
|
|||
Button* btn_bing;
|
||||
wxStaticText* text_bing_title;
|
||||
wxStaticText* text_bing_val;
|
||||
Button* btn_iot;
|
||||
wxStaticText* text_iot_title;
|
||||
wxStaticText* text_iot_value;
|
||||
Button* btn_oss;
|
||||
wxStaticText* text_oss_title;
|
||||
wxStaticText* text_oss_value;
|
||||
Button* btn_oss_upgrade;
|
||||
wxStaticText* text_oss_upgrade_title;
|
||||
wxStaticText* text_oss_upgrade_value;
|
||||
Button* btn_oss_download;
|
||||
wxStaticText* text_oss_download_title;
|
||||
wxStaticText* text_oss_download_value;
|
||||
Button* btn_oss_upload;
|
||||
wxStaticText* text_oss_upload_title;
|
||||
wxStaticText* text_oss_upload_value;
|
||||
Button* btn_network_plugin;
|
||||
wxStaticText* text_network_plugin_title;
|
||||
wxStaticText* text_network_plugin_value;
|
||||
wxStaticText* text_ping_title;
|
||||
wxStaticText* text_ping_value;
|
||||
wxStaticText* text_result;
|
||||
|
@ -116,23 +92,10 @@ public:
|
|||
void start_all_job();
|
||||
void start_all_job_sequence();
|
||||
void start_test_bing_thread();
|
||||
void start_test_bambulab_thread();
|
||||
void start_test_iot_thread();
|
||||
void start_test_oss_thread();
|
||||
void start_test_oss_upgrade_thread();
|
||||
void start_test_oss_download_thread();
|
||||
void start_test_oss_upload_thread();
|
||||
void start_test_github_thread();
|
||||
void start_test_ping_thread();
|
||||
void start_test_plugin_download_thread();
|
||||
|
||||
void start_test_bing();
|
||||
void start_test_bambulab();
|
||||
void start_test_iot();
|
||||
void start_test_oss();
|
||||
void start_test_oss_upgrade();
|
||||
void start_test_oss_download();
|
||||
void start_test_oss_upload();
|
||||
void start_test_plugin_download();
|
||||
void start_test_url(TestJob job, wxString name, wxString url);
|
||||
|
||||
void on_close(wxCloseEvent& event);
|
||||
|
||||
|
|
|
@ -6835,6 +6835,26 @@ void Plater::priv::on_tab_selection_changing(wxBookCtrlEvent& e)
|
|||
const int new_sel = e.GetSelection();
|
||||
sidebar_layout.show = new_sel == MainFrame::tp3DEditor || new_sel == MainFrame::tpPreview;
|
||||
update_sidebar();
|
||||
int old_sel = e.GetOldSelection();
|
||||
if (wxGetApp().preset_bundle && wxGetApp().preset_bundle->is_bbl_vendor() && new_sel == MainFrame::tpMonitor) {
|
||||
if (!wxGetApp().getAgent()) {
|
||||
e.Veto();
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("skipped tab switch from %1% to %2%, lack of network plugins") % old_sel % new_sel;
|
||||
if (q) {
|
||||
wxCommandEvent* evt = new wxCommandEvent(EVT_INSTALL_PLUGIN_HINT);
|
||||
wxQueueEvent(q, evt);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (new_sel == MainFrame::tpMonitor && wxGetApp().preset_bundle != nullptr) {
|
||||
auto cfg = wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
wxString url = cfg.opt_string("print_host_webui").empty() ? cfg.opt_string("print_host") : cfg.opt_string("print_host_webui");
|
||||
if (url.empty()) {
|
||||
// It's missing_connection page, reload so that we can replay the gif image
|
||||
main_frame->m_printer_view->reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int Plater::priv::update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name, std::string file_path)
|
||||
|
|
|
@ -629,7 +629,7 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxWindow *pa
|
|||
m_sizer_checkbox->Add(0, 0, 0, wxEXPAND | wxLEFT, 23);
|
||||
|
||||
auto checkbox = new ::CheckBox(parent);
|
||||
checkbox->SetValue((app_config->get(param) == "true") ? true : false);
|
||||
checkbox->SetValue(app_config->get_bool(param));
|
||||
|
||||
m_sizer_checkbox->Add(checkbox, 0, wxALIGN_CENTER, 0);
|
||||
m_sizer_checkbox->Add(0, 0, 0, wxEXPAND | wxLEFT, 8);
|
||||
|
@ -701,10 +701,16 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxWindow *pa
|
|||
}
|
||||
}
|
||||
|
||||
#endif // __WXMSW__
|
||||
if (param == "installed_networking") {
|
||||
bool pbool = app_config->get_bool("installed_networking");
|
||||
if (pbool) {
|
||||
GUI::wxGetApp().CallAfter([] { GUI::wxGetApp().ShowDownNetPluginDlg(); });
|
||||
}
|
||||
}
|
||||
|
||||
if (param == "developer_mode")
|
||||
{
|
||||
#endif // __WXMSW__
|
||||
|
||||
if (param == "developer_mode") {
|
||||
m_developer_mode_def = app_config->get("developer_mode");
|
||||
if (m_developer_mode_def == "true") {
|
||||
Slic3r::GUI::wxGetApp().save_mode(comDevelop);
|
||||
|
@ -1004,6 +1010,7 @@ wxWindow* PreferencesDialog::create_general_page()
|
|||
auto item_region= create_item_region_combobox(_L("Login Region"), page, _L("Login Region"), Regions);
|
||||
|
||||
auto item_stealth_mode = create_item_checkbox(_L("Stealth Mode"), page, _L("Stealth Mode"), 50, "stealth_mode");
|
||||
auto item_enable_plugin = create_item_checkbox(_L("Enable network plugin"), page, _L("Enable network plugin"), 50, "installed_networking");
|
||||
auto item_check_stable_version_only = create_item_checkbox(_L("Check for stable updates only"), page, _L("Check for stable updates only"), 50, "check_stable_update_only");
|
||||
|
||||
std::vector<wxString> Units = {_L("Metric") + " (mm, g)", _L("Imperial") + " (in, oz)"};
|
||||
|
@ -1020,6 +1027,7 @@ wxWindow* PreferencesDialog::create_general_page()
|
|||
|
||||
auto item_calc_mode = create_item_checkbox(_L("Flushing volumes: Auto-calculate everytime the color changed."), page, _L("If enabled, auto-calculate everytime the color changed."), 50, "auto_calculate");
|
||||
auto title_presets = create_item_title(_L("Presets"), page, _L("Presets"));
|
||||
auto title_network = create_item_title(_L("Network"), page, _L("Network"));
|
||||
auto item_user_sync = create_item_checkbox(_L("Auto sync user presets(Printer/Filament/Process)"), page, _L("User Sync"), 50, "sync_user_preset");
|
||||
auto item_system_sync = create_item_checkbox(_L("Update built-in Presets automatically."), page, _L("System Sync"), 50, "sync_system_preset");
|
||||
auto item_save_presets = create_item_button(_L("Clear my choice on the unsaved presets."), _L("Clear"), page, _L("Clear my choice on the unsaved presets."), []() {
|
||||
|
@ -1080,12 +1088,14 @@ wxWindow* PreferencesDialog::create_general_page()
|
|||
sizer_page->Add(item_show_splash_screen, 0, wxTOP, FromDIP(3));
|
||||
sizer_page->Add(item_hints, 0, wxTOP, FromDIP(3));
|
||||
sizer_page->Add(title_presets, 0, wxTOP | wxEXPAND, FromDIP(20));
|
||||
sizer_page->Add(item_stealth_mode, 0, wxTOP, FromDIP(3));
|
||||
sizer_page->Add(item_check_stable_version_only, 0, wxTOP, FromDIP(3));
|
||||
sizer_page->Add(item_calc_mode, 0, wxTOP, FromDIP(3));
|
||||
sizer_page->Add(item_user_sync, 0, wxTOP, FromDIP(3));
|
||||
sizer_page->Add(item_system_sync, 0, wxTOP, FromDIP(3));
|
||||
sizer_page->Add(item_save_presets, 0, wxTOP, FromDIP(3));
|
||||
sizer_page->Add(title_network, 0, wxTOP | wxEXPAND, FromDIP(20));
|
||||
sizer_page->Add(item_check_stable_version_only, 0, wxTOP, FromDIP(3));
|
||||
sizer_page->Add(item_stealth_mode, 0, wxTOP, FromDIP(3));
|
||||
sizer_page->Add(item_enable_plugin, 0, wxTOP, FromDIP(3));
|
||||
#ifdef _WIN32
|
||||
sizer_page->Add(title_associate_file, 0, wxTOP| wxEXPAND, FromDIP(20));
|
||||
sizer_page->Add(item_associate_3mf, 0, wxTOP, FromDIP(3));
|
||||
|
|
|
@ -80,6 +80,11 @@ void PrinterWebView::load_url(wxString& url, wxString apikey)
|
|||
//m_browser->SetFocus();
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
void PrinterWebView::reload()
|
||||
{
|
||||
m_browser->Reload();
|
||||
}
|
||||
/**
|
||||
* Method that retrieves the current state from the web control and updates the
|
||||
* GUI the reflect this current state.
|
||||
|
|
|
@ -41,6 +41,7 @@ public:
|
|||
void OnClose(wxCloseEvent& evt);
|
||||
void OnError(wxWebViewEvent& evt);
|
||||
void OnLoaded(wxWebViewEvent& evt);
|
||||
void reload();
|
||||
private:
|
||||
void SendAPIKey();
|
||||
|
||||
|
|
|
@ -421,6 +421,11 @@ void WebViewPanel::OnFreshLoginStatus(wxTimerEvent &event)
|
|||
Slic3r::GUI::wxGetApp().get_login_info();
|
||||
}
|
||||
|
||||
void WebViewPanel::SetLoginPanelVisibility(bool bshow)
|
||||
{
|
||||
wxString strJS = wxString::Format("SetLoginPanelVisibility(%s)", bshow ? "true" : "false");
|
||||
RunScript(strJS);
|
||||
}
|
||||
void WebViewPanel::SendRecentList(int images)
|
||||
{
|
||||
boost::property_tree::wptree req;
|
||||
|
|
|
@ -94,6 +94,7 @@ public:
|
|||
|
||||
public:
|
||||
void SendRecentList(int images);
|
||||
void SetLoginPanelVisibility(bool bshow);
|
||||
void SendDesignStaffpick(bool on);
|
||||
void OpenModelDetail(std::string id, NetworkAgent *agent);
|
||||
void SendLoginInfo();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue