Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2020-03-12 14:43:01 +0300
committerbubnikv <bubnikv@gmail.com>2020-03-12 14:43:09 +0300
commite2274bfc8372577a62e309218c2a2fe6457da0c2 (patch)
tree0e2060c1bad8503cd1e9c5ed1408f6691d312bf5 /src/slic3r/GUI
parentb9415607369d7a69772e197ac099c0ff2e8a41d5 (diff)
Saving one enumeration of external drives when deciding whether
to verify the file saved or not.
Diffstat (limited to 'src/slic3r/GUI')
-rw-r--r--src/slic3r/GUI/BackgroundSlicingProcess.cpp7
-rw-r--r--src/slic3r/GUI/BackgroundSlicingProcess.hpp5
-rw-r--r--src/slic3r/GUI/Plater.cpp10
3 files changed, 12 insertions, 10 deletions
diff --git a/src/slic3r/GUI/BackgroundSlicingProcess.cpp b/src/slic3r/GUI/BackgroundSlicingProcess.cpp
index 44b5a8bb8..35a55d767 100644
--- a/src/slic3r/GUI/BackgroundSlicingProcess.cpp
+++ b/src/slic3r/GUI/BackgroundSlicingProcess.cpp
@@ -101,8 +101,7 @@ void BackgroundSlicingProcess::process_fff()
//FIXME localize the messages
// Perform the final post-processing of the export path by applying the print statistics over the file name.
std::string export_path = m_fff_print->print_statistics().finalize_output_path(m_export_path);
- bool with_check = GUI::wxGetApp().removable_drive_manager()->is_path_on_removable_drive(export_path);
- int copy_ret_val = copy_file(m_temp_output_path, export_path, with_check);
+ int copy_ret_val = copy_file(m_temp_output_path, export_path, m_export_path_on_removable_media);
switch (copy_ret_val) {
case SUCCESS: break; // no error
case FAIL_COPY_FILE:
@@ -402,7 +401,7 @@ void BackgroundSlicingProcess::set_task(const PrintBase::TaskParams &params)
}
// Set the output path of the G-code.
-void BackgroundSlicingProcess::schedule_export(const std::string &path)
+void BackgroundSlicingProcess::schedule_export(const std::string &path, bool export_path_on_removable_media)
{
assert(m_export_path.empty());
if (! m_export_path.empty())
@@ -412,6 +411,7 @@ void BackgroundSlicingProcess::schedule_export(const std::string &path)
tbb::mutex::scoped_lock lock(m_print->state_mutex());
this->invalidate_step(bspsGCodeFinalize);
m_export_path = path;
+ m_export_path_on_removable_media = export_path_on_removable_media;
}
void BackgroundSlicingProcess::schedule_upload(Slic3r::PrintHostJob upload_job)
@@ -432,6 +432,7 @@ void BackgroundSlicingProcess::reset_export()
assert(! this->running());
if (! this->running()) {
m_export_path.clear();
+ m_export_path_on_removable_media = false;
// invalidate_step expects the mutex to be locked.
tbb::mutex::scoped_lock lock(m_print->state_mutex());
this->invalidate_step(bspsGCodeFinalize);
diff --git a/src/slic3r/GUI/BackgroundSlicingProcess.hpp b/src/slic3r/GUI/BackgroundSlicingProcess.hpp
index c8ece38f0..d091ecb31 100644
--- a/src/slic3r/GUI/BackgroundSlicingProcess.hpp
+++ b/src/slic3r/GUI/BackgroundSlicingProcess.hpp
@@ -98,7 +98,7 @@ public:
// Set the export path of the G-code.
// Once the path is set, the G-code
- void schedule_export(const std::string &path);
+ void schedule_export(const std::string &path, bool export_path_on_removable_media);
// Set print host upload job data to be enqueued to the PrintHostJobQueue
// after current print slicing is complete
void schedule_upload(Slic3r::PrintHostJob upload_job);
@@ -157,13 +157,14 @@ private:
GCodePreviewData *m_gcode_preview_data = nullptr;
#if ENABLE_THUMBNAIL_GENERATOR
// Callback function, used to write thumbnails into gcode.
- ThumbnailsGeneratorCallback m_thumbnail_cb = nullptr;
+ ThumbnailsGeneratorCallback m_thumbnail_cb = nullptr;
#endif // ENABLE_THUMBNAIL_GENERATOR
// Temporary G-code, there is one defined for the BackgroundSlicingProcess, differentiated from the other processes by a process ID.
std::string m_temp_output_path;
// Output path provided by the user. The output path may be set even if the slicing is running,
// but once set, it cannot be re-set.
std::string m_export_path;
+ bool m_export_path_on_removable_media = false;
// Print host upload job to schedule after slicing is complete, used by schedule_upload(),
// empty by default (ie. no upload to schedule)
PrintHostJob m_upload_job;
diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp
index 224eb42fd..3d17c1fab 100644
--- a/src/slic3r/GUI/Plater.cpp
+++ b/src/slic3r/GUI/Plater.cpp
@@ -1929,7 +1929,7 @@ struct Plater::priv
GUI::show_error(this->q, msg);
}
}
- void export_gcode(fs::path output_path, PrintHostJob upload_job);
+ void export_gcode(fs::path output_path, bool output_path_on_removable_media, PrintHostJob upload_job);
void reload_from_disk();
void reload_all_from_disk();
void fix_through_netfabb(const int obj_idx, const int vol_idx = -1);
@@ -3216,7 +3216,7 @@ bool Plater::priv::restart_background_process(unsigned int state)
return false;
}
-void Plater::priv::export_gcode(fs::path output_path, PrintHostJob upload_job)
+void Plater::priv::export_gcode(fs::path output_path, bool output_path_on_removable_media, PrintHostJob upload_job)
{
wxCHECK_RET(!(output_path.empty() && upload_job.empty()), "export_gcode: output_path and upload_job empty");
@@ -3237,7 +3237,7 @@ void Plater::priv::export_gcode(fs::path output_path, PrintHostJob upload_job)
return;
if (! output_path.empty()) {
- background_process.schedule_export(output_path.string());
+ background_process.schedule_export(output_path.string(), output_path_on_removable_media);
} else {
background_process.schedule_upload(std::move(upload_job));
}
@@ -4901,8 +4901,8 @@ void Plater::export_gcode(bool prefer_removable)
}
if (! output_path.empty()) {
- p->export_gcode(output_path, PrintHostJob());
bool path_on_removable_media = removable_drive_manager.set_and_verify_last_save_path(output_path.string());
+ p->export_gcode(output_path, path_on_removable_media, PrintHostJob());
// Storing a path to AppConfig either as path to removable media or a path to internal media.
// is_path_on_removable_drive() is called with the "true" parameter to update its internal database as the user may have shuffled the external drives
// while the dialog was open.
@@ -5225,7 +5225,7 @@ void Plater::send_gcode()
upload_job.upload_data.upload_path = dlg.filename();
upload_job.upload_data.start_print = dlg.start_print();
- p->export_gcode(fs::path(), std::move(upload_job));
+ p->export_gcode(fs::path(), false, std::move(upload_job));
}
}