1
package Slic3r::GUI::Preferences;
2
use Wx qw(:dialog :id :misc :sizer :systemsettings);
3
use Wx::Event qw(EVT_BUTTON EVT_TEXT_ENTER);
8
my ($parent, %params) = @_;
9
my $self = $class->SUPER::new($parent, -1, "Preferences", wxDefaultPosition, [500,200]);
12
my $optgroup = Slic3r::GUI::OptionsGroup->new(
20
tooltip => 'Choose between a simpler, basic mode and an expert mode with more options and more complicated interface.',
21
labels => ['Simple','Expert'],
22
values => ['simple','expert'],
23
default => $Slic3r::GUI::Settings->{_}{mode},
26
opt_key => 'version_check',
28
label => 'Check for updates',
29
tooltip => 'If this is enabled, Slic3r will check for updates daily and display a reminder if a newer version is available.',
30
default => $Slic3r::GUI::Settings->{_}{version_check} // 1,
31
readonly => !Slic3r::GUI->have_version_check,
34
opt_key => 'remember_output_path',
36
label => 'Remember output directory',
37
tooltip => 'If this is enabled, Slic3r will prompt the last output directory instead of the one containing the input files.',
38
default => $Slic3r::GUI::Settings->{_}{remember_output_path},
41
opt_key => 'autocenter',
43
label => 'Auto-center parts',
44
tooltip => 'If this is enabled, Slic3r will auto-center objects around the configured print center.',
45
default => $Slic3r::GUI::Settings->{_}{autocenter},
48
on_change => sub { $self->{values}{$_[0]} = $_[1] },
51
my $sizer = Wx::BoxSizer->new(wxVERTICAL);
52
$sizer->Add($optgroup->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
54
my $buttons = $self->CreateStdDialogButtonSizer(wxOK | wxCANCEL);
55
EVT_BUTTON($self, wxID_OK, sub { $self->_accept });
56
$sizer->Add($buttons, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
58
$self->SetSizer($sizer);
59
$sizer->SetSizeHints($self);
67
if ($self->{values}{mode}) {
68
Slic3r::GUI::warning_catcher($self)->("You need to restart Slic3r to make the changes effective.");
71
$Slic3r::GUI::Settings->{_}{$_} = $self->{values}{$_} for keys %{$self->{values}};
72
Slic3r::GUI->save_settings;
74
$self->EndModal(wxID_OK);
75
$self->Close; # needed on Linux