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:
parent
7873c28584
commit
41d5c16b76
3 changed files with 41 additions and 32 deletions
|
@ -2808,21 +2808,25 @@ bool ConfigWizard::priv::check_and_install_missing_materials(Technology technolo
|
|||
}
|
||||
}
|
||||
}
|
||||
// template_profile_selected check
|
||||
template_profile_selected = false;
|
||||
for (const auto& bp : bundles) {
|
||||
if (!bp.second.preset_bundle->vendors.empty() && bp.second.preset_bundle->vendors.begin()->second.templates_profile) {
|
||||
for (const auto& preset : appconfig_presets) {
|
||||
const PresetCollection& template_materials = bp.second.preset_bundle->materials(technology);
|
||||
const Preset* template_material = template_materials.find_preset(preset.first, false);
|
||||
if (template_material){
|
||||
template_profile_selected = true;
|
||||
// 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 = false;
|
||||
for (const auto& bp : bundles) {
|
||||
if (!bp.second.preset_bundle->vendors.empty() && bp.second.preset_bundle->vendors.begin()->second.templates_profile) {
|
||||
for (const auto& preset : appconfig_presets) {
|
||||
const PresetCollection& template_materials = bp.second.preset_bundle->materials(technology);
|
||||
const Preset* template_material = template_materials.find_preset(preset.first, false);
|
||||
if (template_material){
|
||||
template_profile_selected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (template_profile_selected) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (template_profile_selected) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
assert(printer_models_without_material.empty() || only_for_model_id.empty() || only_for_model_id == (*printer_models_without_material.begin())->id);
|
||||
|
@ -2988,11 +2992,12 @@ bool ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
|
|||
}
|
||||
|
||||
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 (template_profile_selected && pair.second.vendor_profile && pair.second.vendor_profile->templates_profile && vendor == enabled_vendors.end()) {
|
||||
// Templates vendor needs to be installed
|
||||
install_bundles.emplace_back(pair.first);
|
||||
if (vendor == enabled_vendors.end()) {
|
||||
// vendor not found
|
||||
// if templates vendor and needs to be installed, add it
|
||||
// then continue
|
||||
if (template_profile_selected && pair.second.vendor_profile && pair.second.vendor_profile->templates_profile)
|
||||
install_bundles.emplace_back(pair.first);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -808,6 +808,7 @@ void GUI_App::post_init()
|
|||
// Configuration is not compatible and reconfigure was refused by the user. Application is closing.
|
||||
return;
|
||||
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();
|
||||
this->preset_updater->sync(preset_bundle);
|
||||
this->app_version_check(false);
|
||||
|
|
|
@ -920,22 +920,25 @@ 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_vendors = (p->vendor_path / bundle).replace_extension(".ini");
|
||||
// find if in cache vendor is newer version than in resources
|
||||
auto vp_cache = VendorProfile::from_ini(path_in_cache_vendor, false);
|
||||
auto vp_rsrc = VendorProfile::from_ini(path_in_rsrc, false);
|
||||
if (vp_cache.config_version > vp_rsrc.config_version) {
|
||||
// in case we are installing from cache / vendor. we should also copy index to cache
|
||||
// This needs to be done now bcs the current one would be missing this version on next start
|
||||
auto path_idx_cache_vendor(path_in_cache_vendor);
|
||||
path_idx_cache_vendor.replace_extension(".idx");
|
||||
auto path_idx_cache = (p->cache_path / bundle).replace_extension(".idx");
|
||||
// DK: do this during perform_updates() too?
|
||||
if (fs::exists(path_idx_cache_vendor))
|
||||
copy_file_fix(path_idx_cache_vendor, path_idx_cache);
|
||||
else // Should we dialog this?
|
||||
BOOST_LOG_TRIVIAL(error) << GUI::format(_L("Couldn't locate idx file %1% when performing updates."), path_idx_cache_vendor.string());
|
||||
updates.updates.emplace_back(std::move(path_in_cache_vendor), std::move(path_in_vendors), Version(), "", "");
|
||||
if (boost::filesystem::exists(path_in_cache_vendor)) {
|
||||
auto vp_cache = VendorProfile::from_ini(path_in_cache_vendor, false);
|
||||
auto vp_rsrc = VendorProfile::from_ini(path_in_rsrc, false);
|
||||
if (vp_cache.config_version > vp_rsrc.config_version) {
|
||||
// in case we are installing from cache / vendor. we should also copy index to cache
|
||||
// This needs to be done now bcs the current one would be missing this version on next start
|
||||
auto path_idx_cache_vendor(path_in_cache_vendor);
|
||||
path_idx_cache_vendor.replace_extension(".idx");
|
||||
auto path_idx_cache = (p->cache_path / bundle).replace_extension(".idx");
|
||||
// DK: do this during perform_updates() too?
|
||||
if (fs::exists(path_idx_cache_vendor))
|
||||
copy_file_fix(path_idx_cache_vendor, path_idx_cache);
|
||||
else // Should we dialog this?
|
||||
BOOST_LOG_TRIVIAL(error) << GUI::format(_L("Couldn't locate idx file %1% when performing updates."), path_idx_cache_vendor.string());
|
||||
updates.updates.emplace_back(std::move(path_in_cache_vendor), std::move(path_in_vendors), Version(), "", "");
|
||||
|
||||
} else
|
||||
} else
|
||||
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(), "", "");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue