Added Preferences dialog

internal-support
Alessandro Ranellucci 2013-01-02 20:30:48 +01:00
parent 34e047205a
commit cf4c090208
3 changed files with 45 additions and 0 deletions

View File

@ -31,6 +31,7 @@ lib/Slic3r/GUI/AboutDialog.pm
lib/Slic3r/GUI/ConfigWizard.pm
lib/Slic3r/GUI/OptionsGroup.pm
lib/Slic3r/GUI/Plater.pm
lib/Slic3r/GUI/Preferences.pm
lib/Slic3r/GUI/SkeinPanel.pm
lib/Slic3r/GUI/Tab.pm
lib/Slic3r/Layer.pm

View File

@ -7,6 +7,7 @@ use FindBin;
use Slic3r::GUI::AboutDialog;
use Slic3r::GUI::ConfigWizard;
use Slic3r::GUI::Plater;
use Slic3r::GUI::Preferences;
use Slic3r::GUI::OptionsGroup;
use Slic3r::GUI::SkeinPanel;
use Slic3r::GUI::Tab;
@ -94,6 +95,8 @@ sub OnInit {
$fileMenu->AppendSeparator();
$fileMenu->Append(MI_COMBINE_STLS, "Combine multi-material STL files…", 'Combine multiple STL files into a single multi-material AMF file');
$fileMenu->AppendSeparator();
$fileMenu->Append(wxID_PREFERENCES, "Preferences…", 'Application preferences');
$fileMenu->AppendSeparator();
$fileMenu->Append(wxID_EXIT, "&Quit", 'Quit Slic3r');
EVT_MENU($frame, MI_LOAD_CONF, sub { $self->{skeinpanel}->load_config_file });
EVT_MENU($frame, MI_EXPORT_CONF, sub { $self->{skeinpanel}->export_config });
@ -104,6 +107,7 @@ sub OnInit {
$repeat->Enable(defined $Slic3r::GUI::SkeinPanel::last_input_file) });
EVT_MENU($frame, MI_SLICE_SVG, sub { $self->{skeinpanel}->do_slice(save_as => 1, export_svg => 1) });
EVT_MENU($frame, MI_COMBINE_STLS, sub { $self->{skeinpanel}->combine_stls });
EVT_MENU($frame, wxID_PREFERENCES, sub { Slic3r::GUI::Preferences->new($frame)->ShowModal });
EVT_MENU($frame, wxID_EXIT, sub {$_[0]->Close(0)});
}

View File

@ -0,0 +1,40 @@
package Slic3r::GUI::Preferences;
use Wx qw(:dialog :id :misc :sizer :systemsettings);
use Wx::Event qw(EVT_BUTTON EVT_TEXT_ENTER);
use base 'Wx::Dialog';
sub new {
my $class = shift;
my ($parent, %params) = @_;
my $self = $class->SUPER::new($parent, -1, "Preferences", wxDefaultPosition, [500,200]);
my $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 => 'simple',
},
],
label_width => 100,
);
my $sizer = Wx::BoxSizer->new(wxVERTICAL);
$sizer->Add($optgroup->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
my $buttons = $self->CreateStdDialogButtonSizer(wxOK | wxCANCEL);
EVT_BUTTON($self, wxID_OK, sub { $self->EndModal(wxID_OK); });
$sizer->Add($buttons, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
$self->SetSizer($sizer);
$sizer->SetSizeHints($self);
return $self;
}
1;