OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::SlicingProcessCompletedEvent Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/BackgroundSlicingProcess.hpp>

Inheritance diagram for Slic3r::SlicingProcessCompletedEvent:
Collaboration diagram for Slic3r::SlicingProcessCompletedEvent:

Public Types

enum  StatusType { Finished , Cancelled , Error }

Public Member Functions

 SlicingProcessCompletedEvent (wxEventType eventType, int winid, StatusType status, std::exception_ptr exception)
virtual wxEvent * Clone () const
StatusType status () const
bool finished () const
bool success () const
bool cancelled () const
bool error () const
bool critical_error () const
bool invalidate_plater () const
void rethrow_exception () const
std::pair< std::string, std::vector< size_t > > format_error_message () const

Private Attributes

StatusType m_status
std::exception_ptr m_exception

Detailed Description

Member Enumeration Documentation

◆ StatusType

Enumerator
Finished 
Cancelled 
Error 
53 {
56 Error
57 };
@ Cancelled
Definition BackgroundSlicingProcess.hpp:55
@ Finished
Definition BackgroundSlicingProcess.hpp:54
@ Error
Definition BackgroundSlicingProcess.hpp:56

Constructor & Destructor Documentation

◆ SlicingProcessCompletedEvent()

Slic3r::SlicingProcessCompletedEvent::SlicingProcessCompletedEvent ( wxEventType eventType,
int winid,
StatusType status,
std::exception_ptr exception )
inline
59 :
60 wxEvent(winid, eventType), m_status(status), m_exception(exception) {}
std::exception_ptr m_exception
Definition BackgroundSlicingProcess.hpp:80
StatusType m_status
Definition BackgroundSlicingProcess.hpp:79
StatusType status() const
Definition BackgroundSlicingProcess.hpp:63

References m_exception, m_status, and status().

Referenced by Clone().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ cancelled()

bool Slic3r::SlicingProcessCompletedEvent::cancelled ( ) const
inline
66{ return m_status == Cancelled; }

References Cancelled, and m_status.

Referenced by Slic3r::GUI::Plater::priv::on_process_completed().

Here is the caller graph for this function:

◆ Clone()

virtual wxEvent * Slic3r::SlicingProcessCompletedEvent::Clone ( ) const
inlinevirtual
61{ return new SlicingProcessCompletedEvent(*this); }
SlicingProcessCompletedEvent(wxEventType eventType, int winid, StatusType status, std::exception_ptr exception)
Definition BackgroundSlicingProcess.hpp:59

References SlicingProcessCompletedEvent().

Referenced by Slic3r::GUI::Plater::reslice(), Slic3r::GUI::Plater::start_next_slice(), Slic3r::BackgroundSlicingProcess::thread_proc(), and Slic3r::GUI::Plater::priv::update_background_process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ critical_error()

bool Slic3r::SlicingProcessCompletedEvent::critical_error ( ) const
72{
73 try {
74 this->rethrow_exception();
75 } catch (const Slic3r::SlicingError&) {
76 // Exception derived from SlicingError is non-critical.
77 return false;
78 } catch (const Slic3r::SlicingErrors&) {
79 return false;
80 } catch (...) {}
81 return true;
82}
void rethrow_exception() const
Definition BackgroundSlicingProcess.hpp:73

References rethrow_exception().

Referenced by invalidate_plater(), and Slic3r::GUI::Plater::priv::on_process_completed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ error()

bool Slic3r::SlicingProcessCompletedEvent::error ( ) const
inline
67{ return m_status == Error; }

References Error, and m_status.

Referenced by format_error_message(), Slic3r::GUI::Plater::priv::on_process_completed(), and rethrow_exception().

Here is the caller graph for this function:

◆ finished()

bool Slic3r::SlicingProcessCompletedEvent::finished ( ) const
inline
64{ return m_status == Finished; }

References Finished, and m_status.

◆ format_error_message()

