New --autosave option for better toolchain integration. #837

This commit is contained in:
Alessandro Ranellucci 2013-06-02 20:03:22 +02:00
parent 895e0bbfcd
commit 8c74d2f41e
4 changed files with 11 additions and 3 deletions

View File

@ -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 <file> Automatically export current configuration to the specified file
Output options:
--output-filename-format

View File

@ -45,6 +45,7 @@ use constant MI_DOCUMENTATION => &Wx::NewId;
our $datadir;
our $no_plater;
our $mode;
our $autosave;
our $Settings = {
_ => {

View File

@ -49,10 +49,13 @@ 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
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 {
$self->{plater}->update_presets($tab_name, @_) if $self->{plater};

View File

@ -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 <file> Automatically export current configuration to the specified file
Output options:
--output-filename-format