select default print when add the first printer from wizard

supermerill/SuperSlicer#1198
This commit is contained in:
remi durand 2021-05-30 01:44:18 +02:00
parent 370e9ca741
commit 03cc99cdf7
2 changed files with 10 additions and 3 deletions

View File

@ -941,7 +941,8 @@ void PresetCollection::load_presets(const std::string &dir_path, const std::stri
}
m_presets.insert(m_presets.end(), std::make_move_iterator(presets_loaded.begin()), std::make_move_iterator(presets_loaded.end()));
std::sort(m_presets.begin() + m_num_default_presets, m_presets.end());
this->select_preset(first_visible_idx());
if(this->type() == Preset::Type::TYPE_PRINTER)
this->select_preset(first_visible_idx());
if (! errors_cummulative.empty())
throw Slic3r::RuntimeError(errors_cummulative);
}
@ -1329,6 +1330,8 @@ size_t PresetCollection::update_compatible_internal(const PresetWithVendorProfil
if (opt)
config.set_key_value("num_milling", new ConfigOptionInt((int)static_cast<const ConfigOptionFloats*>(opt)->values.size()));
bool some_compatible = false;
if(m_idx_selected < m_num_default_presets && unselect_if_incompatible != PresetSelectCompatibleType::Never)
m_idx_selected = size_t(-1);
for (size_t idx_preset = m_num_default_presets; idx_preset < m_presets.size(); ++ idx_preset) {
bool selected = idx_preset == m_idx_selected;
Preset &preset_selected = m_presets[idx_preset];

View File

@ -1481,7 +1481,10 @@ void PresetBundle::update_compatible(PresetSelectCompatibleType select_other_pri
{
public:
PreferedPrintProfileMatch(const Preset &preset, const std::string &prefered_name) :
PreferedProfileMatch(preset.alias, prefered_name), m_prefered_layer_height(preset.config.opt_float("layer_height")) {}
PreferedProfileMatch(preset.alias, prefered_name), m_alias_preset(preset), m_prefered_layer_height(0){
if(!preset.alias.empty())
m_prefered_layer_height = preset.config.opt_float("layer_height");
}
int operator()(const Preset &preset) const
{
@ -1495,7 +1498,8 @@ void PresetBundle::update_compatible(PresetSelectCompatibleType select_other_pri
}
private:
const double m_prefered_layer_height;
double m_prefered_layer_height;
const Preset& m_alias_preset;
};
// Matching by the layer height in addition.