diff --git a/lib/Slic3r/GUI/MainFrame.pm b/lib/Slic3r/GUI/MainFrame.pm index 9e7bfacd8..d1f3a9d4c 100644 --- a/lib/Slic3r/GUI/MainFrame.pm +++ b/lib/Slic3r/GUI/MainFrame.pm @@ -723,6 +723,10 @@ sub config_wizard { } else { # Wizard returned a name of a preset bundle bundled with the installation. Unpack it. wxTheApp->{preset_bundle}->install_vendor_configbundle($directory . '/' . $result->{preset_name} . '.ini'); + # Reset the print / filament / printer selections, so that following line will select some sensible defaults. + if ($fresh_start) { + wxTheApp->{app_config}->reset_selections; + } # Reload all presets after the vendor config bundle has been installed. wxTheApp->{preset_bundle}->load_presets(wxTheApp->{app_config}); } diff --git a/xs/src/slic3r/GUI/AppConfig.cpp b/xs/src/slic3r/GUI/AppConfig.cpp index 99339e2f3..e32b645b4 100644 --- a/xs/src/slic3r/GUI/AppConfig.cpp +++ b/xs/src/slic3r/GUI/AppConfig.cpp @@ -145,6 +145,17 @@ void AppConfig::update_last_output_dir(const std::string &dir) this->set("", "last_output_path", dir); } +void AppConfig::reset_selections() +{ + auto it = m_storage.find("presets"); + if (it != m_storage.end()) { + it->second.erase("print"); + it->second.erase("filament"); + it->second.erase("printer"); + m_dirty = true; + } +} + std::string AppConfig::config_path() { return (boost::filesystem::path(Slic3r::data_dir()) / "slic3r.ini").make_preferred().string(); diff --git a/xs/src/slic3r/GUI/AppConfig.hpp b/xs/src/slic3r/GUI/AppConfig.hpp index c6d7766a4..9b1d5a712 100644 --- a/xs/src/slic3r/GUI/AppConfig.hpp +++ b/xs/src/slic3r/GUI/AppConfig.hpp @@ -73,6 +73,11 @@ public: std::string get_last_output_dir(const std::string &alt) const; void update_last_output_dir(const std::string &dir); + // reset the current print / filament / printer selections, so that + // the PresetBundle::load_selections(const AppConfig &config) call will select + // the first non-default preset when called. + void reset_selections(); + // Get the default config path from Slic3r::data_dir(). static std::string config_path(); diff --git a/xs/xsp/GUI_AppConfig.xsp b/xs/xsp/GUI_AppConfig.xsp index 8162b9a5e..08a88883d 100644 --- a/xs/xsp/GUI_AppConfig.xsp +++ b/xs/xsp/GUI_AppConfig.xsp @@ -41,4 +41,6 @@ void update_skein_dir(char *dir); std::string get_last_output_dir(const char *alt = ""); void update_last_output_dir(char *dir); + + void reset_selections(); };