Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_toolpaths_export
This commit is contained in:
commit
2e3c71baaf
2 changed files with 38 additions and 5 deletions
|
@ -25,6 +25,7 @@
|
|||
#include "PresetBundle.hpp"
|
||||
#include "GUI.hpp"
|
||||
#include "GUI_Utils.hpp"
|
||||
#include "slic3r/Config/Snapshot.hpp"
|
||||
#include "slic3r/Utils/PresetUpdater.hpp"
|
||||
|
||||
|
||||
|
@ -32,6 +33,10 @@ namespace Slic3r {
|
|||
namespace GUI {
|
||||
|
||||
|
||||
using Config::Snapshot;
|
||||
using Config::SnapshotDB;
|
||||
|
||||
|
||||
// Printer model picker GUI control
|
||||
|
||||
struct PrinterPickerEvent : public wxEvent
|
||||
|
@ -1025,15 +1030,33 @@ void ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
|
|||
|
||||
// Decide whether to create snapshot based on run_reason and the reset profile checkbox
|
||||
bool snapshot = true;
|
||||
Snapshot::Reason snapshot_reason = Snapshot::SNAPSHOT_UPGRADE;
|
||||
switch (run_reason) {
|
||||
case ConfigWizard::RR_DATA_EMPTY: snapshot = false; break;
|
||||
case ConfigWizard::RR_DATA_LEGACY: snapshot = true; break;
|
||||
case ConfigWizard::RR_DATA_INCOMPAT: snapshot = false; break; // In this case snapshot is done by PresetUpdater with the appropriate reason
|
||||
case ConfigWizard::RR_USER: snapshot = page_welcome->reset_user_profile(); break;
|
||||
case ConfigWizard::RR_DATA_EMPTY:
|
||||
snapshot = false;
|
||||
break;
|
||||
case ConfigWizard::RR_DATA_LEGACY:
|
||||
snapshot = true;
|
||||
break;
|
||||
case ConfigWizard::RR_DATA_INCOMPAT:
|
||||
// In this case snapshot has already been taken by
|
||||
// PresetUpdater with the appropriate reason
|
||||
snapshot = false;
|
||||
break;
|
||||
case ConfigWizard::RR_USER:
|
||||
snapshot = page_welcome->reset_user_profile();
|
||||
snapshot_reason = Snapshot::SNAPSHOT_USER;
|
||||
break;
|
||||
}
|
||||
|
||||
if (snapshot) {
|
||||
SnapshotDB::singleton().take_snapshot(*app_config, snapshot_reason);
|
||||
}
|
||||
|
||||
if (install_bundles.size() > 0) {
|
||||
// Install bundles from resources.
|
||||
updater->install_bundles_rsrc(std::move(install_bundles), snapshot);
|
||||
// Don't create snapshot - we've already done that above if applicable.
|
||||
updater->install_bundles_rsrc(std::move(install_bundles), false);
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(info) << "No bundles need to be installed from resources";
|
||||
}
|
||||
|
|
|
@ -35,6 +35,10 @@ using Slic3r::GUI::Config::Snapshot;
|
|||
using Slic3r::GUI::Config::SnapshotDB;
|
||||
|
||||
|
||||
|
||||
// FIXME: Incompat bundle resolution doesn't deal with inherited user presets
|
||||
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
|
||||
|
@ -624,11 +628,17 @@ PresetUpdater::UpdateResult PresetUpdater::config_update() const
|
|||
const auto res = dlg.ShowModal();
|
||||
if (res == wxID_REPLACE) {
|
||||
BOOST_LOG_TRIVIAL(info) << "User wants to re-configure...";
|
||||
|
||||
// This effectively removes the incompatible bundles:
|
||||
// (snapshot is taken beforehand)
|
||||
p->perform_updates(std::move(updates));
|
||||
|
||||
GUI::ConfigWizard wizard(nullptr, GUI::ConfigWizard::RR_DATA_INCOMPAT);
|
||||
|
||||
if (! wizard.run(GUI::wxGetApp().preset_bundle, this)) {
|
||||
return R_INCOMPAT_EXIT;
|
||||
}
|
||||
|
||||
GUI::wxGetApp().load_current_presets();
|
||||
return R_INCOMPAT_CONFIGURED;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue