From 68463ac7b3a4e1fbd31201c4b442a670492b2229 Mon Sep 17 00:00:00 2001 From: Kunlong Ma Date: Fri, 19 Jan 2024 10:29:28 +0800 Subject: [PATCH] FIX: fix issues in the third phase of buried point JIRA: STUDIO-5970 STUDIO-6001 STUDIO-6011 STUDIO-6012 Signed-off-by: Kunlong Ma Change-Id: Ie0726adb1ef0a9e775ab588aed036cd764c05f06 --- src/slic3r/GUI/GUI_Factories.cpp | 16 -------------- src/slic3r/GUI/GUI_Factories.hpp | 4 ---- src/slic3r/GUI/MainFrame.cpp | 9 ++++---- src/slic3r/GUI/Monitor.cpp | 25 +++++++++++++++++++-- src/slic3r/GUI/Monitor.hpp | 2 ++ src/slic3r/GUI/Plater.cpp | 38 +++++++++++--------------------- 6 files changed, 42 insertions(+), 52 deletions(-) diff --git a/src/slic3r/GUI/GUI_Factories.cpp b/src/slic3r/GUI/GUI_Factories.cpp index 26cd1c922..5e1804a50 100644 --- a/src/slic3r/GUI/GUI_Factories.cpp +++ b/src/slic3r/GUI/GUI_Factories.cpp @@ -1323,10 +1323,6 @@ wxMenu* MenuFactory::sla_object_menu() append_menu_items_convert_unit(&m_sla_object_menu); append_menu_item_settings(&m_sla_object_menu); //update_menu_items_instance_manipulation(mtObjectSLA); - { - NetworkAgent* agent = GUI::wxGetApp().getAgent(); - if (agent) agent->track_update_property("sla_object_menu", std::to_string(++sla_obj_menu_count)); - } return &m_sla_object_menu; } @@ -1344,19 +1340,11 @@ wxMenu* MenuFactory::part_menu() wxMenu* MenuFactory::instance_menu() { - { - NetworkAgent* agent = GUI::wxGetApp().getAgent(); - if (agent) agent->track_update_property("instance_menu", std::to_string(++instance_menu_count)); - } return &m_instance_menu; } wxMenu* MenuFactory::layer_menu() { - { - NetworkAgent* agent = GUI::wxGetApp().getAgent(); - if (agent) agent->track_update_property("layer_menu", std::to_string(++layer_menu_count)); - } MenuWithSeparators* menu = new MenuWithSeparators(); append_menu_item_settings(menu); @@ -1499,10 +1487,6 @@ wxMenu* MenuFactory::assemble_part_menu() append_menu_item_change_extruder(menu); //append_menu_item_per_object_settings(menu); - { - NetworkAgent* agent = GUI::wxGetApp().getAgent(); - if (agent) agent->track_update_property("assemble_part_menu", std::to_string(++assemble_part_menu_count)); - } return menu; } diff --git a/src/slic3r/GUI/GUI_Factories.hpp b/src/slic3r/GUI/GUI_Factories.hpp index 840862d12..c6c9b025e 100644 --- a/src/slic3r/GUI/GUI_Factories.hpp +++ b/src/slic3r/GUI/GUI_Factories.hpp @@ -96,14 +96,10 @@ private: int object_menu_count{ 0 }; int part_menu_count{ 0 }; - int sla_obj_menu_count{ 0 }; int default_menu_count{ 0 }; - int instance_menu_count{ 0 }; int plate_menu_count{ 0 }; - int layer_menu_count{ 0 }; int multi_selection_menu_count{ 0 }; int assemble_object_menu_ocunt{ 0 }; - int assemble_part_menu_count{ 0 }; int assemble_multi_selection_menu_count{ 0 }; // Removed/Prepended Items according to the view mode diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 612e0595b..d53ff23a6 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -525,21 +525,20 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_ j.clear(); j["default_menu"] = get_value("default_menu"); - j["object_menu"] = get_value("object_ment"); + j["object_menu"] = get_value("object_menu"); j["part_menu"] = get_value("part_menu"); - j["layer_menu"] = get_value("layer_menu"); j["multi_selection_menu"] = get_value("multi_selection_menu"); j["plate_menu"] = get_value("plate_menu"); j["assemble_object_menu"] = get_value("assemble_object_menu"); - j["assemble_part_menu"] = get_value("assemble_part_menu"); j["assemble_multi_selection_menu"] = get_value("assemble_multi_selection_menu"); agent->track_event("menu_click", j.dump()); j.clear(); j["device_page"] = get_value("select_device_page"); - j["status"] = get_value("Status"); - j["MicroSD_card"] = get_value("MicroSD Card"); + j["status"] = get_value("status"); + j["sd_card"] = get_value("sd_card"); j["HMS"] = get_value("HMS"); + j["update"] = get_value("update"); agent->track_event("device_ctrl", j.dump()); } } diff --git a/src/slic3r/GUI/Monitor.cpp b/src/slic3r/GUI/Monitor.cpp index e9863a37f..cfb122f46 100644 --- a/src/slic3r/GUI/Monitor.cpp +++ b/src/slic3r/GUI/Monitor.cpp @@ -171,10 +171,11 @@ MonitorPanel::~MonitorPanel() m_media_file_panel->SwitchStorage(title == _L("SD Card")); } page->SetFocus(); - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " select :" << m_tabpanel->GetPageText(m_tabpanel->GetSelection()); + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " select :" << get_string_from_tab(PrinterTab(m_tabpanel->GetSelection())) + << " wxString:" << m_tabpanel->GetPageText(m_tabpanel->GetSelection()).ToStdString(); NetworkAgent* agent = GUI::wxGetApp().getAgent(); if (agent) { - std::string name = m_tabpanel->GetPageText(m_tabpanel->GetSelection()).ToStdString(); + std::string name = get_string_from_tab(PrinterTab(m_tabpanel->GetSelection())); if (name != "") { std::string value = ""; agent->track_get_property(name, value); @@ -518,5 +519,25 @@ Freeze(); Thaw(); } +std::string MonitorPanel::get_string_from_tab(PrinterTab tab) +{ + switch (tab) { + case PT_STATUS : + return "status"; + case PT_MEDIA: + return "sd_card"; + case PT_UPDATE: + return "update"; + case PT_HMS: + return "HMS"; + case PT_DEBUG: + return "debug"; + default: + return ""; + } + return ""; +} + + } // GUI } // Slic3r diff --git a/src/slic3r/GUI/Monitor.hpp b/src/slic3r/GUI/Monitor.hpp index cb5615b04..48a14f67c 100644 --- a/src/slic3r/GUI/Monitor.hpp +++ b/src/slic3r/GUI/Monitor.hpp @@ -146,6 +146,8 @@ public: void update_side_panel(); void show_status(int status); + std::string get_string_from_tab(PrinterTab tab); + MachineObject *obj { nullptr }; std::string last_conn_type = "undedefined"; }; diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 26d52626a..face4e59c 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2118,6 +2118,8 @@ struct Plater::priv //BBS: add popup object table logic //ObjectTableDialog* m_popup_table{ nullptr }; std::chrono::system_clock::time_point start; + std::string file_type; + std::string is_mw; #if ENABLE_ENVIRONMENT_MAP GLTexture environment_texture; @@ -4166,25 +4168,15 @@ std::vector Plater::priv::load_files(const std::vector& input_ if (start == default_time) { start = std::chrono::system_clock::now(); } - NetworkAgent* agent = wxGetApp().getAgent(); - if (agent) { - if (!input_files.empty()) { - auto path = input_files.front(); - std::string extension = path.extension().string(); + if (!input_files.empty()) { + auto path = input_files.front(); + file_type = path.extension().string(); - std::string value = ""; - agent->track_get_property("file_type", value); - if (value == "") { - value = extension; - agent->track_update_property("file_type", value); - } - - if (model.model_info == nullptr) { - agent->track_update_property("is_mw", "false"); - } - else { - agent->track_update_property("is_mw", "true"); - } + if (model.model_info == nullptr) { + is_mw = "false"; + } + else { + is_mw = "true"; } } return obj_idxs; @@ -8369,12 +8361,8 @@ void Plater::priv::record_start_print_preset(std::string action) { j["record_event"] = action; NetworkAgent* agent = wxGetApp().getAgent(); if (agent) { - std::string value = ""; - agent->track_get_property("file_type", value); - j_workflow_debug["file_type"] = value; - value = ""; - agent->track_get_property("is_mw", value); - j_workflow_debug["is_mw"] = value; + j_workflow_debug["file_type"] = file_type; + j_workflow_debug["is_mw"] = is_mw; agent->track_event("user_start_print", j.dump()); agent->track_event("workflow_debug", j_workflow_debug.dump()); @@ -8670,7 +8658,7 @@ int Plater::save_project(bool saveAs) json j; boost::uintmax_t size = boost::filesystem::file_size(into_path(filename)); j["file_size"] = size; - j["file_name"] = std::string(filename.mb_str()); + j["file_name"] = into_path(filename).filename().string(); NetworkAgent* agent = wxGetApp().getAgent(); if (agent) agent->track_event("save_project", j.dump());