New preset management (unfinished)
This commit is contained in:
parent
9e6e3bd269
commit
35f36e0446
@ -73,9 +73,9 @@ our $gcode_comments = 0;
|
|||||||
our $filament_diameter = 3; # mm
|
our $filament_diameter = 3; # mm
|
||||||
our $extrusion_multiplier = 1;
|
our $extrusion_multiplier = 1;
|
||||||
our $temperature = 200;
|
our $temperature = 200;
|
||||||
our $first_layer_temperature;
|
our $first_layer_temperature = $temperature;
|
||||||
our $bed_temperature = 0;
|
our $bed_temperature = 0;
|
||||||
our $first_layer_bed_temperature;
|
our $first_layer_bed_temperature = $bed_temperature;
|
||||||
|
|
||||||
# speed options
|
# speed options
|
||||||
our $travel_speed = 130; # mm/s
|
our $travel_speed = 130; # mm/s
|
||||||
@ -168,6 +168,8 @@ our $complete_objects = 0;
|
|||||||
our $extruder_clearance_radius = 20; # mm
|
our $extruder_clearance_radius = 20; # mm
|
||||||
our $extruder_clearance_height = 20; # mm
|
our $extruder_clearance_height = 20; # mm
|
||||||
|
|
||||||
|
our $Defaults = Slic3r::Config->current;
|
||||||
|
|
||||||
sub parallelize {
|
sub parallelize {
|
||||||
my %params = @_;
|
my %params = @_;
|
||||||
|
|
||||||
|
@ -8,6 +8,12 @@ use constant PI => 4 * atan2(1, 1);
|
|||||||
# cemetery of old config settings
|
# cemetery of old config settings
|
||||||
our @Ignore = qw(duplicate_x duplicate_y multiply_x multiply_y);
|
our @Ignore = qw(duplicate_x duplicate_y multiply_x multiply_y);
|
||||||
|
|
||||||
|
our %Groups = (
|
||||||
|
print => [qw(layer_height first_layer_height perimeters randomize_start solid_layers fill_density fill_angle fill_pattern solid_fill_pattern infill_every_layers perimeter_speed small_perimeter_speed infill_speed solid_infill_speed top_solid_infill_speed bridge_speed travel_speed first_layer_speed skirts skirt_distance skirt_height support_material support_material_tool notes complete_objects extruder_clearance_radius extruder_clearance_height gcode_comments output_filename_format post_process extrusion_width first_layer_extrusion_width perimeters_extrusion_width infill_extrusion_width bridge_flow_ratio duplicate_distance)],
|
||||||
|
filament => [qw(filament_diameter extrusion_multiplier temperature first_layer_temperature bed_temperature first_layer_bed_temperature cooling min_fan_speed max_fan_speed bridge_fan_speed disable_fan_first_layers fan_always_on fan_below_layer_time slowdown_below_layer_time min_print_speed)],
|
||||||
|
printer => [qw(bed_size print_center z_offset gcode_flavor use_relative_e_distances nozzle_diameter retract_length retract_lift retract_speed retract_restart_extra retract_before_travel start_gcode end_gcode layer_gcode)],
|
||||||
|
);
|
||||||
|
|
||||||
our $Options = {
|
our $Options = {
|
||||||
|
|
||||||
# miscellaneous options
|
# miscellaneous options
|
||||||
@ -243,7 +249,7 @@ our $Options = {
|
|||||||
# accuracy options
|
# accuracy options
|
||||||
'layer_height' => {
|
'layer_height' => {
|
||||||
label => 'Layer height',
|
label => 'Layer height',
|
||||||
tooltip => 'This setting control the height (and thus the total number) of the slices/layers. Thinner layers give better accuracy but take more time to print.',
|
tooltip => 'This setting controls the height (and thus the total number) of the slices/layers. Thinner layers give better accuracy but take more time to print.',
|
||||||
sidetext => 'mm',
|
sidetext => 'mm',
|
||||||
cli => 'layer-height=f',
|
cli => 'layer-height=f',
|
||||||
type => 'f',
|
type => 'f',
|
||||||
@ -651,11 +657,12 @@ sub deserialize {
|
|||||||
|
|
||||||
sub save {
|
sub save {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
my ($file) = @_;
|
my ($file, $group) = @_;
|
||||||
|
|
||||||
open my $fh, '>', $file;
|
open my $fh, '>', $file;
|
||||||
binmode $fh, ':utf8';
|
binmode $fh, ':utf8';
|
||||||
foreach my $opt (sort keys %$Options) {
|
foreach my $opt (sort keys %$Options) {
|
||||||
|
next if defined $group && not ($opt ~~ @{$Groups{$group}});
|
||||||
next if $Options->{$opt}{gui_only};
|
next if $Options->{$opt}{gui_only};
|
||||||
my $value = get($opt);
|
my $value = get($opt);
|
||||||
$value = $Options->{$opt}{serialize}->($value) if $Options->{$opt}{serialize};
|
$value = $Options->{$opt}{serialize}->($value) if $Options->{$opt}{serialize};
|
||||||
@ -674,22 +681,42 @@ sub setenv {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub load {
|
sub current {
|
||||||
|
my $class = shift;
|
||||||
|
return { map +($_ => get($_)), sort keys %$Options };
|
||||||
|
}
|
||||||
|
|
||||||
|
sub read_ini {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
my ($file) = @_;
|
my ($file) = @_;
|
||||||
|
|
||||||
my %ignore = map { $_ => 1 } @Ignore;
|
|
||||||
|
|
||||||
local $/ = "\n";
|
local $/ = "\n";
|
||||||
open my $fh, '<', $file;
|
open my $fh, '<', $file;
|
||||||
binmode $fh, ':utf8';
|
binmode $fh, ':utf8';
|
||||||
|
|
||||||
|
my $ini = { _ => {} };
|
||||||
|
my $category = '_';
|
||||||
while (<$fh>) {
|
while (<$fh>) {
|
||||||
s/\R+$//;
|
s/\R+$//;
|
||||||
next if /^\s+/;
|
next if /^\s+/;
|
||||||
next if /^$/;
|
next if /^$/;
|
||||||
next if /^\s*#/;
|
next if /^\s*#/;
|
||||||
/^(\w+) = (.*)/ or die "Unreadable configuration file (invalid data at line $.)\n";
|
/^(\w+) = (.*)/ or die "Unreadable configuration file (invalid data at line $.)\n";
|
||||||
my ($key, $val) = ($1, $2);
|
$ini->{$category}{$1} = $2;
|
||||||
|
}
|
||||||
|
close $fh;
|
||||||
|
|
||||||
|
return $ini;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub load_hash {
|
||||||
|
my $class = shift;
|
||||||
|
my ($hash, $group, $deserialized) = @_;
|
||||||
|
|
||||||
|
my %ignore = map { $_ => 1 } @Ignore;
|
||||||
|
foreach my $key (sort keys %$hash) {
|
||||||
|
next if defined $group && not ($key ~~ @{$Groups{$group}});
|
||||||
|
my $val = $hash->{$key};
|
||||||
|
|
||||||
# handle legacy options
|
# handle legacy options
|
||||||
next if $ignore{$key};
|
next if $ignore{$key};
|
||||||
@ -705,9 +732,16 @@ sub load {
|
|||||||
}
|
}
|
||||||
next unless $key;
|
next unless $key;
|
||||||
my $opt = $Options->{$key};
|
my $opt = $Options->{$key};
|
||||||
set($key, $opt->{deserialize} ? $opt->{deserialize}->($val) : $val);
|
set($key, ($opt->{deserialize} && !$deserialized) ? $opt->{deserialize}->($val) : $val);
|
||||||
}
|
}
|
||||||
close $fh;
|
}
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my $class = shift;
|
||||||
|
my ($file) = @_;
|
||||||
|
|
||||||
|
my $ini = __PACKAGE__->read_ini($file);
|
||||||
|
__PACKAGE__->load_hash($ini->{_});
|
||||||
}
|
}
|
||||||
|
|
||||||
sub validate_cli {
|
sub validate_cli {
|
||||||
|
@ -14,6 +14,7 @@ use Wx::Event qw(EVT_MENU);
|
|||||||
use base 'Wx::App';
|
use base 'Wx::App';
|
||||||
|
|
||||||
my $growler;
|
my $growler;
|
||||||
|
our $datadir;
|
||||||
|
|
||||||
sub OnInit {
|
sub OnInit {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
@ -21,12 +22,6 @@ sub OnInit {
|
|||||||
$self->SetAppName('Slic3r');
|
$self->SetAppName('Slic3r');
|
||||||
Slic3r::debugf "wxWidgets version %s\n", &Wx::wxVERSION_STRING;
|
Slic3r::debugf "wxWidgets version %s\n", &Wx::wxVERSION_STRING;
|
||||||
|
|
||||||
my $frame = Wx::Frame->new(undef, -1, 'Slic3r', [-1, -1], [760,500], wxDEFAULT_FRAME_STYLE);
|
|
||||||
Wx::Image::AddHandler(Wx::PNGHandler->new);
|
|
||||||
$frame->SetIcon(Wx::Icon->new("$Slic3r::var/Slic3r_128px.png", &Wx::wxBITMAP_TYPE_PNG) );
|
|
||||||
|
|
||||||
my $panel = Slic3r::GUI::SkeinPanel->new($frame);
|
|
||||||
|
|
||||||
if (eval "use Growl::GNTP; 1") {
|
if (eval "use Growl::GNTP; 1") {
|
||||||
# register growl notifications
|
# register growl notifications
|
||||||
eval {
|
eval {
|
||||||
@ -35,8 +30,19 @@ sub OnInit {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
# menubar
|
# locate or create data directory
|
||||||
my $menubar = Wx::MenuBar->new;
|
$datadir = Wx::StandardPaths::Get->GetUserDataDir;
|
||||||
|
for ($datadir, "$datadir/print", "$datadir/filament", "$datadir/printer") {
|
||||||
|
mkdir or $self->fatal_error("Slic3r was unable to create its data directory at $_ (errno: $!).")
|
||||||
|
unless -d $_;
|
||||||
|
}
|
||||||
|
|
||||||
|
# application frame
|
||||||
|
Wx::Image::AddHandler(Wx::PNGHandler->new);
|
||||||
|
my $frame = Wx::Frame->new(undef, -1, 'Slic3r', [-1, -1], [760,500], wxDEFAULT_FRAME_STYLE);
|
||||||
|
$frame->SetIcon(Wx::Icon->new("$Slic3r::var/Slic3r_128px.png", &Wx::wxBITMAP_TYPE_PNG) );
|
||||||
|
my $panel = Slic3r::GUI::SkeinPanel->new($frame);
|
||||||
|
|
||||||
|
|
||||||
# status bar
|
# status bar
|
||||||
$frame->{statusbar} = Slic3r::GUI::ProgressStatusBar->new($frame, -1);
|
$frame->{statusbar} = Slic3r::GUI::ProgressStatusBar->new($frame, -1);
|
||||||
@ -44,6 +50,7 @@ sub OnInit {
|
|||||||
|
|
||||||
# File menu
|
# File menu
|
||||||
my $fileMenu = Wx::Menu->new;
|
my $fileMenu = Wx::Menu->new;
|
||||||
|
{
|
||||||
$fileMenu->Append(1, "Save Config…");
|
$fileMenu->Append(1, "Save Config…");
|
||||||
$fileMenu->Append(2, "Open Config…");
|
$fileMenu->Append(2, "Open Config…");
|
||||||
$fileMenu->AppendSeparator();
|
$fileMenu->AppendSeparator();
|
||||||
@ -53,7 +60,6 @@ sub OnInit {
|
|||||||
$fileMenu->Append(6, "Export SVG…");
|
$fileMenu->Append(6, "Export SVG…");
|
||||||
$fileMenu->AppendSeparator();
|
$fileMenu->AppendSeparator();
|
||||||
$fileMenu->Append(wxID_EXIT, "&Quit");
|
$fileMenu->Append(wxID_EXIT, "&Quit");
|
||||||
$menubar->Append($fileMenu, "&File");
|
|
||||||
EVT_MENU($frame, 1, sub { $panel->save_config });
|
EVT_MENU($frame, 1, sub { $panel->save_config });
|
||||||
EVT_MENU($frame, 2, sub { $panel->load_config });
|
EVT_MENU($frame, 2, sub { $panel->load_config });
|
||||||
EVT_MENU($frame, 3, sub { $panel->do_slice });
|
EVT_MENU($frame, 3, sub { $panel->do_slice });
|
||||||
@ -61,16 +67,24 @@ sub OnInit {
|
|||||||
EVT_MENU($frame, 5, sub { $panel->do_slice(save_as => 1) });
|
EVT_MENU($frame, 5, sub { $panel->do_slice(save_as => 1) });
|
||||||
EVT_MENU($frame, 6, sub { $panel->do_slice(save_as => 1, export_svg => 1) });
|
EVT_MENU($frame, 6, sub { $panel->do_slice(save_as => 1, export_svg => 1) });
|
||||||
EVT_MENU($frame, wxID_EXIT, sub {$_[0]->Close(1)});
|
EVT_MENU($frame, wxID_EXIT, sub {$_[0]->Close(1)});
|
||||||
|
}
|
||||||
|
|
||||||
# Help menu
|
# Help menu
|
||||||
my $helpMenu = Wx::Menu->new;
|
my $helpMenu = Wx::Menu->new;
|
||||||
|
{
|
||||||
$helpMenu->Append(wxID_ABOUT, "&About");
|
$helpMenu->Append(wxID_ABOUT, "&About");
|
||||||
$menubar->Append($helpMenu, "&Help");
|
|
||||||
EVT_MENU($frame, wxID_ABOUT, \&About);
|
EVT_MENU($frame, wxID_ABOUT, \&About);
|
||||||
|
}
|
||||||
|
|
||||||
# Set the menubar after appending items, otherwise special items
|
# menubar
|
||||||
|
# assign menubar to frame after appending items, otherwise special items
|
||||||
# will not be handled correctly
|
# will not be handled correctly
|
||||||
|
{
|
||||||
|
my $menubar = Wx::MenuBar->new;
|
||||||
|
$menubar->Append($fileMenu, "&File");
|
||||||
|
$menubar->Append($helpMenu, "&Help");
|
||||||
$frame->SetMenuBar($menubar);
|
$frame->SetMenuBar($menubar);
|
||||||
|
}
|
||||||
|
|
||||||
$frame->SetMinSize($frame->GetSize);
|
$frame->SetMinSize($frame->GetSize);
|
||||||
$frame->Show;
|
$frame->Show;
|
||||||
@ -104,6 +118,18 @@ sub catch_error {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub show_error {
|
||||||
|
my $self = shift;
|
||||||
|
my ($message) = @_;
|
||||||
|
Wx::MessageDialog->new($self, $message, 'Error', &Wx::wxOK | &Wx::wxICON_ERROR)->ShowModal;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub fatal_error {
|
||||||
|
my $self = shift;
|
||||||
|
$self->show_error(@_);
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
|
||||||
sub warning_catcher {
|
sub warning_catcher {
|
||||||
my ($self, $message_dialog) = @_;
|
my ($self, $message_dialog) = @_;
|
||||||
return sub {
|
return sub {
|
||||||
|
@ -3,12 +3,12 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
use Wx qw(:sizer wxSYS_DEFAULT_GUI_FONT);
|
use Wx qw(:sizer wxSYS_DEFAULT_GUI_FONT);
|
||||||
use Wx::Event qw(EVT_TEXT EVT_SPINCTRL EVT_CHECKBOX EVT_CHOICE);
|
use Wx::Event qw(EVT_TEXT EVT_SPINCTRL EVT_CHECKBOX EVT_COMBOBOX);
|
||||||
use base 'Wx::StaticBoxSizer';
|
use base 'Wx::StaticBoxSizer';
|
||||||
|
|
||||||
|
|
||||||
# not very elegant, but this solution is temporary waiting for a better GUI
|
# not very elegant, but this solution is temporary waiting for a better GUI
|
||||||
our @reload_callbacks = ();
|
our %reload_callbacks = (); # key => $cb
|
||||||
our %fields = (); # $key => [$control]
|
our %fields = (); # $key => [$control]
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
@ -28,6 +28,8 @@ sub new {
|
|||||||
my $sidetext_font = Wx::SystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
|
my $sidetext_font = Wx::SystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
|
||||||
$sidetext_font->SetPointSize(12);
|
$sidetext_font->SetPointSize(12);
|
||||||
|
|
||||||
|
my $onChange = $p{on_change} || sub {};
|
||||||
|
|
||||||
foreach my $opt_key (@{$p{options}}) {
|
foreach my $opt_key (@{$p{options}}) {
|
||||||
my $opt = $Slic3r::Config::Options->{$opt_key};
|
my $opt = $Slic3r::Config::Options->{$opt_key};
|
||||||
my $label;
|
my $label;
|
||||||
@ -52,17 +54,17 @@ sub new {
|
|||||||
if ($opt->{type} eq 'i') {
|
if ($opt->{type} eq 'i') {
|
||||||
my $value = Slic3r::Config->$get($opt_key);
|
my $value = Slic3r::Config->$get($opt_key);
|
||||||
$field = Wx::SpinCtrl->new($parent, -1, $value, Wx::wxDefaultPosition, $size, $style, $opt->{min} || 0, $opt->{max} || 100, $value);
|
$field = Wx::SpinCtrl->new($parent, -1, $value, Wx::wxDefaultPosition, $size, $style, $opt->{min} || 0, $opt->{max} || 100, $value);
|
||||||
EVT_SPINCTRL($parent, $field, sub { Slic3r::Config->$set($opt_key, $field->GetValue) });
|
EVT_SPINCTRL($parent, $field, sub { Slic3r::Config->$set($opt_key, $field->GetValue); $onChange->($opt_key) });
|
||||||
} else {
|
} else {
|
||||||
$field = Wx::TextCtrl->new($parent, -1, Slic3r::Config->$get($opt_key), Wx::wxDefaultPosition, $size, $style);
|
$field = Wx::TextCtrl->new($parent, -1, Slic3r::Config->$get($opt_key), Wx::wxDefaultPosition, $size, $style);
|
||||||
EVT_TEXT($parent, $field, sub { Slic3r::Config->$set($opt_key, $field->GetValue) });
|
EVT_TEXT($parent, $field, sub { Slic3r::Config->$set($opt_key, $field->GetValue); $onChange->($opt_key) });
|
||||||
}
|
}
|
||||||
push @reload_callbacks, sub { $field->SetValue(Slic3r::Config->$get($opt_key)) };
|
$reload_callbacks{$opt_key} = sub { $field->SetValue(Slic3r::Config->$get($opt_key)) };
|
||||||
} elsif ($opt->{type} eq 'bool') {
|
} elsif ($opt->{type} eq 'bool') {
|
||||||
$field = Wx::CheckBox->new($parent, -1, "");
|
$field = Wx::CheckBox->new($parent, -1, "");
|
||||||
$field->SetValue(Slic3r::Config->get($opt_key));
|
$field->SetValue(Slic3r::Config->get($opt_key));
|
||||||
EVT_CHECKBOX($parent, $field, sub { Slic3r::Config->set($opt_key, $field->GetValue) });
|
EVT_CHECKBOX($parent, $field, sub { Slic3r::Config->set($opt_key, $field->GetValue); $onChange->($opt_key) });
|
||||||
push @reload_callbacks, sub { $field->SetValue(Slic3r::Config->get($opt_key)) };
|
$reload_callbacks{$opt_key} = sub { $field->SetValue(Slic3r::Config->get($opt_key)) };
|
||||||
} elsif ($opt->{type} eq 'point') {
|
} elsif ($opt->{type} eq 'point') {
|
||||||
$field = Wx::BoxSizer->new(wxHORIZONTAL);
|
$field = Wx::BoxSizer->new(wxHORIZONTAL);
|
||||||
my $field_size = Wx::Size->new(40, -1);
|
my $field_size = Wx::Size->new(40, -1);
|
||||||
@ -83,9 +85,9 @@ sub new {
|
|||||||
$val->[$i] = $value;
|
$val->[$i] = $value;
|
||||||
Slic3r::Config->set($opt_key, $val);
|
Slic3r::Config->set($opt_key, $val);
|
||||||
};
|
};
|
||||||
EVT_TEXT($parent, $x_field, sub { $set_value->(0, $x_field->GetValue) });
|
EVT_TEXT($parent, $x_field, sub { $set_value->(0, $x_field->GetValue); $onChange->($opt_key) });
|
||||||
EVT_TEXT($parent, $y_field, sub { $set_value->(1, $y_field->GetValue) });
|
EVT_TEXT($parent, $y_field, sub { $set_value->(1, $y_field->GetValue); $onChange->($opt_key) });
|
||||||
push @reload_callbacks, sub {
|
$reload_callbacks{$opt_key} = sub {
|
||||||
my $value = Slic3r::Config->get($opt_key);
|
my $value = Slic3r::Config->get($opt_key);
|
||||||
$x_field->SetValue($value->[0]);
|
$x_field->SetValue($value->[0]);
|
||||||
$y_field->SetValue($value->[1]);
|
$y_field->SetValue($value->[1]);
|
||||||
@ -93,14 +95,15 @@ sub new {
|
|||||||
$fields{$opt_key} = [$x_field, $y_field];
|
$fields{$opt_key} = [$x_field, $y_field];
|
||||||
} elsif ($opt->{type} eq 'select') {
|
} elsif ($opt->{type} eq 'select') {
|
||||||
$field = Wx::ComboBox->new($parent, -1, "", Wx::wxDefaultPosition, Wx::wxDefaultSize, $opt->{labels} || $opt->{values}, &Wx::wxCB_READONLY);
|
$field = Wx::ComboBox->new($parent, -1, "", Wx::wxDefaultPosition, Wx::wxDefaultSize, $opt->{labels} || $opt->{values}, &Wx::wxCB_READONLY);
|
||||||
EVT_CHOICE($parent, $field, sub {
|
EVT_COMBOBOX($parent, $field, sub {
|
||||||
Slic3r::Config->set($opt_key, $opt->{values}[$field->GetSelection]);
|
Slic3r::Config->set($opt_key, $opt->{values}[$field->GetSelection]);
|
||||||
|
$onChange->($opt_key);
|
||||||
});
|
});
|
||||||
push @reload_callbacks, sub {
|
$reload_callbacks{$opt_key} = sub {
|
||||||
my $value = Slic3r::Config->get($opt_key);
|
my $value = Slic3r::Config->get($opt_key);
|
||||||
$field->SetSelection(grep $opt->{values}[$_] eq $value, 0..$#{$opt->{values}});
|
$field->SetSelection(grep $opt->{values}[$_] eq $value, 0..$#{$opt->{values}});
|
||||||
};
|
};
|
||||||
$reload_callbacks[-1]->();
|
$reload_callbacks{$opt_key}->();
|
||||||
} else {
|
} else {
|
||||||
die "Unsupported option type: " . $opt->{type};
|
die "Unsupported option type: " . $opt->{type};
|
||||||
}
|
}
|
||||||
|
@ -58,8 +58,6 @@ sub new {
|
|||||||
$self->SetSizer($sizer);
|
$self->SetSizer($sizer);
|
||||||
$self->Layout;
|
$self->Layout;
|
||||||
|
|
||||||
$_->() for @Slic3r::GUI::OptionsGroup::reload_callbacks;
|
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,7 +212,7 @@ sub load_config {
|
|||||||
Slic3r::Config->load($file);
|
Slic3r::Config->load($file);
|
||||||
};
|
};
|
||||||
Slic3r::GUI::catch_error($self);
|
Slic3r::GUI::catch_error($self);
|
||||||
$_->() for @Slic3r::GUI::OptionsGroup::reload_callbacks;
|
$_->() for values %Slic3r::GUI::OptionsGroup::reload_callbacks;
|
||||||
}
|
}
|
||||||
$dlg->Destroy;
|
$dlg->Destroy;
|
||||||
}
|
}
|
||||||
|
@ -3,26 +3,60 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
use utf8;
|
use utf8;
|
||||||
|
|
||||||
|
use List::Util qw(first);
|
||||||
use Wx qw(:sizer :progressdialog);
|
use Wx qw(:sizer :progressdialog);
|
||||||
use Wx::Event qw(EVT_TREE_SEL_CHANGED);
|
use Wx::Event qw(EVT_TREE_SEL_CHANGED EVT_CHOICE EVT_BUTTON);
|
||||||
use base 'Wx::Panel';
|
use base 'Wx::Panel';
|
||||||
|
|
||||||
|
my $small_font = Wx::SystemSettings::GetFont(&Wx::wxSYS_DEFAULT_GUI_FONT);
|
||||||
|
$small_font->SetPointSize(11);
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
my ($parent) = @_;
|
my ($parent) = @_;
|
||||||
my $self = $class->SUPER::new($parent, -1, [-1,-1], [-1,-1], &Wx::wxBK_LEFT);
|
my $self = $class->SUPER::new($parent, -1, [-1,-1], [-1,-1], &Wx::wxBK_LEFT);
|
||||||
|
|
||||||
|
# horizontal sizer
|
||||||
$self->{sizer} = Wx::BoxSizer->new(&Wx::wxHORIZONTAL);
|
$self->{sizer} = Wx::BoxSizer->new(&Wx::wxHORIZONTAL);
|
||||||
$self->{sizer}->SetSizeHints($self);
|
$self->{sizer}->SetSizeHints($self);
|
||||||
$self->SetSizer($self->{sizer});
|
$self->SetSizer($self->{sizer});
|
||||||
|
|
||||||
$self->{treectrl} = Wx::TreeCtrl->new($self, -1, [-1, -1], [200, -1], &Wx::wxTR_NO_BUTTONS | &Wx::wxTR_HIDE_ROOT | &Wx::wxTR_SINGLE | &Wx::wxTR_NO_LINES);
|
# left vertical sizer
|
||||||
$self->{sizer}->Add($self->{treectrl}, 0, &Wx::wxEXPAND);
|
my $left_sizer = Wx::BoxSizer->new(&Wx::wxVERTICAL);
|
||||||
|
$self->{sizer}->Add($left_sizer, 0, &Wx::wxEXPAND);
|
||||||
|
|
||||||
|
my $left_col_width = 200;
|
||||||
|
|
||||||
|
# preset chooser
|
||||||
|
{
|
||||||
|
my $box = Wx::StaticBox->new($self, -1, "Presets:", [-1, -1], [$left_col_width, 50]);
|
||||||
|
$left_sizer->Add($box, 0, &Wx::wxEXPAND | &Wx::wxBOTTOM, 5);
|
||||||
|
|
||||||
|
# choice menu
|
||||||
|
$self->{presets_choice} = Wx::Choice->new($box, -1, [-1, -1], [-1, -1], []);
|
||||||
|
$self->{presets_choice}->SetFont($small_font);
|
||||||
|
|
||||||
|
# buttons
|
||||||
|
$self->{btn_save_preset} = Wx::BitmapButton->new($box, -1, Wx::Bitmap->new("$Slic3r::var/disk.png", &Wx::wxBITMAP_TYPE_PNG));
|
||||||
|
$self->{btn_delete_preset} = Wx::BitmapButton->new($box, -1, Wx::Bitmap->new("$Slic3r::var/delete.png", &Wx::wxBITMAP_TYPE_PNG));
|
||||||
|
$self->{btn_save_preset}->SetToolTipString("Save current settings");
|
||||||
|
$self->{btn_delete_preset}->SetToolTipString("Delete this preset");
|
||||||
|
$self->{btn_save_preset}->Disable;
|
||||||
|
$self->{btn_delete_preset}->Disable;
|
||||||
|
|
||||||
|
my $hsizer = Wx::BoxSizer->new(&Wx::wxHORIZONTAL);
|
||||||
|
$box->SetSizer($hsizer);
|
||||||
|
$hsizer->Add($self->{presets_choice}, 1, &Wx::wxRIGHT | &Wx::wxALIGN_CENTER_VERTICAL, 3);
|
||||||
|
$hsizer->Add($self->{btn_save_preset}, 0, &Wx::wxALIGN_CENTER_VERTICAL);
|
||||||
|
$hsizer->Add($self->{btn_delete_preset}, 0, &Wx::wxALIGN_CENTER_VERTICAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
# tree
|
||||||
|
$self->{treectrl} = Wx::TreeCtrl->new($self, -1, [-1, -1], [$left_col_width, -1], &Wx::wxTR_NO_BUTTONS | &Wx::wxTR_HIDE_ROOT | &Wx::wxTR_SINGLE | &Wx::wxTR_NO_LINES);
|
||||||
|
$left_sizer->Add($self->{treectrl}, 1, &Wx::wxEXPAND);
|
||||||
$self->{icons} = Wx::ImageList->new(16, 16, 1);
|
$self->{icons} = Wx::ImageList->new(16, 16, 1);
|
||||||
$self->{treectrl}->AssignImageList($self->{icons});
|
$self->{treectrl}->AssignImageList($self->{icons});
|
||||||
$self->{iconcount} = -1;
|
$self->{iconcount} = -1;
|
||||||
|
|
||||||
$self->{treectrl}->AddRoot("root");
|
$self->{treectrl}->AddRoot("root");
|
||||||
$self->{pages} = {};
|
$self->{pages} = {};
|
||||||
$self->{treectrl}->SetIndent(0);
|
$self->{treectrl}->SetIndent(0);
|
||||||
@ -35,14 +69,57 @@ sub new {
|
|||||||
$self->{sizer}->Layout;
|
$self->{sizer}->Layout;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
EVT_CHOICE($parent, $self->{presets_choice}, sub {
|
||||||
|
if (defined $self->{dirty}) {
|
||||||
|
# TODO: prompt user?
|
||||||
|
$self->set_dirty(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
my $i = $self->{presets_choice}->GetSelection;
|
||||||
|
if ($i == 0) {
|
||||||
|
Slic3r::Config->load_hash($Slic3r::Defaults, $self->{presets_group}, 1);
|
||||||
|
$self->{btn_delete_preset}->Disable;
|
||||||
|
} else {
|
||||||
|
my $file = "$Slic3r::GUI::datadir/$self->{presets_group}/" . $self->{presets}[$i-1];
|
||||||
|
if (!-e $file) {
|
||||||
|
Slic3r::GUI::show_error($self, "The selected preset does not exist anymore ($file).");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Slic3r::Config->load($file, $self->{presets_group});
|
||||||
|
$self->{btn_delete_preset}->Enable;
|
||||||
|
}
|
||||||
|
$_->() for @Slic3r::GUI::OptionsGroup::reload_callbacks{@{$Slic3r::Config::Groups{$self->{presets_group}}}};
|
||||||
|
$self->set_dirty(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
EVT_BUTTON($self, $self->{btn_save_preset}, sub {
|
||||||
|
my $i = $self->{presets_choice}->GetSelection;
|
||||||
|
my $default = $i == 0 ? 'Untitled' : $self->{presets}[$i-1];
|
||||||
|
$default =~ s/\.ini$//i;
|
||||||
|
|
||||||
|
my $dlg = Slic3r::GUI::SavePresetWindow->new($self,
|
||||||
|
default => $default,
|
||||||
|
values => [ map { $_ =~ s/\.ini$//i; $_ } @{$self->{presets}} ],
|
||||||
|
);
|
||||||
|
return unless $dlg->ShowModal;
|
||||||
|
|
||||||
|
my $file = sprintf "$Slic3r::GUI::datadir/$self->{presets_group}/%s.ini", $dlg->get_name;
|
||||||
|
Slic3r::Config->save($file, $self->{presets_group});
|
||||||
|
$self->set_dirty(0);
|
||||||
|
$self->load_presets;
|
||||||
|
$self->{presets_choice}->SetSelection(1 + first { $self->{presets}[$_] eq $dlg->get_name . ".ini" } 0 .. $#{$self->{presets}});
|
||||||
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub AddOptionsPage {
|
sub add_options_page {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $title = shift;
|
my $title = shift;
|
||||||
my $icon = (ref $_[1]) ? undef : shift;
|
my $icon = (ref $_[1]) ? undef : shift;
|
||||||
my $page = Slic3r::GUI::Tab::Page->new($self, @_);
|
my $page = Slic3r::GUI::Tab::Page->new($self, @_, on_change => sub {
|
||||||
|
$self->set_dirty(1);
|
||||||
|
});
|
||||||
|
|
||||||
my $bitmap = $icon
|
my $bitmap = $icon
|
||||||
? Wx::Bitmap->new("$Slic3r::var/$icon", &Wx::wxBITMAP_TYPE_PNG)
|
? Wx::Bitmap->new("$Slic3r::var/$icon", &Wx::wxBITMAP_TYPE_PNG)
|
||||||
@ -52,12 +129,55 @@ sub AddOptionsPage {
|
|||||||
$self->{iconcount}++;
|
$self->{iconcount}++;
|
||||||
}
|
}
|
||||||
$page->Hide;
|
$page->Hide;
|
||||||
$self->{treectrl}->AppendItem($self->{treectrl}->GetRootItem, $title, $self->{iconcount});
|
my $itemId = $self->{treectrl}->AppendItem($self->{treectrl}->GetRootItem, $title, $self->{iconcount});
|
||||||
$self->{pages}{$title} = $page;
|
$self->{pages}{$title} = $page;
|
||||||
|
if (keys %{$self->{pages}} == 1) {
|
||||||
|
$self->{treectrl}->SelectItem($itemId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub set_dirty {
|
||||||
|
my $self = shift;
|
||||||
|
my ($dirty) = @_;
|
||||||
|
|
||||||
|
my $i = $self->{dirty} // $self->{presets_choice}->GetSelection; #/
|
||||||
|
my $text = $self->{presets_choice}->GetString($i);
|
||||||
|
|
||||||
|
if ($dirty) {
|
||||||
|
$self->{dirty} = $i;
|
||||||
|
$self->{btn_save_preset}->Enable;
|
||||||
|
if ($text !~ / \(modified\)$/) {
|
||||||
|
$self->{presets_choice}->SetString($i, "$text (modified)");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$self->{dirty} = undef;
|
||||||
|
$self->{btn_save_preset}->Disable;
|
||||||
|
$text =~ s/ \(modified\)$//;
|
||||||
|
$self->{presets_choice}->SetString($i, $text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub load_presets {
|
||||||
|
my $self = shift;
|
||||||
|
my ($group) = @_;
|
||||||
|
|
||||||
|
$self->{presets_group} ||= $group;
|
||||||
|
$self->{presets} = [];
|
||||||
|
|
||||||
|
opendir my $dh, "$Slic3r::GUI::datadir/$self->{presets_group}" or die "Failed to read directory $Slic3r::GUI::datadir/$self->{presets_group} (errno: $!)\n";
|
||||||
|
my @presets = sort grep /\.ini$/i, readdir $dh;
|
||||||
|
closedir $dh;
|
||||||
|
|
||||||
|
$self->{presets_choice}->Clear;
|
||||||
|
$self->{presets_choice}->Append("- default -");
|
||||||
|
foreach my $preset (@presets) {
|
||||||
|
push @{$self->{presets}}, $preset;
|
||||||
|
$preset =~ s/\.ini$//i;
|
||||||
|
$self->{presets_choice}->Append($preset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
package Slic3r::GUI::Tab::Print;
|
package Slic3r::GUI::Tab::Print;
|
||||||
|
|
||||||
use Wx qw(:sizer :progressdialog);
|
use Wx qw(:sizer :progressdialog);
|
||||||
use Wx::Event qw();
|
use Wx::Event qw();
|
||||||
use base 'Slic3r::GUI::Tab';
|
use base 'Slic3r::GUI::Tab';
|
||||||
@ -67,7 +187,7 @@ sub new {
|
|||||||
my ($parent) = @_;
|
my ($parent) = @_;
|
||||||
my $self = $class->SUPER::new($parent, -1);
|
my $self = $class->SUPER::new($parent, -1);
|
||||||
|
|
||||||
$self->AddOptionsPage('Layers and perimeters', 'layers.png', optgroups => [
|
$self->add_options_page('Layers and perimeters', 'layers.png', optgroups => [
|
||||||
{
|
{
|
||||||
title => 'Layer height',
|
title => 'Layer height',
|
||||||
options => [qw(layer_height first_layer_height)],
|
options => [qw(layer_height first_layer_height)],
|
||||||
@ -82,14 +202,14 @@ sub new {
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$self->AddOptionsPage('Infill', 'shading.png', optgroups => [
|
$self->add_options_page('Infill', 'shading.png', optgroups => [
|
||||||
{
|
{
|
||||||
title => 'Infill',
|
title => 'Infill',
|
||||||
options => [qw(fill_density fill_angle fill_pattern solid_fill_pattern infill_every_layers)],
|
options => [qw(fill_density fill_angle fill_pattern solid_fill_pattern infill_every_layers)],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$self->AddOptionsPage('Speed', 'time.png', optgroups => [
|
$self->add_options_page('Speed', 'time.png', optgroups => [
|
||||||
{
|
{
|
||||||
title => 'Speed for print moves',
|
title => 'Speed for print moves',
|
||||||
options => [qw(perimeter_speed small_perimeter_speed infill_speed solid_infill_speed top_solid_infill_speed bridge_speed)],
|
options => [qw(perimeter_speed small_perimeter_speed infill_speed solid_infill_speed top_solid_infill_speed bridge_speed)],
|
||||||
@ -104,21 +224,21 @@ sub new {
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$self->AddOptionsPage('Skirt', 'box.png', optgroups => [
|
$self->add_options_page('Skirt', 'box.png', optgroups => [
|
||||||
{
|
{
|
||||||
title => 'Skirt',
|
title => 'Skirt',
|
||||||
options => [qw(skirts skirt_distance skirt_height)],
|
options => [qw(skirts skirt_distance skirt_height)],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$self->AddOptionsPage('Support material', 'building.png', optgroups => [
|
$self->add_options_page('Support material', 'building.png', optgroups => [
|
||||||
{
|
{
|
||||||
title => 'Support material',
|
title => 'Support material',
|
||||||
options => [qw(support_material support_material_tool)],
|
options => [qw(support_material support_material_tool)],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$self->AddOptionsPage('Notes', 'note.png', optgroups => [
|
$self->add_options_page('Notes', 'note.png', optgroups => [
|
||||||
{
|
{
|
||||||
title => 'Notes',
|
title => 'Notes',
|
||||||
no_labels => 1,
|
no_labels => 1,
|
||||||
@ -126,7 +246,7 @@ sub new {
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$self->AddOptionsPage('Output options', 'page_white_go.png', optgroups => [
|
$self->add_options_page('Output options', 'page_white_go.png', optgroups => [
|
||||||
{
|
{
|
||||||
title => 'Sequential printing',
|
title => 'Sequential printing',
|
||||||
options => [qw(complete_objects extruder_clearance_radius extruder_clearance_height)],
|
options => [qw(complete_objects extruder_clearance_radius extruder_clearance_height)],
|
||||||
@ -142,7 +262,7 @@ sub new {
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$self->AddOptionsPage('Advanced', 'wrench.png', optgroups => [
|
$self->add_options_page('Advanced', 'wrench.png', optgroups => [
|
||||||
{
|
{
|
||||||
title => 'Extrusion width',
|
title => 'Extrusion width',
|
||||||
label_width => 180,
|
label_width => 180,
|
||||||
@ -158,11 +278,12 @@ sub new {
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$self->load_presets('print');
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
package Slic3r::GUI::Tab::Filament;
|
package Slic3r::GUI::Tab::Filament;
|
||||||
|
|
||||||
use Wx qw(:sizer :progressdialog);
|
use Wx qw(:sizer :progressdialog);
|
||||||
use Wx::Event qw();
|
use Wx::Event qw();
|
||||||
use base 'Slic3r::GUI::Tab';
|
use base 'Slic3r::GUI::Tab';
|
||||||
@ -172,7 +293,7 @@ sub new {
|
|||||||
my ($parent) = @_;
|
my ($parent) = @_;
|
||||||
my $self = $class->SUPER::new($parent, -1);
|
my $self = $class->SUPER::new($parent, -1);
|
||||||
|
|
||||||
$self->AddOptionsPage('Filament', 'spool.png', optgroups => [
|
$self->add_options_page('Filament', 'spool.png', optgroups => [
|
||||||
{
|
{
|
||||||
title => 'Filament',
|
title => 'Filament',
|
||||||
options => [qw(filament_diameter extrusion_multiplier)],
|
options => [qw(filament_diameter extrusion_multiplier)],
|
||||||
@ -183,7 +304,7 @@ sub new {
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$self->AddOptionsPage('Cooling', 'hourglass.png', optgroups => [
|
$self->add_options_page('Cooling', 'hourglass.png', optgroups => [
|
||||||
{
|
{
|
||||||
title => 'Enable',
|
title => 'Enable',
|
||||||
options => [qw(cooling)],
|
options => [qw(cooling)],
|
||||||
@ -199,11 +320,12 @@ sub new {
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$self->load_presets('filament');
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
package Slic3r::GUI::Tab::Printer;
|
package Slic3r::GUI::Tab::Printer;
|
||||||
|
|
||||||
use Wx qw(:sizer :progressdialog);
|
use Wx qw(:sizer :progressdialog);
|
||||||
use Wx::Event qw();
|
use Wx::Event qw();
|
||||||
use base 'Slic3r::GUI::Tab';
|
use base 'Slic3r::GUI::Tab';
|
||||||
@ -213,7 +335,7 @@ sub new {
|
|||||||
my ($parent) = @_;
|
my ($parent) = @_;
|
||||||
my $self = $class->SUPER::new($parent, -1);
|
my $self = $class->SUPER::new($parent, -1);
|
||||||
|
|
||||||
$self->AddOptionsPage('General', 'printer_empty.png', optgroups => [
|
$self->add_options_page('General', 'printer_empty.png', optgroups => [
|
||||||
{
|
{
|
||||||
title => 'Size and coordinates',
|
title => 'Size and coordinates',
|
||||||
options => [qw(bed_size print_center z_offset)],
|
options => [qw(bed_size print_center z_offset)],
|
||||||
@ -224,7 +346,7 @@ sub new {
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$self->AddOptionsPage('Extruder 1', 'funnel.png', optgroups => [
|
$self->add_options_page('Extruder 1', 'funnel.png', optgroups => [
|
||||||
{
|
{
|
||||||
title => 'Size',
|
title => 'Size',
|
||||||
options => [qw(nozzle_diameter)],
|
options => [qw(nozzle_diameter)],
|
||||||
@ -235,7 +357,7 @@ sub new {
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$self->AddOptionsPage('Custom G-code', 'cog.png', optgroups => [
|
$self->add_options_page('Custom G-code', 'cog.png', optgroups => [
|
||||||
{
|
{
|
||||||
title => 'Start G-code',
|
title => 'Start G-code',
|
||||||
no_labels => 1,
|
no_labels => 1,
|
||||||
@ -253,11 +375,12 @@ sub new {
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$self->load_presets('printer');
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
package Slic3r::GUI::Tab::Page;
|
package Slic3r::GUI::Tab::Page;
|
||||||
|
|
||||||
use Wx qw(:sizer :progressdialog);
|
use Wx qw(:sizer :progressdialog);
|
||||||
use Wx::Event qw();
|
use Wx::Event qw();
|
||||||
use base 'Wx::ScrolledWindow';
|
use base 'Wx::ScrolledWindow';
|
||||||
@ -273,7 +396,7 @@ sub new {
|
|||||||
$self->SetSizer($self->{vsizer});
|
$self->SetSizer($self->{vsizer});
|
||||||
|
|
||||||
if ($params{optgroups}) {
|
if ($params{optgroups}) {
|
||||||
$self->append_optgroup(%$_) for @{$params{optgroups}};
|
$self->append_optgroup(%$_, on_change => $params{on_change}) for @{$params{optgroups}};
|
||||||
}
|
}
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
@ -286,4 +409,41 @@ sub append_optgroup {
|
|||||||
$self->{vsizer}->Add($optgroup, 0, wxEXPAND | wxALL, 5);
|
$self->{vsizer}->Add($optgroup, 0, wxEXPAND | wxALL, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
package Slic3r::GUI::SavePresetWindow;
|
||||||
|
use Wx qw(:sizer);
|
||||||
|
use Wx::Event qw(EVT_BUTTON);
|
||||||
|
use base 'Wx::Dialog';
|
||||||
|
|
||||||
|
sub new {
|
||||||
|
my $class = shift;
|
||||||
|
my ($parent, %params) = @_;
|
||||||
|
my $self = $class->SUPER::new($parent, -1, "Save preset", [-1, -1], [-1, -1]);
|
||||||
|
|
||||||
|
my $text = Wx::StaticText->new($self, -1, "Save settings as:", [-1, -1], [-1, -1]);
|
||||||
|
my $combo = Wx::ComboBox->new($self, -1, $params{default}, [-1, -1], [-1, -1], $params{values});
|
||||||
|
my $buttons = $self->CreateStdDialogButtonSizer(&Wx::wxOK | &Wx::wxCANCEL);
|
||||||
|
|
||||||
|
my $sizer = Wx::BoxSizer->new(wxVERTICAL);
|
||||||
|
$sizer->Add($text, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 10);
|
||||||
|
$sizer->Add($combo, 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
|
||||||
|
$sizer->Add($buttons, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
|
||||||
|
|
||||||
|
EVT_BUTTON($self, &Wx::wxID_OK, sub {
|
||||||
|
if (($self->{chosen_name} = $combo->GetValue) && $self->{chosen_name} =~ /^[a-z0-9 _-]+$/i) {
|
||||||
|
$self->EndModal(1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$self->SetSizer($sizer);
|
||||||
|
$sizer->SetSizeHints($self);
|
||||||
|
$self->SetReturnCode(0);
|
||||||
|
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_name {
|
||||||
|
my $self = shift;
|
||||||
|
return $self->{chosen_name};
|
||||||
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
BIN
var/disk.png
Executable file
BIN
var/disk.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 620 B |
Loading…
Reference in New Issue
Block a user