Allow loading multiple files at once. #402

This commit is contained in:
Alessandro Ranellucci 2012-05-31 09:26:30 +02:00
parent 8aa20cd784
commit 3ef86ad6ff
2 changed files with 5 additions and 5 deletions

View File

@ -206,14 +206,14 @@ sub load {
my $self = shift; my $self = shift;
my $dir = $Slic3r::GUI::SkeinPanel::last_skein_dir || $Slic3r::GUI::SkeinPanel::last_config_dir || ""; my $dir = $Slic3r::GUI::SkeinPanel::last_skein_dir || $Slic3r::GUI::SkeinPanel::last_config_dir || "";
my $dialog = Wx::FileDialog->new($self, 'Choose a file (STL/OBJ/AMF):', $dir, "", $Slic3r::GUI::SkeinPanel::model_wildcard, wxFD_OPEN); my $dialog = Wx::FileDialog->new($self, 'Choose one or more files (STL/OBJ/AMF):', $dir, "", $Slic3r::GUI::SkeinPanel::model_wildcard, wxFD_OPEN | &Wx::wxFD_MULTIPLE | &Wx::wxFD_FILE_MUST_EXIST);
if ($dialog->ShowModal != wxID_OK) { if ($dialog->ShowModal != wxID_OK) {
$dialog->Destroy; $dialog->Destroy;
return; return;
} }
my $input_file = $dialog->GetPaths; my @input_files = $dialog->GetPaths;
$dialog->Destroy; $dialog->Destroy;
return $self->load_file($input_file); $self->load_file($_) for @input_files;
} }
sub load_file { sub load_file {

View File

@ -194,7 +194,7 @@ sub do_slice {
my $input_file; my $input_file;
if (!$params{reslice}) { if (!$params{reslice}) {
my $dialog = Wx::FileDialog->new($self, 'Choose a file to slice (STL/OBJ/AMF):', $dir, "", $model_wildcard, wxFD_OPEN); my $dialog = Wx::FileDialog->new($self, 'Choose a file to slice (STL/OBJ/AMF):', $dir, "", $model_wildcard, wxFD_OPEN | &Wx::wxFD_FILE_MUST_EXIST);
if ($dialog->ShowModal != wxID_OK) { if ($dialog->ShowModal != wxID_OK) {
$dialog->Destroy; $dialog->Destroy;
return; return;
@ -310,7 +310,7 @@ sub load_config {
my $dir = $last_config ? dirname($last_config) : $last_config_dir || $last_skein_dir || ""; my $dir = $last_config ? dirname($last_config) : $last_config_dir || $last_skein_dir || "";
my $dlg = Wx::FileDialog->new($self, 'Select configuration to load:', $dir, "config.ini", my $dlg = Wx::FileDialog->new($self, 'Select configuration to load:', $dir, "config.ini",
$ini_wildcard, wxFD_OPEN); $ini_wildcard, wxFD_OPEN | &Wx::wxFD_FILE_MUST_EXIST);
if ($dlg->ShowModal == wxID_OK) { if ($dlg->ShowModal == wxID_OK) {
my ($file) = $dlg->GetPaths; my ($file) = $dlg->GetPaths;
$last_config_dir = dirname($file); $last_config_dir = dirname($file);