std::pair< std::string, std::vector< size_t > > Slic3r::SlicingProcessCompletedEvent::format_error_message ( ) const
99{
100 std::string error;
101 size_t monospace = 0;
102 try {
103 this->rethrow_exception();
104 } catch (const std::bad_alloc& ex) {
105 wxString errmsg = GUI::from_u8(boost::format(_utf8(L("An error occurred. The system may have run out of memory, or a bug may have occurred."))).str());
106 error = std::string(errmsg.ToUTF8()) + "\n" + std::string(ex.what());
107 } catch (const HardCrash& ex) {
108 error = GUI::format(_u8L("A fatal error occurred: \"%1%\""), ex.what()) + "\n" +
109 _u8L("Please save your project and restart the application.");
110 } catch (PlaceholderParserError& ex) {
111 error = ex.what();
112 monospace = 1;
113 } catch (SlicingError& ex) {
114 error = ex.what();
115 monospace = ex.objectId();
116 } catch (SlicingErrors& exs) {
117 std::vector<size_t> ids;
118 for (auto& ex : exs.errors_) {
119 error = ex.what();
120 monospace = ex.objectId();
121 ids.push_back(monospace);
122 }
123 return std::make_pair(std::move(error), ids);
124 } catch (std::exception& ex) {
125 error = ex.what();
126 } catch (...) {
127 error = _u8L("Unknown C++ exception.");
128 }
129 return std::make_pair(std::move(error), std::vector<size_t>{monospace});
130}
#define L(s)
Definition ExtrusionEntity.cpp:25
bool error() const
Definition BackgroundSlicingProcess.hpp:67
std::string format(const char *fmt, TArgs &&... args)
Definition format.hpp:36
wxString from_u8(const std::string &str)
Definition GUI.cpp:544
#define _utf8(s)
Definition I18N.hpp:10
#define _u8L(s)
Definition I18N.hpp:11

References _u8L, _utf8, error(), Slic3r::SlicingErrors::errors_, Slic3r::GUI::format(), Slic3r::GUI::from_u8(), L, and rethrow_exception().

Referenced by Slic3r::GUI::Plater::priv::on_process_completed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ invalidate_plater()

bool Slic3r::SlicingProcessCompletedEvent::invalidate_plater ( ) const
85{
86 if (critical_error()) {
87 try {
88 this->rethrow_exception();
89 } catch (const Slic3r::ExportError&) {
90 // Exception thrown by copying file does not ivalidate plater
91 return false;
92 } catch (...) {}
93 return true;
94 }
95 return false;
96}
bool critical_error() const
Definition BackgroundSlicingProcess.cpp:71

References critical_error(), and rethrow_exception().

Referenced by Slic3r::GUI::Plater::priv::on_process_completed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rethrow_exception()

void Slic3r::SlicingProcessCompletedEvent::rethrow_exception ( ) const
inline
73{ assert(this->error()); assert(m_exception); std::rethrow_exception(m_exception); }

References error(), and m_exception.

Referenced by critical_error(), format_error_message(), and invalidate_plater().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ status()

StatusType Slic3r::SlicingProcessCompletedEvent::status ( ) const
inline
63{ return m_status; }

References m_status.

Referenced by SlicingProcessCompletedEvent(), Slic3r::GUI::Plater::priv::on_process_completed(), Slic3r::BackgroundSlicingProcess::thread_proc(), and Slic3r::GUI::Plater::priv::update_background_process().

Here is the caller graph for this function:

◆ success()

bool Slic3r::SlicingProcessCompletedEvent::success ( ) const
inline
65{ return m_status == Finished; }

References Finished, and m_status.

Referenced by Slic3r::GUI::Plater::priv::on_process_completed().

Here is the caller graph for this function:

Member Data Documentation

◆ m_exception

std::exception_ptr Slic3r::SlicingProcessCompletedEvent::m_exception
private

◆ m_status

StatusType Slic3r::SlicingProcessCompletedEvent::m_status
private

The documentation for this class was generated from the following files: