fix of crash on empty config -> add template filament

fixed checking if template profile needs to be installed
fixed checking path before loading profile header from cache / vendor
This commit is contained in:
David Kocik 2022-04-22 15:04:58 +02:00
parent bf6988fb5f
commit 050c03b291
3 changed files with 41 additions and 32 deletions

View File

@ -2535,6 +2535,9 @@ bool ConfigWizard::priv::check_and_install_missing_materials(Technology technolo
} }
} }
} }
// todo: just workaround so template_profile_selected wont get to false after this function is called for SLA
// this will work unltil there are no SLA template filaments
if (technology == ptFFF) {
// template_profile_selected check // template_profile_selected check
template_profile_selected = false; template_profile_selected = false;
for (const auto& bp : bundles) { for (const auto& bp : bundles) {
@ -2552,6 +2555,7 @@ bool ConfigWizard::priv::check_and_install_missing_materials(Technology technolo
} }
} }
} }
}
assert(printer_models_without_material.empty() || only_for_model_id.empty() || only_for_model_id == (*printer_models_without_material.begin())->id); assert(printer_models_without_material.empty() || only_for_model_id.empty() || only_for_model_id == (*printer_models_without_material.begin())->id);
return printer_models_without_material; return printer_models_without_material;
}; };
@ -2715,10 +2719,11 @@ bool ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
} }
const auto vendor = enabled_vendors.find(pair.first); const auto vendor = enabled_vendors.find(pair.first);
if (vendor == enabled_vendors.end() && ((pair.second.vendor_profile && !pair.second.vendor_profile->templates_profile) || !pair.second.vendor_profile) ) { continue; } if (vendor == enabled_vendors.end()) {
// vendor not found
if (template_profile_selected && pair.second.vendor_profile && pair.second.vendor_profile->templates_profile && vendor == enabled_vendors.end()) { // if templates vendor and needs to be installed, add it
// Templates vendor needs to be installed // then continue
if (template_profile_selected && pair.second.vendor_profile && pair.second.vendor_profile->templates_profile)
install_bundles.emplace_back(pair.first); install_bundles.emplace_back(pair.first);
continue; continue;
} }

View File

@ -786,6 +786,7 @@ void GUI_App::post_init()
// Configuration is not compatible and reconfigure was refused by the user. Application is closing. // Configuration is not compatible and reconfigure was refused by the user. Application is closing.
return; return;
CallAfter([this] { CallAfter([this] {
// preset_updater->sync downloads profile updates on background so it must begin after config wizard finished.
bool cw_showed = this->config_wizard_startup(); bool cw_showed = this->config_wizard_startup();
this->preset_updater->sync(preset_bundle); this->preset_updater->sync(preset_bundle);
this->app_version_check(false); this->app_version_check(false);

View File

@ -920,6 +920,7 @@ bool PresetUpdater::install_bundles_rsrc(std::vector<std::string> bundles, bool
auto path_in_cache_vendor = (p->cache_vendor_path / bundle).replace_extension(".ini"); auto path_in_cache_vendor = (p->cache_vendor_path / bundle).replace_extension(".ini");
auto path_in_vendors = (p->vendor_path / bundle).replace_extension(".ini"); auto path_in_vendors = (p->vendor_path / bundle).replace_extension(".ini");
// find if in cache vendor is newer version than in resources // find if in cache vendor is newer version than in resources
if (boost::filesystem::exists(path_in_cache_vendor)) {
auto vp_cache = VendorProfile::from_ini(path_in_cache_vendor, false); auto vp_cache = VendorProfile::from_ini(path_in_cache_vendor, false);
auto vp_rsrc = VendorProfile::from_ini(path_in_rsrc, false); auto vp_rsrc = VendorProfile::from_ini(path_in_rsrc, false);
if (vp_cache.config_version > vp_rsrc.config_version) { if (vp_cache.config_version > vp_rsrc.config_version) {
@ -937,6 +938,8 @@ bool PresetUpdater::install_bundles_rsrc(std::vector<std::string> bundles, bool
} else } else
updates.updates.emplace_back(std::move(path_in_rsrc), std::move(path_in_vendors), Version(), "", ""); updates.updates.emplace_back(std::move(path_in_rsrc), std::move(path_in_vendors), Version(), "", "");
} else
updates.updates.emplace_back(std::move(path_in_rsrc), std::move(path_in_vendors), Version(), "", "");
} }
return p->perform_updates(std::move(updates), snapshot); return p->perform_updates(std::move(updates), snapshot);