common filaments for custom printer

This commit is contained in:
David Kocik 2022-02-09 14:07:12 +01:00
parent e566e948a3
commit e794ce4c1d
2 changed files with 13 additions and 4 deletions

View File

@ -1989,14 +1989,15 @@ void ConfigWizard::priv::load_pages()
if (any_fff_selected) { index->add_page(page_filaments); } if (any_fff_selected) { index->add_page(page_filaments); }
// Filaments page if only custom printer is selected // Filaments page if only custom printer is selected
const AppConfig* app_config = wxGetApp().app_config; const AppConfig* app_config = wxGetApp().app_config;
if (!any_fff_selected && custom_printer_selected && (app_config->get("no_common") == "0")) { if (!any_fff_selected && (custom_printer_selected || custom_printer_in_bundle) && (app_config->get("no_common") == "0")) {
update_materials(T_ANY);
index->add_page(page_filaments); index->add_page(page_filaments);
} }
} }
if (any_sla_selected) { index->add_page(page_sla_materials); } if (any_sla_selected) { index->add_page(page_sla_materials); }
// there should to be selected at least one printer // there should to be selected at least one printer
btn_finish->Enable(any_fff_selected || any_sla_selected || custom_printer_selected); btn_finish->Enable(any_fff_selected || any_sla_selected || custom_printer_selected || custom_printer_in_bundle);
index->add_page(page_update); index->add_page(page_update);
index->add_page(page_reload_from_disk); index->add_page(page_reload_from_disk);
@ -2057,6 +2058,13 @@ void ConfigWizard::priv::load_vendors()
} }
} }
for (const auto& printer : wxGetApp().preset_bundle->printers) {
if (!printer.is_default && !printer.is_system && printer.is_visible) {
custom_printer_in_bundle = true;
break;
}
}
// Initialize the is_visible flag in printer Presets // Initialize the is_visible flag in printer Presets
for (auto &pair : bundles) { for (auto &pair : bundles) {
pair.second.preset_bundle->load_installed_printers(appconfig_new); pair.second.preset_bundle->load_installed_printers(appconfig_new);
@ -2178,7 +2186,7 @@ void ConfigWizard::priv::set_run_reason(RunReason run_reason)
void ConfigWizard::priv::update_materials(Technology technology) void ConfigWizard::priv::update_materials(Technology technology)
{ {
if (any_fff_selected && (technology & T_FFF)) { if ((any_fff_selected || custom_printer_in_bundle || custom_printer_selected) && (technology & T_FFF)) {
filaments.clear(); filaments.clear();
aliases_fff.clear(); aliases_fff.clear();
// Iterate filaments in all bundles // Iterate filaments in all bundles

View File

@ -560,7 +560,8 @@ struct ConfigWizard::priv
std::unique_ptr<DynamicPrintConfig> custom_config; // Backing for custom printer definition std::unique_ptr<DynamicPrintConfig> custom_config; // Backing for custom printer definition
bool any_fff_selected; // Used to decide whether to display Filaments page bool any_fff_selected; // Used to decide whether to display Filaments page
bool any_sla_selected; // Used to decide whether to display SLA Materials page bool any_sla_selected; // Used to decide whether to display SLA Materials page
bool custom_printer_selected { false }; bool custom_printer_selected { false }; // New custom printer is requested
bool custom_printer_in_bundle { false }; // Older custom printer already exists when wizard starts
// Set to true if there are none FFF printers on the main FFF page. If true, only SLA printers are shown (not even custum printers) // Set to true if there are none FFF printers on the main FFF page. If true, only SLA printers are shown (not even custum printers)
bool only_sla_mode { false }; bool only_sla_mode { false };