Notice dialog about no default materials in printer profile.
This commit is contained in:
parent
b431fd1f7e
commit
6ebd58e7a0
1 changed files with 34 additions and 6 deletions
|
@ -2293,7 +2293,10 @@ void ConfigWizard::priv::select_default_materials_for_printer_models(Technology
|
|||
PageMaterials *page_materials = technology & T_FFF ? page_filaments : page_sla_materials;
|
||||
const std::string &appconfig_section = page_materials->materials->appconfig_section();
|
||||
|
||||
auto select_default_materials_for_printer_page = [this, appconfig_section, printer_models](PagePrinters *page_printers, Technology technology)
|
||||
// Following block was unnecessary. Its enough to iterate printer_models once. Not for every vendor printer page.
|
||||
// Filament is selected on same page for all printers of same technology.
|
||||
/*
|
||||
auto select_default_materials_for_printer_page = [this, appconfig_section, printer_models, technology](PagePrinters *page_printers, Technology technology)
|
||||
{
|
||||
const std::string vendor_id = page_printers->get_vendor_id();
|
||||
for (auto& pair : bundles)
|
||||
|
@ -2312,6 +2315,31 @@ void ConfigWizard::priv::select_default_materials_for_printer_models(Technology
|
|||
if (page_printers)
|
||||
select_default_materials_for_printer_page(page_printers, technology);
|
||||
}
|
||||
*/
|
||||
|
||||
// Iterate printer_models and select default materials. If none available -> msg to user.
|
||||
std::vector<const VendorProfile::PrinterModel*> models_without_default;
|
||||
for (const VendorProfile::PrinterModel* printer_model : printer_models) {
|
||||
if (printer_model->default_materials.empty()) {
|
||||
models_without_default.emplace_back(printer_model);
|
||||
} else {
|
||||
for (const std::string& material : printer_model->default_materials)
|
||||
appconfig_new.set(appconfig_section, material, "1");
|
||||
}
|
||||
}
|
||||
|
||||
if (!models_without_default.empty()) {
|
||||
std::string printer_names = "\n\n";
|
||||
for (const VendorProfile::PrinterModel* printer_model : models_without_default) {
|
||||
printer_names += printer_model->name + "\n";
|
||||
}
|
||||
printer_names += "\n\n";
|
||||
std::string message = (technology & T_FFF ?
|
||||
GUI::format(_L("Following printer profiles has no default filament: %1%Please select one manually."), printer_names) :
|
||||
GUI::format(_L("Following printer profiles has no default material: %1%Please select one manually."), printer_names));
|
||||
MessageDialog msg(q, message, _L("Notice"), wxOK);
|
||||
msg.ShowModal();
|
||||
}
|
||||
|
||||
update_materials(technology);
|
||||
((technology & T_FFF) ? page_filaments : page_sla_materials)->reload_presets();
|
||||
|
|
Loading…
Reference in a new issue