ENH: add logic to load default filaments of newly added model

1. fix the prefer_model issue
2. when a printer is visible and no filament is selected, just set its default materials to visible
3. add some log for shutdown debug

Change-Id: I599dbd9c8b180c944ff4086c7638267ff002f94a
This commit is contained in:
lane.wei 2022-10-18 16:07:50 +08:00 committed by Lane.Wei
parent 16e7993a65
commit 631897c0a6
4 changed files with 47 additions and 24 deletions

View file

@ -749,28 +749,23 @@ bool GuideFrame::apply_config(AppConfig *app_config, PresetBundle *preset_bundle
const auto config = enabled_vendors.find(bundle_name);
if (config == enabled_vendors.end())
return std::string();
auto vendor_profile = preset_bundle->vendors.find(bundle_name);
if (vendor_profile == preset_bundle->vendors.end()) {
BOOST_LOG_TRIVIAL(info) << boost::format("%1%, can not find bundle %2% in preset bundles")%__FUNCTION__ %bundle_name;
return std::string();
}
const std::map<std::string, std::set<std::string>>& model_maps = config->second;
//for (const auto& vendor_profile : preset_bundle->vendors) {
for (const auto model: vendor_profile->second.models) {
if (const auto model_it = config->second.find(model.id);
model_it != config->second.end() && model_it->second.size() > 0 &&
preferred_pt == model.technology) {
variant = *model_it->second.begin();
for (const auto model_it: model_maps) {
if (model_it.second.size() > 0) {
variant = *model_it.second.begin();
const auto config_old = old_enabled_vendors.find(bundle_name);
if (config_old == old_enabled_vendors.end())
return model.id;
const auto model_it_old = config_old->second.find(model.id);
return model_it.first;
const auto model_it_old = config_old->second.find(model_it.first);
if (model_it_old == config_old->second.end())
return model.id;
else if (model_it_old->second != model_it->second) {
for (const auto& var : model_it->second)
return model_it.first;
else if (model_it_old->second != model_it.second) {
for (const auto& var : model_it.second)
if (model_it_old->second.find(var) == model_it_old->second.end()) {
variant = var;
return model.id;
return model_it.first;
}
}
}