Introduced the system profiles.

The Config Wizard now just copies the Vendor's Config Bundle
into user_dir/vendor/ directory and Slic3r uses the configs
from the bundles found in user_dir/vendor directly.
This commit is contained in:
bubnikv 2018-03-09 16:37:33 +01:00
parent 4e58c9dab9
commit f55becd43c
15 changed files with 318 additions and 11138 deletions

View file

@ -185,7 +185,7 @@ void ConfigBase::apply_only(const ConfigBase &other, const t_config_option_keys
// This is only possible if other is of DynamicConfig type.
if (ignore_nonexistent)
continue;
throw UnknownOptionException();
throw UnknownOptionException(opt_key);
}
const ConfigOption *other_opt = other.option(opt_key);
if (other_opt != nullptr)
@ -232,7 +232,7 @@ bool ConfigBase::set_deserialize_raw(const t_config_option_key &opt_key_src, con
// Try to deserialize the option by its name.
const ConfigDef *def = this->def();
if (def == nullptr)
throw NoDefinitionException();
throw NoDefinitionException(opt_key);
const ConfigOptionDef *optdef = def->get(opt_key);
if (optdef == nullptr) {
// If we didn't find an option, look for any other option having this as an alias.
@ -248,7 +248,7 @@ bool ConfigBase::set_deserialize_raw(const t_config_option_key &opt_key_src, con
break;
}
if (optdef == nullptr)
throw UnknownOptionException();
throw UnknownOptionException(opt_key);
}
if (! optdef->shortcut.empty()) {
@ -278,7 +278,7 @@ double ConfigBase::get_abs_value(const t_config_option_key &opt_key) const
// Get option definition.
const ConfigDef *def = this->def();
if (def == nullptr)
throw NoDefinitionException();
throw NoDefinitionException(opt_key);
const ConfigOptionDef *opt_def = def->get(opt_key);
assert(opt_def != nullptr);
// Compute absolute value over the absolute value of the base option.
@ -468,7 +468,7 @@ ConfigOption* DynamicConfig::optptr(const t_config_option_key &opt_key, bool cre
// Try to create a new ConfigOption.
const ConfigDef *def = this->def();
if (def == nullptr)
throw NoDefinitionException();
throw NoDefinitionException(opt_key);
const ConfigOptionDef *optdef = def->get(opt_key);
if (optdef == nullptr)
// throw std::runtime_error(std::string("Invalid option name: ") + opt_key);

View file

@ -1232,17 +1232,22 @@ protected:
};
/// Specialization of std::exception to indicate that an unknown config option has been encountered.
class UnknownOptionException : public std::exception
{
class UnknownOptionException : public std::runtime_error {
public:
const char* what() const noexcept override { return "Unknown config option"; }
UnknownOptionException() :
std::runtime_error("Unknown option exception") {}
UnknownOptionException(const std::string &opt_key) :
std::runtime_error(std::string("Unknown option exception: ") + opt_key) {}
};
/// Indicate that the ConfigBase derived class does not provide config definition (the method def() returns null).
class NoDefinitionException : public std::exception
class NoDefinitionException : public std::runtime_error
{
public:
const char* what() const noexcept override { return "No config definition"; }
NoDefinitionException() :
std::runtime_error("No definition exception") {}
NoDefinitionException(const std::string &opt_key) :
std::runtime_error(std::string("No definition exception: ") + opt_key) {}
};
}

View file

@ -176,6 +176,18 @@ PrintConfigDef::PrintConfigDef()
def->min = 0;
def->default_value = new ConfigOptionFloat(0);
def = this->add("default_filament_profile", coStrings);
def->label = L("Default filament profile");
def->tooltip = L("Default filament profile associated with the current printer profile. "
"On selection of the current printer profile, this filament profile will be activated.");
def->default_value = new ConfigOptionStrings();
def = this->add("default_print_profile", coString);
def->label = L("Default print profile");
def->tooltip = L("Default print profile associated with the current printer profile. "
"On selection of the current printer profile, this print profile will be activated.");
def->default_value = new ConfigOptionString();
def = this->add("disable_fan_first_layers", coInts);
def->label = L("Disable fan for the first");
def->tooltip = L("You can set this to a positive value to disable fan at all "
@ -753,6 +765,13 @@ PrintConfigDef::PrintConfigDef()
def->min = 0;
def->default_value = new ConfigOptionFloat(80);
def = this->add("inherits", coString);
def->label = L("Inherits profile");
def->tooltip = L("Name of the profile, from which this profile inherits.");
def->full_width = true;
def->height = 50;
def->default_value = new ConfigOptionString("");
def = this->add("interface_shells", coBool);
def->label = L("Interface shells");
def->tooltip = L("Force the generation of solid shells between adjacent materials/volumes. "
@ -1017,6 +1036,11 @@ PrintConfigDef::PrintConfigDef()
def->height = 60;
def->default_value = new ConfigOptionStrings{ "" };
def = this->add("printer_model", coString);
def->label = L("Printer type");
def->tooltip = L("Type of the printer.");
def->default_value = new ConfigOptionString();
def = this->add("printer_notes", coString);
def->label = L("Printer notes");
def->tooltip = L("You can put your notes regarding the printer here.");
@ -1026,6 +1050,16 @@ PrintConfigDef::PrintConfigDef()
def->height = 130;
def->default_value = new ConfigOptionString("");
def = this->add("printer_vendor", coString);
def->label = L("Printer vendor");
def->tooltip = L("Name of the printer vendor.");
def->default_value = new ConfigOptionString();
def = this->add("printer_variant", coString);
def->label = L("Printer variant");
def->tooltip = L("Name of the printer variant. For example, the printer variants may be differentiated by a nozzle diameter.");
def->default_value = new ConfigOptionString();
def = this->add("print_settings_id", coString);
def->default_value = new ConfigOptionString("");