Merge pull request #70 from Snapmaker/dev_bury_point_alves

Dev bury point alves
This commit is contained in:
Alves
2025-12-18 14:44:56 +08:00
committed by GitHub
37 changed files with 452 additions and 97 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ add_library(nlohmann_json INTERFACE)
target_include_directories(nlohmann_json SYSTEM
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/..
)
target_sources(nlohmann_json INTERFACE
+2 -1
View File
@@ -62,7 +62,8 @@ function GotoPolicyPage()
SendWXMessage( JSON.stringify(tSend) );
window.location.href="../21/index.html";
window.location.href="../3/index.html";
}
+1 -1
View File
@@ -104,7 +104,7 @@
</div>
<div id="AcceptArea">
<div class="GrayBtn trans" id="PreBtn" tid="t8" onclick="window.open('../1/index.html','_self')">Back</div>
<div class="GrayBtn trans" id="PreBtn" tid="t8" onclick="window.open('../3/index.html','_self')">Back</div>
<div class="NormalBtn trans" id="AcceptBtn" tid="t9" onclick="GotoFilamentPage()">Next</div>
</div>
+22
View File
@@ -1,3 +1,25 @@
#Title {
height: auto;
min-height: 60px;
padding: 12px 25px;
box-sizing: border-box;
}
#Title div {
font-size: 16px;
line-height: 24px;
word-wrap: break-word;
white-space: normal;
text-align: center;
}
#Content {
flex: 1;
height: auto;
}
.PolicyArea
{
background-color: #4A4A51;
+65 -53
View File
@@ -1,31 +1,12 @@
var m_Region = '';
function OnInit()
{
TranslatePage();
SendPrivacySelect();
}
function SendPrivacySelect()
{
let nVal="refuse";
if( $('#ChoosePrivacy').is(':checked') )
nVal="agree";
var tSend={};
tSend['sequence_id']=Math.round(new Date() / 1000);
tSend['command']="user_private_choice";
tSend['data']={};
tSend['data']['action']=nVal;
SendWXMessage( JSON.stringify(tSend) );
}
function GotoNextPage()
{
RequestProfile();
RequestProfile();
}
function RequestProfile()
@@ -40,41 +21,72 @@ function RequestProfile()
function HandleStudio( pVal )
{
let strCmd=pVal['command'];
//alert(strCmd);
if(strCmd=='response_userguide_profile')
{
HandleModelInfo(pVal['response']);
if(pVal['response'] && pVal['response']['region']) {
m_Region = pVal['response']['region'];
}
}
}
function HandleModelInfo( pVal )
{
let Modellist=pVal["model"];
let nModel=Modellist.length;
if(nModel==1)
{
// let pModel=Modellist[0];
//
// var tSend={};
// tSend['sequence_id']=Math.round(new Date() / 1000);
// tSend['command']="save_userguide_models";
// tSend['data']={};
//
// let ModelName=pModel['model'];
//
// tSend['data'][ModelName]={};
// tSend['data'][ModelName]['model']=pModel['model'];
// tSend['data'][ModelName]['nozzle_diameter']=pModel['nozzle_diameter'];
// tSend['data'][ModelName]['vendor']=pModel['vendor'];
//
// SendWXMessage( JSON.stringify(tSend) );
window.location.href="../22/index.html";
return;
}
window.location.href="../21/index.html";
}
function GotoBackPage()
{
window.location.href="../11/index.html";
}
function GotoNextPage()
{
SendPrivacyChoice("agree");
window.location.href="../21/index.html";
}
function GotoSkipPage()
{
SendPrivacyChoice("refuse");
window.location.href="../21/index.html";
}
function SendPrivacyChoice(action)
{
var tSend={};
tSend['sequence_id']=Math.round(new Date() / 1000);
tSend['command']="user_private_choice";
tSend['data']={};
tSend['data']['action']=action; // "agree" 或 "refuse"
SendWXMessage( JSON.stringify(tSend) );
}
function OpenPrivacyPolicy()
{
var privacyUrl = "";
if(m_Region === "China") {
privacyUrl = "https://www.snapmaker.cn/privacy-policy.html";
} else {
privacyUrl = "https://www.snapmaker.com/privacy-policy";
}
var tSend={};
tSend['sequence_id']=Math.round(new Date() / 1000);
tSend['command']="common_openurl";
tSend['url']=privacyUrl;
tSend['local']=m_Region
SendWXMessage( JSON.stringify(tSend) );
}
+6 -9
View File
@@ -16,24 +16,21 @@
</head>
<body onLoad="OnInit()">
<div id="Title">
<div class="trans" tid="t6">We kindly request your help to improve<br/> everyone's printing</div>
<div class="trans" tid="t6">We kindly request your help to improve everyone's printing.<br/>Come and Join our Customer Experience Improvement Program</div>
</div>
<div id="Content">
<div id="PolicyTxt" class="TextS2 TextArea1 ZScrol">
<a class="trans" tid="t54">In the 3D Printing community, we learn from each others successes and failures to adjust our own slicing parameters and settings. Orca Slicer follows the same principle and uses machine learning to improve its performance from the successes and failures of the vast number of prints by our users. We are training Orca Slicer to be smarter by feeding them the real-world data. If you are willing, this service will access information from your error logs and usage logs, which may include information described in </a><a class="HyperLink trans" tid="t55" href="https://bambulab.com/policies/privacy" target="_blank">Privacy Policy</a><a class="trans" tid="t56">
<a class="trans" tid="t54">In the 3D Printing community, we learn from each others successes and failures to adjust our own slicing parameters and settings. Bambu Studio follows the same principle and uses machine learning to improve its performance from the successes and failures of the vast number of prints by our users. We are training Bambu Studio to be smarter by feeding them the real-world data. If you are willing, this service will access information from your error logs and usage logs, which may include information described in </a><a class="HyperLink trans" tid="t55" onClick="OpenPrivacyPolicy()">Privacy Policy</a><a class="trans" tid="t56">
. We will not collect any Personal Data by which an individual can be identified directly or indirectly, including without limitation names, addresses, payment information, or phone numbers. By enabling this service, you agree to these terms and the statement about Privacy Policy.
</a>
<p class="trans" tid="t113" style="text-indent:2em;">You may change your choice in preference anytime.</p>
</div>
<br/>
<label> <!-- ORCA use label tag to allow checkbox to toggle when user clicked to text -->
<input id="ChoosePrivacy" type="checkbox" onClick="SendPrivacySelect()" onChange="SendPrivacySelect()" />
<span class="trans TextS1" tid="t7">Allow sending anonymous data</span>
</label>
</div>
<div id="AcceptArea">
<div class="GrayBtn trans" tid="t8" id="PreBtn" onclick="window.open('../11/index.html','_self')">Back</div>
<div class="NormalBtn trans" tid="t9" id="AcceptBtn" onclick="GotoNextPage()">Next</div>
<div class="GrayBtn trans" tid="t8" id="PreBtn" onclick="GotoBackPage()">Back</div>
<div class="GrayBtn trans" tid="t52" id="SkipBtn" onclick="GotoSkipPage()">Skip</div>
<div class="NormalBtn trans" tid="t112" id="AcceptBtn" onclick="GotoNextPage()">Join the Program</div>
</div>
</body>
</html>
+1 -1
View File
@@ -19,7 +19,7 @@
</div>
<div id="Content">
<div id="PolicyTxt">
<a class="trans" tid="t54">In the 3D Printing community, we learn from each others successes and failures to adjust our own slicing parameters and settings. Orca Slicer follows the same principle and uses machine learning to improve its performance from the successes and failures of the vast number of prints by our users. We are training Orca Slicer to be smarter by feeding them the real-world data. If you are willing, this service will access information from your error logs and usage logs, which may include information described in </a><a class="HyperLink trans" tid="t55" href="https://bambulab.com/policies/privacy" target="_blank">Privacy Policy</a><a class="trans" tid="t56">
<a class="trans" tid="t54">In the 3D Printing community, we learn from each others successes and failures to adjust our own slicing parameters and settings. Orca Slicer follows the same principle and uses machine learning to improve its performance from the successes and failures of the vast number of prints by our users. We are training Orca Slicer to be smarter by feeding them the real-world data. If you are willing, this service will access information from your error logs and usage logs, which may include information described in </a><a class="HyperLink trans" tid="t55" href="https://www.snapmaker.com/privacy-policy" target="_blank">Privacy Policy</a><a class="trans" tid="t56">
. We will not collect any Personal Data by which an individual can be identified directly or indirectly, including without limitation names, addresses, payment information, or phone numbers. By enabling this service, you agree to these terms and the statement about Privacy Policy.
</a>
</div>
+8 -5
View File
@@ -115,9 +115,10 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dev-utils/platform/msw/Snapmaker_Orca
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dev-utils/platform/msw/Snapmaker_Orca.manifest.in ${CMAKE_CURRENT_BINARY_DIR}/Snapmaker_Orca.manifest @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dev-utils/platform/osx/Info.plist.in ${CMAKE_CURRENT_BINARY_DIR}/Info.plist @ONLY)
if (WIN32)
add_library(Snapmaker_Orca SHARED Snapmaker_Orca.cpp Snapmaker_Orca.hpp dev-utils/BaseException.cpp dev-utils/BaseException.h dev-utils/StackWalker.cpp dev-utils/StackWalker.h sentry_wrapper/SentryWrapper.hpp sentry_wrapper/SentryWrapper.cpp)
add_library(Snapmaker_Orca SHARED Snapmaker_Orca.cpp Snapmaker_Orca.hpp dev-utils/BaseException.cpp dev-utils/BaseException.h dev-utils/StackWalker.cpp dev-utils/StackWalker.h sentry_wrapper/SentryWrapper.hpp sentry_wrapper/SentryWrapper.cpp bury_cfg/bury_point.hpp bury_cfg/bury_point.cpp common_func/common_func.hpp common_func/common_func.cpp)
target_compile_definitions(Snapmaker_Orca PRIVATE BURY_EXPORTS)
else ()
add_executable(Snapmaker_Orca Snapmaker_Orca.cpp Snapmaker_Orca.hpp sentry_wrapper/SentryWrapper.hpp sentry_wrapper/SentryWrapper.cpp)
add_executable(Snapmaker_Orca Snapmaker_Orca.cpp Snapmaker_Orca.hpp sentry_wrapper/SentryWrapper.hpp sentry_wrapper/SentryWrapper.cpp bury_cfg/bury_point.hpp bury_cfg/bury_point.cpp common_func/common_func.hpp common_func/common_func.cpp)
endif ()
if (MINGW)
@@ -181,7 +182,8 @@ if (WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -municode")
endif()
add_executable(Snapmaker_Orca_app_gui WIN32 Snapmaker_Orca_app_msvc.cpp sentry_wrapper/SentryWrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/Snapmaker_Orca.rc)
add_executable(Snapmaker_Orca_app_gui WIN32 Snapmaker_Orca_app_msvc.cpp sentry_wrapper/SentryWrapper.cpp common_func/common_func.cpp ${CMAKE_CURRENT_BINARY_DIR}/Snapmaker_Orca.rc)
# Generate debug symbols even in release mode.
if(MSVC)
target_link_options(Snapmaker_Orca_app_gui PUBLIC "$<$<CONFIG:RELEASE>:/DEBUG>")
@@ -189,10 +191,11 @@ if (WIN32)
target_compile_definitions(Snapmaker_Orca_app_gui PRIVATE -DSLIC3R_WRAPPER_NOCONSOLE)
add_dependencies(Snapmaker_Orca_app_gui Snapmaker_Orca)
set_target_properties(Snapmaker_Orca_app_gui PROPERTIES OUTPUT_NAME "snapmaker-orca")
if (SLIC3R_SENTRY)
target_link_libraries(Snapmaker_Orca_app_gui PRIVATE boost_headeronly sentry::sentry)
target_link_libraries(Snapmaker_Orca_app_gui PRIVATE boost_headeronly sentry::sentry nlohmann_json Snapmaker_Orca)
else()
target_link_libraries(Snapmaker_Orca_app_gui PRIVATE boost_headeronly)
target_link_libraries(Snapmaker_Orca_app_gui PRIVATE boost_headeronly nlohmann_json Snapmaker_Orca)
endif()
if (SLIC3R_SENTRY)
target_compile_definitions(Snapmaker_Orca_app_gui PRIVATE SLIC3R_SENTRY)
+4 -1
View File
@@ -6296,9 +6296,12 @@ extern "C" {
int main(int argc, char **argv)
{
initSentry();
auto soft_start_time = get_time_timestamp();
auto res = CLI().run(argc, argv);
auto soft_end_time = get_time_timestamp();
std::string softEndTime = BP_SOFT_WORKS_TIME + std::string(":") + get_works_time(soft_end_time - soft_start_time);
sentryReportLog(SENTRY_LOG_TRACE, softEndTime, BP_START_SOFT);
exitSentry();
return res;
+11
View File
@@ -227,6 +227,7 @@ int wmain(int argc, wchar_t** argv)
_set_error_mode(_OUT_TO_MSGBOX);
initSentry();
auto soft_start_time = get_time_timestamp();
std::vector<wchar_t*> argv_extended;
argv_extended.emplace_back(argv[0]);
@@ -292,6 +293,10 @@ int wmain(int argc, wchar_t** argv)
HINSTANCE hInstance_Slic3r = LoadLibraryExW(path_to_slic3r, nullptr, 0);
if (hInstance_Slic3r == nullptr) {
printf("Snapmaker_Orca.dll was not loaded, error=%d\n", GetLastError());
auto soft_end_time = get_time_timestamp();
std::string softEndTime = BP_SOFT_WORKS_TIME + std::string(":") + get_works_time(soft_end_time - soft_start_time);
sentryReportLog(SENTRY_LOG_TRACE, softEndTime, BP_START_SOFT);
exitSentry();
return -1;
}
@@ -308,12 +313,18 @@ int wmain(int argc, wchar_t** argv)
);
if (Snapmaker_Orca_main == nullptr) {
printf("could not locate the function Snapmaker_Orca_main in Snapmaker_Orca.dll\n");
auto soft_end_time = get_time_timestamp();
std::string softEndTime = BP_SOFT_WORKS_TIME + std::string(":") + get_works_time(soft_end_time - soft_start_time);
sentryReportLog(SENTRY_LOG_TRACE, softEndTime, BP_START_SOFT);
exitSentry();
return -1;
}
// argc minus the trailing nullptr of the argv
auto res = Snapmaker_Orca_main((int) argv_extended.size() - 1, argv_extended.data());
auto soft_end_time = get_time_timestamp();
std::string softEndTime = BP_SOFT_WORKS_TIME + std::string(":") + get_works_time(soft_end_time - soft_start_time);
sentryReportLog(SENTRY_LOG_TRACE, softEndTime, BP_START_SOFT);
exitSentry();
return res;
}
+57
View File
@@ -0,0 +1,57 @@
#include "bury_point.hpp"
#include <chrono>
#include <ctime>
#include <iomanip>
#include <sstream>
static std::atomic<bool> isAgreeSlice(true);
bool get_privacy_policy()
{
return isAgreeSlice;
}
void set_privacy_policy(bool isAgree) {
isAgreeSlice = isAgree;
}
std::string get_timestamp_seconds()
{
auto now = std::chrono::system_clock::now();
auto timestamp = std::chrono::duration_cast<std::chrono::seconds>(now.time_since_epoch()).count();
std::ostringstream oss;
oss << timestamp;
auto strTime = oss.str();
return strTime;
}
long long get_time_timestamp()
{
auto now = std::chrono::system_clock::now();
auto timestamp = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count();
return timestamp;
}
std::string get_works_time(const long long& timestamp)
{
long long hours = timestamp / 3600000;
long long remaining_ms = timestamp % 3600000;
long long minutes = remaining_ms / 60000;
remaining_ms = remaining_ms % 60000;
long long seconds = remaining_ms / 1000;
long long ms = remaining_ms % 1000;
char buffer[32] = {0};
std::snprintf(buffer, sizeof(buffer), "%02llu:%02llu:%02llu.%03llu", hours, minutes, seconds, ms);
std::string works_time = std::string(buffer);
return works_time;
}
+55
View File
@@ -0,0 +1,55 @@
#ifndef _BURY_POINT_hpp_
#define _BURY_POINT_hpp_
#include <string>
#include <iostream>
#include <atomic>
#ifdef _WIN32
#ifdef BURY_EXPORTS
#define BURY_API __declspec(dllexport)
#else
#define BURY_API __declspec(dllimport)
#endif
#else
#define BURY_API extern
#endif
#define BURY_POINT "bury_point"
#define BP_START_SOFT "bury_point_start_soft"
#define BP_SOFT_WORKS_TIME "soft_works_time"
#define BP_DEIVCE_CONNECT "bury_point_device_connect"
#define BP_CONNECT_DEVICE_ID "device_id"
#define BP_CONNECT_NET_TYPE "net_type"
#define BP_LOGIN "bury_point_login"
#define BP_LOGIN_USER_ID "user_id"
#define BP_LOGIN_HTTP_CODE "http_code"
#define BP_VIDEO_START "bury_point_video_start"
#define BP_VIDEO_STATUS "video_status"
#define BP_DEVICE_ERROR "bury_point_device_error"
#define BP_DEVICE_ERROR_STATUS "error_status"
#define BP_UPLOAD "bury_point_upload"
#define BP_UPLOAD_AND_PRINT "bury_point_upload_and_print"
#define BP_COLOR_PAINTING "bury_point_color_painting"
#define BP_VIDEO_ABNORMAL "bury_point_video_abnormal"
#define BP_SLICE_DURATION "bury_point_slice_duration"
#define BP_SLICE_DURATION_TIME "slice_duration_time"
//webview bury point
BURY_API bool get_privacy_policy();
BURY_API void set_privacy_policy(bool isAgree);
BURY_API std::string get_timestamp_seconds();
BURY_API long long get_time_timestamp();
BURY_API std::string get_works_time(const long long& timestamp);
#endif
+59
View File
@@ -0,0 +1,59 @@
#include "common_func.hpp"
#include <boost/asio/ip/host_name.hpp>
#ifdef _WIN32
#include <windows.h>
#include <Shlobj.h>
#elif __APPLE__
#include <stdlib.h>
#endif
#include <fstream>
#include <nlohmann/json.hpp>
namespace common
{
std::string get_pc_name()
{
return boost::asio::ip::host_name();
}
std::string get_flutter_version()
{
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);
std::string filePath = path;
versionFilePath = filePath + "\\" + std::string("Snapmaker_Orca\\web\\flutter_web\\version.json");
#elif __APPLE__
const char* home_env = getenv("HOME");
versionFilePath = home_env;
versionFilePath = versionFilePath + "/Library/Application Support/Snapmaker_Orca/web/flutter_web/version.json";
#else
#endif
std::ifstream json_file(versionFilePath);
if (!json_file.is_open()) {
std::ifstream json_file(versionFilePath);
return "";
}
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 flutter_version = std::string("flutter_version: ") + str_version + std::string(" ") + std::string("build_number: ") +
str_build_number;
return flutter_version;
}
}
+27
View File
@@ -0,0 +1,27 @@
#ifndef _common_func_hppp_
#define _common_func_hppp_
#include <iostream>
#define SLIC3R_APP_NAME "Snapmaker Orca"
#define SLIC3R_APP_KEY "Snapmaker_Orca"
#define SLIC3R_VERSION "01.10.01.50"
#define Snapmaker_VERSION "2.2.0"
#define MIN_FIRM_VER "0.8.4"
#ifndef GIT_COMMIT_HASH
#define GIT_COMMIT_HASH "0000000" // 0000000 means uninitialized
#endif
#define SLIC3R_BUILD_ID ""
// #define SLIC3R_RC_VERSION "01.10.01.50"
#define BBL_RELEASE_TO_PUBLIC 1
#define BBL_INTERNAL_TESTING 0
#define ORCA_CHECK_GCODE_PLACEHOLDERS 0
namespace common
{
std::string get_pc_name();
std::string get_flutter_version();
} // namespace common
#endif
+1 -1
View File
@@ -6,7 +6,7 @@
#include "Utils.hpp"
#include "Model.hpp"
#include "format.hpp"
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#include <algorithm>
#include <set>
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef _libslic3r_h_
#define _libslic3r_h_
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#define SLIC3R_APP_FULL_NAME "Snapmaker Orca"
#define GCODEVIEWER_APP_NAME "Snapmaker_Orca G-code Viewer"
#define GCODEVIEWER_APP_KEY "Snapmaker_OrcaGcodeViewer"
+1 -1
View File
@@ -125,7 +125,7 @@
#include "SVG.hpp"
#include "libslic3r.h"
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#include <Shiny/Shiny.h>
+28 -3
View File
@@ -27,6 +27,7 @@
#include <cstdlib>
#include <atomic>
#include <random>
#include "common_func/common_func.hpp"
namespace Slic3r {
@@ -56,15 +57,22 @@ static sentry_value_t on_crash_callback(const sentry_ucontext_t* uctx, sentry_va
static sentry_value_t before_send(sentry_value_t event, void* hint, void* data)
{
if (!get_privacy_policy())
{
sentry_value_decref(event);
return sentry_value_new_null();
}
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 logger_val = sentry_value_get_by_key(event, "logger");
std::string logger = sentry_value_as_string(logger_val);
sentry_value_t moduleValue = sentry_value_get_by_key(event, "logger");
std::string moduleName = sentry_value_as_string(moduleValue);
if (MACHINE_MODULE == logger)
if (MACHINE_MODULE == moduleName)
{
srand((unsigned int) time(0));
int random_num = rand() % 100;
@@ -192,6 +200,7 @@ void initSentryEx()
#endif
sentry_options_set_environment(options, "develop");
//sentry_options_set_environment(options, "Release");
sentry_options_set_auto_session_tracking(options, 0);
sentry_options_set_symbolize_stacktraces(options, 1);
@@ -201,6 +210,12 @@ void initSentryEx()
sentry_options_set_sample_rate(options, 1.0);
sentry_options_set_traces_sample_rate(options, 1.0);
sentry_set_tag("version", Snapmaker_VERSION);
std::string flutterVersion = common::get_flutter_version();
if (!flutterVersion.empty())
set_sentry_tags("flutter_version", flutterVersion);
sentry_init(options);
sentry_start_session();
@@ -255,6 +270,8 @@ void sentryReportLogEx(SENTRY_LOG_LEVEL logLevel,
sentry_value_set_by_key(tags, "snapmaker_trace_id", sentry_value_new_string(logTraceId.c_str()));
}
if (SENTRY_LEVEL_TRACE == sentry_msg_level)
sentry_set_tag(BURY_POINT, "snapmaker_bury_point");
if (!logTagKey.empty())
sentry_set_tag(logTagKey.c_str(), logTagValue.c_str());
@@ -293,5 +310,13 @@ void sentryReportLog(SENTRY_LOG_LEVEL logLevel,
#endif
}
void set_sentry_tags(const std::string& tag_key, const std::string& tag_value)
{
#ifdef SLIC3R_SENTRY
if (!tag_key.empty())
sentry_set_tag(tag_key.c_str(), tag_value.c_str());
#endif
}
} // namespace Slic3r
+3
View File
@@ -2,6 +2,7 @@
#define slic3r_SentryWrapper_hpp_
#include <string>
#include "bury_cfg/bury_point.hpp"
namespace Slic3r {
@@ -24,6 +25,8 @@ namespace Slic3r {
const std::string& logTagKey = "",
const std::string& logTagValue = "",
const std::string& logTraceId = "");
void set_sentry_tags(const std::string& tag_key,const std::string& tag_value);
} // namespace Slic3r
#endif // slic3r_SentryWrapper_hpp_
+1 -1
View File
@@ -653,7 +653,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/GeneratedConfig.hpp.in
@ONLY)
add_library(libslic3r_gui STATIC ${SLIC3R_GUI_SOURCES})
target_include_directories(libslic3r_gui PRIVATE Utils ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(libslic3r_gui PRIVATE Utils ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/..)
target_link_libraries(libslic3r_gui paho-mqttpp3-static)
target_include_directories(libslic3r_gui PRIVATE ${PAHO_MQTT_CPP_PATH}/include)
+1 -1
View File
@@ -16,7 +16,7 @@
#include "FileHelp.hpp"
#include "Tab.hpp"
#include "MainFrame.hpp"
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#define NAME_OPTION_COMBOBOX_SIZE wxSize(FromDIP(200), FromDIP(24))
#define FILAMENT_PRESET_COMBOBOX_SIZE wxSize(FromDIP(300), FromDIP(24))
+8 -2
View File
@@ -6,7 +6,7 @@
#include "slic3r/GUI/UserManager.hpp"
#include "slic3r/GUI/TaskManager.hpp"
#include "format.hpp"
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#include "Downloader.hpp"
#include "slic3r/GUI/WebUrlDialog.hpp"
@@ -120,7 +120,7 @@
#include "PrivacyUpdateDialog.hpp"
#include "ModelMall.hpp"
#include "HintNotification.hpp"
#include "bury_cfg/bury_point.hpp"
//#ifdef WIN32
//#include "BaseException.h"
//#endif
@@ -3756,6 +3756,9 @@ if (res) {
} catch (std::exception &) {
// wxMessageBox(e.what(), "", MB_OK);
}
auto isAgree = wxGetApp().app_config->get("snapmaker_privacy_policy", "isagree");
set_privacy_policy(isAgree == "true");
}
void GUI_App::ShowDownNetPluginDlg() {
@@ -7061,6 +7064,9 @@ 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("snapmaker_privacy_policy", "isagree");
set_privacy_policy(isAgree == "true");
return res;
}
@@ -34,6 +34,7 @@
#include <wx/glcanvas.h>
#include "sentry_wrapper/SentryWrapper.hpp"
namespace Slic3r {
namespace GUI {
//BBS: GUI refactor: to support top layout
@@ -350,6 +351,8 @@ bool GLGizmosManager::open_gizmo(EType type)
#ifdef __WXOSX__
m_parent.post_event(SimpleEvent(wxEVT_PAINT));
#endif
if (EType::MmSegmentation == type)
sentryReportLog(SENTRY_LOG_TRACE, BP_COLOR_PAINTING, BP_COLOR_PAINTING);
return true;
}
return false;
+2 -2
View File
@@ -72,9 +72,9 @@
#include <dbt.h>
#include <shlobj.h>
#include <shellapi.h>
#include "sentry_wrapper/SentryWrapper.hpp"
#endif // _WIN32
#include <slic3r/GUI/CreatePresetsDialog.hpp>
#include "sentry_wrapper/SentryWrapper.hpp"
namespace Slic3r {
@@ -1089,8 +1089,8 @@ void MainFrame::init_tabpanel() {
});
m_tabpanel->AddPage(m_webview, "", "tab_home_active", "tab_home_active", false);
m_param_panel = new ParamsPanel(m_tabpanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL);
}
m_plater = new Plater(this, this);
m_plater->SetBackgroundColour(*wxWHITE);
m_plater->Hide();
+42 -1
View File
@@ -1,6 +1,6 @@
#include "Plater.hpp"
#include "libslic3r/Config.hpp"
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#include <cstddef>
#include <algorithm>
@@ -156,6 +156,9 @@
#include "CloneDialog.hpp"
#include "WebPreprintDialog.hpp"
#include "sentry_wrapper/SentryWrapper.hpp"
#include <chrono>
using boost::optional;
namespace fs = boost::filesystem;
using Slic3r::_3DScene;
@@ -3089,6 +3092,9 @@ struct Plater::priv
bool show_wireframe{ false };
bool wireframe_enabled{ true };
std::chrono::steady_clock::time_point m_slice_start_time;
bool m_slice_timing_active = false;
static const std::regex pattern_bundle;
static const std::regex pattern_3mf;
static const std::regex pattern_zip_amf;
@@ -7649,6 +7655,9 @@ void Plater::priv::on_export_finished(wxCommandEvent& evt)
void Plater::priv::on_slicing_began()
{
if(!m_slice_timing_active)
m_slice_start_time = std::chrono::steady_clock::now();
m_slice_timing_active = true;
clear_warnings();
notification_manager->close_notification_of_type(NotificationType::SignDetected);
notification_manager->close_notification_of_type(NotificationType::ExportFinished);
@@ -7733,6 +7742,31 @@ void Plater::priv::on_process_completed(SlicingProcessCompletedEvent &evt)
//BBS: add project slice logic
bool is_finished = !m_slice_all || (m_cur_slice_plate == (partplate_list.get_plate_count() - 1));
{
if (m_slice_timing_active) {
auto end_time = std::chrono::steady_clock::now();
auto duration_ms = std::chrono::duration_cast<std::chrono::milliseconds>(end_time - m_slice_start_time).count();
auto timess = duration_ms;
if (evt.cancelled()) {
BOOST_LOG_TRIVIAL(info) << "Slicing cancelled after " << duration_ms << " ms";
m_slice_start_time = {};
m_slice_timing_active = false;
} else if (evt.error())
{
m_slice_start_time = {};
m_slice_timing_active = false;
}
else if (is_finished && evt.finished())
{
auto strTime = get_works_time(duration_ms);
auto slice_time = BP_SLICE_DURATION_TIME + std::string(":") + strTime;
sentryReportLog(SENTRY_LOG_TRACE, slice_time, BP_SLICE_DURATION);
m_slice_start_time = {};
m_slice_timing_active = false;
}
}
}
//BBS: slice .gcode.3mf file related logic, assign is_finished again
bool only_has_gcode_need_preview = false;
auto plate_list = this->partplate_list.get_plate_list();
@@ -7751,6 +7785,13 @@ void Plater::priv::on_process_completed(SlicingProcessCompletedEvent &evt)
// At this point of time the thread should be either finished or canceled,
// so the following call just confirms, that the produced data were consumed.
this->background_process.stop();
if (m_slice_timing_active && !this->background_process.running())
{
if (evt.cancelled() || evt.error()) {
m_slice_start_time = {};
m_slice_timing_active = false;
}
}
notification_manager->set_slicing_progress_export_possible();
// Reset the "export G-code path" name, so that the automatic background processing will be enabled again.
+3
View File
@@ -3,6 +3,7 @@
#include <algorithm>
#include <iomanip>
#include "sentry_wrapper/SentryWrapper.hpp"
#include <wx/frame.h>
#include <wx/progdlg.h>
#include <wx/sizer.h>
@@ -152,6 +153,7 @@ void PrintHostSendDialog::init()
auto* btn_ok = add_button(wxID_OK, true, _L("Upload"));
btn_ok->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) {
sentryReportLog(SENTRY_LOG_TRACE, BP_UPLOAD, BP_UPLOAD);
if (validate_path(txt_filename->GetValue())) {
post_upload_action = PrintHostPostUploadAction::None;
EndDialog(wxID_OK);
@@ -172,6 +174,7 @@ void PrintHostSendDialog::init()
if (post_actions.has(PrintHostPostUploadAction::StartPrint)) {
auto* btn_print = add_button(wxID_YES, false, _L("Upload and Print"));
btn_print->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) {
sentryReportLog(SENTRY_LOG_TRACE, BP_UPLOAD_AND_PRINT, BP_UPLOAD_AND_PRINT);
if (validate_path(txt_filename->GetValue())) {
post_upload_action = PrintHostPostUploadAction::StartPrint;
EndDialog(wxID_OK);
+1 -1
View File
@@ -5,7 +5,7 @@
#include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "slic3r/GUI/MainFrame.hpp"
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#include <wx/sizer.h>
#include <wx/string.h>
+2
View File
@@ -20,6 +20,7 @@
#include <boost/nowide/convert.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/asio/ip/host_name.hpp>
#include <slic3r/GUI/Widgets/WebView.hpp>
#include "NetworkTestDialog.hpp"
@@ -91,6 +92,7 @@ bool WCP_Logger::set_level(wxString& level)
}
}
// Add a log message to the queue
void WCP_Logger::add_log(const wxString& content, bool is_web = false, wxString time = "", wxString module = "Default", wxString level = "debug")
{
+1 -1
View File
@@ -6,7 +6,7 @@
#include "libslic3r/AppConfig.hpp"
#include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#include <wx/sizer.h>
#include <wx/toolbar.h>
+11 -2
View File
@@ -10,7 +10,7 @@
#include "libslic3r/PresetBundle.hpp"
#include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#include <wx/sizer.h>
#include <wx/toolbar.h>
@@ -492,6 +492,15 @@ void GuideFrame::OnScriptMessage(wxWebViewEvent &evt)
this->Close();
} else if (strCmd == "save_region") {
m_Region = j["region"];
m_ProfileJson["region"] = m_Region;
}
else if (strCmd == "common_openurl") {
std::string url = j["url"];
std::string local = j["local"];
if (!url.empty()) {
wxLaunchDefaultBrowser(url);
}
}
else if (strCmd == "network_plugin_install") {
std::string sAction = j["data"]["action"];
@@ -617,7 +626,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("snapmaker_privacy_policy", "isagree", PrivacyUse);
m_MainPtr->app_config->set("region", m_Region);
m_MainPtr->app_config->set_bool("stealth_mode", StealthMode);
+9 -1
View File
@@ -6,7 +6,7 @@
#include "libslic3r/AppConfig.hpp"
#include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#include <wx/sizer.h>
#include <wx/toolbar.h>
@@ -590,6 +590,14 @@ void WebPresetDialog::OnScriptMessage(wxWebViewEvent& evt)
this->Close();
} else if (strCmd == "save_region") {
m_Region = j["region"];
m_ProfileJson["region"] = m_Region;
}
else if (strCmd == "common_openurl") {
std::string url = j["url"];
if (!url.empty()) {
wxLaunchDefaultBrowser(url);
}
} else if (strCmd == "network_plugin_install") {
std::string sAction = j["data"]["action"];
+8 -3
View File
@@ -5,7 +5,7 @@
#include "libslic3r/AppConfig.hpp"
#include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#include <wx/sizer.h>
#include <wx/toolbar.h>
@@ -25,6 +25,7 @@
#include <sstream>
#include <slic3r/GUI/Widgets/WebView.hpp>
#include "sentry_wrapper/SentryWrapper.hpp"
using namespace std;
using namespace nlohmann;
@@ -198,11 +199,13 @@ void SMUserLogin::OnNavigationRequest(wxWebViewEvent &evt)
http.header("Authorization",token);
http.on_complete([&](std::string body, unsigned status) {
if (status == 200) {
std::string user_id = "";
json response = json::parse(body);
if (response.count("data")) {
json data = response["data"];
if (data.count("id")) {
wxGetApp().sm_get_userinfo()->set_user_id(std::to_string(data["id"].get<int>()));
user_id = std::to_string(data["id"].get<int>());
}
if (data.count("nickname")) {
wxGetApp().sm_get_userinfo()->set_user_name(data["nickname"].get<std::string>());
@@ -214,13 +217,15 @@ void SMUserLogin::OnNavigationRequest(wxWebViewEvent &evt)
wxGetApp().sm_get_userinfo()->set_user_account(data["account"].get<std::string>());
}
}
string userInfo = BP_LOGIN_USER_ID + std::string(":") + user_id;
sentryReportLog(SENTRY_LOG_TRACE, userInfo, BP_LOGIN);
wxGetApp().sm_get_userinfo()->set_user_token(token);
wxGetApp().sm_get_userinfo()->set_user_login(true);
}
})
.on_error([&](std::string body, std::string error, unsigned status) {
std::string http_code = BP_LOGIN_HTTP_CODE + string(":") + std::to_string(status);
sentryReportLog(SENTRY_LOG_TRACE, http_code, BP_LOGIN);
})
.perform_sync();
});
+1 -1
View File
@@ -5,7 +5,7 @@
#include "libslic3r/AppConfig.hpp"
#include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#include <wx/sizer.h>
#include <wx/toolbar.h>
+1 -1
View File
@@ -4,7 +4,7 @@
#include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "slic3r/GUI/MainFrame.hpp"
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#include "../Utils/Http.hpp"
#include "SSWCP.hpp"
+1 -1
View File
@@ -9,7 +9,7 @@
#include <boost/filesystem/fstream.hpp>
#include "libslic3r/Exception.hpp"
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#define MAX_SIZE_TO_FILE 3*1024
+3
View File
@@ -28,6 +28,7 @@
#include "slic3r/GUI/WebPreprintDialog.hpp"
#include "slic3r/GUI/SSWCP.hpp"
#include "sentry_wrapper/SentryWrapper.hpp"
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
@@ -2287,6 +2288,7 @@ void Moonraker_Mqtt::async_camera_start(const std::string& domain, int interval,
callback) {
BOOST_LOG_TRIVIAL(error) << "[Moonraker_Mqtt] 发送启动摄像头监控请求失败";
wcp_loger.add_log("发送启动摄像头监控请求失败", false, "", "Moonraker_Mqtt", "error");
sentryReportLog(SENTRY_LOG_TRACE, "open video cmd error", BP_VIDEO_ABNORMAL);
callback(json::value_t::null);
}
}
@@ -2336,6 +2338,7 @@ void Moonraker_Mqtt::async_canmera_stop(const std::string& domain, std::function
callback) {
BOOST_LOG_TRIVIAL(error) << "[Moonraker_Mqtt] 发送停止摄像头监控请求失败";
wcp_loger.add_log("发送停止摄像头监控请求失败", false, "", "Moonraker_Mqtt", "error");
sentryReportLog(SENTRY_LOG_TRACE, "stop video cmd error", BP_VIDEO_ABNORMAL);
callback(json::value_t::null);
}
}
+1 -1
View File
@@ -25,7 +25,7 @@
#include "libslic3r/format.hpp"
#include "libslic3r/Utils.hpp"
#include "libslic3r/PresetBundle.hpp"
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#include "slic3r/GUI/GUI.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "slic3r/GUI/I18N.hpp"