From 8c74d2f41eb12bf098245dfe2769b1ac73bada70 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sun, 2 Jun 2013 20:03:22 +0200 Subject: [PATCH] New --autosave option for better toolchain integration. #837 --- README.markdown | 1 + lib/Slic3r/GUI.pm | 1 + lib/Slic3r/GUI/SkeinPanel.pm | 9 ++++++--- slic3r.pl | 3 +++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.markdown b/README.markdown index 01c43d22..0a4e2b95 100644 --- a/README.markdown +++ b/README.markdown @@ -93,6 +93,7 @@ The author of the Silk icon set is Mark James. GUI options: --no-plater Disable the plater tab --gui-mode Overrides the configured mode (simple/expert) + --autosave Automatically export current configuration to the specified file Output options: --output-filename-format diff --git a/lib/Slic3r/GUI.pm b/lib/Slic3r/GUI.pm index b08ae251..fd46cc5e 100644 --- a/lib/Slic3r/GUI.pm +++ b/lib/Slic3r/GUI.pm @@ -45,6 +45,7 @@ use constant MI_DOCUMENTATION => &Wx::NewId; our $datadir; our $no_plater; our $mode; +our $autosave; our $Settings = { _ => { diff --git a/lib/Slic3r/GUI/SkeinPanel.pm b/lib/Slic3r/GUI/SkeinPanel.pm index 6f30da47..6c4842ea 100644 --- a/lib/Slic3r/GUI/SkeinPanel.pm +++ b/lib/Slic3r/GUI/SkeinPanel.pm @@ -49,9 +49,12 @@ sub new { $self->{tabpanel}, on_value_change => sub { $self->{plater}->on_config_change(@_) if $self->{plater}; # propagate config change events to the plater - if ($self->{mode} eq 'simple' && $init) { # don't save while loading for the first time - # save config - $self->config->save("$Slic3r::GUI::datadir/simple.ini"); + if ($init) { # don't save while loading for the first time + if ($self->{mode} eq 'simple') { + # save config + $self->config->save("$Slic3r::GUI::datadir/simple.ini"); + } + $self->config->save($Slic3r::GUI::autosave) if $Slic3r::GUI::autosave; } }, on_presets_changed => sub { diff --git a/slic3r.pl b/slic3r.pl index 1d09441d..e792548e 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -26,6 +26,7 @@ my %cli_options = (); 'save=s' => \$opt{save}, 'load=s@' => \$opt{load}, + 'autosave=s' => \$opt{autosave}, 'ignore-nonexistent-config' => \$opt{ignore_nonexistent_config}, 'no-plater' => \$opt{no_plater}, 'gui-mode=s' => \$opt{gui_mode}, @@ -78,6 +79,7 @@ if (!@ARGV && !$opt{save} && eval "require Slic3r::GUI; 1") { $Slic3r::GUI::datadir = $opt{datadir}; $Slic3r::GUI::no_plater = $opt{no_plater}; $Slic3r::GUI::mode = $opt{gui_mode}; + $Slic3r::GUI::autosave = $opt{autosave}; } $gui = Slic3r::GUI->new; $gui->{skeinpanel}->load_config_file($_) for @{$opt{load}}; @@ -152,6 +154,7 @@ $j GUI options: --no-plater Disable the plater tab --gui-mode Overrides the configured mode (simple/expert) + --autosave Automatically export current configuration to the specified file Output options: --output-filename-format