Merge pull request #118 from Snapmaker/dev_bug_fixed_2.3.0_alves

Dev bug fixed 2.3.0 alves
This commit is contained in:
Alves
2026-01-16 10:48:24 +08:00
committed by GitHub
28 changed files with 528 additions and 248 deletions
+3 -2
View File
@@ -46,9 +46,10 @@ You can do this in Environment Variables settings.
endif ()
if (APPLE)
# if CMAKE_OSX_DEPLOYMENT_TARGET is not set, set it to 11.3
# Require macOS 12.0+ (Monterey) as minimum version
# This ensures proper "requires macOS 12.0" system dialog instead of crash on older systems
if (NOT CMAKE_OSX_DEPLOYMENT_TARGET)
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.3" CACHE STRING "Minimum OS X deployment version" FORCE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "12.0" CACHE STRING "Minimum OS X deployment version" FORCE)
endif ()
message(STATUS "CMAKE_OSX_DEPLOYMENT_TARGET: ${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif ()
+1 -1
View File
@@ -82,7 +82,7 @@ if [ -z "$DEPS_CMAKE_GENERATOR" ]; then
fi
if [ -z "$OSX_DEPLOYMENT_TARGET" ]; then
export OSX_DEPLOYMENT_TARGET="11.3"
export OSX_DEPLOYMENT_TARGET="12.0"
fi
echo "Build params:"
+3 -2
View File
@@ -22,9 +22,10 @@
cmake_minimum_required(VERSION 3.2)
if (APPLE)
# if CMAKE_OSX_DEPLOYMENT_TARGET is not set, set it to 11.3
# Require macOS 12.0+ (Monterey) as minimum version
# All deps must use the same deployment target for consistent behavior
if (NOT CMAKE_OSX_DEPLOYMENT_TARGET)
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.3" CACHE STRING "Minimum OS X deployment version" FORCE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "12.0" CACHE STRING "Minimum OS X deployment version" FORCE)
endif ()
message(STATUS "CMAKE_OSX_DEPLOYMENT_TARGET: ${CMAKE_OSX_DEPLOYMENT_TARGET}")
+1 -1
View File
@@ -81,7 +81,7 @@ endif()
Snapmaker_Orca_add_cmake_project(Sentry
GIT_REPOSITORY https://github.com/getsentry/sentry-native.git
GIT_TAG 0.12.1
GIT_TAG 0.12.2
GIT_SHALLOW ON
PATCH_COMMAND ${SENTRY_PATCH_COMMAND}
CMAKE_ARGS
+98 -7
View File
@@ -78,13 +78,19 @@ namespace common
std::string versionFilePath = "";
#ifdef _WIN32
wchar_t appDataPath[MAX_PATH] = {0};
auto hr = SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appDataPath);
char* path = new char[MAX_PATH];
size_t pathLength;
wcstombs_s(&pathLength, path, MAX_PATH, appDataPath, MAX_PATH);
PWSTR pszPath = nullptr;
char* path = new char[MAX_PATH]();
size_t pathLength = 0;
HRESULT hr = SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &pszPath);
if (SUCCEEDED(hr)) {
wcstombs_s(&pathLength, path, MAX_PATH, pszPath, MAX_PATH);
CoTaskMemFree(pszPath);
}
std::string filePath = path;
versionFilePath = filePath + "\\" + std::string("Snapmaker_Orca\\web\\flutter_web\\version.json");
delete[] path;
#elif __APPLE__
const char* home_env = getenv("HOME");
versionFilePath = home_env;
@@ -100,8 +106,8 @@ namespace common
}
nlohmann::json json_data;
json_file >> json_data;
std::string str_version = json_data["version"];
std::string str_build_number = json_data["build_number"];
std::string str_version = json_data.value("version", "");
std::string str_build_number = json_data.value("build_number", "");
std::string flutter_version = std::string("flutter_version: ") + str_version + std::string(" ") + std::string("build_number: ") +
str_build_number;
@@ -109,4 +115,89 @@ namespace common
return flutter_version;
}
std::string getLocalArea()
{
std::string localArea = "";
std::string cfgfile = "";
std::string versionFilePath = "";
#ifdef _WIN32
PWSTR pszPath = nullptr;
char* path = new char[MAX_PATH]();
size_t pathLength = 0;
HRESULT hr = SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &pszPath);
if (SUCCEEDED(hr)) {
wcstombs_s(&pathLength, path, MAX_PATH, pszPath, MAX_PATH);
CoTaskMemFree(pszPath);
}
std::string filePath = path;
cfgfile = filePath + "\\" + std::string("Snapmaker_Orca\\Snapmaker_Orca.conf");
delete[] path;
#elif __APPLE__
const char* home_env = getenv("HOME");
versionFilePath = home_env;
cfgfile = versionFilePath + "/Library/Application Support/Snapmaker_Orca/Snapmaker_Orca.conf";
#else
#endif
std::ifstream json_file(cfgfile);
if (!json_file.is_open()) {
std::ifstream json_file(cfgfile);
return "";
}
nlohmann::json json_data;
json_file >> json_data;
auto dataObj = json_data.value("app", nlohmann::json::object());
localArea = dataObj.value("region", "");
return localArea;
}
std::string getLanguage()
{
std::string localLanguage = "";
std::string versionFilePath = "";
std::string cfgfile = "";
#ifdef _WIN32
PWSTR pszPath = nullptr;
char* path = new char[MAX_PATH]();
size_t pathLength = 0;
HRESULT hr = SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &pszPath);
if (SUCCEEDED(hr)) {
wcstombs_s(&pathLength, path, MAX_PATH, pszPath, MAX_PATH);
CoTaskMemFree(pszPath);
}
std::string filePath = path;
cfgfile = filePath + "\\" + std::string("Snapmaker_Orca\\Snapmaker_Orca.conf");
delete[] path;
#elif __APPLE__
const char* home_env = getenv("HOME");
versionFilePath = home_env;
cfgfile = versionFilePath + "/Library/Application Support/Snapmaker_Orca/Snapmaker_Orca.conf";
#else
#endif
std::ifstream json_file(cfgfile);
if (!json_file.is_open()) {
std::ifstream json_file(cfgfile);
return "";
}
nlohmann::json json_data;
json_file >> json_data;
auto dataObj = json_data.value("app", nlohmann::json::object());
localLanguage = dataObj.value("language", "");
return localLanguage;
}
}
+4
View File
@@ -25,6 +25,10 @@ namespace common
std::string getMachineId();
std::string getLocalArea();
std::string getLanguage();
} // namespace common
#endif
+1 -1
View File
@@ -125,7 +125,7 @@
</dict>
</array>
<key>LSMinimumSystemVersion</key>
<string>10.10</string>
<string>12.0</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
+117 -54
View File
@@ -15,6 +15,9 @@
#ifdef _WIN32
#include <Windows.h>
#include <shlobj.h>
#include <stdlib.h>
#include <iphlpapi.h>
#pragma comment(lib, "iphlpapi.lib")
#endif
#ifdef __APPLE__
@@ -55,10 +58,13 @@ static sentry_value_t on_crash_callback(const sentry_ucontext_t* uctx, sentry_va
return event;
}
static sentry_value_t before_send_log(sentry_value_t log, void* user_dataa)
{
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);
@@ -123,11 +129,6 @@ void initSentryEx()
sentry_options_t* options = sentry_options_new();
std::string dsn = std::string("https://c74b617c2aedc291444d3a238d23e780@o4508125599563776.ingest.us.sentry.io/4510425163956224");
{
#ifdef __APPLE__
#elif _WIN32
#endif
sentry_options_set_dsn(options, dsn.c_str());
std::string handlerDir = "";
std::string dataBaseDir = "";
@@ -176,14 +177,20 @@ void initSentryEx()
handlerDir = wstringTostring(desDir);
wchar_t appDataPath[MAX_PATH] = {0};
auto hr = SHGetFolderPathW(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appDataPath);
char* path = new char[MAX_PATH];
size_t pathLength;
wcstombs_s(&pathLength, path, MAX_PATH, appDataPath, MAX_PATH);
PWSTR pszPath = nullptr;
char* path = new char[MAX_PATH]();
size_t pathLength = 0;
HRESULT hr = SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, nullptr, &pszPath);
if (SUCCEEDED(hr)) {
wcstombs_s(&pathLength, path, MAX_PATH, pszPath, MAX_PATH);
CoTaskMemFree(pszPath);
}
std::string filePath = path;
std::string appName = "\\" + std::string("Snapmaker_Orca\\");
dataBaseDir = filePath + appName;
delete[] path;
#endif
if (!handlerDir.empty())
@@ -198,7 +205,7 @@ void initSentryEx()
sentry_options_set_debug(options, 0);
#endif
// sentry_options_set_environment(options, "develop");
//sentry_options_set_environment(options, "develop");
sentry_options_set_environment(options, "Release");
sentry_options_set_auto_session_tracking(options, 0);
@@ -209,6 +216,10 @@ void initSentryEx()
sentry_options_set_sample_rate(options, 1.0);
sentry_options_set_traces_sample_rate(options, 1.0);
sentry_options_set_enable_logs(options, 1);
sentry_options_set_before_send_log(options, before_send_log, NULL);
sentry_options_set_logs_with_attributes(options, true);
sentry_init(options);
sentry_start_session();
@@ -233,55 +244,107 @@ void exitSentryEx()
sentry_close();
}
void sentryReportLogEx(SENTRY_LOG_LEVEL logLevel,
const std::string& logContent,
const std::string& funcModule,
const std::string& logTagKey,
const std::string& logTagValue,
const std::string& logTraceId)
const std::string& logContent,
const std::string& funcModule,
const std::string& logTagKey,
const std::string& logTagValue,
const std::string& logTraceId)
{
sentry_level_t sentry_msg_level;
switch (logLevel)
{
case SENTRY_LOG_TRACE:
sentry_msg_level = SENTRY_LEVEL_TRACE;
break;
case SENTRY_LOG_DEBUG:
sentry_msg_level = SENTRY_LEVEL_DEBUG;
break;
case SENTRY_LOG_INFO:
sentry_msg_level = SENTRY_LEVEL_INFO;
break;
case SENTRY_LOG_WARNING:
sentry_msg_level = SENTRY_LEVEL_WARNING;
break;
case SENTRY_LOG_ERROR:
sentry_msg_level = SENTRY_LEVEL_ERROR;
break;
case SENTRY_LOG_FATAL:
sentry_msg_level = SENTRY_LEVEL_FATAL;
break;
default:
if (!get_privacy_policy()) {
return;
}
sentry_value_t event = sentry_value_new_message_event(sentry_msg_level,
funcModule.c_str(),
logContent.c_str()
);
sentry_level_t sentry_msg_level;
sentry_value_t tags = sentry_value_new_object();
sentry_value_t tags = sentry_value_new_object();
if (!funcModule.empty()) {
sentry_value_t attr = sentry_value_new_attribute(sentry_value_new_string(funcModule.c_str()), NULL);
sentry_value_set_by_key(tags, "function_module", attr);
}
if (!logTraceId.empty())
sentry_value_set_by_key(tags, "snapmaker_trace_id", sentry_value_new_string(logTraceId.c_str()));
if (!logTraceId.empty()) {
sentry_value_t attr = sentry_value_new_attribute(sentry_value_new_string(logTraceId.c_str()), NULL);
sentry_value_set_by_key(tags, "snapmaker_trace_id", attr);
}
if (SENTRY_LEVEL_TRACE == sentry_msg_level)
sentry_value_set_by_key(tags, BURY_POINT, sentry_value_new_string("snapmaker_bury_point"));
if (!logTagKey.empty())
sentry_value_set_by_key(tags, logTagKey.c_str(), sentry_value_new_string(logTagValue.c_str()));
if (!logTagKey.empty()) {
sentry_value_t attr = sentry_value_new_attribute(sentry_value_new_string(logTagValue.c_str()), NULL);
sentry_value_set_by_key(tags, logTagKey.c_str(), attr);
}
sentry_value_set_by_key(event, "snapmaker_tags", tags);
sentry_capture_event(event);
sentry_value_t attr = sentry_value_new_attribute(sentry_value_new_string(Snapmaker_VERSION), NULL);
sentry_value_set_by_key(tags, "snapmaker_version", attr);
std::string flutterVersion = common::get_flutter_version();
if (!flutterVersion.empty()) {
sentry_value_t attr = sentry_value_new_attribute(sentry_value_new_string(flutterVersion.c_str()), NULL);
sentry_value_set_by_key(tags, "flutter_version", attr);
}
std::string pcName = common::get_pc_name();
if (!pcName.empty()) {
sentry_value_t attr = sentry_value_new_attribute(sentry_value_new_string(pcName.c_str()), NULL);
sentry_value_set_by_key(tags, "pc_name", attr);
}
static std::string machineID = "";
if (machineID.empty())
machineID = common::getMachineId();
if (!machineID.empty()) {
sentry_value_t attr = sentry_value_new_attribute(sentry_value_new_string(machineID.c_str()), NULL);
sentry_value_set_by_key(tags, "machine_id", attr);
}
static std::string currentLanguage = "";
if (currentLanguage.empty())
currentLanguage = common::getLanguage();
if (!currentLanguage.empty()) {
sentry_value_t attr = sentry_value_new_attribute(sentry_value_new_string(currentLanguage.c_str()), NULL);
sentry_value_set_by_key(tags, "current_language", attr);
}
static std::string localArea = "";
if (localArea.empty())
localArea = common::getLocalArea();
if (!localArea.empty())
{
sentry_value_t attr = sentry_value_new_attribute(sentry_value_new_string(localArea.c_str()), NULL);
sentry_value_set_by_key(tags, "local_area", attr);
}
switch (logLevel) {
case SENTRY_LOG_TRACE: {
sentry_msg_level = SENTRY_LEVEL_TRACE;
sentry_value_t attr = sentry_value_new_attribute(sentry_value_new_string("snapmaker_bury_point"), NULL);
sentry_value_set_by_key(tags, BURY_POINT, attr);
sentry_log_trace(logContent.c_str(), tags);
} break;
case SENTRY_LOG_DEBUG: {
sentry_msg_level = SENTRY_LEVEL_DEBUG;
sentry_log_debug(logContent.c_str(), tags);
} break;
case SENTRY_LOG_INFO: {
sentry_msg_level = SENTRY_LEVEL_INFO;
sentry_log_info(logContent.c_str(), tags);
} break;
case SENTRY_LOG_WARNING: {
sentry_msg_level = SENTRY_LEVEL_WARNING;
sentry_log_warn(logContent.c_str(), tags);
} break;
case SENTRY_LOG_ERROR:
{
sentry_msg_level = SENTRY_LEVEL_ERROR;
sentry_log_error(logContent.c_str(), tags);
}
break;
case SENTRY_LOG_FATAL:
{
sentry_msg_level = SENTRY_LEVEL_FATAL;
sentry_log_fatal(logContent.c_str(), tags);
}
break;
default: return;
}
}
+1 -1
View File
@@ -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", is_BBL_Printer);
toggle_line("timelapse_type", true);
bool have_small_area_infill_flow_compensation = config->opt_bool("small_area_infill_flow_compensation");
+13 -1
View File
@@ -1330,7 +1330,12 @@ void GLCanvas3D::reset_volumes()
m_volumes.clear();
m_dirty = true;
_set_warning_notification(EWarning::ObjectOutside, false);
auto pLater = wxGetApp().plater();
if (pLater && wxGetApp().plater()->get_notification_manager())
{
_set_warning_notification(EWarning::ObjectOutside, false);
}
}
//BBS: get current plater's bounding box
@@ -9695,8 +9700,15 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state)
//BBS: this may happened when exit the app, plater is null
if (!wxGetApp().plater())
return;
NotificationManager* notification_managerEx = wxGetApp().plater()->get_notification_manager();
auto& notification_manager = *wxGetApp().plater()->get_notification_manager();
if (!notification_managerEx)
{
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format("notification_manager is null");
return;
}
switch (error)
{
case PLATER_WARNING:
-4
View File
@@ -497,10 +497,6 @@ void about()
void login()
{
//LoginDialog dlg;
//dlg.ShowModal();
// ZUserLogin dlg;
SMUserLogin dlg;
dlg.run();
}
+28 -14
View File
@@ -4092,14 +4092,6 @@ void GUI_App::sm_request_user_logout()
m_login_userinfo.set_user_login(false);
}
try {
//if (!sm_login_dlg) {
// sm_login_dlg = new SMUserLogin(true);
//} else {
// delete sm_login_dlg;
// sm_login_dlg = new SMUserLogin(true);
//}
//// sm_login_dlg->ShowModal();
wxString region = wxString::FromUTF8(app_config->get_country_code());
std::string url = "";
if (region == "CN") {
@@ -4159,13 +4151,18 @@ 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("&dark_mode=" + dark_mode) + wxString::FromUTF8("&privacy_policy_isagree=" + useAgree);
} else {
return baseUrl + wxString::FromUTF8("?locale=") + lang + wxString::FromUTF8("-") + region +
wxString::FromUTF8("&dark_mode=" + dark_mode);
wxString::FromUTF8("&dark_mode=" + dark_mode) + wxString::FromUTF8("&privacy_policy_isagree=" + useAgree);
}
}
bool GUI_App::is_user_login()
@@ -7071,8 +7068,8 @@ bool GUI_App::run_wizard(ConfigWizard::RunReason reason, ConfigWizard::StartPage
}
auto isAgree = wxGetApp().app_config->get("app", "privacy_policy_isagree");
set_privacy_policy(isAgree == "true");
user_update_privacy_notify(isAgree == "true");
BOOST_LOG_TRIVIAL(warning) << "run_wizard changed the privacy policy with: " << (isAgree);
return res;
}
@@ -7276,6 +7273,23 @@ void GUI_App::cache_notify(const std::string& key, const json& res)
}
}
void GUI_App::user_update_privacy_notify(const bool& res)
{
set_privacy_policy(res);
json data;
data["privacy_policy_isagree"] = res;
for (const auto& instance : m_user_update_privacy_subscribers) {
auto ptr = instance.second.lock();
if (ptr) {
ptr->m_res_data = data;
ptr->send_to_js();
}
}
}
void GUI_App::user_login_notify(const json& res)
{
@@ -7291,8 +7305,8 @@ 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");
set_privacy_policy(isAgree == "true");
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()) {
BOOST_LOG_TRIVIAL(info) << "run wizard...";
run_wizard(ConfigWizard::RR_DATA_EMPTY);
+2 -2
View File
@@ -834,7 +834,7 @@ public:
std::unordered_map<void*, std::weak_ptr<SSWCP_Instance>> m_user_login_subscribers;
std::unordered_map<void*, std::weak_ptr<SSWCP_Instance>> m_device_card_subscribers;
std::unordered_map<void*, std::weak_ptr<SSWCP_Instance>> m_page_state_subscribers;
std::unordered_map<void*, std::weak_ptr<SSWCP_Instance>> m_user_update_privacy_subscribers;
struct CachePairCompare
{
bool operator()(const std::pair<void*, std::weak_ptr<SSWCP_Instance>>& lhs,
@@ -850,7 +850,7 @@ public:
void device_card_notify(const json& res);
void page_state_notify_webview(wxWebView* webview, const std::string& state);
void cache_notify(const std::string& key, const json& res);
void user_update_privacy_notify(const bool& res);
public:
bool sm_disconnect_current_machine(bool need_reload_printerview = true);
+14
View File
@@ -8,6 +8,7 @@
#include "I18N.hpp"
#include <wx/display.h>
#include "sentry_wrapper/SentryWrapper.hpp"
namespace fs = boost::filesystem;
@@ -268,6 +269,19 @@ void MarkdownTip::OnTitleChanged(wxWebViewEvent& event)
}
void MarkdownTip::OnError(wxWebViewEvent& event)
{
auto e = "unknown error";
switch (event.GetInt()) {
case wxWEBVIEW_NAV_ERR_CONNECTION: e = "wxWEBVIEW_NAV_ERR_CONNECTION"; break;
case wxWEBVIEW_NAV_ERR_CERTIFICATE: e = "wxWEBVIEW_NAV_ERR_CERTIFICATE"; break;
case wxWEBVIEW_NAV_ERR_AUTH: e = "wxWEBVIEW_NAV_ERR_AUTH"; break;
case wxWEBVIEW_NAV_ERR_SECURITY: e = "wxWEBVIEW_NAV_ERR_SECURITY"; break;
case wxWEBVIEW_NAV_ERR_NOT_FOUND: e = "wxWEBVIEW_NAV_ERR_NOT_FOUND"; break;
case wxWEBVIEW_NAV_ERR_REQUEST: e = "wxWEBVIEW_NAV_ERR_REQUEST"; break;
case wxWEBVIEW_NAV_ERR_USER_CANCELLED: e = "wxWEBVIEW_NAV_ERR_USER_CANCELLED"; break;
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)
+3 -2
View File
@@ -750,8 +750,9 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxWindow *pa
if (param == "privacy_policy_isagree")
{
app_config->set("app", "privacy_policy_isagree", checkbox->GetValue());
set_privacy_policy(checkbox->GetValue());
app_config->set("app", "privacy_policy_isagree", 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());
}
// if (param == "staff_pick_switch") {
// bool pbool = app_config->get("staff_pick_switch") == "true";
+3 -1
View File
@@ -15,6 +15,7 @@
#include <slic3r/GUI/Widgets/WebView.hpp>
#include <wx/webview.h>
#include "slic3r/GUI/SSWCP.hpp"
#include "sentry_wrapper/SentryWrapper.hpp"
namespace pt = boost::property_tree;
@@ -183,7 +184,8 @@ void PrinterWebView::OnError(wxWebViewEvent &evt)
e = "wxWEBVIEW_NAV_ERR_OTHER";
break;
}
BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format(": error loading page %1% %2% %3% %4%") %evt.GetURL() %evt.GetTarget() %e %evt.GetString();
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)
+14
View File
@@ -24,6 +24,7 @@
#include "Plater.hpp"
#include "BitmapCache.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "sentry_wrapper/SentryWrapper.hpp"
namespace Slic3r { namespace GUI {
@@ -445,6 +446,19 @@ void UpdateVersionDialog::OnTitleChanged(wxWebViewEvent& event)
}
void UpdateVersionDialog::OnError(wxWebViewEvent& event)
{
auto e = "unknown error";
switch (event.GetInt()) {
case wxWEBVIEW_NAV_ERR_CONNECTION: e = "wxWEBVIEW_NAV_ERR_CONNECTION"; break;
case wxWEBVIEW_NAV_ERR_CERTIFICATE: e = "wxWEBVIEW_NAV_ERR_CERTIFICATE"; break;
case wxWEBVIEW_NAV_ERR_AUTH: e = "wxWEBVIEW_NAV_ERR_AUTH"; break;
case wxWEBVIEW_NAV_ERR_SECURITY: e = "wxWEBVIEW_NAV_ERR_SECURITY"; break;
case wxWEBVIEW_NAV_ERR_NOT_FOUND: e = "wxWEBVIEW_NAV_ERR_NOT_FOUND"; break;
case wxWEBVIEW_NAV_ERR_REQUEST: e = "wxWEBVIEW_NAV_ERR_REQUEST"; break;
case wxWEBVIEW_NAV_ERR_USER_CANCELLED: e = "wxWEBVIEW_NAV_ERR_USER_CANCELLED"; break;
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();
}
+99 -2
View File
@@ -644,6 +644,10 @@ void SSWCP_Instance::sw_GetActiveFile()
if (iszip) {
std::weak_ptr<SSWCP_Instance> weak_self = shared_from_this();
if (m_work_thread.joinable())
m_work_thread.join();
m_work_thread = std::thread([file_path, file_name, weak_self]() {
auto self = weak_self.lock();
std::string zipname = generate_zip_path(file_path, file_name);
@@ -766,6 +770,8 @@ void SSWCP_Instance::sw_GetFileStream() {
auto targetname = SSWCP::get_display_filename();
std::weak_ptr<SSWCP_Instance> weak_self = shared_from_this();
if (m_work_thread.joinable())
m_work_thread.join();
m_work_thread = std::thread([oriname, targetname, weak_self]() {
auto self = weak_self.lock();
if (self) {
@@ -784,6 +790,8 @@ void SSWCP_Instance::sw_GetFileStream() {
}
});
} else {
if (m_work_thread.joinable())
m_work_thread.join();
m_work_thread = std::thread([file_path, weak_self]() {
auto self = weak_self.lock();
if (self) {
@@ -1167,6 +1175,7 @@ void SSWCP_Instance::sw_UnsubscribeAll() {
wxGetApp().m_recent_file_subscribers.clear();
wxGetApp().m_user_login_subscribers.clear();
wxGetApp().m_cache_subscribers.clear();
wxGetApp().m_user_update_privacy_subscribers.clear();
send_to_js();
finish_job();
@@ -1209,6 +1218,15 @@ void SSWCP_Instance::sw_Webview_Unsubscribe() {
}
}
auto& privacy_map = wxGetApp().m_user_update_privacy_subscribers;
for (auto iter = privacy_map.begin(); iter != privacy_map.end();) {
if (iter->first == m_webview) {
iter = privacy_map.erase(iter);
} else {
iter++;
}
}
send_to_js();
finish_job();
}
@@ -1225,6 +1243,7 @@ void SSWCP_Instance::sw_Unsubscribe_Filter() {
auto& device_map = wxGetApp().m_device_card_subscribers;
auto& login_map = wxGetApp().m_user_login_subscribers;
auto& privacy_map = wxGetApp().m_user_update_privacy_subscribers;
auto& recent_file_map = wxGetApp().m_recent_file_subscribers;
auto& cache_map = wxGetApp().m_cache_subscribers;
@@ -1263,6 +1282,23 @@ void SSWCP_Instance::sw_Unsubscribe_Filter() {
}
}
for (auto iter = privacy_map.begin(); iter != privacy_map.end();) {
if (iter->first == m_webview) {
auto ptr = iter->second.lock();
if (ptr) {
if (ptr->m_event_id == event_id) {
iter = privacy_map.erase(iter);
} else {
iter++;
}
} else {
iter = privacy_map.erase(iter);
}
} else {
iter++;
}
}
for (auto iter = recent_file_map.begin(); iter != recent_file_map.end();) {
if (iter->first == m_webview) {
auto ptr = iter->second.lock();
@@ -1331,7 +1367,26 @@ void SSWCP_Instance::sw_Unsubscribe_Filter() {
iter++;
}
}
} else if (cmd == "sw_SubscribeLocalDevices") {
} else if (cmd == UPDATE_PRIVACY_STATUS) {
for (auto iter = privacy_map.begin(); iter != privacy_map.end();) {
if (iter->first == m_webview) {
auto ptr = iter->second.lock();
if (ptr) {
if (event_id == "" || (event_id != "" && event_id == ptr->m_event_id)) {
iter = privacy_map.erase(iter);
} else {
iter++;
}
} else {
iter = privacy_map.erase(iter);
}
} else {
iter++;
}
}
}else if (cmd == "sw_SubscribeLocalDevices") {
for (auto iter = device_map.begin(); iter != device_map.end();) {
if (iter->first == m_webview) {
auto ptr = iter->second.lock();
@@ -1365,7 +1420,7 @@ void SSWCP_Instance::sw_Unsubscribe_Filter() {
iter++;
}
}
}
}
send_to_js();
finish_job();
@@ -2703,6 +2758,9 @@ void SSWCP_MachineOption_Instance::sw_GetPrintZip()
std::weak_ptr<SSWCP_Instance> weak_self = shared_from_this();
if (m_work_thread.joinable())
m_work_thread.join();
m_work_thread = std::thread([oriname, targetname, weak_self]() {
auto self = weak_self.lock();
if (self) {
@@ -3915,6 +3973,8 @@ void SSWCP_MachineConnect_Instance::sw_test_connect() {
// 错误处理
finish_job();
} else {
if (m_work_thread.joinable())
m_work_thread.join();
m_work_thread = std::thread([this, host] {
wxString msg;
bool res = host->test(msg);
@@ -3967,6 +4027,10 @@ void SSWCP_MachineConnect_Instance::sw_disconnect() {
std::string dev_id = m_param_data.count("dev_id") ? m_param_data["dev_id"] : "";
auto weak_self = std::weak_ptr<SSWCP_Instance>(shared_from_this());
if (m_work_thread.joinable())
m_work_thread.join();
m_work_thread = std::thread([weak_self, need_reload, dev_id](){
auto self = weak_self.lock();
@@ -4724,6 +4788,10 @@ void SSWCP_MqttAgent_Instance::sw_mqtt_connect()
std::weak_ptr<SSWCP_Instance> weak_ptr = shared_from_this();
auto engine = get_current_engine();
if (m_work_thread.joinable())
m_work_thread.join();
m_work_thread = std::thread([weak_ptr, engine]() {
if (!weak_ptr.lock()) {
return;
@@ -4776,6 +4844,10 @@ void SSWCP_MqttAgent_Instance::sw_mqtt_disconnect()
std::weak_ptr<SSWCP_Instance> weak_ptr = shared_from_this();
auto engine = get_current_engine();
if (m_work_thread.joinable())
m_work_thread.join();
m_work_thread = std::thread([weak_ptr, engine]() {
if (!weak_ptr.lock()) {
return;
@@ -4850,6 +4922,10 @@ void SSWCP_MqttAgent_Instance::sw_mqtt_subscribe()
std::weak_ptr<SSWCP_Instance> weak_ptr = shared_from_this();
auto engine = get_current_engine();
if (m_work_thread.joinable())
m_work_thread.join();
m_work_thread = std::thread([weak_ptr, engine, topic, qos]() {
if (!weak_ptr.lock()) {
return;
@@ -4923,6 +4999,10 @@ void SSWCP_MqttAgent_Instance::sw_mqtt_unsubscribe() {
std::weak_ptr<SSWCP_Instance> weak_ptr = shared_from_this();
auto engine = get_current_engine();
if (m_work_thread.joinable())
m_work_thread.join();
m_work_thread = std::thread([weak_ptr, engine, topic]() {
if (!weak_ptr.lock()) {
return;
@@ -5110,6 +5190,10 @@ void SSWCP_MqttAgent_Instance::sw_mqtt_set_engine()
} else {
auto weak_self = std::weak_ptr<SSWCP_Instance>(shared_from_this());
// 设置断联回调
if (m_work_thread.joinable())
m_work_thread.join();
m_work_thread = std::thread([weak_self, host, connect_params, link_mode, id, userid, reload_device_view] {
auto self = weak_self.lock();
wxString msg = "";
@@ -5583,6 +5667,10 @@ void SSWCP_MqttAgent_Instance::sw_mqtt_publish()
std::weak_ptr<SSWCP_Instance> weak_ptr = shared_from_this();
auto engine = get_current_engine();
if (m_work_thread.joinable())
m_work_thread.join();
m_work_thread = std::thread([weak_ptr, engine, topic, payload, qos]() {
if (!weak_ptr.lock()) {
return;
@@ -5900,6 +5988,15 @@ void SSWCP::on_webview_delete(wxWebView* view)
}
}
auto& privacy_map = wxGetApp().m_user_update_privacy_subscribers;
for (auto iter = privacy_map.begin(); iter != privacy_map.end();) {
if (iter->first == view) {
iter = privacy_map.erase(iter);
} else {
iter++;
}
}
auto& recent_file_map = wxGetApp().m_recent_file_subscribers;
for (auto iter = recent_file_map.begin(); iter != recent_file_map.end();) {
if (iter->first == view) {
+5 -1
View File
@@ -23,6 +23,8 @@ using namespace nlohmann;
namespace asio = boost::asio;
using tcp = asio::ip::tcp;
#define UPDATE_PRIVACY_STATUS "sw_SubUserUpdatePrivacy"
namespace Slic3r { namespace GUI {
class WCP_Logger
@@ -185,7 +187,7 @@ public:
void update_filament_info(const json& objects, bool send_message = false);
protected:
std::thread m_work_thread; // Worker thread
std::thread m_work_thread; // Worker thread
public:
std::string m_cmd; // Command to execute
@@ -525,6 +527,8 @@ private:
void sw_SubscribeUserLoginState();
void sw_SubUserUpdatePrivacy();
};
// Instance class for homepage business
+14 -1
View File
@@ -5,6 +5,7 @@
#include "SSWCP.hpp"
#include <wx/sizer.h>
#include <slic3r/GUI/Widgets/WebView.hpp>
#include "sentry_wrapper/SentryWrapper.hpp"
namespace Slic3r { namespace GUI {
@@ -105,7 +106,19 @@ void WebDeviceDialog::OnDocumentLoaded(wxWebViewEvent &evt)
void WebDeviceDialog::OnError(wxWebViewEvent &evt)
{
wxLogError("Web View Error: %s", evt.GetString());
auto e = "unknown error";
switch (evt.GetInt()) {
case wxWEBVIEW_NAV_ERR_CONNECTION: e = "wxWEBVIEW_NAV_ERR_CONNECTION"; break;
case wxWEBVIEW_NAV_ERR_CERTIFICATE: e = "wxWEBVIEW_NAV_ERR_CERTIFICATE"; break;
case wxWEBVIEW_NAV_ERR_AUTH: e = "wxWEBVIEW_NAV_ERR_AUTH"; break;
case wxWEBVIEW_NAV_ERR_SECURITY: e = "wxWEBVIEW_NAV_ERR_SECURITY"; break;
case wxWEBVIEW_NAV_ERR_NOT_FOUND: e = "wxWEBVIEW_NAV_ERR_NOT_FOUND"; break;
case wxWEBVIEW_NAV_ERR_REQUEST: e = "wxWEBVIEW_NAV_ERR_REQUEST"; break;
case wxWEBVIEW_NAV_ERR_USER_CANCELLED: e = "wxWEBVIEW_NAV_ERR_USER_CANCELLED"; break;
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)
+1 -1
View File
@@ -29,7 +29,7 @@
#include "GUI_App.hpp"
namespace Slic3r { namespace GUI {
//not use on snapmaker orca
class DownPluginFrame : public wxDialog
{
public:
+16 -25
View File
@@ -34,7 +34,7 @@
#include <libslic3r/Utils.hpp>
#include "CreatePresetsDialog.hpp"
#include <mutex>
#include "bury_cfg/bury_point.hpp"
#include "sentry_wrapper/SentryWrapper.hpp"
using namespace nlohmann;
@@ -596,32 +596,22 @@ void GuideFrame::OnRunScriptArrayWithEmulationLevel(wxCommandEvent &WXUNUSED(evt
/**
* Callback invoked when a loading error occurs
*/
void GuideFrame::OnError(wxWebViewEvent &evt)
void GuideFrame::OnError(wxWebViewEvent& event)
{
#define WX_ERROR_CASE(type) \
case type: category = #type; break;
wxString category;
switch (evt.GetInt()) {
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_CONNECTION);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_CERTIFICATE);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_AUTH);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_SECURITY);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_NOT_FOUND);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_REQUEST);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_USER_CANCELLED);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_OTHER);
auto e = "unknown error";
switch (event.GetInt()) {
case wxWEBVIEW_NAV_ERR_CONNECTION: e = "wxWEBVIEW_NAV_ERR_CONNECTION"; break;
case wxWEBVIEW_NAV_ERR_CERTIFICATE: e = "wxWEBVIEW_NAV_ERR_CERTIFICATE"; break;
case wxWEBVIEW_NAV_ERR_AUTH: e = "wxWEBVIEW_NAV_ERR_AUTH"; break;
case wxWEBVIEW_NAV_ERR_SECURITY: e = "wxWEBVIEW_NAV_ERR_SECURITY"; break;
case wxWEBVIEW_NAV_ERR_NOT_FOUND: e = "wxWEBVIEW_NAV_ERR_NOT_FOUND"; break;
case wxWEBVIEW_NAV_ERR_REQUEST: e = "wxWEBVIEW_NAV_ERR_REQUEST"; break;
case wxWEBVIEW_NAV_ERR_USER_CANCELLED: e = "wxWEBVIEW_NAV_ERR_USER_CANCELLED"; break;
case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
}
// wxLogMessage("%s", "Error; url='" + evt.GetURL() + "', error='" +
// category + " (" + evt.GetString() + ")'");
// Show the info bar with an error
// m_info->ShowMessage(_L("An error occurred loading ") + evt.GetURL() +
// "\n" + "'" + category + "'", wxICON_ERROR);
BOOST_LOG_TRIVIAL(trace) << "GuideFrame::OnError: An error occurred loading " << evt.GetURL() << category;
UpdateState();
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))
@@ -650,7 +640,8 @@ int GuideFrame::SaveProfile()
// } else
// m_MainPtr->app_config->set(std::string(m_SectionName.mb_str()), "privacyuse", "0");
m_MainPtr->app_config->set("app", "privacy_policy_isagree", PrivacyUse);
set_privacy_policy(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);
m_MainPtr->app_config->set_bool("stealth_mode", StealthMode);
+16 -2
View File
@@ -6,6 +6,7 @@
#include <wx/sizer.h>
#include <slic3r/GUI/Widgets/WebView.hpp>
#include "NotificationManager.hpp"
#include "sentry_wrapper/SentryWrapper.hpp"
namespace Slic3r { namespace GUI {
@@ -151,9 +152,22 @@ void WebPreprintDialog::OnDocumentLoaded(wxWebViewEvent &evt)
evt.Skip();
}
void WebPreprintDialog::OnError(wxWebViewEvent &evt)
void WebPreprintDialog::OnError(wxWebViewEvent &event)
{
wxLogError("Web View Error: %s", evt.GetString());
auto e = "unknown error";
switch (event.GetInt()) {
case wxWEBVIEW_NAV_ERR_CONNECTION: e = "wxWEBVIEW_NAV_ERR_CONNECTION"; break;
case wxWEBVIEW_NAV_ERR_CERTIFICATE: e = "wxWEBVIEW_NAV_ERR_CERTIFICATE"; break;
case wxWEBVIEW_NAV_ERR_AUTH: e = "wxWEBVIEW_NAV_ERR_AUTH"; break;
case wxWEBVIEW_NAV_ERR_SECURITY: e = "wxWEBVIEW_NAV_ERR_SECURITY"; break;
case wxWEBVIEW_NAV_ERR_NOT_FOUND: e = "wxWEBVIEW_NAV_ERR_NOT_FOUND"; break;
case wxWEBVIEW_NAV_ERR_REQUEST: e = "wxWEBVIEW_NAV_ERR_REQUEST"; break;
case wxWEBVIEW_NAV_ERR_USER_CANCELLED: e = "wxWEBVIEW_NAV_ERR_USER_CANCELLED"; break;
case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
}
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)
+14 -24
View File
@@ -6,7 +6,7 @@
#include "libslic3r/AppConfig.hpp"
#include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "common_func/common_func.hpp"
#include "sentry_wrapper/SentryWrapper.hpp"
#include <wx/sizer.h>
#include <wx/toolbar.h>
@@ -692,32 +692,22 @@ void WebPresetDialog::OnRunScriptArrayWithEmulationLevel(wxCommandEvent& WXUNUSE
/**
* Callback invoked when a loading error occurs
*/
void WebPresetDialog::OnError(wxWebViewEvent& evt)
void WebPresetDialog::OnError(wxWebViewEvent& event)
{
#define WX_ERROR_CASE(type) \
case type: category = #type; break;
wxString category;
switch (evt.GetInt()) {
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_CONNECTION);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_CERTIFICATE);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_AUTH);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_SECURITY);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_NOT_FOUND);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_REQUEST);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_USER_CANCELLED);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_OTHER);
auto e = "unknown error";
switch (event.GetInt()) {
case wxWEBVIEW_NAV_ERR_CONNECTION: e = "wxWEBVIEW_NAV_ERR_CONNECTION"; break;
case wxWEBVIEW_NAV_ERR_CERTIFICATE: e = "wxWEBVIEW_NAV_ERR_CERTIFICATE"; break;
case wxWEBVIEW_NAV_ERR_AUTH: e = "wxWEBVIEW_NAV_ERR_AUTH"; break;
case wxWEBVIEW_NAV_ERR_SECURITY: e = "wxWEBVIEW_NAV_ERR_SECURITY"; break;
case wxWEBVIEW_NAV_ERR_NOT_FOUND: e = "wxWEBVIEW_NAV_ERR_NOT_FOUND"; break;
case wxWEBVIEW_NAV_ERR_REQUEST: e = "wxWEBVIEW_NAV_ERR_REQUEST"; break;
case wxWEBVIEW_NAV_ERR_USER_CANCELLED: e = "wxWEBVIEW_NAV_ERR_USER_CANCELLED"; break;
case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
}
// wxLogMessage("%s", "Error; url='" + evt.GetURL() + "', error='" +
// category + " (" + evt.GetString() + ")'");
// Show the info bar with an error
// m_info->ShowMessage(_L("An error occurred loading ") + evt.GetURL() +
// "\n" + "'" + category + "'", wxICON_ERROR);
BOOST_LOG_TRIVIAL(trace) << "WebPresetDialog::OnError: An error occurred loading " << evt.GetURL() << category;
UpdateState();
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))
+13 -34
View File
@@ -387,42 +387,21 @@ void SMUserLogin::OnRunScriptArrayWithEmulationLevel(wxCommandEvent &WXUNUSED(ev
/**
* Callback invoked when a loading error occurs
*/
void SMUserLogin::OnError(wxWebViewEvent &evt)
void SMUserLogin::OnError(wxWebViewEvent &event)
{
#define WX_ERROR_CASE(type) \
case type: category = #type; break;
wxString category;
switch (evt.GetInt()) {
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_CONNECTION);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_CERTIFICATE);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_AUTH);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_SECURITY);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_NOT_FOUND);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_REQUEST);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_USER_CANCELLED);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_OTHER);
auto e = "unknown error";
switch (event.GetInt()) {
case wxWEBVIEW_NAV_ERR_CONNECTION: e = "wxWEBVIEW_NAV_ERR_CONNECTION"; break;
case wxWEBVIEW_NAV_ERR_CERTIFICATE: e = "wxWEBVIEW_NAV_ERR_CERTIFICATE"; break;
case wxWEBVIEW_NAV_ERR_AUTH: e = "wxWEBVIEW_NAV_ERR_AUTH"; break;
case wxWEBVIEW_NAV_ERR_SECURITY: e = "wxWEBVIEW_NAV_ERR_SECURITY"; break;
case wxWEBVIEW_NAV_ERR_NOT_FOUND: e = "wxWEBVIEW_NAV_ERR_NOT_FOUND"; break;
case wxWEBVIEW_NAV_ERR_REQUEST: e = "wxWEBVIEW_NAV_ERR_REQUEST"; break;
case wxWEBVIEW_NAV_ERR_USER_CANCELLED: e = "wxWEBVIEW_NAV_ERR_USER_CANCELLED"; break;
case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
}
if( evt.GetInt()==wxWEBVIEW_NAV_ERR_CONNECTION )
{
if(m_timer!=NULL)
m_timer->Stop();
m_networkOk = false;
if (m_networkOk==false)
ShowErrorPage();
}
// wxLogMessage("%s", "Error; url='" + evt.GetURL() + "', error='" +
// category + " (" + evt.GetString() + ")'");
// Show the info bar with an error
// m_info->ShowMessage(_L("An error occurred loading ") + evt.GetURL() +
// "\n" + "'" + category + "'", wxICON_ERROR);
UpdateState();
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))
+16 -2
View File
@@ -6,6 +6,7 @@
#include "SSWCP.hpp"
#include <wx/sizer.h>
#include <slic3r/GUI/Widgets/WebView.hpp>
#include "sentry_wrapper/SentryWrapper.hpp"
namespace Slic3r { namespace GUI {
@@ -114,9 +115,22 @@ void WebUrlDialog::OnDocumentLoaded(wxWebViewEvent &evt)
evt.Skip();
}
void WebUrlDialog::OnError(wxWebViewEvent &evt)
void WebUrlDialog::OnError(wxWebViewEvent &event)
{
wxLogError("Web View Error: %s", evt.GetString());
auto e = "unknown error";
switch (event.GetInt()) {
case wxWEBVIEW_NAV_ERR_CONNECTION: e = "wxWEBVIEW_NAV_ERR_CONNECTION"; break;
case wxWEBVIEW_NAV_ERR_CERTIFICATE: e = "wxWEBVIEW_NAV_ERR_CERTIFICATE"; break;
case wxWEBVIEW_NAV_ERR_AUTH: e = "wxWEBVIEW_NAV_ERR_AUTH"; break;
case wxWEBVIEW_NAV_ERR_SECURITY: e = "wxWEBVIEW_NAV_ERR_SECURITY"; break;
case wxWEBVIEW_NAV_ERR_NOT_FOUND: e = "wxWEBVIEW_NAV_ERR_NOT_FOUND"; break;
case wxWEBVIEW_NAV_ERR_REQUEST: e = "wxWEBVIEW_NAV_ERR_REQUEST"; break;
case wxWEBVIEW_NAV_ERR_USER_CANCELLED: e = "wxWEBVIEW_NAV_ERR_USER_CANCELLED"; break;
case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
}
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)
+14 -33
View File
@@ -5,7 +5,7 @@
#include "libslic3r/AppConfig.hpp"
#include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "common_func/common_func.hpp"
#include "sentry_wrapper/SentryWrapper.hpp"
#include <wx/sizer.h>
#include <wx/toolbar.h>
@@ -361,40 +361,21 @@ void ZUserLogin::OnRunScriptArrayWithEmulationLevel(wxCommandEvent &WXUNUSED(evt
/**
* Callback invoked when a loading error occurs
*/
void ZUserLogin::OnError(wxWebViewEvent &evt)
void ZUserLogin::OnError(wxWebViewEvent &event)
{
#define WX_ERROR_CASE(type) \
case type: category = #type; break;
wxString category;
switch (evt.GetInt()) {
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_CONNECTION);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_CERTIFICATE);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_AUTH);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_SECURITY);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_NOT_FOUND);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_REQUEST);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_USER_CANCELLED);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_OTHER);
auto e = "unknown error";
switch (event.GetInt()) {
case wxWEBVIEW_NAV_ERR_CONNECTION: e = "wxWEBVIEW_NAV_ERR_CONNECTION"; break;
case wxWEBVIEW_NAV_ERR_CERTIFICATE: e = "wxWEBVIEW_NAV_ERR_CERTIFICATE"; break;
case wxWEBVIEW_NAV_ERR_AUTH: e = "wxWEBVIEW_NAV_ERR_AUTH"; break;
case wxWEBVIEW_NAV_ERR_SECURITY: e = "wxWEBVIEW_NAV_ERR_SECURITY"; break;
case wxWEBVIEW_NAV_ERR_NOT_FOUND: e = "wxWEBVIEW_NAV_ERR_NOT_FOUND"; break;
case wxWEBVIEW_NAV_ERR_REQUEST: e = "wxWEBVIEW_NAV_ERR_REQUEST"; break;
case wxWEBVIEW_NAV_ERR_USER_CANCELLED: e = "wxWEBVIEW_NAV_ERR_USER_CANCELLED"; break;
case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
}
if( evt.GetInt()==wxWEBVIEW_NAV_ERR_CONNECTION )
{
if(m_timer!=NULL)
m_timer->Stop();
if (m_networkOk==false)
ShowErrorPage();
}
// wxLogMessage("%s", "Error; url='" + evt.GetURL() + "', error='" +
// category + " (" + evt.GetString() + ")'");
// Show the info bar with an error
// m_info->ShowMessage(_L("An error occurred loading ") + evt.GetURL() +
// "\n" + "'" + category + "'", wxICON_ERROR);
UpdateState();
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))
+14 -30
View File
@@ -4,7 +4,7 @@
#include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "slic3r/GUI/MainFrame.hpp"
#include "common_func/common_func.hpp"
#include "sentry_wrapper/SentryWrapper.hpp"
#include "../Utils/Http.hpp"
#include "SSWCP.hpp"
@@ -894,37 +894,21 @@ void WebViewPanel::OnSelectAll(wxCommandEvent& WXUNUSED(evt))
/**
* Callback invoked when a loading error occurs
*/
void WebViewPanel::OnError(wxWebViewEvent& evt)
void WebViewPanel::OnError(wxWebViewEvent& event)
{
#define WX_ERROR_CASE(type) \
case type: \
category = #type; \
break;
wxString category;
switch (evt.GetInt())
{
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_CONNECTION);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_CERTIFICATE);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_AUTH);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_SECURITY);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_NOT_FOUND);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_REQUEST);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_USER_CANCELLED);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_OTHER);
auto e = "unknown error";
switch (event.GetInt()) {
case wxWEBVIEW_NAV_ERR_CONNECTION: e = "wxWEBVIEW_NAV_ERR_CONNECTION"; break;
case wxWEBVIEW_NAV_ERR_CERTIFICATE: e = "wxWEBVIEW_NAV_ERR_CERTIFICATE"; break;
case wxWEBVIEW_NAV_ERR_AUTH: e = "wxWEBVIEW_NAV_ERR_AUTH"; break;
case wxWEBVIEW_NAV_ERR_SECURITY: e = "wxWEBVIEW_NAV_ERR_SECURITY"; break;
case wxWEBVIEW_NAV_ERR_NOT_FOUND: e = "wxWEBVIEW_NAV_ERR_NOT_FOUND"; break;
case wxWEBVIEW_NAV_ERR_REQUEST: e = "wxWEBVIEW_NAV_ERR_REQUEST"; break;
case wxWEBVIEW_NAV_ERR_USER_CANCELLED: e = "wxWEBVIEW_NAV_ERR_USER_CANCELLED"; break;
case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
}
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << ": [" << category << "] " << evt.GetString().ToUTF8().data();
if (wxGetApp().get_mode() == comDevelop)
{
wxLogMessage("%s", "Error; url='" + evt.GetURL() + "', error='" + category + " (" + evt.GetString() + ")'");
// Show the info bar with an error
m_info->ShowMessage(_L("An error occurred loading ") + evt.GetURL() + "\n" + "'" + category + "'", wxICON_ERROR);
}
UpdateState();
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);
}