Added updating of the is_external value for edited_preset after loading preset from (.ini, .gcode, .amf, .3mf etc)
This commit is contained in:
parent
fa86d776cb
commit
fcc781195b
2 changed files with 13 additions and 3 deletions
|
@ -336,6 +336,10 @@ public:
|
||||||
// Generate a file path from a profile name. Add the ".ini" suffix if it is missing.
|
// Generate a file path from a profile name. Add the ".ini" suffix if it is missing.
|
||||||
std::string path_from_name(const std::string &new_name) const;
|
std::string path_from_name(const std::string &new_name) const;
|
||||||
|
|
||||||
|
// update m_edited_preset.is_external value after loading preset for .ini, .gcode, .amf, .3mf
|
||||||
|
void update_edited_preset_is_external(bool is_external) {
|
||||||
|
m_edited_preset.is_external = is_external; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Select a preset, if it exists. If it does not exist, select an invalid (-1) index.
|
// Select a preset, if it exists. If it does not exist, select an invalid (-1) index.
|
||||||
// This is a temporary state, which shall be fixed immediately by the following step.
|
// This is a temporary state, which shall be fixed immediately by the following step.
|
||||||
|
|
|
@ -505,8 +505,10 @@ void PresetBundle::load_config_file_config(const std::string &name_or_path, bool
|
||||||
for (size_t i_group = 0; i_group < 2; ++ i_group) {
|
for (size_t i_group = 0; i_group < 2; ++ i_group) {
|
||||||
PresetCollection &presets = (i_group == 0) ? this->prints : this->printers;
|
PresetCollection &presets = (i_group == 0) ? this->prints : this->printers;
|
||||||
Preset &preset = presets.load_preset(is_external ? name_or_path : presets.path_from_name(name), name, config);
|
Preset &preset = presets.load_preset(is_external ? name_or_path : presets.path_from_name(name), name, config);
|
||||||
if (is_external)
|
if (is_external) {
|
||||||
preset.is_external = true;
|
preset.is_external = true;
|
||||||
|
presets.update_edited_preset_is_external(true);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
preset.save();
|
preset.save();
|
||||||
}
|
}
|
||||||
|
@ -518,8 +520,10 @@ void PresetBundle::load_config_file_config(const std::string &name_or_path, bool
|
||||||
if (num_extruders <= 1) {
|
if (num_extruders <= 1) {
|
||||||
Preset &preset = this->filaments.load_preset(
|
Preset &preset = this->filaments.load_preset(
|
||||||
is_external ? name_or_path : this->filaments.path_from_name(name), name, config);
|
is_external ? name_or_path : this->filaments.path_from_name(name), name, config);
|
||||||
if (is_external)
|
if (is_external) {
|
||||||
preset.is_external = true;
|
preset.is_external = true;
|
||||||
|
this->filaments.update_edited_preset_is_external(true);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
preset.save();
|
preset.save();
|
||||||
this->filament_presets.clear();
|
this->filament_presets.clear();
|
||||||
|
@ -553,8 +557,10 @@ void PresetBundle::load_config_file_config(const std::string &name_or_path, bool
|
||||||
Preset &preset = this->filaments.load_preset(
|
Preset &preset = this->filaments.load_preset(
|
||||||
is_external ? name_or_path : this->filaments.path_from_name(new_name),
|
is_external ? name_or_path : this->filaments.path_from_name(new_name),
|
||||||
new_name, std::move(configs[i]), i == 0);
|
new_name, std::move(configs[i]), i == 0);
|
||||||
if (is_external)
|
if (is_external) {
|
||||||
preset.is_external = true;
|
preset.is_external = true;
|
||||||
|
this->filaments.update_edited_preset_is_external(true);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
preset.save();
|
preset.save();
|
||||||
this->filament_presets.emplace_back(new_name);
|
this->filament_presets.emplace_back(new_name);
|
||||||
|
|
Loading…
Reference in a new issue