NEW: add more track records

Change-Id: If82430f8b432f1a1d5a78cd6a63a16cf50d2bbaa
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
Stone Li 2023-06-13 19:50:41 +08:00 committed by Lane.Wei
parent 4893cebaa5
commit 43810bdac8
7 changed files with 69 additions and 18 deletions

View File

@ -382,6 +382,12 @@ void BBLTopbar::OnPublishClicked(wxAuiToolBarEvent& event)
return;
}
// record
json j;
NetworkAgent* agent = GUI::wxGetApp().getAgent();
if (agent)
agent->track_event("enter_model_mall", j.dump());
//no more check
//if (GUI::wxGetApp().plater()->model().objects.empty()) return;

View File

@ -4115,10 +4115,17 @@ void GUI_App::check_track_enable()
int major = 0, minor = 0, micro = 0;
header_json["os"] = std::string(os_desc.ToUTF8());
header_json["name"] = std::string(SLIC3R_APP_NAME);
header_json["uuid"] = app_config->get("slicer_uuid");
if (m_agent) {
m_agent->track_header(header_json.dump());
m_agent->track_enable(true);
}
/* record studio start event */
json j;
j["user_mode"] = this->get_mode_str();
if (m_agent) {
m_agent->track_event("studio_launch", j.dump());
}
}
}
@ -5041,6 +5048,13 @@ ConfigOptionMode GUI_App::get_mode()
mode == "develop" ? comDevelop : comSimple;
}
std::string GUI_App::get_mode_str()
{
if (!app_config->has("user_mode"))
return "simple";
return app_config->get("user_mode");
}
void GUI_App::save_mode(const /*ConfigOptionMode*/int mode)
{
//BBS

View File

@ -464,6 +464,7 @@ public:
Tab* get_model_tab(bool part = false);
Tab* get_layer_tab();
ConfigOptionMode get_mode();
std::string get_mode_str();
void save_mode(const /*ConfigOptionMode*/int mode) ;
void update_mode();
void update_internal_development();

View File

@ -471,8 +471,9 @@ void PrintJob::process()
}
BOOST_LOG_TRIVIAL(error) << "print_job: failed, result = " << result;
} else {
wxGetApp().plater()->record_slice_preset("print");
BOOST_LOG_TRIVIAL(error) << "print_job: send ok.";
wxCommandEvent* evt = new wxCommandEvent(m_print_job_completed_id);
if (m_print_job_completed_id == wxGetApp().plater()->get_send_calibration_finished_event()) {

View File

@ -1995,6 +1995,11 @@ static void add_common_publish_menu_items(wxMenu* publish_menu, MainFrame* mainF
return;
}
json j;
NetworkAgent* agent = GUI::wxGetApp().getAgent();
if (agent)
agent->track_event("enter_model_mall", j.dump());
//if (GUI::wxGetApp().plater()->model().objects.empty()) return;
wxGetApp().open_publish_page_dialog();
});

View File

@ -9434,10 +9434,8 @@ void Plater::export_gcode(bool prefer_removable)
if (preset_bundle) {
j["Gcode_printer_model"] = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle);
}
NetworkAgent *agent = wxGetApp().getAgent();
if (agent) agent->track_event("printer_export_Gcode", j.dump());
if (agent) agent->track_event("printer_export_gcode", j.dump());
} catch (...) {}
}
@ -10069,17 +10067,23 @@ void Plater::reslice()
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": finished, started slicing for plate %1%") % p->partplate_list.get_curr_plate_index();
record_slice_preset("slicing");
}
void Plater::record_slice_preset(std::string action)
{
// record slice preset
try
{
json j;
auto printer_preset = wxGetApp().preset_bundle->printers.get_edited_preset_with_vendor_profile().preset;
if (printer_preset.is_system) {
j["printer_preset_name"] = printer_preset.name;
} else {
}
else {
j["printer_preset_name"] = printer_preset.config.opt_string("inherits");
}
const t_config_enum_values *keys_map = print_config_def.get("curr_bed_type")->enum_keys_map;
const t_config_enum_values* keys_map = print_config_def.get("curr_bed_type")->enum_keys_map;
if (keys_map) {
for (auto item : *keys_map) {
if (item.second == wxGetApp().preset_bundle->project_config.opt_enum<BedType>("curr_bed_type")) {
@ -10093,20 +10097,40 @@ void Plater::reslice()
auto filament_preset = wxGetApp().preset_bundle->filaments.find_preset(filament_presets[i]);
if (filament_preset->is_system) {
j["filament_preset_" + std::to_string(i)] = filament_preset->name;
} else {
}
else {
j["filament_preset_" + std::to_string(i)] = filament_preset->config.opt_string("inherits");
}
}
auto print_preset = wxGetApp().preset_bundle->prints.get_edited_preset();
Preset& print_preset = wxGetApp().preset_bundle->prints.get_edited_preset();
if (print_preset.is_system) {
j["print_preset"] = print_preset.name;
} else {
j["print_preset"] = print_preset.config.opt_string("inherits");
j["process_preset"] = print_preset.name;
}
else {
j["process_preset"] = print_preset.config.opt_string("inherits");
}
j["support_type"] = ConfigOptionEnum<SupportType>::get_enum_names().at(print_preset.config.opt_enum<SupportType>("support_type"));
j["sparse_infill_pattern"] = ConfigOptionEnum<InfillPattern>::get_enum_names().at(print_preset.config.opt_enum<InfillPattern>("sparse_infill_pattern"));
j["sparse_infill_density"] = print_preset.config.opt<ConfigOptionPercent>("sparse_infill_density")->value;
j["brim_type"] = ConfigOptionEnum<BrimType>::get_enum_names().at(print_preset.config.opt_enum<BrimType>("brim_type"));
j["user_mode"] = wxGetApp().get_mode_str();
if (p->background_process.fff_print()) {
const DynamicPrintConfig& full_config = p->background_process.fff_print()->full_print_config();
json values = json::array();
if (full_config.has("different_settings_to_system")) {
std::vector<std::string> different_values = full_config.option<ConfigOptionStrings>("different_settings_to_system")->values;
for (auto& item : different_values) {
values.push_back(item);
}
}
j["different_settings_to_system"] = values;
}
NetworkAgent *agent = wxGetApp().getAgent();
j["record_event"] = action;
NetworkAgent* agent = wxGetApp().getAgent();
if (agent)
agent->track_event("slice_completed", j.dump());
}
@ -10114,7 +10138,6 @@ void Plater::reslice()
{
return;
}
}
//BBS: add project slicing related logic
@ -10249,7 +10272,7 @@ void Plater::send_gcode_legacy(int plate_idx, Export3mfProgressFn proFn)
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
if (preset_bundle) {
j["Gcode_printer_model"] = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle);
j["gcode_printer_model"] = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle);
}
if (physical_printer_config) {

View File

@ -339,6 +339,7 @@ public:
bool has_toolpaths_to_export() const;
void export_toolpaths_to_obj() const;
void reslice();
void record_slice_preset(std::string action);
void reslice_SLA_supports(const ModelObject &object, bool postpone_error_messages = false);
void reslice_SLA_hollowing(const ModelObject &object, bool postpone_error_messages = false);
void reslice_SLA_until_step(SLAPrintObjectStep step, const ModelObject &object, bool postpone_error_messages = false);