From 253b47edc60d4e5c252b2ff8b82a966676ae9932 Mon Sep 17 00:00:00 2001 From: "liz.li" Date: Wed, 28 Aug 2024 15:27:24 +0800 Subject: [PATCH] ENH: add a repair model url for Mac bbs jira: new Change-Id: I6230588700d01e5b9599cb408713e63bf01a144a (cherry picked from commit d67a977969bb5731de8c0f7fb47d60211183e243) --- src/slic3r/GUI/NotificationManager.cpp | 14 ++------------ src/slic3r/GUI/NotificationManager.hpp | 3 ++- src/slic3r/GUI/Plater.cpp | 23 +++++++++++++++++++++-- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp index 5553e470a..73525be58 100644 --- a/src/slic3r/GUI/NotificationManager.cpp +++ b/src/slic3r/GUI/NotificationManager.cpp @@ -2512,19 +2512,9 @@ void NotificationManager::bbl_close_preview_only_notification() } } -void NotificationManager::bbl_show_objectsinfo_notification(const std::string &text, bool is_warning, bool is_hidden) +void NotificationManager::bbl_show_objectsinfo_notification(const std::string &text, bool is_warning, bool is_hidden, const std::string hypertext, std::function callback) { - std::string hyper_text; - auto callback = std::function(); - if (is_warning) { - callback =[](wxEvtHandler *) { - wxCommandEvent *evt = new wxCommandEvent(EVT_REPAIR_MODEL); - wxQueueEvent(wxGetApp().plater(), evt); - return false; - }; - hyper_text = _u8L(" (Repair)"); - } - NotificationData data{NotificationType::BBLObjectInfo, NotificationLevel::PrintInfoNotificationLevel, BBL_NOTICE_MAX_INTERVAL, text, hyper_text, callback}; + NotificationData data{NotificationType::BBLObjectInfo, NotificationLevel::PrintInfoNotificationLevel, BBL_NOTICE_MAX_INTERVAL, text, hypertext, callback}; if (is_warning) data.use_warn_color = true; diff --git a/src/slic3r/GUI/NotificationManager.hpp b/src/slic3r/GUI/NotificationManager.hpp index 91211a661..3bab8e741 100644 --- a/src/slic3r/GUI/NotificationManager.hpp +++ b/src/slic3r/GUI/NotificationManager.hpp @@ -309,7 +309,8 @@ public: void bbl_close_plugin_install_notification(); //BBS--Objects Info - void bbl_show_objectsinfo_notification(const std::string &text, bool is_warning, bool is_hidden); + void bbl_show_objectsinfo_notification(const std::string &text, bool is_warning, bool is_hidden, + const std::string hypertext = "", std::function callback = std::function()); void bbl_close_objectsinfo_notification(); void bbl_show_seqprintinfo_notification(const std::string &text); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index db5542d94..5562386b3 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -13629,16 +13629,35 @@ void Plater::show_object_info() wxString info_manifold; int non_manifold_edges = 0; auto mesh_errors = p->sidebar->obj_list()->get_mesh_errors_info(&info_manifold, &non_manifold_edges); + bool warning = non_manifold_edges > 0; + wxString hyper_text; + std::function callback; + if (warning) { + hyper_text = _L(" (Repair)"); + callback = [](wxEvtHandler*) { + wxCommandEvent* evt = new wxCommandEvent(EVT_REPAIR_MODEL); + wxQueueEvent(wxGetApp().plater(), evt); + return false; + }; + } #ifndef __WINDOWS__ if (non_manifold_edges > 0) { - info_manifold += into_u8("\n" + _L("Tips:") + "\n" +_L("\"Fix Model\" feature is currently only on Windows. Please repair the model on Bambu Studio(windows) or CAD softwares.")); + info_manifold += into_u8("\n" + _L("Tips:") + "\n" +_L("\"Fix Model\" feature is currently only on Windows. Please use a third-party tool to repair the model before importing it into Bambu Studio, such as ")); + } + if (warning) { + std::string repair_url = "https://www.formware.co/onlinestlrepair"; + hyper_text = repair_url + "."; + callback = [repair_url](wxEvtHandler*) { + wxGetApp().open_browser_with_warning_dialog(repair_url); + return false; + }; } #endif //APPLE & LINUX info_manifold = "" + info_manifold + ""; info_text += into_u8(info_manifold); - notify_manager->bbl_show_objectsinfo_notification(info_text, is_windows10()&&(non_manifold_edges > 0), !(p->current_panel == p->view3D)); + notify_manager->bbl_show_objectsinfo_notification(info_text, warning, !(p->current_panel == p->view3D), into_u8(hyper_text), callback); } bool Plater::show_publish_dialog(bool show)