mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
Implemented a "Reset user profile" on the first page of the configuration
wizard if the wizard is opened from the menu. This allows one to reinstall the bundled printer profile cleanly. Fixed a bug when loading a config bundle as a config: The config bundle should not be unpacked into the user profile directory.
This commit is contained in:
parent
5a768ddd7b
commit
0b6bd3cbde
8 changed files with 91 additions and 26 deletions
|
@ -14,13 +14,13 @@ our $wizard = 'Wizard';
|
|||
$wizard = 'Assistant' if &Wx::wxMAC || &Wx::wxGTK;
|
||||
|
||||
sub new {
|
||||
my ($class, $parent, $presets) = @_;
|
||||
my ($class, $parent, $presets, $fresh_start) = @_;
|
||||
my $self = $class->SUPER::new($parent, -1, "Configuration $wizard");
|
||||
|
||||
# initialize an empty repository
|
||||
$self->{config} = Slic3r::Config->new;
|
||||
|
||||
my $welcome_page = Slic3r::GUI::ConfigWizard::Page::Welcome->new($self);
|
||||
my $welcome_page = Slic3r::GUI::ConfigWizard::Page::Welcome->new($self, $fresh_start);
|
||||
$self->add_page($welcome_page);
|
||||
$self->add_page(Slic3r::GUI::ConfigWizard::Page::Firmware->new($self));
|
||||
$self->add_page(Slic3r::GUI::ConfigWizard::Page::Bed->new($self));
|
||||
|
@ -50,9 +50,13 @@ sub add_page {
|
|||
|
||||
sub run {
|
||||
my ($self) = @_;
|
||||
my $result = undef;
|
||||
my $result;
|
||||
if (Wx::Wizard::RunWizard($self, $self->{pages}[0])) {
|
||||
my $preset_name = $self->{pages}[0]->{preset_name};
|
||||
$result = {
|
||||
preset_name => $preset_name,
|
||||
reset_user_profile => $self->{pages}[0]->{reset_user_profile}
|
||||
};
|
||||
if ($preset_name eq 'Other') {
|
||||
# it would be cleaner to have these defined inside each page class,
|
||||
# in some event getting called before leaving the page
|
||||
|
@ -67,9 +71,7 @@ sub run {
|
|||
# set first_layer_bed_temperature to temperature + 5
|
||||
$self->{config}->set('first_layer_bed_temperature',
|
||||
[ ($self->{config}->bed_temperature->[0] > 0) ? ($self->{config}->bed_temperature->[0] + 5) : 0 ]);
|
||||
$result = $self->{config};
|
||||
} else {
|
||||
$result = $preset_name;
|
||||
$result->{config} = $self->{config};
|
||||
}
|
||||
}
|
||||
$self->Destroy;
|
||||
|
@ -266,13 +268,13 @@ sub config {
|
|||
package Slic3r::GUI::ConfigWizard::Page::Welcome;
|
||||
use base 'Slic3r::GUI::ConfigWizard::Page';
|
||||
use Wx qw(:misc :sizer wxID_FORWARD);
|
||||
use Wx::Event qw(EVT_ACTIVATE EVT_CHOICE);
|
||||
use Wx::Event qw(EVT_ACTIVATE EVT_CHOICE EVT_CHECKBOX);
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my ($parent) = @_;
|
||||
my ($class, $parent, $fresh_start) = @_;
|
||||
my $self = $class->SUPER::new($parent, "Welcome to the Slic3r Configuration $wizard", 'Welcome');
|
||||
$self->{full_wizard_workflow} = 1;
|
||||
$self->{reset_user_profile} = 0;
|
||||
|
||||
# Test for the existence of the old config path.
|
||||
my $message_has_legacy;
|
||||
|
@ -300,6 +302,10 @@ sub new {
|
|||
|
||||
$self->{choice} = my $choice = Wx::Choice->new($self, -1, wxDefaultPosition, wxDefaultSize, []);
|
||||
$self->{vsizer}->Add($choice, 0, wxEXPAND | wxTOP | wxBOTTOM, 10);
|
||||
if (! $fresh_start) {
|
||||
$self->{reset_checkbox} = Wx::CheckBox->new($self, -1, "Reset user profile, install from scratch");
|
||||
$self->{vsizer}->Add($self->{reset_checkbox}, 0, wxEXPAND | wxTOP | wxBOTTOM, 10);
|
||||
}
|
||||
|
||||
EVT_CHOICE($parent, $choice, sub {
|
||||
my $sel = $self->{choice}->GetStringSelection;
|
||||
|
@ -307,6 +313,12 @@ sub new {
|
|||
$self->set_full_wizard_workflow(($sel eq 'Other') || ($sel eq ''));
|
||||
});
|
||||
|
||||
if (! $fresh_start) {
|
||||
EVT_CHECKBOX($self, $self->{reset_checkbox}, sub {
|
||||
$self->{reset_user_profile} = $self->{reset_checkbox}->GetValue();
|
||||
});
|
||||
}
|
||||
|
||||
EVT_ACTIVATE($parent, sub {
|
||||
$self->set_full_wizard_workflow($self->{preset_name} eq 'Other');
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue