From 3ef86ad6ff4c6dcf35a847fd39ac80eac0d8b012 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Thu, 31 May 2012 09:26:30 +0200 Subject: [PATCH] Allow loading multiple files at once. #402 --- lib/Slic3r/GUI/Plater.pm | 6 +++--- lib/Slic3r/GUI/SkeinPanel.pm | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index a08660e54..37fc8d9ec 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -206,14 +206,14 @@ sub load { my $self = shift; 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) { $dialog->Destroy; return; } - my $input_file = $dialog->GetPaths; + my @input_files = $dialog->GetPaths; $dialog->Destroy; - return $self->load_file($input_file); + $self->load_file($_) for @input_files; } sub load_file { diff --git a/lib/Slic3r/GUI/SkeinPanel.pm b/lib/Slic3r/GUI/SkeinPanel.pm index 4ffedbe6b..f19c93314 100644 --- a/lib/Slic3r/GUI/SkeinPanel.pm +++ b/lib/Slic3r/GUI/SkeinPanel.pm @@ -194,7 +194,7 @@ sub do_slice { my $input_file; 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) { $dialog->Destroy; return; @@ -310,7 +310,7 @@ sub load_config { 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", - $ini_wildcard, wxFD_OPEN); + $ini_wildcard, wxFD_OPEN | &Wx::wxFD_FILE_MUST_EXIST); if ($dlg->ShowModal == wxID_OK) { my ($file) = $dlg->GetPaths; $last_config_dir = dirname($file);