Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::SlicingProcessCompletedEvent Class Reference

#include <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, bool > format_error_message () const
 

Private Attributes

StatusType m_status
 
std::exception_ptr m_exception
 

Detailed Description

Member Enumeration Documentation

◆ StatusType

Enumerator
Finished 
Cancelled 
Error 
39 {
42 Error
43 };
@ Cancelled
Definition BackgroundSlicingProcess.hpp:41
@ Finished
Definition BackgroundSlicingProcess.hpp:40
@ Error
Definition BackgroundSlicingProcess.hpp:42

Constructor & Destructor Documentation

◆ SlicingProcessCompletedEvent()

Slic3r::SlicingProcessCompletedEvent::SlicingProcessCompletedEvent ( wxEventType  eventType,
int  winid,
StatusType  status,
std::exception_ptr  exception 
)
inline
45 :
46 wxEvent(winid, eventType), m_status(status), m_exception(exception) {}
std::exception_ptr m_exception
Definition BackgroundSlicingProcess.hpp:66
StatusType m_status
Definition BackgroundSlicingProcess.hpp:65
StatusType status() const
Definition BackgroundSlicingProcess.hpp:49

Member Function Documentation

◆ cancelled()

bool Slic3r::SlicingProcessCompletedEvent::cancelled ( ) const
inline
52{ 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
47{ return new SlicingProcessCompletedEvent(*this); }
SlicingProcessCompletedEvent(wxEventType eventType, int winid, StatusType status, std::exception_ptr exception)
Definition BackgroundSlicingProcess.hpp:45

Referenced by Slic3r::BackgroundSlicingProcess::thread_proc().

+ Here is the caller graph for this function:

◆ critical_error()

bool Slic3r::SlicingProcessCompletedEvent::critical_error ( ) const
43{
44 try {
45 this->rethrow_exception();
46 } catch (const Slic3r::SlicingError &) {
47 // Exception derived from SlicingError is non-critical.
48 return false;
49 } catch (...) {
50 }
51 return true;
52}
void rethrow_exception() const
Definition BackgroundSlicingProcess.hpp:59

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
53{ 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
50{ return m_status == Finished; }

References Finished, and m_status.

◆ format_error_message()

std::pair< std::string, bool > Slic3r::SlicingProcessCompletedEvent::format_error_message ( ) const
73{
74 std::string error;
75 bool monospace = false;
76 try {
77 this->rethrow_exception();
78 } catch (const std::bad_alloc &ex) {
79 error = GUI::format(_L("%s has encountered an error. It was likely caused by running out of memory. "
80 "If you are sure you have enough RAM on your system, this may also be a bug and we would "
81 "be glad if you reported it."), SLIC3R_APP_NAME);
82 error += "\n\n" + std::string(ex.what());
83 } catch (const HardCrash &ex) {
84 error = GUI::format(_L("PrusaSlicer has encountered a fatal error: \"%1%\""), ex.what()) + "\n\n" +
85 _u8L("Please save your project and restart PrusaSlicer. "
86 "We would be glad if you reported the issue.");
87 } catch (PlaceholderParserError &ex) {
88 error = ex.what();
89 monospace = true;
90 } catch (std::exception &ex) {
91 error = ex.what();
92 } catch (...) {
93 error = "Unknown C++ exception.";
94 }
95 return std::make_pair(std::move(error), monospace);
96}
#define _u8L(s)
macro used to mark string used at localization, return same string
Definition SLAPrint.cpp:29
bool error() const
Definition BackgroundSlicingProcess.hpp:53
std::string format(const char *fmt, TArgs &&... args)
Definition format.hpp:56
#define _L(s)
Definition I18N.hpp:3

References _L, _u8L, error(), Slic3r::GUI::format(), 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
55{
56 if (critical_error())
57 {
58 try {
59 this->rethrow_exception();
60 }
61 catch (const Slic3r::ExportError&) {
62 // Exception thrown by copying file does not ivalidate plater
63 return false;
64 }
65 catch (...) {
66 }
67 return true;
68 }
69 return false;
70}
bool critical_error() const
Definition BackgroundSlicingProcess.cpp:42

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
59{ 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
49{ return m_status; }

References m_status.

◆ success()

bool Slic3r::SlicingProcessCompletedEvent::success ( ) const
inline
51{ 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

Referenced by rethrow_exception().

◆ m_status

StatusType Slic3r::SlicingProcessCompletedEvent::m_status
private

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