Move ConfigWizard instance in GUI_App, lazy-initialized,

add filament/material installation item in Sidebar combo boxes
This commit is contained in:
Vojtech Kral 2019-06-04 18:01:41 +02:00
parent 87b7b1cc1d
commit dba9925c4e
13 changed files with 115 additions and 85 deletions

View file

@ -584,7 +584,7 @@ PageUpdate::PageUpdate(ConfigWizard *parent)
, version_check(true) , version_check(true)
, preset_update(true) , preset_update(true)
{ {
const AppConfig *app_config = GUI::get_app_config(); const AppConfig *app_config = wxGetApp().app_config;
auto boldfont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); auto boldfont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
boldfont.SetWeight(wxFONTWEIGHT_BOLD); boldfont.SetWeight(wxFONTWEIGHT_BOLD);
@ -1084,7 +1084,7 @@ const std::string& Materials::get_filament_vendor(const Preset &preset)
const std::string& Materials::get_material_type(Preset &preset) const std::string& Materials::get_material_type(Preset &preset)
{ {
// XXX: The initial_layer_height is of a float type and contains no string to reference, // XXX: The initial_layer_height is of a float type and contains no string to reference,
// and so here he serialize it into an ad-hoc option initial_layer_height_str, which is then referenced // and so here we serialize it into an ad-hoc option initial_layer_height_str, which is then referenced
const auto *opt_str = preset.config.opt<ConfigOptionString>("initial_layer_height_str"); const auto *opt_str = preset.config.opt<ConfigOptionString>("initial_layer_height_str");
if (opt_str == nullptr) { if (opt_str == nullptr) {
@ -1234,7 +1234,7 @@ void ConfigWizard::priv::load_vendors()
} }
// Load up the set of vendors / models / variants the user has had enabled up till now // Load up the set of vendors / models / variants the user has had enabled up till now
AppConfig *app_config = GUI::get_app_config(); AppConfig *app_config = wxGetApp().app_config;
if (! app_config->legacy_datadir()) { if (! app_config->legacy_datadir()) {
appconfig_new.set_vendors(*app_config); appconfig_new.set_vendors(*app_config);
} else { } else {
@ -1271,6 +1271,16 @@ void ConfigWizard::priv::enable_next(bool enable)
btn_finish->Enable(enable); btn_finish->Enable(enable);
} }
void ConfigWizard::priv::set_start_page(ConfigWizard::StartPage start_page)
{
switch (start_page) {
case ConfigWizard::SP_PRINTERS: index->go_to(page_fff); break;
case ConfigWizard::SP_FILAMENTS: index->go_to(page_filaments); break;
case ConfigWizard::SP_MATERIALS: index->go_to(page_sla_materials); break;
default: index->go_to(page_welcome); break;
}
}
void ConfigWizard::priv::on_custom_setup() void ConfigWizard::priv::on_custom_setup()
{ {
load_pages(); load_pages();
@ -1390,12 +1400,11 @@ void ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
// Public // Public
ConfigWizard::ConfigWizard(wxWindow *parent, RunReason reason) ConfigWizard::ConfigWizard()
: DPIDialog(parent, wxID_ANY, wxString(SLIC3R_APP_NAME) + " - " + name(), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) : DPIDialog(nullptr, wxID_ANY, wxString(SLIC3R_APP_NAME) + " - " + name(), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
, p(new priv(this)) , p(new priv(this))
{ {
this->SetFont(wxGetApp().normal_font()); this->SetFont(wxGetApp().normal_font());
p->run_reason = reason;
p->load_vendors(); p->load_vendors();
p->custom_config.reset(DynamicPrintConfig::new_from_defaults_keys({ p->custom_config.reset(DynamicPrintConfig::new_from_defaults_keys({
@ -1499,13 +1508,18 @@ ConfigWizard::ConfigWizard(wxWindow *parent, RunReason reason)
ConfigWizard::~ConfigWizard() {} ConfigWizard::~ConfigWizard() {}
bool ConfigWizard::run(PresetBundle *preset_bundle, const PresetUpdater *updater) bool ConfigWizard::run(RunReason reason, StartPage start_page)
{ {
BOOST_LOG_TRIVIAL(info) << "Running ConfigWizard, reason: " << p->run_reason; BOOST_LOG_TRIVIAL(info) << boost::format("Running ConfigWizard, reason: %1%, start_page: %2%") % reason % start_page;
GUI_App &app = wxGetApp();
p->run_reason = reason;
p->set_start_page(start_page);
if (ShowModal() == wxID_OK) { if (ShowModal() == wxID_OK) {
auto *app_config = GUI::get_app_config(); p->apply_config(app.app_config, app.preset_bundle, app.preset_updater);
p->apply_config(app_config, preset_bundle, updater); app.app_config->set_legacy_datadir(false);
app_config->set_legacy_datadir(false);
BOOST_LOG_TRIVIAL(info) << "ConfigWizard applied"; BOOST_LOG_TRIVIAL(info) << "ConfigWizard applied";
return true; return true;
} else { } else {
@ -1514,7 +1528,6 @@ bool ConfigWizard::run(PresetBundle *preset_bundle, const PresetUpdater *updater
} }
} }
const wxString& ConfigWizard::name(const bool from_menu/* = false*/) const wxString& ConfigWizard::name(const bool from_menu/* = false*/)
{ {
// A different naming convention is used for the Wizard on Windows vs. OSX & GTK. // A different naming convention is used for the Wizard on Windows vs. OSX & GTK.

View file

@ -26,7 +26,15 @@ public:
RR_USER, // User requested the Wizard from the menus RR_USER, // User requested the Wizard from the menus
}; };
ConfigWizard(wxWindow *parent, RunReason run_reason); // What page should wizard start on
enum StartPage {
SP_WELCOME,
SP_PRINTERS,
SP_FILAMENTS,
SP_MATERIALS,
};
ConfigWizard();
ConfigWizard(ConfigWizard &&) = delete; ConfigWizard(ConfigWizard &&) = delete;
ConfigWizard(const ConfigWizard &) = delete; ConfigWizard(const ConfigWizard &) = delete;
ConfigWizard &operator=(ConfigWizard &&) = delete; ConfigWizard &operator=(ConfigWizard &&) = delete;
@ -34,7 +42,7 @@ public:
~ConfigWizard(); ~ConfigWizard();
// Run the Wizard. Return whether it was completed. // Run the Wizard. Return whether it was completed.
bool run(PresetBundle *preset_bundle, const PresetUpdater *updater); bool run(RunReason reason, StartPage start_page = SP_WELCOME);
static const wxString& name(const bool from_menu = false); static const wxString& name(const bool from_menu = false);

View file

@ -192,11 +192,9 @@ typedef DataList<wxCheckListBox, Preset> PresetList;
struct PageMaterials: ConfigWizardPage struct PageMaterials: ConfigWizardPage
{ {
// Technology technology;
Materials *materials; Materials *materials;
StringList *list_l1, *list_l2; StringList *list_l1, *list_l2;
PresetList *list_l3; PresetList *list_l3;
// wxCheckListBox *list_l3;
int sel1_prev, sel2_prev; int sel1_prev, sel2_prev;
PageMaterials(ConfigWizard *parent, Materials *materials, wxString title, wxString shortname, wxString list1name); PageMaterials(ConfigWizard *parent, Materials *materials, wxString title, wxString shortname, wxString list1name);
@ -333,7 +331,7 @@ wxDEFINE_EVENT(EVT_INDEX_PAGE, wxCommandEvent);
struct ConfigWizard::priv struct ConfigWizard::priv
{ {
ConfigWizard *q; ConfigWizard *q;
ConfigWizard::RunReason run_reason; ConfigWizard::RunReason run_reason = RR_USER;
AppConfig appconfig_new; // Backing for vendor/model/variant and material selections in the GUI AppConfig appconfig_new; // Backing for vendor/model/variant and material selections in the GUI
std::unordered_map<std::string, VendorProfile> vendors; std::unordered_map<std::string, VendorProfile> vendors;
Materials filaments; // Holds available filament presets and their types & vendors Materials filaments; // Holds available filament presets and their types & vendors
@ -382,6 +380,7 @@ struct ConfigWizard::priv
void load_vendors(); void load_vendors();
void add_page(ConfigWizardPage *page); void add_page(ConfigWizardPage *page);
void enable_next(bool enable); void enable_next(bool enable);
void set_start_page(ConfigWizard::StartPage start_page);
void on_custom_setup(); void on_custom_setup();
void on_printer_pick(PagePrinters *page); void on_printer_pick(PagePrinters *page);

View file

@ -101,49 +101,6 @@ const std::string& shortkey_alt_prefix()
return str; return str;
} }
bool config_wizard_startup(bool app_config_exists)
{
if (!app_config_exists || wxGetApp().preset_bundle->printers.size() <= 1) {
config_wizard(ConfigWizard::RR_DATA_EMPTY);
return true;
} else if (get_app_config()->legacy_datadir()) {
// Looks like user has legacy pre-vendorbundle data directory,
// explain what this is and run the wizard
MsgDataLegacy dlg;
dlg.ShowModal();
config_wizard(ConfigWizard::RR_DATA_LEGACY);
return true;
}
return false;
}
void config_wizard(int reason)
{
// Exit wizard if there are unsaved changes and the user cancels the action.
if (! wxGetApp().check_unsaved_changes())
return;
try {
ConfigWizard wizard(nullptr, static_cast<ConfigWizard::RunReason>(reason));
wizard.run(wxGetApp().preset_bundle, wxGetApp().preset_updater);
}
catch (const std::exception &e) {
show_error(nullptr, e.what());
}
wxGetApp().load_current_presets();
if (wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA && model_has_multi_part_objects(wxGetApp().model()))
{
show_info(nullptr,
_(L("It's impossible to print multi-part object(s) with SLA technology.")) + "\n\n" +
_(L("Please check and fix your object list.")),
_(L("Attention!")));
}
}
// opt_index = 0, by the reason of zero-index in ConfigOptionVector by default (in case only one element) // opt_index = 0, by the reason of zero-index in ConfigOptionVector by default (in case only one element)
void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt_key, const boost::any& value, int opt_index /*= 0*/) void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt_key, const boost::any& value, int opt_index /*= 0*/)
{ {

View file

@ -35,14 +35,6 @@ extern AppConfig* get_app_config();
extern void add_menus(wxMenuBar *menu, int event_preferences_changed, int event_language_change); extern void add_menus(wxMenuBar *menu, int event_preferences_changed, int event_language_change);
// Checks if configuration wizard needs to run, calls config_wizard if so.
// Returns whether the Wizard ran.
extern bool config_wizard_startup(bool app_config_exists);
// Opens the configuration wizard, returns true if wizard is finished & accepted.
// The run_reason argument is actually ConfigWizard::RunReason, but int is used here because of Perl.
extern void config_wizard(int run_reason);
// Change option value in config // Change option value in config
void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt_key, const boost::any& value, int opt_index = 0); void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt_key, const boost::any& value, int opt_index = 0);

View file

@ -38,7 +38,6 @@
#include "../Utils/PresetUpdater.hpp" #include "../Utils/PresetUpdater.hpp"
#include "../Utils/PrintHost.hpp" #include "../Utils/PrintHost.hpp"
#include "../Utils/MacDarkMode.hpp" #include "../Utils/MacDarkMode.hpp"
#include "ConfigWizard.hpp"
#include "slic3r/Config/Snapshot.hpp" #include "slic3r/Config/Snapshot.hpp"
#include "ConfigSnapshotDialog.hpp" #include "ConfigSnapshotDialog.hpp"
#include "FirmwareDialog.hpp" #include "FirmwareDialog.hpp"
@ -46,6 +45,7 @@
#include "Tab.hpp" #include "Tab.hpp"
#include "SysInfoDialog.hpp" #include "SysInfoDialog.hpp"
#include "KBShortcutsDialog.hpp" #include "KBShortcutsDialog.hpp"
#include "UpdateDialogs.hpp"
#ifdef __WXMSW__ #ifdef __WXMSW__
#include <Shlobj.h> #include <Shlobj.h>
@ -148,6 +148,7 @@ GUI_App::GUI_App()
: wxApp() : wxApp()
, m_em_unit(10) , m_em_unit(10)
, m_imgui(new ImGuiWrapper()) , m_imgui(new ImGuiWrapper())
, m_wizard(nullptr)
{} {}
GUI_App::~GUI_App() GUI_App::~GUI_App()
@ -204,7 +205,6 @@ bool GUI_App::on_init_inner()
// supplied as argument to --datadir; in that case we should still run the wizard // supplied as argument to --datadir; in that case we should still run the wizard
preset_bundle->setup_directories(); preset_bundle->setup_directories();
app_conf_exists = app_config->exists();
// load settings // load settings
app_conf_exists = app_config->exists(); app_conf_exists = app_config->exists();
if (app_conf_exists) { if (app_conf_exists) {
@ -287,7 +287,7 @@ bool GUI_App::on_init_inner()
} }
CallAfter([this] { CallAfter([this] {
config_wizard_startup(app_conf_exists); config_wizard_startup();
preset_updater->slic3r_update_notify(); preset_updater->slic3r_update_notify();
preset_updater->sync(preset_bundle); preset_updater->sync(preset_bundle);
}); });
@ -826,7 +826,7 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
local_menu->Bind(wxEVT_MENU, [this, config_id_base](wxEvent &event) { local_menu->Bind(wxEVT_MENU, [this, config_id_base](wxEvent &event) {
switch (event.GetId() - config_id_base) { switch (event.GetId() - config_id_base) {
case ConfigMenuWizard: case ConfigMenuWizard:
config_wizard(ConfigWizard::RR_USER); run_wizard(ConfigWizard::RR_USER);
break; break;
case ConfigMenuTakeSnapshot: case ConfigMenuTakeSnapshot:
// Take a configuration snapshot. // Take a configuration snapshot.
@ -1057,6 +1057,29 @@ void GUI_App::open_web_page_localized(const std::string &http_address)
wxLaunchDefaultBrowser(http_address + "&lng=" + this->current_language_code_safe()); wxLaunchDefaultBrowser(http_address + "&lng=" + this->current_language_code_safe());
} }
bool GUI_App::run_wizard(ConfigWizard::RunReason reason, ConfigWizard::StartPage start_page)
{
if (! m_wizard) {
m_wizard.reset(new ConfigWizard());
}
const bool res = m_wizard->run(reason, start_page);
if (res) {
load_current_presets();
if (preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA
&& Slic3r::model_has_multi_part_objects(wxGetApp().model())) {
GUI::show_info(nullptr,
_(L("It's impossible to print multi-part object(s) with SLA technology.")) + "\n\n" +
_(L("Please check and fix your object list.")),
_(L("Attention!")));
}
}
return res;
}
void GUI_App::window_pos_save(wxTopLevelWindow* window, const std::string &name) void GUI_App::window_pos_save(wxTopLevelWindow* window, const std::string &name)
{ {
if (name.empty()) { return; } if (name.empty()) { return; }
@ -1105,6 +1128,24 @@ void GUI_App::window_pos_sanitize(wxTopLevelWindow* window)
} }
} }
bool GUI_App::config_wizard_startup()
{
if (!app_conf_exists || preset_bundle->printers.size() <= 1) {
run_wizard(ConfigWizard::RR_DATA_EMPTY);
return true;
} else if (get_app_config()->legacy_datadir()) {
// Looks like user has legacy pre-vendorbundle data directory,
// explain what this is and run the wizard
MsgDataLegacy dlg;
dlg.ShowModal();
run_wizard(ConfigWizard::RR_DATA_LEGACY);
return true;
}
return false;
}
// static method accepting a wxWindow object as first parameter // static method accepting a wxWindow object as first parameter
// void warning_catcher{ // void warning_catcher{
// my($self, $message_dialog) = @_; // my($self, $message_dialog) = @_;

View file

@ -6,6 +6,7 @@
#include "libslic3r/PrintConfig.hpp" #include "libslic3r/PrintConfig.hpp"
#include "MainFrame.hpp" #include "MainFrame.hpp"
#include "ImGuiWrapper.hpp" #include "ImGuiWrapper.hpp"
#include "ConfigWizard.hpp"
#include <wx/app.h> #include <wx/app.h>
#include <wx/colour.h> #include <wx/colour.h>
@ -69,6 +70,7 @@ enum ConfigMenuIDs {
}; };
class Tab; class Tab;
class ConfigWizard;
static wxString dots("", wxConvUTF8); static wxString dots("", wxConvUTF8);
@ -96,6 +98,7 @@ class GUI_App : public wxApp
std::unique_ptr<ImGuiWrapper> m_imgui; std::unique_ptr<ImGuiWrapper> m_imgui;
std::unique_ptr<PrintHostJobQueue> m_printhost_job_queue; std::unique_ptr<PrintHostJobQueue> m_printhost_job_queue;
std::unique_ptr<ConfigWizard> m_wizard;
public: public:
bool OnInit() override; bool OnInit() override;
@ -184,6 +187,7 @@ public:
PrintHostJobQueue& printhost_job_queue() { return *m_printhost_job_queue.get(); } PrintHostJobQueue& printhost_job_queue() { return *m_printhost_job_queue.get(); }
void open_web_page_localized(const std::string &http_address); void open_web_page_localized(const std::string &http_address);
bool run_wizard(ConfigWizard::RunReason reason, ConfigWizard::StartPage start_page = ConfigWizard::SP_WELCOME);
private: private:
bool on_init_inner(); bool on_init_inner();
@ -191,6 +195,9 @@ private:
void window_pos_restore(wxTopLevelWindow* window, const std::string &name, bool default_maximized = false); void window_pos_restore(wxTopLevelWindow* window, const std::string &name, bool default_maximized = false);
void window_pos_sanitize(wxTopLevelWindow* window); void window_pos_sanitize(wxTopLevelWindow* window);
bool select_language(); bool select_language();
bool config_wizard_startup();
#ifdef __WXMSW__ #ifdef __WXMSW__
void associate_3mf_files(); void associate_3mf_files();
#endif // __WXMSW__ #endif // __WXMSW__

View file

@ -251,11 +251,18 @@ wxBitmapComboBox(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(15 *
auto selected_item = this->GetSelection(); auto selected_item = this->GetSelection();
auto marker = reinterpret_cast<Marker>(this->GetClientData(selected_item)); auto marker = reinterpret_cast<Marker>(this->GetClientData(selected_item));
if (marker == LABEL_ITEM_MARKER || marker == LABEL_ITEM_CONFIG_WIZARD) { if (marker >= LABEL_ITEM_MARKER && marker < LABEL_ITEM_MAX) {
this->SetSelection(this->last_selected); this->SetSelection(this->last_selected);
evt.StopPropagation(); evt.StopPropagation();
if (marker == LABEL_ITEM_CONFIG_WIZARD) if (marker >= LABEL_ITEM_WIZARD_PRINTERS) {
wxTheApp->CallAfter([]() { Slic3r::GUI::config_wizard(Slic3r::GUI::ConfigWizard::RR_USER); }); ConfigWizard::StartPage sp = ConfigWizard::SP_WELCOME;
switch (marker) {
case LABEL_ITEM_WIZARD_PRINTERS: sp = ConfigWizard::SP_PRINTERS; break;
case LABEL_ITEM_WIZARD_FILAMENTS: sp = ConfigWizard::SP_FILAMENTS; break;
case LABEL_ITEM_WIZARD_MATERIALS: sp = ConfigWizard::SP_MATERIALS; break;
}
wxTheApp->CallAfter([sp]() { wxGetApp().run_wizard(ConfigWizard::RR_USER, sp); });
}
} else if ( this->last_selected != selected_item || } else if ( this->last_selected != selected_item ||
wxGetApp().get_tab(this->preset_type)->get_presets()->current_is_dirty() ) { wxGetApp().get_tab(this->preset_type)->get_presets()->current_is_dirty() ) {
this->last_selected = selected_item; this->last_selected = selected_item;

View file

@ -56,8 +56,12 @@ public:
ScalableButton* edit_btn { nullptr }; ScalableButton* edit_btn { nullptr };
enum LabelItemType { enum LabelItemType {
LABEL_ITEM_MARKER = 0x4d, LABEL_ITEM_MARKER = 0xffffff01,
LABEL_ITEM_CONFIG_WIZARD = 0x4e LABEL_ITEM_WIZARD_PRINTERS,
LABEL_ITEM_WIZARD_FILAMENTS,
LABEL_ITEM_WIZARD_MATERIALS,
LABEL_ITEM_MAX,
}; };
void set_label_marker(int item, LabelItemType label_item_type = LABEL_ITEM_MARKER); void set_label_marker(int item, LabelItemType label_item_type = LABEL_ITEM_MARKER);

View file

@ -1070,7 +1070,9 @@ void PresetCollection::update_platter_ui(GUI::PresetComboBox *ui)
bmps.emplace_back(m_bitmap_add ? *m_bitmap_add : wxNullBitmap); bmps.emplace_back(m_bitmap_add ? *m_bitmap_add : wxNullBitmap);
bmp = m_bitmap_cache->insert(bitmap_key, bmps); bmp = m_bitmap_cache->insert(bitmap_key, bmps);
} }
ui->set_label_marker(ui->Append(PresetCollection::separator(L("Add a new printer")), *bmp), GUI::PresetComboBox::LABEL_ITEM_CONFIG_WIZARD); ui->set_label_marker(ui->Append(PresetCollection::separator(L("Add a new printer")), *bmp), GUI::PresetComboBox::LABEL_ITEM_WIZARD_PRINTERS);
} else if (m_type == Preset::TYPE_SLA_MATERIAL) {
ui->set_label_marker(ui->Append(PresetCollection::separator(L("Add/Remove materials")), wxNullBitmap), GUI::PresetComboBox::LABEL_ITEM_WIZARD_MATERIALS);
} }
ui->SetSelection(selected_preset_item); ui->SetSelection(selected_preset_item);

View file

@ -1601,6 +1601,9 @@ void PresetBundle::update_platter_filament_ui(unsigned int idx_extruder, GUI::Pr
selected_preset_item = ui->GetCount() - 1; selected_preset_item = ui->GetCount() - 1;
} }
} }
ui->set_label_marker(ui->Append(PresetCollection::separator(L("Add/Remove filaments")), wxNullBitmap), GUI::PresetComboBox::LABEL_ITEM_WIZARD_FILAMENTS);
ui->SetSelection(selected_preset_item); ui->SetSelection(selected_preset_item);
ui->SetToolTip(ui->GetString(selected_preset_item)); ui->SetToolTip(ui->GetString(selected_preset_item));
ui->check_selection(); ui->check_selection();

View file

@ -227,9 +227,9 @@ void Tab::create_preset_tab()
m_treectrl->Bind(wxEVT_KEY_DOWN, &Tab::OnKeyDown, this); m_treectrl->Bind(wxEVT_KEY_DOWN, &Tab::OnKeyDown, this);
m_presets_choice->Bind(wxEVT_COMBOBOX, ([this](wxCommandEvent e) { m_presets_choice->Bind(wxEVT_COMBOBOX, ([this](wxCommandEvent e) {
//! Because of The MSW and GTK version of wxBitmapComboBox derived from wxComboBox, //! Because of The MSW and GTK version of wxBitmapComboBox derived from wxComboBox,
//! but the OSX version derived from wxOwnerDrawnCombo, instead of: //! but the OSX version derived from wxOwnerDrawnCombo, instead of:
//! select_preset(m_presets_choice->GetStringSelection().ToUTF8().data()); //! select_preset(m_presets_choice->GetStringSelection().ToUTF8().data());
//! we doing next: //! we doing next:
int selected_item = m_presets_choice->GetSelection(); int selected_item = m_presets_choice->GetSelection();
if (m_selected_preset_item == size_t(selected_item) && !m_presets->current_is_dirty()) if (m_selected_preset_item == size_t(selected_item) && !m_presets->current_is_dirty())
@ -241,7 +241,7 @@ void Tab::create_preset_tab()
selected_string == "------- User presets -------"*/) { selected_string == "------- User presets -------"*/) {
m_presets_choice->SetSelection(m_selected_preset_item); m_presets_choice->SetSelection(m_selected_preset_item);
if (wxString::FromUTF8(selected_string.c_str()) == PresetCollection::separator(L("Add a new printer"))) if (wxString::FromUTF8(selected_string.c_str()) == PresetCollection::separator(L("Add a new printer")))
wxTheApp->CallAfter([]() { Slic3r::GUI::config_wizard(Slic3r::GUI::ConfigWizard::RR_USER); }); wxTheApp->CallAfter([]() { wxGetApp().run_wizard(ConfigWizard::RR_USER); });
return; return;
} }
m_selected_preset_item = selected_item; m_selected_preset_item = selected_item;

View file

@ -643,13 +643,10 @@ PresetUpdater::UpdateResult PresetUpdater::config_update() const
// (snapshot is taken beforehand) // (snapshot is taken beforehand)
p->perform_updates(std::move(updates)); p->perform_updates(std::move(updates));
GUI::ConfigWizard wizard(nullptr, GUI::ConfigWizard::RR_DATA_INCOMPAT); if (! GUI::wxGetApp().run_wizard(GUI::ConfigWizard::RR_DATA_INCOMPAT)) {
if (! wizard.run(GUI::wxGetApp().preset_bundle, this)) {
return R_INCOMPAT_EXIT; return R_INCOMPAT_EXIT;
} }
GUI::wxGetApp().load_current_presets();
return R_INCOMPAT_CONFIGURED; return R_INCOMPAT_CONFIGURED;
} else { } else {
BOOST_LOG_TRIVIAL(info) << "User wants to exit Slic3r, bye..."; BOOST_LOG_TRIVIAL(info) << "User wants to exit Slic3r, bye...";