Temporary workaround for compatibility with older Slicer:

To the "physical_printer" added "preset_name" option as a duplicate of the "preset_names" but like one string.
Note: It will works just for printer preset names without ";" (see #5503)
This commit is contained in:
YuSanka 2021-07-20 10:18:59 +02:00
parent cc92757cdc
commit bf981ae049
2 changed files with 16 additions and 0 deletions

View File

@ -1418,6 +1418,7 @@ const std::vector<std::string>& PhysicalPrinter::printer_options()
static std::vector<std::string> s_opts; static std::vector<std::string> s_opts;
if (s_opts.empty()) { if (s_opts.empty()) {
s_opts = { s_opts = {
"preset_name", // temporary option to compatibility with older Slicer
"preset_names", "preset_names",
"printer_technology", "printer_technology",
"host_type", "host_type",
@ -1481,6 +1482,15 @@ void PhysicalPrinter::update_preset_names_in_config()
values.clear(); values.clear();
for (auto preset : preset_names) for (auto preset : preset_names)
values.push_back(preset); values.push_back(preset);
// temporary workaround for compatibility with older Slicer
{
std::string name;
for (auto el : preset_names)
name += el + ";";
name.pop_back();
config.set_key_value("preset_name", new ConfigOptionString(name));
}
} }
} }

View File

@ -317,6 +317,12 @@ void PrintConfigDef::init_common_params()
def->mode = comAdvanced; def->mode = comAdvanced;
def->set_default_value(new ConfigOptionStrings()); def->set_default_value(new ConfigOptionStrings());
// temporary workaround for compatibility with older Slicer
{
def = this->add("preset_name", coString);
def->set_default_value(new ConfigOptionString());
}
def = this->add("printhost_authorization_type", coEnum); def = this->add("printhost_authorization_type", coEnum);
def->label = L("Authorization Type"); def->label = L("Authorization Type");
// def->tooltip = L(""); // def->tooltip = L("");