From a2eecdfb25769d1ad1335958c8fe0cefc5cb7ea7 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Wed, 23 May 2018 16:28:18 +0200 Subject: [PATCH] Output directory selection changed to zip file selection with file dialog. --- lib/Slic3r/GUI/MainFrame.pm | 7 ++++++- xs/CMakeLists.txt | 3 ++- xs/src/libslic3r/Print.cpp | 17 +++++++---------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/lib/Slic3r/GUI/MainFrame.pm b/lib/Slic3r/GUI/MainFrame.pm index 30d7ec9fd..5df8e16e4 100644 --- a/lib/Slic3r/GUI/MainFrame.pm +++ b/lib/Slic3r/GUI/MainFrame.pm @@ -460,7 +460,12 @@ sub quick_slice { wxTheApp->{app_config}->update_last_output_dir(dirname($output_file)); $dlg->Destroy; } elsif($params{export_png}) { - my $dlg = Wx::DirDialog->new($self, L('Choose output directory')); + $output_file = $sprint->output_filepath; + $output_file =~ s/\.[gG][cC][oO][dD][eE]$/.zip/; + # my $dlg = Wx::DirDialog->new($self, L('Choose output directory')); + my $dlg = Wx::FileDialog->new($self, L('Save zip file as:'), + wxTheApp->{app_config}->get_last_output_dir(dirname($output_file)), + basename($output_file), '*.zip', wxFD_SAVE | wxFD_OVERWRITE_PROMPT); if ($dlg->ShowModal != wxID_OK) { $dlg->Destroy; return; diff --git a/xs/CMakeLists.txt b/xs/CMakeLists.txt index cb1dea93e..8a082823e 100644 --- a/xs/CMakeLists.txt +++ b/xs/CMakeLists.txt @@ -344,7 +344,7 @@ add_library(semver STATIC # Configure rasterizer target # ############################################################################## -find_package(PNG) +find_package(PNG QUIET) option(RASTERIZER_FORCE_BUILTIN_LIBPNG "Force the usage of builting libpng instead of the system version." OFF) @@ -359,6 +359,7 @@ if(PNG_FOUND AND NOT RASTERIZER_FORCE_BUILTIN_LIBPNG) target_include_directories(rasterizer PRIVATE ${PNG_INCLUDE_DIRS}) target_compile_definitions(rasterizer PRIVATE ${PNG_DEFINITIONS}) else() + set(ZLIB_LIBRARY "") message(WARNING "Using builtin libpng. This can cause crashes on some platforms.") add_subdirectory( ${LIBDIR}/png/zlib) diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp index d2c4401d2..dd5ad9059 100644 --- a/xs/src/libslic3r/Print.cpp +++ b/xs/src/libslic3r/Print.cpp @@ -1377,7 +1377,7 @@ public: inline void save(const std::string& path) { - wxFFileOutputStream zipfile(path + "zippedout.zip"); + wxFFileOutputStream zipfile(path); if(!zipfile.IsOk()) { BOOST_LOG_TRIVIAL(error) << "Can't create zip file for layers!"; @@ -1429,13 +1429,7 @@ void Print::print_to(std::string dirpath, Args...args) { - std::string dir = dirpath; - -#ifdef WIN32 // Making dirpath end with a directory separator on all platforms - if(dir.back() != '\\') dir.push_back('\\'); -#else - if(dir.back() != '/') dir.push_back('/'); -#endif + std::string& dir = dirpath; LayerPtrs layers; @@ -1499,12 +1493,15 @@ void Print::print_to(std::string dirpath, }); if(has_support_material() && layer_id > 0) { - std::cout << "support layer " << layer_id << "\n"; +// BOOST_LOG_TRIVIAL(warning) << "support material for layer " +// << layer_id << " defined but export is " +// "unimplemented."; + } printer.finishLayer(layer_id); // Finish the layer for later saving it. - std::cout << "Layer " << layer_id << " processed." << "\n"; + // std::cout << "Layer " << layer_id << " processed." << "\n"; // printer.saveLayer(layer_id, dir); We could save the layer immediately };