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 Wx::Event qw(EVT_BUTTON);
|
||||||
use base 'Wx::Panel';
|
use base 'Wx::Panel';
|
||||||
|
|
||||||
my $last_dir;
|
my $last_skein_dir;
|
||||||
|
my $last_config_dir;
|
||||||
our $last_config;
|
our $last_config;
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
|
@ -153,11 +154,11 @@ sub do_slice {
|
||||||
Slic3r::Config->validate;
|
Slic3r::Config->validate;
|
||||||
|
|
||||||
# select input file
|
# 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;
|
return unless $dialog->ShowModal == wxID_OK;
|
||||||
my ($input_file) = $dialog->GetPaths;
|
my ($input_file) = $dialog->GetPaths;
|
||||||
my $input_file_basename = basename($input_file);
|
my $input_file_basename = basename($input_file);
|
||||||
$last_dir = dirname($input_file);
|
$last_skein_dir = dirname($input_file);
|
||||||
|
|
||||||
my $skein = Slic3r::Skein->new(
|
my $skein = Slic3r::Skein->new(
|
||||||
input_file => $input_file,
|
input_file => $input_file,
|
||||||
|
@ -211,13 +212,13 @@ sub do_slice {
|
||||||
sub save_config {
|
sub save_config {
|
||||||
my $self = shift;
|
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 $filename = $last_config ? basename($last_config) : "config.ini";
|
||||||
my $dlg = Wx::FileDialog->new($self, 'Save configuration as:', $dir, $filename,
|
my $dlg = Wx::FileDialog->new($self, 'Save configuration as:', $dir, $filename,
|
||||||
$ini_wildcard, wxFD_SAVE);
|
$ini_wildcard, wxFD_SAVE);
|
||||||
if ($dlg->ShowModal == wxID_OK) {
|
if ($dlg->ShowModal == wxID_OK) {
|
||||||
my $file = $dlg->GetPath;
|
my $file = $dlg->GetPath;
|
||||||
$last_dir = dirname($file);
|
$last_config_dir = dirname($file);
|
||||||
$last_config = $file;
|
$last_config = $file;
|
||||||
Slic3r::Config->save($file);
|
Slic3r::Config->save($file);
|
||||||
}
|
}
|
||||||
|
@ -226,11 +227,12 @@ sub save_config {
|
||||||
sub load_config {
|
sub load_config {
|
||||||
my $self = shift;
|
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);
|
$ini_wildcard, wxFD_OPEN);
|
||||||
if ($dlg->ShowModal == wxID_OK) {
|
if ($dlg->ShowModal == wxID_OK) {
|
||||||
my ($file) = $dlg->GetPaths;
|
my ($file) = $dlg->GetPaths;
|
||||||
$last_dir = dirname($file);
|
$last_config_dir = dirname($file);
|
||||||
$last_config = $file;
|
$last_config = $file;
|
||||||
eval {
|
eval {
|
||||||
local $SIG{__WARN__} = $self->catch_warning;
|
local $SIG{__WARN__} = $self->catch_warning;
|
||||||
|
|
Loading…
Add table
Reference in a new issue