From 8f943486a16b3ed547626383c23ff83316abc734 Mon Sep 17 00:00:00 2001 From: "xin.zhang" Date: Mon, 23 Jun 2025 15:06:26 +0800 Subject: [PATCH] ENH: add wiki for replacing nozzle jira: [STUDIO-12864] Change-Id: I3804d3599eb8746902f23b59626fe8c04e949dca (cherry picked from commit b9428cd32ff8c1c748377cab1e5539fed911177d) --- resources/printers/BL-P001.json | 4 +++ resources/printers/BL-P002.json | 4 +++ resources/printers/C11.json | 4 +++ resources/printers/C12.json | 4 +++ resources/printers/C13.json | 4 +++ resources/printers/N1.json | 4 +++ resources/printers/N2S.json | 4 +++ resources/printers/O1D.json | 4 +++ resources/printers/version.txt | 2 +- src/slic3r/GUI/DeviceManager.cpp | 17 ++++++++++++ src/slic3r/GUI/DeviceManager.hpp | 27 +++++++++++++++++++ src/slic3r/GUI/PrintOptionsDialog.cpp | 38 +++++++++++++++++++++++++-- src/slic3r/GUI/PrintOptionsDialog.hpp | 3 +++ 13 files changed, 116 insertions(+), 3 deletions(-) diff --git a/resources/printers/BL-P001.json b/resources/printers/BL-P001.json index 38836a2284..d1079d0380 100644 --- a/resources/printers/BL-P001.json +++ b/resources/printers/BL-P001.json @@ -14,6 +14,10 @@ } }, "nozzle_temp_range": [ 0, 300 ], + "nozzle_replace_wiki": { + "zh": "https://wiki.bambulab.com/zh/x1/maintenance/replace-hotend", + "en": "https://wiki.bambulab.com/en/x1/maintenance/replace-hotend" + }, "support_motor_noise_cali": false, "support_tunnel_mqtt": false, "support_mqtt_alive": false, diff --git a/resources/printers/BL-P002.json b/resources/printers/BL-P002.json index 8639d6db0e..d5a4bb9b5a 100644 --- a/resources/printers/BL-P002.json +++ b/resources/printers/BL-P002.json @@ -14,6 +14,10 @@ } }, "nozzle_temp_range": [ 0, 300 ], + "nozzle_replace_wiki": { + "zh": "https://wiki.bambulab.com/zh/x1/maintenance/replace-hotend", + "en": "https://wiki.bambulab.com/en/x1/maintenance/replace-hotend" + }, "support_motor_noise_cali": false, "support_tunnel_mqtt": false, "support_mqtt_alive": false, diff --git a/resources/printers/C11.json b/resources/printers/C11.json index e4e16add1d..68476c435e 100644 --- a/resources/printers/C11.json +++ b/resources/printers/C11.json @@ -9,6 +9,10 @@ } }, "nozzle_temp_range": [ 0, 300 ], + "nozzle_replace_wiki": { + "zh": "https://wiki.bambulab.com/zh/p1/maintenance/complete-hot-end-assembly", + "en": "https://wiki.bambulab.com/en/p1/maintenance/complete-hot-end-assembly" + }, "support_motor_noise_cali": false, "support_tunnel_mqtt": false, "support_mqtt_alive": false, diff --git a/resources/printers/C12.json b/resources/printers/C12.json index b2ce83a320..80b83f83b3 100644 --- a/resources/printers/C12.json +++ b/resources/printers/C12.json @@ -9,6 +9,10 @@ } }, "nozzle_temp_range": [ 0, 300 ], + "nozzle_replace_wiki": { + "zh": "https://wiki.bambulab.com/zh/p1/maintenance/complete-hot-end-assembly", + "en": "https://wiki.bambulab.com/en/p1/maintenance/complete-hot-end-assembly" + }, "support_motor_noise_cali": false, "support_tunnel_mqtt": false, "support_mqtt_alive": false, diff --git a/resources/printers/C13.json b/resources/printers/C13.json index 2dbc7221a4..53fc26a341 100644 --- a/resources/printers/C13.json +++ b/resources/printers/C13.json @@ -14,6 +14,10 @@ } }, "nozzle_temp_range": [ 0, 320 ], + "nozzle_replace_wiki": { + "zh": "https://wiki.bambulab.com/zh/x1/maintenance/replace-hotend", + "en": "https://wiki.bambulab.com/en/x1/maintenance/replace-hotend" + }, "support_motor_noise_cali": false, "support_tunnel_mqtt": true, "support_mqtt_alive": true, diff --git a/resources/printers/N1.json b/resources/printers/N1.json index 6f5a6ed90b..a6c10bca8f 100644 --- a/resources/printers/N1.json +++ b/resources/printers/N1.json @@ -10,6 +10,10 @@ } }, "nozzle_temp_range": [ 0, 300 ], + "nozzle_replace_wiki": { + "zh": "https://wiki.bambulab.com/zh/a1-mini/maintenance/hotend-heating-assembly-replacement", + "en": "https://wiki.bambulab.com/en/a1-mini/maintenance/hotend-heating-assembly-replacement" + }, "support_motor_noise_cali": true, "support_tunnel_mqtt": true, "support_mqtt_alive": true, diff --git a/resources/printers/N2S.json b/resources/printers/N2S.json index bf87b9ed43..1aa0210072 100644 --- a/resources/printers/N2S.json +++ b/resources/printers/N2S.json @@ -10,6 +10,10 @@ } }, "nozzle_temp_range": [ 0, 300 ], + "nozzle_replace_wiki": { + "zh": "https://wiki.bambulab.com/zh/a1-mini/maintenance/hotend-heating-assembly-replacement", + "en": "https://wiki.bambulab.com/en/a1-mini/maintenance/hotend-heating-assembly-replacement" + }, "support_motor_noise_cali": true, "support_tunnel_mqtt": true, "support_mqtt_alive": true, diff --git a/resources/printers/O1D.json b/resources/printers/O1D.json index fde457cafc..87f4aa3c51 100644 --- a/resources/printers/O1D.json +++ b/resources/printers/O1D.json @@ -20,6 +20,10 @@ } }, "nozzle_temp_range": [ 0, 350 ], + "nozzle_replace_wiki": { + "zh": "https://wiki.bambulab.com/zh/h2/maintenance/replace-hotend", + "en": "https://wiki.bambulab.com/en/h2/maintenance/replace-hotend" + }, "bed_temp_range": [ 0, 120 ], "support_motor_noise_cali": false, "support_tunnel_mqtt": true, diff --git a/resources/printers/version.txt b/resources/printers/version.txt index 7f023810f7..14e655d15a 100644 --- a/resources/printers/version.txt +++ b/resources/printers/version.txt @@ -1 +1 @@ -02.00.00.25 \ No newline at end of file +02.00.00.26 \ No newline at end of file diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 0d4934fb3f..6fdb83a6f9 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -6885,6 +6885,23 @@ void MachineObject::command_set_save_remote_print_file_to_storage(bool save) } } +wxString MachineObject::get_nozzle_replace_url() const +{ + const wxString& strLanguage = GUI::wxGetApp().app_config->get("language"); + const wxString& lan_code = strLanguage.BeforeFirst('_'); + + const json& link_map = DeviceManager::get_json_from_config(printer_type, "print", "nozzle_replace_wiki"); + if (link_map.contains(lan_code.ToStdString())) { + return link_map[lan_code.ToStdString()].get(); + } + + if (link_map.contains("en")){ + return link_map["en"].get(); + }/*retry with en*/ + + return "https://wiki.bambulab.com/en/h2/maintenance/replace-hotend"; +} + bool DeviceManager::EnableMultiMachine = false; bool DeviceManager::key_field_only = false; diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index dd5c2199b1..b1381cf953 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -815,6 +815,7 @@ public: [[nodiscard]] bool is_nozzle_flow_type_supported() const { return is_enable_np; }; [[nodiscard]] NozzleFlowType get_nozzle_flow_type(int extruder_id) const; [[nodiscard]] const Extder& get_current_extruder() const; + [[nodiscard]] wxString get_nozzle_replace_url() const; //new fan data AirDuctData m_air_duct_data; @@ -1496,6 +1497,32 @@ public: return T(); } + static json get_json_from_config(const std::string& type_str, const std::string& key1, const std::string& key2 = std::string()) { + std::string config_file = Slic3r::resources_dir() + "/printers/" + type_str + ".json"; + boost::nowide::ifstream json_file(config_file.c_str()); + try { + json jj; + if (json_file.is_open()) { + json_file >> jj; + if (jj.contains("00.00.00.00")) { + json const& printer = jj["00.00.00.00"]; + if (printer.contains(key1)) { + json const& key1_item = printer[key1]; + if (key2.empty()) { + return key1_item; + } + + if (key1_item.contains(key2)) { + return key1_item[key2]; + } + } + } + } + } + catch (...) {} + return json(); + } + static std::string parse_printer_type(std::string type_str); static std::string get_printer_display_name(std::string type_str); static std::string get_printer_thumbnail_img(std::string type_str); diff --git a/src/slic3r/GUI/PrintOptionsDialog.cpp b/src/slic3r/GUI/PrintOptionsDialog.cpp index ccd6dfd531..20e76bdcb0 100644 --- a/src/slic3r/GUI/PrintOptionsDialog.cpp +++ b/src/slic3r/GUI/PrintOptionsDialog.cpp @@ -621,10 +621,21 @@ PrinterPartsDialog::PrinterPartsDialog(wxWindow* parent) line_sizer_nozzle_flowtype->Add(0, 0, 1, wxEXPAND, 5); line_sizer_nozzle_flowtype->Add(nozzle_flow_type_checkbox, 0, wxALIGN_CENTER, 5); + wxSizer* h_tips_sizer = new wxBoxSizer(wxHORIZONTAL); change_nozzle_tips = new Label(single_panel, _L("Please change the nozzle settings on the printer.")); change_nozzle_tips->SetFont(Label::Body_13); change_nozzle_tips->SetForegroundColour(STATIC_TEXT_CAPTION_COL); + m_wiki_link = new Label(single_panel, _L("View wiki")); + m_wiki_link->SetFont(Label::Body_13); + m_wiki_link->SetForegroundColour(wxColour(0, 174, 66)); + m_wiki_link->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) { SetCursor(wxCURSOR_HAND); }); + m_wiki_link->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) { SetCursor(wxCURSOR_ARROW); }); + m_wiki_link->Bind(wxEVT_LEFT_DOWN, &PrinterPartsDialog::OnWikiClicked, this); + + h_tips_sizer->Add(change_nozzle_tips, 0, wxLEFT); + h_tips_sizer->Add(m_wiki_link, 0, wxLEFT, FromDIP(5)); + single_sizer->Add(single_line, 0, wxEXPAND, 0); single_sizer->Add(0, 0, 0, wxTOP, FromDIP(15)); single_sizer->Add(line_sizer_nozzle_type, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, FromDIP(10)); @@ -633,7 +644,7 @@ PrinterPartsDialog::PrinterPartsDialog(wxWindow* parent) single_sizer->Add(0, 0, 0, wxTOP, FromDIP(15)); single_sizer->Add(line_sizer_nozzle_flowtype, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, FromDIP(10)); single_sizer->Add(0, 0, 0, wxTOP, FromDIP(10)); - single_sizer->Add(change_nozzle_tips, 0, wxLEFT, FromDIP(24)); + single_sizer->Add(h_tips_sizer, 0, wxLEFT, FromDIP(10)); single_sizer->Add(0, 0, 0, wxTOP, FromDIP(10)); single_panel->SetSizer(single_sizer); @@ -716,6 +727,17 @@ PrinterPartsDialog::PrinterPartsDialog(wxWindow* parent) multiple_change_nozzle_tips->SetFont(Label::Body_13); multiple_change_nozzle_tips->SetForegroundColour(STATIC_TEXT_CAPTION_COL); + multiple_wiki_link = new Label(multiple_panel, _L("View wiki")); + multiple_wiki_link->SetFont(Label::Body_13); + multiple_wiki_link->SetForegroundColour(wxColour(0, 174, 66)); + multiple_wiki_link->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) { SetCursor(wxCURSOR_HAND); }); + multiple_wiki_link->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) { SetCursor(wxCURSOR_ARROW); }); + multiple_wiki_link->Bind(wxEVT_LEFT_DOWN, &PrinterPartsDialog::OnWikiClicked, this); + + wxSizer* multiple_change_tips_sizer = new wxBoxSizer(wxHORIZONTAL); + multiple_change_tips_sizer->Add(multiple_change_nozzle_tips, 0, wxLEFT); + multiple_change_tips_sizer->Add(multiple_wiki_link, 0, wxLEFT, FromDIP(5)); + multiple_sizer->Add(multi_line, 0, wxEXPAND, 0); multiple_sizer->Add(0, 0, 0, wxTOP, FromDIP(15)); multiple_sizer->Add(leftTitle, 0, wxLEFT, FromDIP(18)); @@ -724,7 +746,7 @@ PrinterPartsDialog::PrinterPartsDialog(wxWindow* parent) multiple_sizer->Add(rightTitle, 0, wxLEFT, FromDIP(18)); multiple_sizer->Add(multiple_right_line_sizer, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, FromDIP(18)); multiple_sizer->Add(0, 0, 0, wxTOP, FromDIP(20)); - multiple_sizer->Add(multiple_change_nozzle_tips, 0, wxLEFT, FromDIP(18)); + multiple_sizer->Add(multiple_change_tips_sizer, 0, wxLEFT, FromDIP(10)); multiple_sizer->Add(0, 0, 0, wxTOP, FromDIP(10)); multiple_panel->SetSizer(multiple_sizer); @@ -840,4 +862,16 @@ wxString PrinterPartsDialog::GetString(NozzleFlowType nozzle_flow_type) const { return wxEmptyString; } +void PrinterPartsDialog::OnWikiClicked(wxMouseEvent& e) +{ + if (!obj) { return; } + + const wxString& url = obj->get_nozzle_replace_url(); + if (!url.IsEmpty()) { + wxLaunchDefaultBrowser(url); + } else { + wxMessageBox(_L("No wiki link available for this printer."), _L("Error"), wxOK | wxICON_ERROR, this); + } +}// PrinterPartsDialog::OnWikiClicked + }} // namespace Slic3r::GUI diff --git a/src/slic3r/GUI/PrintOptionsDialog.hpp b/src/slic3r/GUI/PrintOptionsDialog.hpp index 796cec7308..ee5a263908 100644 --- a/src/slic3r/GUI/PrintOptionsDialog.hpp +++ b/src/slic3r/GUI/PrintOptionsDialog.hpp @@ -32,6 +32,7 @@ protected: Label* nozzle_flow_type_label; ComboBox* nozzle_flow_type_checkbox; Label *change_nozzle_tips; + Label* m_wiki_link; ComboBox* multiple_left_nozzle_type_checkbox; ComboBox *multiple_left_nozzle_diameter_checkbox; @@ -42,6 +43,7 @@ protected: ComboBox *multiple_right_nozzle_flow_checkbox; Label *multiple_change_nozzle_tips; + Label* multiple_wiki_link; wxPanel *single_panel; wxPanel *multiple_panel; @@ -56,6 +58,7 @@ public: private: void EnableEditing(bool enable); + void OnWikiClicked(wxMouseEvent& e); wxString GetString(NozzleType nozzle_type) const; wxString GetString(NozzleFlowType nozzle_flow_type) const;