mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
Refactored OptionsGroup class for cleaner OOP model and cleaner event model
This commit is contained in:
parent
85c59d78ac
commit
04b67f0cb0
12 changed files with 1609 additions and 1175 deletions
|
@ -4,58 +4,60 @@ use Wx::Event qw(EVT_BUTTON EVT_TEXT_ENTER);
|
|||
use base 'Wx::Dialog';
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my ($parent, %params) = @_;
|
||||
my ($class, $parent) = @_;
|
||||
my $self = $class->SUPER::new($parent, -1, "Preferences", wxDefaultPosition, [500,200]);
|
||||
$self->{values};
|
||||
$self->{values} = {};
|
||||
|
||||
my $optgroup = Slic3r::GUI::OptionsGroup->new(
|
||||
my $optgroup;
|
||||
$optgroup = Slic3r::GUI::OptionsGroup->new(
|
||||
parent => $self,
|
||||
title => 'General',
|
||||
options => [
|
||||
{
|
||||
opt_key => 'mode',
|
||||
type => 'select',
|
||||
label => 'Mode',
|
||||
tooltip => 'Choose between a simpler, basic mode and an expert mode with more options and more complicated interface.',
|
||||
labels => ['Simple','Expert'],
|
||||
values => ['simple','expert'],
|
||||
default => $Slic3r::GUI::Settings->{_}{mode},
|
||||
},
|
||||
{
|
||||
opt_key => 'version_check',
|
||||
type => 'bool',
|
||||
label => 'Check for updates',
|
||||
tooltip => 'If this is enabled, Slic3r will check for updates daily and display a reminder if a newer version is available.',
|
||||
default => $Slic3r::GUI::Settings->{_}{version_check} // 1,
|
||||
readonly => !wxTheApp->have_version_check,
|
||||
},
|
||||
{
|
||||
opt_key => 'remember_output_path',
|
||||
type => 'bool',
|
||||
label => 'Remember output directory',
|
||||
tooltip => 'If this is enabled, Slic3r will prompt the last output directory instead of the one containing the input files.',
|
||||
default => $Slic3r::GUI::Settings->{_}{remember_output_path},
|
||||
},
|
||||
{
|
||||
opt_key => 'autocenter',
|
||||
type => 'bool',
|
||||
label => 'Auto-center parts',
|
||||
tooltip => 'If this is enabled, Slic3r will auto-center objects around the configured print center.',
|
||||
default => $Slic3r::GUI::Settings->{_}{autocenter},
|
||||
},
|
||||
{
|
||||
opt_key => 'background_processing',
|
||||
type => 'bool',
|
||||
label => 'Background processing',
|
||||
tooltip => 'If this is enabled, Slic3r will pre-process objects as soon as they\'re loaded in order to save time when exporting G-code.',
|
||||
default => $Slic3r::GUI::Settings->{_}{background_processing},
|
||||
readonly => !$Slic3r::have_threads,
|
||||
},
|
||||
],
|
||||
on_change => sub { $self->{values}{$_[0]} = $_[1] },
|
||||
on_change => sub {
|
||||
my ($opt_id) = @_;
|
||||
$self->{values}{$opt_id} = $optgroup->get_value($opt_id);
|
||||
},
|
||||
label_width => 100,
|
||||
);
|
||||
$optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
|
||||
opt_id => 'mode',
|
||||
type => 'select',
|
||||
label => 'Mode',
|
||||
tooltip => 'Choose between a simpler, basic mode and an expert mode with more options and more complicated interface.',
|
||||
labels => ['Simple','Expert'],
|
||||
values => ['simple','expert'],
|
||||
default => $Slic3r::GUI::Settings->{_}{mode},
|
||||
));
|
||||
$optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
|
||||
opt_id => 'version_check',
|
||||
type => 'bool',
|
||||
label => 'Check for updates',
|
||||
tooltip => 'If this is enabled, Slic3r will check for updates daily and display a reminder if a newer version is available.',
|
||||
default => $Slic3r::GUI::Settings->{_}{version_check} // 1,
|
||||
readonly => !wxTheApp->have_version_check,
|
||||
));
|
||||
$optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
|
||||
opt_id => 'remember_output_path',
|
||||
type => 'bool',
|
||||
label => 'Remember output directory',
|
||||
tooltip => 'If this is enabled, Slic3r will prompt the last output directory instead of the one containing the input files.',
|
||||
default => $Slic3r::GUI::Settings->{_}{remember_output_path},
|
||||
));
|
||||
$optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
|
||||
opt_id => 'autocenter',
|
||||
type => 'bool',
|
||||
label => 'Auto-center parts',
|
||||
tooltip => 'If this is enabled, Slic3r will auto-center objects around the configured print center.',
|
||||
default => $Slic3r::GUI::Settings->{_}{autocenter},
|
||||
));
|
||||
$optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
|
||||
opt_id => 'background_processing',
|
||||
type => 'bool',
|
||||
label => 'Background processing',
|
||||
tooltip => 'If this is enabled, Slic3r will pre-process objects as soon as they\'re loaded in order to save time when exporting G-code.',
|
||||
default => $Slic3r::GUI::Settings->{_}{background_processing},
|
||||
readonly => !$Slic3r::have_threads,
|
||||
));
|
||||
|
||||
my $sizer = Wx::BoxSizer->new(wxVERTICAL);
|
||||
$sizer->Add($optgroup->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue