mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-22 06:04:01 -06:00
New option to remember last output directory. #698
This commit is contained in:
parent
f5bda326b8
commit
6db8afe36d
4 changed files with 23 additions and 2 deletions
|
@ -304,6 +304,15 @@ sub check_version {
|
||||||
})->detach;
|
})->detach;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub output_path {
|
||||||
|
my $class = shift;
|
||||||
|
my ($dir) = @_;
|
||||||
|
|
||||||
|
return ($Settings->{_}{last_output_path} && $Settings->{_}{remember_output_path})
|
||||||
|
? $Settings->{_}{last_output_path}
|
||||||
|
: $dir;
|
||||||
|
}
|
||||||
|
|
||||||
package Slic3r::GUI::ProgressStatusBar;
|
package Slic3r::GUI::ProgressStatusBar;
|
||||||
use Wx qw(:gauge :misc);
|
use Wx qw(:gauge :misc);
|
||||||
use base 'Wx::StatusBar';
|
use base 'Wx::StatusBar';
|
||||||
|
|
|
@ -531,12 +531,14 @@ sub export_gcode {
|
||||||
$self->{output_file} = $main::opt{output};
|
$self->{output_file} = $main::opt{output};
|
||||||
{
|
{
|
||||||
$self->{output_file} = $print->expanded_output_filepath($self->{output_file}, $self->{objects}[0]->input_file);
|
$self->{output_file} = $print->expanded_output_filepath($self->{output_file}, $self->{objects}[0]->input_file);
|
||||||
my $dlg = Wx::FileDialog->new($self, 'Save G-code file as:', dirname($self->{output_file}),
|
my $dlg = Wx::FileDialog->new($self, 'Save G-code file as:', Slic3r::GUI->output_path(dirname($self->{output_file})),
|
||||||
basename($self->{output_file}), &Slic3r::GUI::SkeinPanel::FILE_WILDCARDS->{gcode}, wxFD_SAVE);
|
basename($self->{output_file}), &Slic3r::GUI::SkeinPanel::FILE_WILDCARDS->{gcode}, wxFD_SAVE);
|
||||||
if ($dlg->ShowModal != wxID_OK) {
|
if ($dlg->ShowModal != wxID_OK) {
|
||||||
$dlg->Destroy;
|
$dlg->Destroy;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$Slic3r::GUI::Settings->{_}{last_output_path} = dirname($dlg->GetPath);
|
||||||
|
Slic3r::GUI->save_settings;
|
||||||
$self->{output_file} = $Slic3r::GUI::SkeinPanel::last_output_file = $dlg->GetPath;
|
$self->{output_file} = $Slic3r::GUI::SkeinPanel::last_output_file = $dlg->GetPath;
|
||||||
$dlg->Destroy;
|
$dlg->Destroy;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,13 @@ sub new {
|
||||||
default => $Slic3r::GUI::Settings->{_}{version_check} // 1,
|
default => $Slic3r::GUI::Settings->{_}{version_check} // 1,
|
||||||
readonly => !Slic3r::GUI->have_version_check,
|
readonly => !Slic3r::GUI->have_version_check,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
opt_key => 'remember_output_path',
|
||||||
|
type => 'bool',
|
||||||
|
label => 'Remember output directory',
|
||||||
|
tooltip => 'If this is enabled, Slic3r will prompt the last output directory instead of the one containing the input files.',
|
||||||
|
default => $Slic3r::GUI::Settings->{_}{remember_output_path},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
on_change => sub { $self->{values}{$_[0]} = $_[1] },
|
on_change => sub { $self->{values}{$_[0]} = $_[1] },
|
||||||
label_width => 100,
|
label_width => 100,
|
||||||
|
|
|
@ -133,7 +133,8 @@ sub do_slice {
|
||||||
} elsif ($params{save_as}) {
|
} elsif ($params{save_as}) {
|
||||||
$output_file = $print->expanded_output_filepath($output_file);
|
$output_file = $print->expanded_output_filepath($output_file);
|
||||||
$output_file =~ s/\.gcode$/.svg/i if $params{export_svg};
|
$output_file =~ s/\.gcode$/.svg/i if $params{export_svg};
|
||||||
my $dlg = Wx::FileDialog->new($self, 'Save ' . ($params{export_svg} ? 'SVG' : 'G-code') . ' file as:', dirname($output_file),
|
my $dlg = Wx::FileDialog->new($self, 'Save ' . ($params{export_svg} ? 'SVG' : 'G-code') . ' file as:',
|
||||||
|
Slic3r::GUI->output_path(dirname($output_file)),
|
||||||
basename($output_file), $params{export_svg} ? FILE_WILDCARDS->{svg} : FILE_WILDCARDS->{gcode}, wxFD_SAVE);
|
basename($output_file), $params{export_svg} ? FILE_WILDCARDS->{svg} : FILE_WILDCARDS->{gcode}, wxFD_SAVE);
|
||||||
if ($dlg->ShowModal != wxID_OK) {
|
if ($dlg->ShowModal != wxID_OK) {
|
||||||
$dlg->Destroy;
|
$dlg->Destroy;
|
||||||
|
@ -141,6 +142,8 @@ sub do_slice {
|
||||||
}
|
}
|
||||||
$output_file = $dlg->GetPath;
|
$output_file = $dlg->GetPath;
|
||||||
$last_output_file = $output_file unless $params{export_svg};
|
$last_output_file = $output_file unless $params{export_svg};
|
||||||
|
$Slic3r::GUI::Settings->{_}{last_output_path} = dirname($output_file);
|
||||||
|
Slic3r::GUI->save_settings;
|
||||||
$dlg->Destroy;
|
$dlg->Destroy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue