SPE 2462: Fix of using printer family instead of printer model when filtering printers for PrusaLink

This commit is contained in:
David Kocik 2024-09-03 15:03:21 +02:00 committed by Lukas Matena
parent 223f88556d
commit 44191c8831

View File

@ -730,12 +730,18 @@ void PhysicalPrinterDialog::update_host_type(bool printer_change)
if (Preset* preset = wxGetApp().preset_bundle->printers.find_preset(preset_name)) { if (Preset* preset = wxGetApp().preset_bundle->printers.find_preset(preset_name)) {
std::string model_id = preset->config.opt_string("printer_model"); std::string model_id = preset->config.opt_string("printer_model");
if (preset->vendor) { if (preset->vendor) {
// No need to remove prefix from printer_model, family is not prefixed std::string model_id_no_pref = model_id;
std::string vendor_repo_prefix;
vendor_repo_prefix = preset->vendor->repo_prefix;
if (model_id_no_pref.find(vendor_repo_prefix) == 0) {
model_id_no_pref = model_id_no_pref.substr(vendor_repo_prefix.size());
boost::trim_left(model_id_no_pref);
}
if (preset->vendor->name.find("Prusa Research") != std::string::npos) { if (preset->vendor->name.find("Prusa Research") != std::string::npos) {
const std::vector<VendorProfile::PrinterModel>& models = preset->vendor->models; const std::vector<VendorProfile::PrinterModel>& models = preset->vendor->models;
auto it = std::find_if(models.begin(), models.end(), auto it = std::find_if(models.begin(), models.end(),
[model_id](const VendorProfile::PrinterModel& model) { return model.id == model_id; }); [model_id](const VendorProfile::PrinterModel& model) { return model.id == model_id; });
if (it != models.end() && model_supports_prusalink(it->family)) if (it != models.end() && model_supports_prusalink(model_id_no_pref))
continue; continue;
} }
} }