Fixed bugs from SPE-180
This commit is contained in:
parent
53e100b890
commit
77f5ed6851
5 changed files with 13 additions and 24 deletions
|
@ -1041,7 +1041,7 @@ PrintConfigDef::PrintConfigDef()
|
||||||
def->multiline = true;
|
def->multiline = true;
|
||||||
def->full_width = true;
|
def->full_width = true;
|
||||||
def->height = 60;
|
def->height = 60;
|
||||||
def->default_value = new ConfigOptionStrings{ "" };
|
def->default_value = new ConfigOptionStrings();
|
||||||
|
|
||||||
def = this->add("printer_model", coString);
|
def = this->add("printer_model", coString);
|
||||||
def->label = L("Printer type");
|
def->label = L("Printer type");
|
||||||
|
|
|
@ -404,6 +404,7 @@ void Choice::set_value(boost::any value, bool change_event)
|
||||||
case coInt:
|
case coInt:
|
||||||
case coFloat:
|
case coFloat:
|
||||||
case coPercent:
|
case coPercent:
|
||||||
|
case coString:
|
||||||
case coStrings:{
|
case coStrings:{
|
||||||
wxString text_value;
|
wxString text_value;
|
||||||
if (m_opt.type == coInt)
|
if (m_opt.type == coInt)
|
||||||
|
@ -417,7 +418,6 @@ void Choice::set_value(boost::any value, bool change_event)
|
||||||
break;
|
break;
|
||||||
++idx;
|
++idx;
|
||||||
}
|
}
|
||||||
// if (m_opt.type == coPercent) text_value += "%";
|
|
||||||
idx == m_opt.enum_values.size() ?
|
idx == m_opt.enum_values.size() ?
|
||||||
dynamic_cast<wxComboBox*>(window)->SetValue(text_value) :
|
dynamic_cast<wxComboBox*>(window)->SetValue(text_value) :
|
||||||
dynamic_cast<wxComboBox*>(window)->SetSelection(idx);
|
dynamic_cast<wxComboBox*>(window)->SetSelection(idx);
|
||||||
|
@ -446,6 +446,7 @@ void Choice::set_values(const std::vector<std::string> values)
|
||||||
auto ww = dynamic_cast<wxComboBox*>(window);
|
auto ww = dynamic_cast<wxComboBox*>(window);
|
||||||
auto value = ww->GetValue();
|
auto value = ww->GetValue();
|
||||||
ww->Clear();
|
ww->Clear();
|
||||||
|
ww->Append("");
|
||||||
for (auto el : values)
|
for (auto el : values)
|
||||||
ww->Append(wxString(el));
|
ww->Append(wxString(el));
|
||||||
ww->SetValue(value);
|
ww->SetValue(value);
|
||||||
|
|
|
@ -406,8 +406,9 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config
|
||||||
ret = text_value;
|
ret = text_value;
|
||||||
else if (opt->gui_flags.compare("serialized") == 0){
|
else if (opt->gui_flags.compare("serialized") == 0){
|
||||||
std::vector<std::string> values = config.option<ConfigOptionStrings>(opt_key)->values;
|
std::vector<std::string> values = config.option<ConfigOptionStrings>(opt_key)->values;
|
||||||
for (auto el : values)
|
if (!values.empty() && values[0].compare("") != 0)
|
||||||
text_value += el + ";";
|
for (auto el : values)
|
||||||
|
text_value += el + ";";
|
||||||
ret = text_value;
|
ret = text_value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -584,14 +584,6 @@ std::vector<std::string> PresetCollection::system_equal_options() const
|
||||||
std::vector<std::string> equal;
|
std::vector<std::string> equal;
|
||||||
if (edited != nullptr && reference != nullptr) {
|
if (edited != nullptr && reference != nullptr) {
|
||||||
equal = reference->config.equal(edited->config);
|
equal = reference->config.equal(edited->config);
|
||||||
// The "compatible_printers" option key is handled differently from the others:
|
|
||||||
// It is not mandatory. If the key is missing, it means it is compatible with any printer.
|
|
||||||
// If the key exists and it is empty, it means it is compatible with no printer.
|
|
||||||
std::initializer_list<const char*> optional_keys{ "compatible_printers", "compatible_printers_condition" };
|
|
||||||
for (auto &opt_key : optional_keys) {
|
|
||||||
if (reference->config.has(opt_key) == edited->config.has(opt_key))
|
|
||||||
equal.emplace_back(opt_key);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return equal;
|
return equal;
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,11 +225,6 @@ void Tab::update_changed_ui()
|
||||||
m_sys_options.resize(0);
|
m_sys_options.resize(0);
|
||||||
const auto sys_preset = m_presets->get_selected_preset_parent();
|
const auto sys_preset = m_presets->get_selected_preset_parent();
|
||||||
if (sys_preset){
|
if (sys_preset){
|
||||||
std::initializer_list<const char*> optional_keys{"compatible_printers", "compatible_printers_condition" };
|
|
||||||
for (auto &opt_key : optional_keys) {
|
|
||||||
if (m_config->has(opt_key) == sys_preset->config.has(opt_key))
|
|
||||||
m_sys_options.emplace_back(opt_key);
|
|
||||||
}
|
|
||||||
for (auto opt_key : m_config->keys())
|
for (auto opt_key : m_config->keys())
|
||||||
{
|
{
|
||||||
if (opt_key == "bed_shape"){ m_sys_options.emplace_back(opt_key); continue; }
|
if (opt_key == "bed_shape"){ m_sys_options.emplace_back(opt_key); continue; }
|
||||||
|
@ -241,7 +236,13 @@ void Tab::update_changed_ui()
|
||||||
case coStrings: add_correct_opts_to_sys_options<ConfigOptionStrings >(opt_key, &m_sys_options, tab); break;
|
case coStrings: add_correct_opts_to_sys_options<ConfigOptionStrings >(opt_key, &m_sys_options, tab); break;
|
||||||
case coPercents:add_correct_opts_to_sys_options<ConfigOptionPercents>(opt_key, &m_sys_options, tab); break;
|
case coPercents:add_correct_opts_to_sys_options<ConfigOptionPercents>(opt_key, &m_sys_options, tab); break;
|
||||||
case coPoints: add_correct_opts_to_sys_options<ConfigOptionPoints >(opt_key, &m_sys_options, tab); break;
|
case coPoints: add_correct_opts_to_sys_options<ConfigOptionPoints >(opt_key, &m_sys_options, tab); break;
|
||||||
default: m_sys_options.emplace_back(opt_key); break;
|
default:{
|
||||||
|
const ConfigOption *opt_cur = tab->m_config->option(opt_key);
|
||||||
|
const ConfigOption *opt_sys = sys_preset->config.option(opt_key);
|
||||||
|
if (opt_cur != nullptr && opt_sys != nullptr && *opt_cur == *opt_sys)
|
||||||
|
m_sys_options.emplace_back(opt_key);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,12 +359,6 @@ void Tab::update_full_options_list()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_full_options_list.emplace_back("extruders_count");
|
m_full_options_list.emplace_back("extruders_count");
|
||||||
|
|
||||||
std::initializer_list<const char*> optional_keys{ "compatible_printers", "compatible_printers_condition" };
|
|
||||||
for (auto &opt_key : optional_keys) {
|
|
||||||
if (m_config->has(opt_key))
|
|
||||||
m_full_options_list.emplace_back(opt_key);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tab::update_sys_ui_after_sel_preset()
|
void Tab::update_sys_ui_after_sel_preset()
|
||||||
|
|
Loading…
Reference in a new issue