ENH: add wiki for replacing nozzle

jira: [STUDIO-12864]
Change-Id: I3804d3599eb8746902f23b59626fe8c04e949dca
(cherry picked from commit b9428cd32ff8c1c748377cab1e5539fed911177d)
This commit is contained in:
xin.zhang
2025-06-23 15:06:26 +08:00
committed by Noisyfox
parent 8dc43f1b67
commit 8f943486a1
13 changed files with 116 additions and 3 deletions

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -1 +1 @@
02.00.00.25
02.00.00.26

View File

@@ -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<wxString>();
}
if (link_map.contains("en")){
return link_map["en"].get<wxString>();
}/*retry with en*/
return "https://wiki.bambulab.com/en/h2/maintenance/replace-hotend";
}
bool DeviceManager::EnableMultiMachine = false;
bool DeviceManager::key_field_only = false;

View File

@@ -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);

View File

@@ -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

View File

@@ -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;