Execution abstraction and build fix for linux and mac
This commit is contained in:
parent
d337b69407
commit
8497289650
4 changed files with 26 additions and 2 deletions
|
@ -175,7 +175,7 @@ public:
|
|||
|
||||
wxFFileOutputStream zipfile(path);
|
||||
|
||||
std::string project = filepath.GetName();
|
||||
std::string project = filepath.GetName().ToStdString();
|
||||
|
||||
if(!zipfile.IsOk()) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Can't create zip file for layers! "
|
||||
|
|
|
@ -318,7 +318,9 @@ void PrintController::slice_to_png()
|
|||
report_issue(IssueType::WARN, ss.str(), "Warning");
|
||||
}
|
||||
|
||||
std::async(std::launch::async, [this, exd]() {
|
||||
std::async(supports_asynch()? std::launch::async : std::launch::deferred,
|
||||
[this, exd]()
|
||||
{
|
||||
progress_indicator(100, "Slicing to zipped png files...");
|
||||
progress_indicator()->procedure_count(3);
|
||||
|
||||
|
|
|
@ -131,6 +131,22 @@ public:
|
|||
*/
|
||||
bool is_main_thread() const;
|
||||
|
||||
/**
|
||||
* @brief The frontend supports asynch execution.
|
||||
*
|
||||
* A Graphic UI will support this, a CLI may not. This can be used in
|
||||
* subclass methods to decide whether to start threads for block free UI.
|
||||
*
|
||||
* Note that even a progress indicator's update called regularly can solve
|
||||
* the blocking UI problem in some cases even when an event loop is present.
|
||||
* This is how wxWidgets gauge work but creating a separate thread will make
|
||||
* the UI even more fluent.
|
||||
*
|
||||
* @return true if a job or method can be executed asynchronously, false
|
||||
* otherwise.
|
||||
*/
|
||||
bool supports_asynch() const;
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "AppController.hpp"
|
||||
|
||||
#include <thread>
|
||||
#include <future>
|
||||
|
||||
#include <slic3r/GUI/GUI.hpp>
|
||||
#include <slic3r/GUI/PngExportDialog.hpp>
|
||||
|
@ -20,6 +21,11 @@
|
|||
|
||||
namespace Slic3r {
|
||||
|
||||
bool AppControllerBoilerplate::supports_asynch() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
AppControllerBoilerplate::PathList
|
||||
AppControllerBoilerplate::query_destination_paths(
|
||||
const std::string &title,
|
||||
|
|
Loading…
Reference in a new issue