Accept multiple --load arguments for GUI too

This commit is contained in:
Alessandro Ranellucci 2012-08-09 00:59:41 +02:00
parent db8bb8c3d8
commit d02012e4a3
2 changed files with 7 additions and 6 deletions

View File

@ -202,9 +202,9 @@ sub get_preset_config {
my $self = shift;
my ($preset) = @_;
my $config = Slic3r::Config->new_from_defaults(@{$self->{options}});
if (!$preset->{default}) {
if ($preset->{default}) {
return Slic3r::Config->new_from_defaults(@{$self->{options}});
} else {
if (!-e $preset->{file}) {
Slic3r::GUI::show_error($self, "The selected preset does not exist anymore ($preset->{file}).");
return;
@ -212,11 +212,12 @@ sub get_preset_config {
# apply preset values on top of defaults
my $external_config = Slic3r::Config->load($preset->{file});
my $config = Slic3r::Config->new;
$config->set($_, $external_config->get($_))
for grep $external_config->has($_), @{$self->{options}};
}
return $config;
}
}
sub add_options_page {

View File

@ -71,7 +71,7 @@ if ($opt{save}) {
my $gui;
if (!@ARGV && !$opt{save} && eval "require Slic3r::GUI; 1") {
$gui = Slic3r::GUI->new;
$gui->{skeinpanel}->load_config_file($opt{load}[0]) if $opt{load};
$gui->{skeinpanel}->load_config_file($_) for @{$opt{load}};
$gui->{skeinpanel}->load_config($cli_config);
$gui->MainLoop;
exit;