mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-20 07:22:35 +00:00
Merge pull request #133 from Snapmaker/dev_upgrade_alves
Dev upgrade alves
This commit is contained in:
@@ -15297,6 +15297,15 @@ msgstr "OrcaSlicer 基于来自 Bambu Lab 的 Bambu Studio 开发而来。"
|
||||
msgid "Printing by object with caution. This function may cause the print head to collide with printed parts during switching."
|
||||
msgstr "谨慎使用逐件打印,该功能可能会导致打印头切换时与打印件碰撞"
|
||||
|
||||
msgid "Check for Process Preset Updates"
|
||||
msgstr "检查工艺预设新版本"
|
||||
|
||||
msgid "Check for Web Resource Updates"
|
||||
msgstr "检查Web资源新版本"
|
||||
|
||||
msgid "Export Logs"
|
||||
msgstr "日志导出"
|
||||
|
||||
#~ msgid "Improve shell precision by adjusting outer wall spacing. This also improves layer consistency."
|
||||
#~ msgstr "优化外墙刀路以提高外墙精度。这个优化同时减少层纹"
|
||||
|
||||
|
||||
@@ -30,7 +30,9 @@
|
||||
#include <cstdlib>
|
||||
#include <atomic>
|
||||
#include <random>
|
||||
#include <mutex>
|
||||
#include "common_func/common_func.hpp"
|
||||
#include <iostream>
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
@@ -63,67 +65,6 @@ static sentry_value_t on_crash_callback(const sentry_ucontext_t* uctx, sentry_va
|
||||
return log;
|
||||
}
|
||||
|
||||
static sentry_value_t before_send(sentry_value_t event, void* hint, void* data)
|
||||
{
|
||||
sentry_value_t level_val = sentry_value_get_by_key(event, SENTRY_KEY_LEVEL);
|
||||
std::string levelName = sentry_value_as_string(level_val);
|
||||
|
||||
std::string eventLevel = sentry_value_as_string(sentry_value_get_by_key(event, SENTRY_KEY_LEVEL));
|
||||
|
||||
//module name
|
||||
sentry_value_t moduleValue = sentry_value_get_by_key(event, "logger");
|
||||
std::string moduleName = sentry_value_as_string(moduleValue);
|
||||
|
||||
if (MACHINE_MODULE == moduleName)
|
||||
{
|
||||
srand((unsigned int) time(0));
|
||||
int random_num = rand() % 100;
|
||||
int randNumber = rand() % 100 + 1;
|
||||
if (randNumber < 85)
|
||||
{
|
||||
sentry_value_decref(event);
|
||||
return sentry_value_new_null();
|
||||
}
|
||||
else
|
||||
{
|
||||
return event;
|
||||
}
|
||||
}
|
||||
|
||||
if (!get_privacy_policy() && levelName == SENTRY_EVENT_TRACE) {
|
||||
|
||||
sentry_value_decref(event);
|
||||
return sentry_value_new_null();
|
||||
}
|
||||
|
||||
if (SENTRY_EVENT_FATAL == eventLevel ||
|
||||
SENTRY_EVENT_ERROR == eventLevel ||
|
||||
SENTRY_EVENT_TRACE == eventLevel)
|
||||
{
|
||||
return event;
|
||||
}
|
||||
else if (SENTRY_EVENT_WARNING == eventLevel)
|
||||
{
|
||||
srand((unsigned int) time(0));
|
||||
int random_num = rand() % 100;
|
||||
int randNumber = rand() % 100 + 1;
|
||||
if (randNumber > 5)
|
||||
{
|
||||
sentry_value_decref(event);
|
||||
return sentry_value_new_null();
|
||||
}
|
||||
else
|
||||
{
|
||||
return event;
|
||||
}
|
||||
}
|
||||
|
||||
//info trace debug not report
|
||||
sentry_value_decref(event);
|
||||
return sentry_value_new_null();
|
||||
|
||||
}
|
||||
|
||||
void initSentryEx()
|
||||
{
|
||||
sentry_options_t* options = sentry_options_new();
|
||||
@@ -154,43 +95,134 @@ void initSentryEx()
|
||||
dataBaseDir = home_env;
|
||||
dataBaseDir = dataBaseDir + "/Library/Application Support/Snapmaker_Orca/SentryData";
|
||||
#elif _WIN32
|
||||
wchar_t exeDir[MAX_PATH];
|
||||
::GetModuleFileNameW(nullptr, exeDir, MAX_PATH);
|
||||
std::wstring wsExeDir(exeDir);
|
||||
int nPos = wsExeDir.find_last_of('\\');
|
||||
std::wstring wsDmpDir = wsExeDir.substr(0, nPos + 1);
|
||||
std::wstring desDir = wsDmpDir + L"crashpad_handler.exe";
|
||||
wsDmpDir += L"dump";
|
||||
// Use extended path length support for Windows (up to 32767 characters)
|
||||
const DWORD MAX_PATH_EXTENDED = 32767;
|
||||
wchar_t exeDir[MAX_PATH_EXTENDED];
|
||||
DWORD pathLen = ::GetModuleFileNameW(nullptr, exeDir, MAX_PATH_EXTENDED);
|
||||
|
||||
// GetModuleFileNameW returns 0 on error, or the number of characters written (excluding null terminator)
|
||||
// If return value equals buffer size, the path was truncated
|
||||
if (pathLen == 0) {
|
||||
// Failed to get module path, use fallback
|
||||
DWORD lastError = GetLastError();
|
||||
std::cout<< "Failed to get module file name, error: " << lastError;
|
||||
handlerDir = "";
|
||||
dataBaseDir = "";
|
||||
} else if (pathLen >= MAX_PATH_EXTENDED) {
|
||||
// Path was truncated, which shouldn't happen with MAX_PATH_EXTENDED
|
||||
std::cout<< "Module file path too long or truncated, length: " << pathLen;
|
||||
handlerDir = "";
|
||||
dataBaseDir = "";
|
||||
} else {
|
||||
// Ensure null termination (GetModuleFileNameW should do this, but be safe)
|
||||
exeDir[pathLen] = L'\0';
|
||||
|
||||
std::wstring wsExeDir(exeDir, pathLen);
|
||||
size_t nPos = wsExeDir.find_last_of(L'\\');
|
||||
|
||||
if (nPos == std::wstring::npos) {
|
||||
// No backslash found, use current directory as fallback
|
||||
std::cout<< "No backslash found in executable path, using current directory";
|
||||
nPos = 0;
|
||||
}
|
||||
|
||||
// Ensure nPos + 1 doesn't exceed string length
|
||||
if (nPos + 1 > wsExeDir.length()) {
|
||||
std::cout<< "Invalid path position, using full path";
|
||||
nPos = wsExeDir.length();
|
||||
}
|
||||
|
||||
std::wstring wsDmpDir = wsExeDir.substr(0, nPos + 1);
|
||||
std::wstring desDir = wsDmpDir + L"crashpad_handler.exe";
|
||||
wsDmpDir += L"dump";
|
||||
|
||||
auto wstringTostring = [](std::wstring wTmpStr) -> std::string {
|
||||
std::string resStr = std::string();
|
||||
int len = WideCharToMultiByte(CP_UTF8, 0, wTmpStr.c_str(), -1, nullptr, 0, nullptr, nullptr);
|
||||
if (len <= 0)
|
||||
return std::string();
|
||||
auto wstringTostring = [](const std::wstring& wTmpStr) -> std::string {
|
||||
if (wTmpStr.empty())
|
||||
return std::string();
|
||||
|
||||
int len = WideCharToMultiByte(CP_UTF8, 0, wTmpStr.c_str(), -1, nullptr, 0, nullptr, nullptr);
|
||||
if (len <= 0) {
|
||||
std::cout<< "WideCharToMultiByte failed, error: " << GetLastError();
|
||||
return std::string();
|
||||
}
|
||||
|
||||
std::string desStr(len, 0);
|
||||
WideCharToMultiByte(CP_UTF8, 0, wTmpStr.c_str(), -1, &desStr[0], len, nullptr, nullptr);
|
||||
resStr = desStr;
|
||||
// Allocate buffer with size len (includes null terminator)
|
||||
std::string desStr;
|
||||
desStr.resize(len - 1); // Reserve space excluding null terminator
|
||||
int result = WideCharToMultiByte(CP_UTF8, 0, wTmpStr.c_str(), -1, &desStr[0], len, nullptr, nullptr);
|
||||
if (result == 0 || result != len) {
|
||||
std::cout<< "WideCharToMultiByte conversion failed, error: " << GetLastError();
|
||||
return std::string();
|
||||
}
|
||||
|
||||
// Remove null terminator if present (safely check before accessing)
|
||||
if (!desStr.empty() && desStr.back() == '\0')
|
||||
desStr.pop_back();
|
||||
|
||||
return resStr;
|
||||
};
|
||||
return desStr;
|
||||
};
|
||||
|
||||
handlerDir = wstringTostring(desDir);
|
||||
handlerDir = wstringTostring(desDir);
|
||||
}
|
||||
|
||||
// Get LocalAppData folder path
|
||||
PWSTR pszPath = nullptr;
|
||||
char* path = new char[MAX_PATH]();
|
||||
char* path = nullptr;
|
||||
size_t pathLength = 0;
|
||||
HRESULT hr = SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, nullptr, &pszPath);
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
wcstombs_s(&pathLength, path, MAX_PATH, pszPath, MAX_PATH);
|
||||
if (SUCCEEDED(hr) && pszPath != nullptr) {
|
||||
// Calculate required buffer size first
|
||||
size_t wcsLen = wcslen(pszPath);
|
||||
if (wcsLen > 0 && wcsLen < SIZE_MAX / 3) { // Check for overflow
|
||||
// Allocate buffer with extra space for safety
|
||||
size_t requiredSize = wcsLen * 3 + 1; // UTF-8 can be up to 3 bytes per wchar
|
||||
path = new (std::nothrow) char[requiredSize]();
|
||||
|
||||
if (path != nullptr) {
|
||||
errno_t err = wcstombs_s(&pathLength, path, requiredSize, pszPath, _TRUNCATE);
|
||||
if (err != 0) {
|
||||
std::cout<< "wcstombs_s failed, error: " << err;
|
||||
delete[] path;
|
||||
path = nullptr;
|
||||
}
|
||||
} else {
|
||||
std::cout<< "Failed to allocate memory for path conversion";
|
||||
}
|
||||
} else if (wcsLen == 0) {
|
||||
std::cout<< "SHGetKnownFolderPath returned empty path";
|
||||
} else {
|
||||
std::cout<< "Path length overflow detected: " << wcsLen;
|
||||
}
|
||||
// Always free the path returned by SHGetKnownFolderPath
|
||||
CoTaskMemFree(pszPath);
|
||||
}
|
||||
pszPath = nullptr;
|
||||
} else {
|
||||
std::cout<< "SHGetKnownFolderPath failed, hr: " << std::hex << hr;
|
||||
// Ensure pszPath is freed even on failure (though it should be nullptr)
|
||||
if (pszPath != nullptr) {
|
||||
CoTaskMemFree(pszPath);
|
||||
pszPath = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
std::string filePath = path;
|
||||
std::string appName = "\\" + std::string("Snapmaker_Orca\\");
|
||||
dataBaseDir = filePath + appName;
|
||||
delete[] path;
|
||||
if (path != nullptr) {
|
||||
std::string filePath = path;
|
||||
std::string appName = "\\" + std::string("Snapmaker_Orca\\");
|
||||
dataBaseDir = filePath + appName;
|
||||
delete[] path;
|
||||
path = nullptr;
|
||||
} else {
|
||||
// Fallback: use temp directory
|
||||
char tempPath[MAX_PATH];
|
||||
if (GetTempPathA(MAX_PATH, tempPath) != 0) {
|
||||
dataBaseDir = std::string(tempPath) + "Snapmaker_Orca\\";
|
||||
std::cout<< "Using temp directory as fallback for Sentry data: " << dataBaseDir;
|
||||
} else {
|
||||
dataBaseDir = "";
|
||||
std::cout<< "Failed to get temp path, Sentry data directory will be empty";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!handlerDir.empty())
|
||||
@@ -211,7 +243,6 @@ void initSentryEx()
|
||||
sentry_options_set_auto_session_tracking(options, 0);
|
||||
sentry_options_set_symbolize_stacktraces(options, 1);
|
||||
sentry_options_set_on_crash(options, on_crash_callback, NULL);
|
||||
sentry_options_set_before_send(options, before_send, NULL);
|
||||
|
||||
sentry_options_set_sample_rate(options, 1.0);
|
||||
sentry_options_set_traces_sample_rate(options, 1.0);
|
||||
|
||||
@@ -846,7 +846,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
|
||||
apply(config, &new_conf);
|
||||
}
|
||||
toggle_line("overhang_reverse_threshold", has_detect_overhang_wall && allow_overhang_reverse && has_overhang_reverse && !has_overhang_reverse_internal_only);
|
||||
toggle_line("timelapse_type", true);
|
||||
toggle_line("timelapse_type", is_BBL_Printer);
|
||||
|
||||
|
||||
bool have_small_area_infill_flow_compensation = config->opt_bool("small_area_infill_flow_compensation");
|
||||
|
||||
+26
-37
@@ -2516,24 +2516,16 @@ bool GUI_App::on_init_inner()
|
||||
skip_this_version = false;
|
||||
}
|
||||
}
|
||||
if (!skip_this_version
|
||||
|| evt.GetInt() != 0) {
|
||||
UpdateVersionDialog dialog(this->mainframe);
|
||||
if (!skip_this_version || evt.GetInt() != 0) {
|
||||
wxString extmsg = wxString::FromUTF8(version_info.description);
|
||||
dialog.update_version_info(extmsg, version_info.version_str);
|
||||
m_updateDialog->update_version_info(extmsg, version_info.version_str);
|
||||
if (evt.GetInt() != 0) {
|
||||
dialog.m_button_skip_version->Hide();
|
||||
}
|
||||
switch (dialog.ShowModal())
|
||||
{
|
||||
case wxID_YES:
|
||||
wxLaunchDefaultBrowser(version_info.url);
|
||||
break;
|
||||
case wxID_NO:
|
||||
break;
|
||||
default:
|
||||
;
|
||||
m_updateDialog->m_button_skip_version->Hide();
|
||||
}
|
||||
m_updateDialog->Raise();
|
||||
m_updateDialog->Show();
|
||||
m_updateDialog->setUrl(version_info.url);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -2669,6 +2661,13 @@ bool GUI_App::on_init_inner()
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "create the main window";
|
||||
mainframe = new MainFrame();
|
||||
m_updateDialog = new UpdateVersionDialog(mainframe);
|
||||
m_updateDialog->Hide();
|
||||
m_updateDialog->Bind(EVT_DOWN_URL_PACK, [this](wxCommandEvent& event) {
|
||||
auto downloadUlr = m_updateDialog->getUrl();
|
||||
wxLaunchDefaultBrowser(downloadUlr);
|
||||
});
|
||||
|
||||
// hide settings tabs after first Layout
|
||||
if (is_editor()) {
|
||||
mainframe->select_tab(size_t(0));
|
||||
@@ -4045,18 +4044,14 @@ wxString GUI_App::get_international_url(const wxString& origin_url) {
|
||||
|
||||
string dark_mode = wxGetApp().app_config->get("dark_color_mode");
|
||||
|
||||
auto isAgree = wxGetApp().app_config->get("app", "privacy_policy_isagree");
|
||||
std::string useAgree = (isAgree == "true" ? "1" : "0");
|
||||
|
||||
if (baseUrl.find("?") != std::string::npos) {
|
||||
return baseUrl + wxString::FromUTF8("&locale=") + lang + wxString::FromUTF8("-") + region +
|
||||
wxString::FromUTF8("&dark_mode=" + dark_mode) + wxString::FromUTF8("&privacy_policy_isagree=" + useAgree);
|
||||
wxString::FromUTF8("&dark_mode=" + dark_mode);
|
||||
} else {
|
||||
return baseUrl + wxString::FromUTF8("?locale=") + lang + wxString::FromUTF8("-") + region +
|
||||
wxString::FromUTF8("&dark_mode=" + dark_mode) + wxString::FromUTF8("&privacy_policy_isagree=" + useAgree);
|
||||
wxString::FromUTF8("&dark_mode=" + dark_mode);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
bool GUI_App::is_user_login()
|
||||
@@ -4857,12 +4852,12 @@ void GUI_App::check_new_version_sf(bool show_tips, bool by_user)
|
||||
|
||||
Semver server_version = get_version(version_info.version_str, matcher);
|
||||
|
||||
if (current_version >= server_version && by_user) {
|
||||
this->no_new_version();
|
||||
if (current_version >= server_version) {
|
||||
if(by_user)
|
||||
this->no_new_version();
|
||||
return;
|
||||
}
|
||||
|
||||
//if (true)
|
||||
if (isForceUpgrade)
|
||||
{
|
||||
wxGetApp().app_config->set_bool("force_upgrade", version_info.force_upgrade);
|
||||
@@ -4879,7 +4874,10 @@ void GUI_App::check_new_version_sf(bool show_tips, bool by_user)
|
||||
if (by_user)
|
||||
evt->SetInt(UPDATE_BY_USER);
|
||||
GUI::wxGetApp().QueueEvent(evt);
|
||||
} catch (...) {}
|
||||
} catch (const std::exception& ex) {
|
||||
std::string errorMsg = ex.what();
|
||||
BOOST_LOG_TRIVIAL(fatal) << "request server soft update data error:" << errorMsg;
|
||||
}
|
||||
})
|
||||
.perform_sync();
|
||||
}
|
||||
@@ -6690,15 +6688,6 @@ bool GUI_App::run_wizard(ConfigWizard::RunReason reason, ConfigWizard::StartPage
|
||||
{
|
||||
wxCHECK_MSG(mainframe != nullptr, false, "Internal error: Main frame not created / null");
|
||||
|
||||
//if (reason == ConfigWizard::RR_USER) {
|
||||
// //TODO: turn off it currently, maybe need to turn on in the future
|
||||
// if (preset_updater->config_update(app_config->orig_version(), PresetUpdater::UpdateParams::FORCED_BEFORE_WIZARD) == PresetUpdater::R_ALL_CANCELED)
|
||||
// return false;
|
||||
//}
|
||||
|
||||
//auto wizard_t = new ConfigWizard(mainframe);
|
||||
//const bool res = wizard_t->run(reason, start_page);
|
||||
|
||||
std::string strFinish = wxGetApp().app_config->get("firstguide", "finish");
|
||||
long pStyle = wxCAPTION | wxCLOSE_BOX | wxSYSTEM_MENU;
|
||||
if (strFinish == "false" || strFinish.empty())
|
||||
@@ -6719,7 +6708,7 @@ bool GUI_App::run_wizard(ConfigWizard::RunReason reason, ConfigWizard::StartPage
|
||||
mainframe->refresh_plugin_tips();
|
||||
// BBS: remove SLA related message
|
||||
}
|
||||
auto isAgree = wxGetApp().app_config->get("app", "privacy_policy_isagree");
|
||||
auto isAgree = wxGetApp().app_config->get("app", PRIVACY_POLICY_FLAGS);
|
||||
|
||||
user_update_privacy_notify(isAgree == "true");
|
||||
BOOST_LOG_TRIVIAL(warning) << "run_wizard changed the privacy policy with: " << (isAgree);
|
||||
@@ -6932,7 +6921,7 @@ void GUI_App::user_update_privacy_notify(const bool& res)
|
||||
|
||||
json data;
|
||||
|
||||
data["privacy_policy_isagree"] = res;
|
||||
data[PRIVACY_POLICY_FLAGS] = res;
|
||||
|
||||
for (const auto& instance : m_user_update_privacy_subscribers) {
|
||||
auto ptr = instance.second.lock();
|
||||
@@ -6957,7 +6946,7 @@ void GUI_App::user_login_notify(const json& res)
|
||||
|
||||
bool GUI_App::config_wizard_startup()
|
||||
{
|
||||
auto isAgree = wxGetApp().app_config->get("app", "privacy_policy_isagree");
|
||||
auto isAgree = wxGetApp().app_config->get("app", PRIVACY_POLICY_FLAGS);
|
||||
user_update_privacy_notify(isAgree == "true");
|
||||
BOOST_LOG_TRIVIAL(warning) << "config_wizard_startup changed the privacy policy with: " << (isAgree);
|
||||
if (!m_app_conf_exists || preset_bundle->printers.only_default_printers()) {
|
||||
|
||||
@@ -46,6 +46,8 @@
|
||||
#define _MSW_DARK_MODE 1
|
||||
#endif // _MSW_DARK_MODE
|
||||
|
||||
#define PRIVACY_POLICY_FLAGS "privacy_policy_isagree"
|
||||
|
||||
class wxMenuItem;
|
||||
class wxMenuBar;
|
||||
class wxTopLevelWindow;
|
||||
@@ -55,7 +57,13 @@ class wxBookCtrlBase;
|
||||
class Notebook;
|
||||
struct wxLanguageInfo;
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
class UpdateVersionDialog;
|
||||
};
|
||||
};
|
||||
|
||||
// namespace Slice3rnamespace GUI::Slice3rnamespace GUI
|
||||
namespace Slic3r {
|
||||
|
||||
class AppConfig;
|
||||
@@ -717,6 +725,7 @@ private:
|
||||
PresetUpdater* preset_updater{ nullptr };
|
||||
MainFrame* mainframe{ nullptr };
|
||||
Plater* plater_{ nullptr };
|
||||
UpdateVersionDialog* m_updateDialog{nullptr};
|
||||
|
||||
PresetUpdater* get_preset_updater() { return preset_updater; }
|
||||
|
||||
|
||||
@@ -1747,8 +1747,9 @@ wxBoxSizer* MainFrame::create_side_tools()
|
||||
{
|
||||
SidePopup* p = new SidePopup(this);
|
||||
|
||||
// if (wxGetApp().preset_bundle && !wxGetApp().preset_bundle->is_bbl_vendor())
|
||||
if (0) {
|
||||
if (wxGetApp().preset_bundle && !wxGetApp().preset_bundle->is_bbl_vendor())
|
||||
//if (0)
|
||||
{
|
||||
// ThirdParty Buttons
|
||||
SideButton* export_gcode_btn = new SideButton(p, _L("Export G-code file"), "");
|
||||
export_gcode_btn->SetCornerRadius(0);
|
||||
@@ -2264,7 +2265,7 @@ static wxMenu* generate_help_menu()
|
||||
"", nullptr, []() { return true; });
|
||||
|
||||
append_menu_item(
|
||||
helpMenu, wxID_ANY, _L("Check for Web ResourceUpdates"), _L("Check for Web ResourceUpdates"),
|
||||
helpMenu, wxID_ANY, _L("Check for Web Resource Updates"), _L("Check for Web Resource Updates"),
|
||||
[](wxCommandEvent&) {
|
||||
wxGetApp().check_web_version();
|
||||
},
|
||||
|
||||
@@ -281,7 +281,6 @@ void MarkdownTip::OnError(wxWebViewEvent& event)
|
||||
case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":MarkdownTip error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString();
|
||||
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init MarkdownTip webview fail", BP_WEB_VIEW);
|
||||
}
|
||||
|
||||
void MarkdownTip::OnTimer(wxTimerEvent& event)
|
||||
|
||||
@@ -172,7 +172,7 @@ Button* MsgDialog::add_button(wxWindowID btn_id, bool set_focus /*= false*/, con
|
||||
btn->SetFocus();
|
||||
btn_sizer->Add(btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(ButtonProps::ChoiceButtonGap()));
|
||||
btn->Bind(wxEVT_BUTTON, [this, btn_id](wxCommandEvent&) { EndModal(btn_id); });
|
||||
|
||||
btn->SetCursor(wxCURSOR_HAND);
|
||||
MsgButton *mb = new MsgButton;
|
||||
ButtonData *bd = new ButtonData;
|
||||
|
||||
|
||||
@@ -13818,16 +13818,6 @@ void Plater::send_gcode_legacy(int plate_idx, Export3mfProgressFn proFn, bool us
|
||||
upload_job = PrintHostJob(physical_printer_config);
|
||||
}
|
||||
|
||||
//if (wxGetApp().app_config->get("use_new_connect") == "true") {
|
||||
// /*std::shared_ptr<PrintHost> temp;
|
||||
// wxGetApp().get_connect_host(temp);
|
||||
// upload_job.printhost = std::unique_ptr<PrintHost>(temp.get());*/
|
||||
// upload_job = PrintHostJob(wxGetApp().get_host_config());
|
||||
//} else {
|
||||
// upload_job = PrintHostJob(physical_printer_config); //
|
||||
//}
|
||||
|
||||
|
||||
if (upload_job.empty())
|
||||
return;
|
||||
|
||||
|
||||
@@ -748,9 +748,9 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxWindow *pa
|
||||
app_config->set_bool(param, checkbox->GetValue());
|
||||
app_config->save();
|
||||
|
||||
if (param == "privacy_policy_isagree")
|
||||
if (param == PRIVACY_POLICY_FLAGS)
|
||||
{
|
||||
app_config->set("app", "privacy_policy_isagree", checkbox->GetValue());
|
||||
app_config->set("app", PRIVACY_POLICY_FLAGS, checkbox->GetValue());
|
||||
BOOST_LOG_TRIVIAL(warning) <<"create_item_checkbox changed the privacy policy with: "<<(checkbox->GetValue()?"true" : "false");
|
||||
wxGetApp().user_update_privacy_notify(checkbox->GetValue());
|
||||
}
|
||||
@@ -1300,7 +1300,7 @@ wxWindow* PreferencesDialog::create_general_page()
|
||||
std::string region = app_config->get("language");
|
||||
|
||||
auto title_user_experience = create_item_title(_L("User Experience"), page, _L("User Experience"));
|
||||
auto item_priv_policy = create_item_checkbox(_L("Join Customer Experience Improvement Program."), page, _L(""), 50, "privacy_policy_isagree");
|
||||
auto item_priv_policy = create_item_checkbox(_L("Join Customer Experience Improvement Program."), page, _L(""), 50,PRIVACY_POLICY_FLAGS);
|
||||
wxHyperlinkCtrl* hyperlink = nullptr;
|
||||
if (region.empty() || region != "zh_CN")
|
||||
hyperlink = new wxHyperlinkCtrl(page, wxID_ANY, _L("What data would be collected?"), enUrl);
|
||||
|
||||
@@ -185,7 +185,6 @@ void PrinterWebView::OnError(wxWebViewEvent &evt)
|
||||
break;
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":PrinterWebView error loading page %1% %2% %3% %4%") %evt.GetURL() %evt.GetTarget() %e %evt.GetString();
|
||||
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init PrinterWebView webview fail", BP_WEB_VIEW);
|
||||
}
|
||||
|
||||
void PrinterWebView::OnLoaded(wxWebViewEvent &evt)
|
||||
|
||||
@@ -44,6 +44,7 @@ wxDEFINE_EVENT(EVT_UPDATE_NOZZLE, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_JUMP_TO_HMS, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_JUMP_TO_LIVEVIEW, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_UPDATE_TEXT_MSG, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_DOWN_URL_PACK, wxCommandEvent);
|
||||
|
||||
ReleaseNoteDialog::ReleaseNoteDialog(Plater *plater /*= nullptr*/)
|
||||
: DPIDialog(static_cast<wxWindow *>(wxGetApp().mainframe), wxID_ANY, _L("Release Note"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
|
||||
@@ -333,7 +334,13 @@ UpdateVersionDialog::UpdateVersionDialog(wxWindow *parent)
|
||||
m_button_download->SetCursor(wxCURSOR_HAND);
|
||||
|
||||
m_button_download->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
EndModal(wxID_YES);
|
||||
wxCommandEvent event(EVT_DOWN_URL_PACK);
|
||||
|
||||
wxPostEvent(this, event);
|
||||
if (isModal)
|
||||
EndModal(wxID_NO);
|
||||
else
|
||||
Close();
|
||||
});
|
||||
|
||||
m_button_skip_version = new Button(this, _L("Skip this Version"));
|
||||
@@ -347,7 +354,10 @@ UpdateVersionDialog::UpdateVersionDialog(wxWindow *parent)
|
||||
|
||||
m_button_skip_version->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
wxGetApp().set_skip_version(true);
|
||||
EndModal(wxID_NO);
|
||||
if (isModal)
|
||||
EndModal(wxID_NO);
|
||||
else
|
||||
Close();
|
||||
});
|
||||
|
||||
m_cb_stable_only = new CheckBox(this);
|
||||
@@ -377,7 +387,11 @@ UpdateVersionDialog::UpdateVersionDialog(wxWindow *parent)
|
||||
m_button_cancel->SetCursor(wxCURSOR_HAND);
|
||||
|
||||
m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
EndModal(wxID_NO);
|
||||
if (isModal)
|
||||
EndModal(wxID_NO);
|
||||
else
|
||||
Close();
|
||||
|
||||
});
|
||||
|
||||
m_sizer_main->Add(m_line_top, 0, wxEXPAND | wxBOTTOM, 0);
|
||||
@@ -446,7 +460,6 @@ void UpdateVersionDialog::OnError(wxWebViewEvent& event)
|
||||
case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":UpdateVersionDialog error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e %event.GetString();
|
||||
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init UpdateVersionDialog webview fail", BP_WEB_VIEW);
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
@@ -514,18 +527,6 @@ void UpdateVersionDialog::update_version_info(wxString release_note, wxString ve
|
||||
//bbs check whether the web display is used
|
||||
bool use_web_link = false;
|
||||
url_line = "";
|
||||
// Orca: not used in Orca Slicer
|
||||
// auto split_array = splitWithStl(release_note.ToStdString(), "###");
|
||||
// if (split_array.size() >= 3) {
|
||||
// for (auto i = 0; i < split_array.size(); i++) {
|
||||
// std::string url = split_array[i];
|
||||
// if (std::strstr(url.c_str(), "http://") != NULL || std::strstr(url.c_str(), "https://") != NULL) {
|
||||
// use_web_link = true;
|
||||
// url_line = url;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
if (use_web_link) {
|
||||
m_brand->Hide();
|
||||
|
||||
@@ -51,6 +51,7 @@ wxDECLARE_EVENT(EVT_LOAD_VAMS_TRAY, wxCommandEvent);
|
||||
wxDECLARE_EVENT(EVT_JUMP_TO_HMS, wxCommandEvent);
|
||||
wxDECLARE_EVENT(EVT_JUMP_TO_LIVEVIEW, wxCommandEvent);
|
||||
wxDECLARE_EVENT(EVT_UPDATE_TEXT_MSG, wxCommandEvent);
|
||||
wxDECLARE_EVENT(EVT_DOWN_URL_PACK, wxCommandEvent);
|
||||
|
||||
class ReleaseNoteDialog : public DPIDialog
|
||||
{
|
||||
@@ -95,6 +96,10 @@ public:
|
||||
void update_version_info(wxString release_note, wxString version);
|
||||
std::vector<std::string> splitWithStl(std::string str, std::string pattern);
|
||||
|
||||
void setDialogMode(bool mode) { isModal = mode; }
|
||||
std::string getUrl() { return m_url; }
|
||||
void setUrl(const std::string downloadUrl) { m_url = downloadUrl; }
|
||||
std::string m_url{""};
|
||||
wxStaticBitmap* m_brand{nullptr};
|
||||
Label * m_text_up_info{nullptr};
|
||||
wxWebView* m_vebview_release_note{nullptr};
|
||||
@@ -108,6 +113,7 @@ public:
|
||||
Button* m_button_download;
|
||||
Button* m_button_cancel;
|
||||
std::string url_line;
|
||||
bool isModal = true;
|
||||
};
|
||||
|
||||
class SecondaryCheckDialog : public DPIFrame
|
||||
|
||||
+73
-18
@@ -1421,7 +1421,10 @@ void SSWCP_Instance::sw_Unsubscribe_Filter() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning) << "no this cmd for:" << cmd;
|
||||
}
|
||||
send_to_js();
|
||||
finish_job();
|
||||
}
|
||||
@@ -2075,17 +2078,15 @@ void SSWCP_MachineOption_Instance::process()
|
||||
sw_UploadCameraTimelapse();
|
||||
} else if (m_cmd == "sw_DeleteCameraTimelapse") {
|
||||
sw_DeleteCameraTimelapse();
|
||||
} else if (m_cmd == "sw_GetTimelapseInstance") {
|
||||
sw_GetTimelapseInstance();
|
||||
} else if (m_cmd == "sw_GetCameraTimelapseInstance") {
|
||||
sw_GetCameraTimelapseInstance();
|
||||
} else if (m_cmd == "sw_ServerClientManagerSetUserinfo") {
|
||||
sw_ServerClientManagerSetUserinfo();
|
||||
} else if (m_cmd == "sw_DefectDetactionConfig"){
|
||||
sw_DefectDetactionConfig();
|
||||
} else if (m_cmd == GETCAMERA_TIMELAPSE_INSTANCE) {
|
||||
CmdForwarding();
|
||||
}
|
||||
}
|
||||
else if (m_cmd == GET_DEVICEDATA_STORAGESPACE) {
|
||||
CmdForwarding();
|
||||
sw_GetDeviceDataStorageSpace();
|
||||
}
|
||||
else {
|
||||
handle_general_fail();
|
||||
@@ -3671,8 +3672,30 @@ void SSWCP_MachineOption_Instance::sw_UploadCameraTimelapse()
|
||||
handle_general_fail();
|
||||
}
|
||||
}
|
||||
void SSWCP_MachineOption_Instance::CmdForwarding()
|
||||
{
|
||||
try {
|
||||
std::shared_ptr<PrintHost> host = nullptr;
|
||||
wxGetApp().get_connect_host(host);
|
||||
|
||||
void SSWCP_MachineOption_Instance::sw_GetTimelapseInstance()
|
||||
if (!host) {
|
||||
handle_general_fail(-1, "Connection lost!");
|
||||
return;
|
||||
}
|
||||
|
||||
auto weak_self = std::weak_ptr<SSWCP_Instance>(shared_from_this());
|
||||
host->test_async_wcp_mqtt_moonraker(m_param_data, [weak_self](const json& response) {
|
||||
auto self = weak_self.lock();
|
||||
if (self) {
|
||||
SSWCP_Instance::on_mqtt_msg_arrived(self, response);
|
||||
}
|
||||
});
|
||||
} catch (std::exception& e) {
|
||||
handle_general_fail();
|
||||
}
|
||||
}
|
||||
|
||||
void SSWCP_MachineOption_Instance::sw_GetCameraTimelapseInstance()
|
||||
{
|
||||
try {
|
||||
std::shared_ptr<PrintHost> host = nullptr;
|
||||
@@ -3695,7 +3718,9 @@ void SSWCP_MachineOption_Instance::sw_GetTimelapseInstance()
|
||||
handle_general_fail();
|
||||
}
|
||||
}
|
||||
void SSWCP_MachineOption_Instance::CmdForwarding() {
|
||||
void SSWCP_MachineOption_Instance::sw_GetDeviceDataStorageSpace()
|
||||
{
|
||||
|
||||
try {
|
||||
std::shared_ptr<PrintHost> host = nullptr;
|
||||
wxGetApp().get_connect_host(host);
|
||||
@@ -3706,7 +3731,7 @@ void SSWCP_MachineOption_Instance::CmdForwarding() {
|
||||
}
|
||||
|
||||
auto weak_self = std::weak_ptr<SSWCP_Instance>(shared_from_this());
|
||||
host->async_delete_camera_timelapse(m_param_data, [weak_self](const json& response) {
|
||||
host->async_get_userdata_space(m_param_data, [weak_self](const json& response) {
|
||||
auto self = weak_self.lock();
|
||||
if (self) {
|
||||
SSWCP_Instance::on_mqtt_msg_arrived(self, response);
|
||||
@@ -3717,7 +3742,6 @@ void SSWCP_MachineOption_Instance::CmdForwarding() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SSWCP_MachineOption_Instance::sw_DeleteCameraTimelapse()
|
||||
{
|
||||
try {
|
||||
@@ -3886,6 +3910,7 @@ void SSWCP_MachineConnect_Instance::sw_get_pin_code()
|
||||
self->send_to_js();
|
||||
self->finish_job();
|
||||
|
||||
|
||||
std::string dc_msg = "success";
|
||||
bool flag = mqtt_client->Disconnect(dc_msg);
|
||||
wxGetApp().CallAfter([mqtt_client]() { delete mqtt_client; });
|
||||
@@ -4267,7 +4292,13 @@ void SSWCP_UserLogin_Instance::process()
|
||||
sw_GetUserLoginState();
|
||||
} else if (m_cmd == "sw_SubscribeUserLoginState") {
|
||||
sw_SubscribeUserLoginState();
|
||||
} else {
|
||||
}
|
||||
else if (m_cmd == UPDATE_PRIVACY_STATUS) {
|
||||
sw_SubUserUpdatePrivacy();
|
||||
} else if (m_cmd == GET_PRIVACY_STATUS) {
|
||||
sw_GetUserUpdatePrivacy();
|
||||
}
|
||||
else {
|
||||
handle_general_fail();
|
||||
}
|
||||
}
|
||||
@@ -4331,6 +4362,33 @@ void SSWCP_UserLogin_Instance::sw_GetUserLoginState()
|
||||
handle_general_fail();
|
||||
}
|
||||
}
|
||||
void SSWCP_UserLogin_Instance::sw_GetUserUpdatePrivacy()
|
||||
{
|
||||
json data;
|
||||
auto isAgree = wxGetApp().app_config->get("app", PRIVACY_POLICY_FLAGS);
|
||||
bool isUserAgree = false;
|
||||
|
||||
if (isAgree == "true")
|
||||
isUserAgree = true;
|
||||
|
||||
data[PRIVACY_POLICY_FLAGS] = isUserAgree;
|
||||
|
||||
m_res_data = data;
|
||||
send_to_js();
|
||||
finish_job();
|
||||
|
||||
}
|
||||
|
||||
void SSWCP_UserLogin_Instance::sw_SubUserUpdatePrivacy()
|
||||
{
|
||||
try {
|
||||
std::weak_ptr<SSWCP_Instance> weak_ptr = shared_from_this();
|
||||
wxGetApp().m_user_update_privacy_subscribers[m_webview] = weak_ptr;
|
||||
} catch (std::exception& e) {
|
||||
handle_general_fail();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SSWCP_UserLogin_Instance::sw_SubscribeUserLoginState()
|
||||
{
|
||||
@@ -5803,10 +5861,9 @@ std::unordered_set<std::string> SSWCP::m_machine_option_cmd_list = {
|
||||
"sw_UpdateMachineFilamentInfo",
|
||||
"sw_UploadCameraTimelapse",
|
||||
"sw_DeleteCameraTimelapse",
|
||||
"sw_GetTimelapseInstance",
|
||||
"sw_GetCameraTimelapseInstance",
|
||||
"sw_ServerClientManagerSetUserinfo",
|
||||
"sw_DefectDetactionConfig",
|
||||
GETCAMERA_TIMELAPSE_INSTANCE,
|
||||
GET_DEVICEDATA_STORAGESPACE
|
||||
};
|
||||
|
||||
@@ -5823,9 +5880,8 @@ std::unordered_set<std::string> SSWCP::m_project_cmd_list = {
|
||||
"sw_NewProject", "sw_OpenProject", "sw_GetRecentProjects", "sw_OpenRecentFile", "sw_DeleteRecentFiles", "sw_SubscribeRecentFiles",
|
||||
};
|
||||
|
||||
std::unordered_set<std::string> SSWCP::m_login_cmd_list = {
|
||||
"sw_UserLogin", "sw_UserLogout", "sw_GetUserLoginState", "sw_SubscribeUserLoginState"
|
||||
};
|
||||
std::unordered_set<std::string> SSWCP::m_login_cmd_list = {"sw_UserLogin", "sw_UserLogout", "sw_GetUserLoginState", "sw_SubscribeUserLoginState",
|
||||
UPDATE_PRIVACY_STATUS, GET_PRIVACY_STATUS};
|
||||
|
||||
std::unordered_set<std::string> SSWCP::m_machine_manage_cmd_list = {
|
||||
"sw_GetLocalDevices", "sw_AddDevice", "sw_SubscribeLocalDevices", "sw_RenameDevice", "sw_SwitchModel", "sw_DeleteDevices"
|
||||
@@ -5899,7 +5955,6 @@ void SSWCP::handle_web_message(std::string message, wxWebView* webview) {
|
||||
if (payload.count("event_id") && !payload["event_id"].is_null()) {
|
||||
event_id = payload["event_id"].get<std::string>();
|
||||
}
|
||||
|
||||
std::shared_ptr<SSWCP_Instance> instance = create_sswcp_instance(cmd, header, params, event_id, webview);
|
||||
if (instance) {
|
||||
if (event_id != "") {
|
||||
|
||||
@@ -26,9 +26,9 @@ using tcp = asio::ip::tcp;
|
||||
|
||||
//WCP Interface definition
|
||||
#define UPDATE_PRIVACY_STATUS "sw_SubUserUpdatePrivacy"
|
||||
#define GET_PRIVACY_STATUS "sw_GetUserUpdatePrivacy"
|
||||
#define UPLOAD_CAMERA_TIMELAPSE "sw_UploadCameraTimelapse"
|
||||
#define DELETE_CAMERA_TIMELAPSE "sw_DeleteCameraTimelapse"
|
||||
#define GETCAMERA_TIMELAPSE_INSTANCE "sw_GetCameraTimelapseInstance"
|
||||
#define GET_DEVICEDATA_STORAGESPACE "sw_GetDeviceDataStorageSpace"
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
@@ -310,9 +310,6 @@ private:
|
||||
void sw_mqtt_publish();
|
||||
void sw_mqtt_set_engine();
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
void clean_current_engine();
|
||||
|
||||
@@ -424,9 +421,11 @@ private:
|
||||
void sw_GetFileListPage();
|
||||
void sw_UploadCameraTimelapse();
|
||||
void sw_DeleteCameraTimelapse();
|
||||
void sw_GetTimelapseInstance();
|
||||
void sw_GetCameraTimelapseInstance();
|
||||
|
||||
void sw_DefectDetactionConfig();
|
||||
void sw_DefectDetactionConfig();
|
||||
|
||||
void sw_GetDeviceDataStorageSpace();
|
||||
|
||||
void CmdForwarding();
|
||||
|
||||
@@ -534,8 +533,9 @@ private:
|
||||
|
||||
void sw_SubscribeUserLoginState();
|
||||
|
||||
void sw_SubUserUpdatePrivacy();
|
||||
void sw_GetUserUpdatePrivacy();
|
||||
|
||||
void sw_SubUserUpdatePrivacy();
|
||||
};
|
||||
|
||||
// Instance class for homepage business
|
||||
|
||||
@@ -118,7 +118,7 @@ void WebDeviceDialog::OnError(wxWebViewEvent &evt)
|
||||
case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":WebDeviceDialog error loading page %1% %2% %3% %4%") % evt.GetURL() % evt.GetTarget() % e %evt.GetString();
|
||||
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init WebDeviceDialog webview fail", BP_WEB_VIEW);
|
||||
|
||||
}
|
||||
|
||||
void WebDeviceDialog::OnScriptMessage(wxWebViewEvent &evt)
|
||||
|
||||
@@ -611,7 +611,7 @@ void GuideFrame::OnError(wxWebViewEvent& event)
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":GuideFrame error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString();
|
||||
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init GuideFrame webview fail", BP_WEB_VIEW);
|
||||
|
||||
}
|
||||
|
||||
void GuideFrame::OnScriptResponseMessage(wxCommandEvent &WXUNUSED(evt))
|
||||
@@ -639,7 +639,7 @@ int GuideFrame::SaveProfile()
|
||||
// m_MainPtr->app_config->set(std::string(m_SectionName.mb_str()), "privacyuse", "1");
|
||||
// } else
|
||||
// m_MainPtr->app_config->set(std::string(m_SectionName.mb_str()), "privacyuse", "0");
|
||||
m_MainPtr->app_config->set("app", "privacy_policy_isagree", PrivacyUse);
|
||||
m_MainPtr->app_config->set("app", PRIVACY_POLICY_FLAGS, PrivacyUse);
|
||||
BOOST_LOG_TRIVIAL(warning) << "SaveProfile changed the privacy policy with: " << (PrivacyUse ? "true" : "false");
|
||||
wxGetApp().user_update_privacy_notify(PrivacyUse);
|
||||
m_MainPtr->app_config->set("region", m_Region);
|
||||
|
||||
@@ -167,7 +167,7 @@ void WebPreprintDialog::OnError(wxWebViewEvent &event)
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":WebPreprintDialog error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString();
|
||||
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init WebPreprintDialog webview fail", BP_WEB_VIEW);
|
||||
|
||||
}
|
||||
|
||||
void WebPreprintDialog::OnScriptMessage(wxWebViewEvent &evt)
|
||||
|
||||
@@ -707,7 +707,7 @@ void WebPresetDialog::OnError(wxWebViewEvent& event)
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":WebPresetDialog error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString();
|
||||
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init WebPresetDialog webview fail", BP_WEB_VIEW);
|
||||
|
||||
}
|
||||
|
||||
void WebPresetDialog::OnScriptResponseMessage(wxCommandEvent& WXUNUSED(evt))
|
||||
|
||||
@@ -400,7 +400,7 @@ void SMUserLogin::OnError(wxWebViewEvent &event)
|
||||
case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":SMUserLogin error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString();
|
||||
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init SMUserLogin webview fail", BP_WEB_VIEW);
|
||||
|
||||
}
|
||||
|
||||
void SMUserLogin::OnScriptResponseMessage(wxCommandEvent &WXUNUSED(evt))
|
||||
|
||||
@@ -130,7 +130,7 @@ void WebUrlDialog::OnError(wxWebViewEvent &event)
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":WebUrlDialog error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString();
|
||||
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init WebUrlDialog webview fail", BP_WEB_VIEW);
|
||||
|
||||
}
|
||||
|
||||
void WebUrlDialog::OnScriptMessage(wxWebViewEvent &evt)
|
||||
|
||||
@@ -374,7 +374,7 @@ void ZUserLogin::OnError(wxWebViewEvent &event)
|
||||
case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":ZUserLogin error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString();
|
||||
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init ZUserLogin webview fail", BP_WEB_VIEW);
|
||||
|
||||
}
|
||||
|
||||
void ZUserLogin::OnScriptResponseMessage(wxCommandEvent &WXUNUSED(evt))
|
||||
|
||||
@@ -908,7 +908,7 @@ void WebViewPanel::OnError(wxWebViewEvent& event)
|
||||
case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":PrinterWebView error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString();
|
||||
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init WebViewPanel webview fail", BP_WEB_VIEW);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2399,6 +2399,30 @@ void Moonraker_Mqtt::async_get_timelapse_instance(const nlohmann::json& targets,
|
||||
}
|
||||
}
|
||||
|
||||
//get the mechine local storage space
|
||||
void Moonraker_Mqtt::async_get_userdata_space(const nlohmann::json& targets, std::function<void(const nlohmann::json& response)> callback)
|
||||
{
|
||||
auto& wcp_loger = GUI::WCP_Logger::getInstance();
|
||||
std::string method = "server.files.get_userdata_space";
|
||||
|
||||
json params = json::object();
|
||||
|
||||
params = targets;
|
||||
|
||||
if (!send_to_request(method, params, true, callback,
|
||||
[callback, &wcp_loger]() {
|
||||
BOOST_LOG_TRIVIAL(warning) << "[Moonraker_Mqtt] get uoser storage space";
|
||||
wcp_loger.add_log("get uoser storage space timeout", false, "", "Moonraker_Mqtt", "warning");
|
||||
json res;
|
||||
res["error"] = "timeout";
|
||||
callback(res);
|
||||
}) &&callback) {
|
||||
BOOST_LOG_TRIVIAL(error) << "[Moonraker_Mqtt]send the cmd to get uoser storage space fail";
|
||||
wcp_loger.add_log("send the cmd to get uoser storage space fail", false, "", "Moonraker_Mqtt", "error");
|
||||
callback(json::value_t::null);
|
||||
}
|
||||
}
|
||||
|
||||
// 请求删除延时摄影文件
|
||||
void Moonraker_Mqtt::async_delete_camera_timelapse(const nlohmann::json& targets,
|
||||
std::function<void(const nlohmann::json& response)> callback)
|
||||
|
||||
@@ -140,6 +140,7 @@ public:
|
||||
|
||||
virtual void async_defect_detaction_config(const nlohmann::json& targets, std::function<void(const nlohmann::json& response)>) {}
|
||||
|
||||
virtual void async_get_userdata_space(const nlohmann::json& targets, std::function<void(const nlohmann::json& response)>) {}
|
||||
|
||||
protected:
|
||||
// Internal upload implementations
|
||||
@@ -272,6 +273,8 @@ public:
|
||||
|
||||
virtual void async_get_timelapse_instance(const nlohmann::json& targets, std::function<void(const nlohmann::json& response)>) override;
|
||||
|
||||
virtual void async_get_userdata_space(const nlohmann::json& targets, std::function<void(const nlohmann::json& response)>) override;
|
||||
|
||||
virtual void async_defect_detaction_config(const nlohmann::json& targets, std::function<void(const nlohmann::json& response)>) override;
|
||||
|
||||
void set_connection_lost(std::function<void()> callback) override;
|
||||
|
||||
@@ -795,7 +795,7 @@ void PresetUpdater::priv::sync_update_flutter_resource(bool isAuto_check)
|
||||
|
||||
if (currentSoftVersion > maxSpVersion || currentSoftVersion < minSpVersion) {
|
||||
if (!isAuto_check) {
|
||||
wxCommandEvent* evt = new wxCommandEvent(EVT_NO_PRESET_UPDATE);
|
||||
wxCommandEvent* evt = new wxCommandEvent(EVT_NO_WEB_RESOURCE_UPDATE);
|
||||
GUI::wxGetApp().QueueEvent(evt);
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << format("use check the web update.");
|
||||
@@ -814,7 +814,10 @@ void PresetUpdater::priv::sync_update_flutter_resource(bool isAuto_check)
|
||||
}
|
||||
}
|
||||
|
||||
} catch (...) {}
|
||||
} catch (const std::exception& ex) {
|
||||
std::string errorMsg = ex.what();
|
||||
BOOST_LOG_TRIVIAL(fatal) << "request server flutter update data error:" << errorMsg;
|
||||
}
|
||||
})
|
||||
.perform_sync();
|
||||
}
|
||||
@@ -920,7 +923,10 @@ void PresetUpdater::priv::sync_config(bool isAuto_check)
|
||||
}
|
||||
}
|
||||
|
||||
} catch (...) {}
|
||||
} catch (const std::exception& ex) {
|
||||
std::string errorMsg = ex.what();
|
||||
BOOST_LOG_TRIVIAL(fatal) << "request server preset update data error:" << errorMsg;
|
||||
}
|
||||
})
|
||||
.perform_sync();
|
||||
}
|
||||
@@ -1422,8 +1428,7 @@ Updates PresetUpdater::priv::get_config_updates(const Semver &old_slic3r_version
|
||||
}
|
||||
}
|
||||
|
||||
bool version_match = ((vendor_ver.maj() == cache_ver.maj()) && (vendor_ver.min() == cache_ver.min()));
|
||||
if (version_match && (vendor_ver < cache_ver)) {
|
||||
if (vendor_ver < cache_ver) {
|
||||
|
||||
Semver min_ver = get_min_version_from_json(file_path);
|
||||
Semver soft_ver = Semver(std::string(Snapmaker_VERSION));
|
||||
@@ -1718,7 +1723,7 @@ void PresetUpdater::sync_web_async(bool isAutoUpdata)
|
||||
GUI::wxGetApp().CallAfter([this] {
|
||||
std::string zipfilepath = this->p->cache_path.string() + "/flutter_web.zip";
|
||||
BOOST_LOG_TRIVIAL(debug) << "[Orca Updater] sync_web_async completed, checking updates...";
|
||||
load_lutter_web(zipfilepath, true);
|
||||
load_flutter_web(zipfilepath, true);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -1802,7 +1807,7 @@ bool PresetUpdater::version_check_enabled() const
|
||||
}
|
||||
|
||||
|
||||
void PresetUpdater::load_lutter_web(const std::string& zip_file, bool serverUpdate)
|
||||
void PresetUpdater::load_flutter_web(const std::string& zip_file, bool serverUpdate)
|
||||
{
|
||||
boost::filesystem::path temp_path = boost::filesystem::temp_directory_path() / "orca_temp_flutter_import";
|
||||
try {
|
||||
@@ -1845,7 +1850,7 @@ void PresetUpdater::load_lutter_web(const std::string& zip_file, bool serverUpda
|
||||
Semver online_version = version_str;
|
||||
Semver current_version = ori_version_str;
|
||||
|
||||
if (/* current_version < online_version && */ ori_build_number_str < build_number_str) {
|
||||
if (current_version < online_version) {
|
||||
auto source_folder_path = fs::path(dir_entry.path().parent_path());
|
||||
auto target_folder_path = (boost::filesystem::path(data_dir()) / "web" / "flutter_web");
|
||||
|
||||
@@ -1939,6 +1944,7 @@ void PresetUpdater::load_lutter_web(const std::string& zip_file, bool serverUpda
|
||||
|
||||
app->recreate_GUI(_L("Update web resources"));
|
||||
}
|
||||
|
||||
|
||||
} catch (std::exception& e) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Failed to importweb resources: " << e.what();
|
||||
@@ -1959,7 +1965,7 @@ void PresetUpdater::import_flutter_web()
|
||||
|
||||
std::string zip_file = dialog.GetPath().ToUTF8().data();
|
||||
|
||||
load_lutter_web(zip_file);
|
||||
load_flutter_web(zip_file);
|
||||
}
|
||||
|
||||
void PresetUpdater::import_system_profile()
|
||||
@@ -2090,7 +2096,6 @@ void PresetUpdater::import_system_profile()
|
||||
}
|
||||
|
||||
// 5. 执行更新并提示结果
|
||||
bool need_restart = false;
|
||||
if (!updates.updates.empty()) {
|
||||
std::vector<GUI::MsgUpdateConfig::Update> updates_msg;
|
||||
for (const auto& update : updates.updates) {
|
||||
@@ -2098,9 +2103,6 @@ void PresetUpdater::import_system_profile()
|
||||
if (update.is_directory)
|
||||
continue;
|
||||
|
||||
if (update.can_install) {
|
||||
need_restart = true;
|
||||
}
|
||||
std::string changelog = update.change_log;
|
||||
updates_msg.emplace_back(update.vendor, update.version.config_version, update.descriptions, std::move(changelog));
|
||||
}
|
||||
@@ -2111,12 +2113,16 @@ void PresetUpdater::import_system_profile()
|
||||
|
||||
if (res == wxID_OK) {
|
||||
p->perform_updates(std::move(updates));
|
||||
// Use hot reload instead of restart
|
||||
if (!reload_configs_update_gui()) {
|
||||
BOOST_LOG_TRIVIAL(warning) << "[Orca Updater]:reload_configs_update_gui failed for system profiles";
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(info) << "[Orca Updater]:System profiles updated successfully via hot reload";
|
||||
}
|
||||
} else {
|
||||
boost::filesystem::remove_all(temp_path);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
wxString message;
|
||||
@@ -2128,18 +2134,6 @@ void PresetUpdater::import_system_profile()
|
||||
GUI::MessageDialog(nullptr, message).ShowModal();
|
||||
}
|
||||
|
||||
if (need_restart) {
|
||||
GUI::MessageDialog msg_wingow(nullptr,
|
||||
_L("Updating the system resources requires application restart.") + "\n" +
|
||||
_L("Do you want to continue?"),
|
||||
L("System resource update"), wxICON_QUESTION | wxOK | wxCANCEL);
|
||||
if (msg_wingow.ShowModal() == wxID_CANCEL) {
|
||||
return;
|
||||
}
|
||||
|
||||
app->recreate_GUI(_L("Update system profiles"));
|
||||
}
|
||||
|
||||
} catch (std::exception& e) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Failed to import presets: " << e.what();
|
||||
GUI::MessageDialog(nullptr, _L("Import Failed")).ShowModal();
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
|
||||
void import_flutter_web();
|
||||
|
||||
void load_lutter_web(const std::string& zip_file,bool serverUpdate = false);
|
||||
void load_flutter_web(const std::string& zip_file,bool serverUpdate = false);
|
||||
|
||||
void sync_config_async();
|
||||
|
||||
|
||||
@@ -170,6 +170,8 @@ public:
|
||||
virtual void async_delete_camera_timelapse(const nlohmann::json& targets, std::function<void(const nlohmann::json& response)>) {}
|
||||
|
||||
virtual void async_get_timelapse_instance(const nlohmann::json& targets, std::function<void(const nlohmann::json& response)>) {}
|
||||
|
||||
virtual void async_get_userdata_space(const nlohmann::json& targets, std::function<void(const nlohmann::json& response)>) {}
|
||||
|
||||
virtual void async_defect_detaction_config(const nlohmann::json& targets, std::function<void(const nlohmann::json& response)>) {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user