Use separate variables for last used config directory and last used skein directory. #187
This commit is contained in:
parent
e84ffa83e3
commit
b4dc299be0
1 changed files with 9 additions and 7 deletions
|
@ -9,7 +9,8 @@ use Wx qw(:sizer :progressdialog wxOK wxICON_INFORMATION wxICON_WARNING wxICON_E
|
|||
use Wx::Event qw(EVT_BUTTON);
|
||||
use base 'Wx::Panel';
|
||||
|
||||
my $last_dir;
|
||||
my $last_skein_dir;
|
||||
my $last_config_dir;
|
||||
our $last_config;
|
||||
|
||||
sub new {
|
||||
|
@ -153,11 +154,11 @@ sub do_slice {
|
|||
Slic3r::Config->validate;
|
||||
|
||||
# select input file
|
||||
my $dialog = Wx::FileDialog->new($self, 'Choose a STL file to slice:', $last_dir || "", "", $stl_wildcard, wxFD_OPEN);
|
||||
my $dialog = Wx::FileDialog->new($self, 'Choose a STL file to slice:', $last_skein_dir || "", "", $stl_wildcard, wxFD_OPEN);
|
||||
return unless $dialog->ShowModal == wxID_OK;
|
||||
my ($input_file) = $dialog->GetPaths;
|
||||
my $input_file_basename = basename($input_file);
|
||||
$last_dir = dirname($input_file);
|
||||
$last_skein_dir = dirname($input_file);
|
||||
|
||||
my $skein = Slic3r::Skein->new(
|
||||
input_file => $input_file,
|
||||
|
@ -211,13 +212,13 @@ sub do_slice {
|
|||
sub save_config {
|
||||
my $self = shift;
|
||||
|
||||
my $dir = $last_config ? dirname($last_config) : $last_dir || "";
|
||||
my $dir = $last_config ? dirname($last_config) : $last_config_dir || "";
|
||||
my $filename = $last_config ? basename($last_config) : "config.ini";
|
||||
my $dlg = Wx::FileDialog->new($self, 'Save configuration as:', $dir, $filename,
|
||||
$ini_wildcard, wxFD_SAVE);
|
||||
if ($dlg->ShowModal == wxID_OK) {
|
||||
my $file = $dlg->GetPath;
|
||||
$last_dir = dirname($file);
|
||||
$last_config_dir = dirname($file);
|
||||
$last_config = $file;
|
||||
Slic3r::Config->save($file);
|
||||
}
|
||||
|
@ -226,11 +227,12 @@ sub save_config {
|
|||
sub load_config {
|
||||
my $self = shift;
|
||||
|
||||
my $dlg = Wx::FileDialog->new($self, 'Select configuration to load:', $last_dir || "", "config.ini",
|
||||
my $dir = $last_config ? dirname($last_config) : $last_config_dir || "";
|
||||
my $dlg = Wx::FileDialog->new($self, 'Select configuration to load:', $dir, "config.ini",
|
||||
$ini_wildcard, wxFD_OPEN);
|
||||
if ($dlg->ShowModal == wxID_OK) {
|
||||
my ($file) = $dlg->GetPaths;
|
||||
$last_dir = dirname($file);
|
||||
$last_config_dir = dirname($file);
|
||||
$last_config = $file;
|
||||
eval {
|
||||
local $SIG{__WARN__} = $self->catch_warning;
|
||||
|
|
Loading…
Reference in a new issue