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

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