This commit is contained in:
enricoturri1966 2020-12-03 13:49:20 +01:00
commit 639ef33aab
18 changed files with 1521 additions and 1403 deletions

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,8 @@ SLIC3R_DERIVE_EXCEPTION(OutOfRange, LogicError);
SLIC3R_DERIVE_EXCEPTION(IOError, CriticalException); SLIC3R_DERIVE_EXCEPTION(IOError, CriticalException);
SLIC3R_DERIVE_EXCEPTION(FileIOError, IOError); SLIC3R_DERIVE_EXCEPTION(FileIOError, IOError);
SLIC3R_DERIVE_EXCEPTION(HostNetworkError, IOError); SLIC3R_DERIVE_EXCEPTION(HostNetworkError, IOError);
SLIC3R_DERIVE_EXCEPTION(ExportError, CriticalException); SLIC3R_DERIVE_EXCEPTION(ExportError, CriticalException);
SLIC3R_DERIVE_EXCEPTION(PlaceholderParserError, RuntimeError);
// Runtime exception produced by Slicer. Such exception cancels the slicing process and it shall be shown in notifications. // Runtime exception produced by Slicer. Such exception cancels the slicing process and it shall be shown in notifications.
SLIC3R_DERIVE_EXCEPTION(SlicingError, Exception); SLIC3R_DERIVE_EXCEPTION(SlicingError, Exception);
#undef SLIC3R_DERIVE_EXCEPTION #undef SLIC3R_DERIVE_EXCEPTION

View File

@ -748,15 +748,17 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessor::Result* re
if (! m_placeholder_parser_failed_templates.empty()) { if (! m_placeholder_parser_failed_templates.empty()) {
// G-code export proceeded, but some of the PlaceholderParser substitutions failed. // G-code export proceeded, but some of the PlaceholderParser substitutions failed.
//FIXME localize!
std::string msg = std::string("G-code export to ") + path + " failed due to invalid custom G-code sections:\n\n"; std::string msg = std::string("G-code export to ") + path + " failed due to invalid custom G-code sections:\n\n";
for (const std::string &name : m_placeholder_parser_failed_templates) for (const auto &name_and_error : m_placeholder_parser_failed_templates)
msg += std::string("\t") + name + "\n"; msg += name_and_error.first + "\n" + name_and_error.second + "\n";
msg += "\nPlease inspect the file "; msg += "\nPlease inspect the file ";
msg += path_tmp + " for error messages enclosed between\n"; msg += path_tmp + " for error messages enclosed between\n";
msg += " !!!!! Failed to process the custom G-code template ...\n"; msg += " !!!!! Failed to process the custom G-code template ...\n";
msg += "and\n"; msg += "and\n";
msg += " !!!!! End of an error report for the custom G-code template ...\n"; msg += " !!!!! End of an error report for the custom G-code template ...\n";
throw Slic3r::RuntimeError(msg); msg += "for all macro processing errors.";
throw Slic3r::PlaceholderParserError(msg);
} }
BOOST_LOG_TRIVIAL(debug) << "Start processing gcode, " << log_memory_info(); BOOST_LOG_TRIVIAL(debug) << "Start processing gcode, " << log_memory_info();
@ -1434,7 +1436,11 @@ std::string GCode::placeholder_parser_process(const std::string &name, const std
return m_placeholder_parser.process(templ, current_extruder_id, config_override); return m_placeholder_parser.process(templ, current_extruder_id, config_override);
} catch (std::runtime_error &err) { } catch (std::runtime_error &err) {
// Collect the names of failed template substitutions for error reporting. // Collect the names of failed template substitutions for error reporting.
m_placeholder_parser_failed_templates.insert(name); auto it = m_placeholder_parser_failed_templates.find(name);
if (it == m_placeholder_parser_failed_templates.end())
// Only if there was no error reported for this template, store the first error message into the map to be reported.
// We don't want to collect error message for each and every occurence of a single custom G-code section.
m_placeholder_parser_failed_templates.insert(it, std::make_pair(name, std::string(err.what())));
// Insert the macro error message into the G-code. // Insert the macro error message into the G-code.
return return
std::string("\n!!!!! Failed to process the custom G-code template ") + name + "\n" + std::string("\n!!!!! Failed to process the custom G-code template ") + name + "\n" +

View File

@ -19,6 +19,7 @@
#include "GCode/ThumbnailData.hpp" #include "GCode/ThumbnailData.hpp"
#include <memory> #include <memory>
#include <map>
#include <string> #include <string>
#ifdef HAS_PRESSURE_EQUALIZER #ifdef HAS_PRESSURE_EQUALIZER
@ -323,7 +324,7 @@ private:
GCodeWriter m_writer; GCodeWriter m_writer;
PlaceholderParser m_placeholder_parser; PlaceholderParser m_placeholder_parser;
// Collection of templates, on which the placeholder substitution failed. // Collection of templates, on which the placeholder substitution failed.
std::set<std::string> m_placeholder_parser_failed_templates; std::map<std::string, std::string> m_placeholder_parser_failed_templates;
OozePrevention m_ooze_prevention; OozePrevention m_ooze_prevention;
Wipe m_wipe; Wipe m_wipe;
AvoidCrossingPerimeters m_avoid_crossing_perimeters; AvoidCrossingPerimeters m_avoid_crossing_perimeters;

View File

@ -6,6 +6,7 @@
#include <iomanip> #include <iomanip>
#include <sstream> #include <sstream>
#include <map> #include <map>
#include <boost/nowide/convert.hpp>
#ifdef _MSC_VER #ifdef _MSC_VER
#include <stdlib.h> // provides **_environ #include <stdlib.h> // provides **_environ
#else #else
@ -870,7 +871,9 @@ namespace client
} }
} }
msg += '\n'; msg += '\n';
msg += error_line; // This hack removes all non-UTF8 characters from the source line, so that the upstream wxWidgets conversions
// from UTF8 to UTF16 don't bail out.
msg += boost::nowide::narrow(boost::nowide::widen(error_line));
msg += '\n'; msg += '\n';
for (size_t i = 0; i < error_pos; ++ i) for (size_t i = 0; i < error_pos; ++ i)
msg += ' '; msg += ' ';
@ -1304,7 +1307,7 @@ static std::string process_macro(const std::string &templ, client::MyContext &co
if (!context.error_message.empty()) { if (!context.error_message.empty()) {
if (context.error_message.back() != '\n' && context.error_message.back() != '\r') if (context.error_message.back() != '\n' && context.error_message.back() != '\r')
context.error_message += '\n'; context.error_message += '\n';
throw Slic3r::RuntimeError(context.error_message); throw Slic3r::PlaceholderParserError(context.error_message);
} }
return output; return output;
} }

View File

@ -40,11 +40,11 @@ public:
const DynamicConfig* external_config() const { return m_external_config; } const DynamicConfig* external_config() const { return m_external_config; }
// Fill in the template using a macro processing language. // Fill in the template using a macro processing language.
// Throws Slic3r::RuntimeError on syntax or runtime error. // Throws Slic3r::PlaceholderParserError on syntax or runtime error.
std::string process(const std::string &templ, unsigned int current_extruder_id = 0, const DynamicConfig *config_override = nullptr) const; std::string process(const std::string &templ, unsigned int current_extruder_id = 0, const DynamicConfig *config_override = nullptr) const;
// Evaluate a boolean expression using the full expressive power of the PlaceholderParser boolean expression syntax. // Evaluate a boolean expression using the full expressive power of the PlaceholderParser boolean expression syntax.
// Throws Slic3r::RuntimeError on syntax or runtime error. // Throws Slic3r::PlaceholderParserError on syntax or runtime error.
static bool evaluate_boolean_expression(const std::string &templ, const DynamicConfig &config, const DynamicConfig *config_override = nullptr); static bool evaluate_boolean_expression(const std::string &templ, const DynamicConfig &config, const DynamicConfig *config_override = nullptr);
// Update timestamp, year, month, day, hour, minute, second variables at the provided config. // Update timestamp, year, month, day, hour, minute, second variables at the provided config.

View File

@ -69,7 +69,7 @@ std::string PrintBase::output_filename(const std::string &format, const std::str
filename = boost::filesystem::change_extension(filename, default_ext); filename = boost::filesystem::change_extension(filename, default_ext);
return filename.string(); return filename.string();
} catch (std::runtime_error &err) { } catch (std::runtime_error &err) {
throw Slic3r::RuntimeError(L("Failed processing of the output_filename_format template.") + "\n" + err.what()); throw Slic3r::PlaceholderParserError(L("Failed processing of the output_filename_format template.") + "\n" + err.what());
} }
} }

View File

@ -68,9 +68,10 @@ bool SlicingProcessCompletedEvent::invalidate_plater() const
return false; return false;
} }
std::string SlicingProcessCompletedEvent::format_error_message() const std::pair<std::string, bool> SlicingProcessCompletedEvent::format_error_message() const
{ {
std::string error; std::string error;
bool monospace = false;
try { try {
this->rethrow_exception(); this->rethrow_exception();
} catch (const std::bad_alloc& ex) { } catch (const std::bad_alloc& ex) {
@ -78,12 +79,15 @@ std::string SlicingProcessCompletedEvent::format_error_message() const
"If you are sure you have enough RAM on your system, this may also be a bug and we would " "If you are sure you have enough RAM on your system, this may also be a bug and we would "
"be glad if you reported it."))) % SLIC3R_APP_NAME).str()); "be glad if you reported it."))) % SLIC3R_APP_NAME).str());
error = std::string(errmsg.ToUTF8()) + "\n\n" + std::string(ex.what()); error = std::string(errmsg.ToUTF8()) + "\n\n" + std::string(ex.what());
} catch (PlaceholderParserError &ex) {
error = ex.what();
monospace = true;
} catch (std::exception &ex) { } catch (std::exception &ex) {
error = ex.what(); error = ex.what();
} catch (...) { } catch (...) {
error = "Unknown C++ exception."; error = "Unknown C++ exception.";
} }
return error; return std::make_pair(std::move(error), monospace);
} }
BackgroundSlicingProcess::BackgroundSlicingProcess() BackgroundSlicingProcess::BackgroundSlicingProcess()

View File

@ -57,7 +57,8 @@ public:
// Only valid if error() // Only valid if error()
void rethrow_exception() const { assert(this->error()); assert(m_exception); std::rethrow_exception(m_exception); } void rethrow_exception() const { assert(this->error()); assert(m_exception); std::rethrow_exception(m_exception); }
// Produce a human readable message to be displayed by a notification or a message box. // Produce a human readable message to be displayed by a notification or a message box.
std::string format_error_message() const; // 2nd parameter defines whether the output should be displayed with a monospace font.
std::pair<std::string, bool> format_error_message() const;
private: private:
StatusType m_status; StatusType m_status;

View File

@ -221,16 +221,16 @@ void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt
} }
} }
void show_error(wxWindow* parent, const wxString& message) void show_error(wxWindow* parent, const wxString& message, bool monospaced_font)
{ {
ErrorDialog msg(parent, message); ErrorDialog msg(parent, message, monospaced_font);
msg.ShowModal(); msg.ShowModal();
} }
void show_error(wxWindow* parent, const char* message) void show_error(wxWindow* parent, const char* message, bool monospaced_font)
{ {
assert(message); assert(message);
show_error(parent, wxString::FromUTF8(message)); show_error(parent, wxString::FromUTF8(message), monospaced_font);
} }
void show_error_id(int id, const std::string& message) void show_error_id(int id, const std::string& message)

View File

@ -39,9 +39,11 @@ extern void add_menus(wxMenuBar *menu, int event_preferences_changed, int event_
// Change option value in config // Change option value in config
void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt_key, const boost::any& value, int opt_index = 0); void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt_key, const boost::any& value, int opt_index = 0);
void show_error(wxWindow* parent, const wxString& message); // If monospaced_font is true, the error message is displayed using html <code><pre></pre></code> tags,
void show_error(wxWindow* parent, const char* message); // so that the code formatting will be preserved. This is useful for reporting errors from the placeholder parser.
inline void show_error(wxWindow* parent, const std::string& message) { show_error(parent, message.c_str()); } void show_error(wxWindow* parent, const wxString& message, bool monospaced_font = false);
void show_error(wxWindow* parent, const char* message, bool monospaced_font = false);
inline void show_error(wxWindow* parent, const std::string& message, bool monospaced_font = false) { show_error(parent, message.c_str(), monospaced_font); }
void show_error_id(int id, const std::string& message); // For Perl void show_error_id(int id, const std::string& message); // For Perl
void show_info(wxWindow* parent, const wxString& message, const wxString& title = wxString()); void show_info(wxWindow* parent, const wxString& message, const wxString& title = wxString());
void show_info(wxWindow* parent, const char* message, const char* title = nullptr); void show_info(wxWindow* parent, const char* message, const char* title = nullptr);

View File

@ -1710,11 +1710,12 @@ bool GUI_App::checked_tab(Tab* tab)
} }
// Update UI / Tabs to reflect changes in the currently loaded presets // Update UI / Tabs to reflect changes in the currently loaded presets
void GUI_App::load_current_presets() void GUI_App::load_current_presets(bool check_printer_presets_ /*= true*/)
{ {
// check printer_presets for the containing information about "Print Host upload" // check printer_presets for the containing information about "Print Host upload"
// and create physical printer from it, if any exists // and create physical printer from it, if any exists
check_printer_presets(); if (check_printer_presets_)
check_printer_presets();
PrinterTechnology printer_technology = preset_bundle->printers.get_edited_preset().printer_technology(); PrinterTechnology printer_technology = preset_bundle->printers.get_edited_preset().printer_technology();
this->plater()->set_printer_technology(printer_technology); this->plater()->set_printer_technology(printer_technology);

View File

@ -206,7 +206,7 @@ public:
void add_config_menu(wxMenuBar *menu); void add_config_menu(wxMenuBar *menu);
bool check_unsaved_changes(const wxString &header = wxString()); bool check_unsaved_changes(const wxString &header = wxString());
bool checked_tab(Tab* tab); bool checked_tab(Tab* tab);
void load_current_presets(); void load_current_presets(bool check_printer_presets = true);
wxString current_language_code() const { return m_wxLocale->GetCanonicalName(); } wxString current_language_code() const { return m_wxLocale->GetCanonicalName(); }
// Translate the language code to a code, for which Prusa Research maintains translations. Defaults to "en_US". // Translate the language code to a code, for which Prusa Research maintains translations. Defaults to "en_US".

View File

@ -1007,7 +1007,7 @@ ManipulationEditor::ManipulationEditor(ObjectManipulation* parent,
const std::string& opt_key, const std::string& opt_key,
int axis) : int axis) :
wxTextCtrl(parent->parent(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxTextCtrl(parent->parent(), wxID_ANY, wxEmptyString, wxDefaultPosition,
wxSize(5*int(wxGetApp().em_unit()), wxDefaultCoord), wxTE_PROCESS_ENTER), wxSize((wxOSX ? 5 : 6)*int(wxGetApp().em_unit()), wxDefaultCoord), wxTE_PROCESS_ENTER),
m_opt_key(opt_key), m_opt_key(opt_key),
m_axis(axis) m_axis(axis)
{ {

View File

@ -64,12 +64,9 @@ MsgDialog::MsgDialog(wxWindow *parent, const wxString &title, const wxString &he
SetSizerAndFit(topsizer); SetSizerAndFit(topsizer);
} }
MsgDialog::~MsgDialog() {}
// ErrorDialog // ErrorDialog
ErrorDialog::ErrorDialog(wxWindow *parent, const wxString &msg) ErrorDialog::ErrorDialog(wxWindow *parent, const wxString &msg, bool monospaced_font)
: MsgDialog(parent, wxString::Format(_(L("%s error")), SLIC3R_APP_NAME), : MsgDialog(parent, wxString::Format(_(L("%s error")), SLIC3R_APP_NAME),
wxString::Format(_(L("%s has encountered an error")), SLIC3R_APP_NAME), wxString::Format(_(L("%s has encountered an error")), SLIC3R_APP_NAME),
wxID_NONE) wxID_NONE)
@ -78,19 +75,23 @@ ErrorDialog::ErrorDialog(wxWindow *parent, const wxString &msg)
// Text shown as HTML, so that mouse selection and Ctrl-V to copy will work. // Text shown as HTML, so that mouse selection and Ctrl-V to copy will work.
wxHtmlWindow* html = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO); wxHtmlWindow* html = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO);
{ {
html->SetMinSize(wxSize(40 * wxGetApp().em_unit(), -1)); html->SetMinSize(wxSize(40 * wxGetApp().em_unit(), monospaced_font ? 30 * wxGetApp().em_unit() : -1));
wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
wxFont monospace = wxSystemSettings::GetFont(wxSYS_ANSI_FIXED_FONT);
wxColour text_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); wxColour text_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
wxColour bgr_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); wxColour bgr_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
auto text_clr_str = wxString::Format(wxT("#%02X%02X%02X"), text_clr.Red(), text_clr.Green(), text_clr.Blue()); auto text_clr_str = wxString::Format(wxT("#%02X%02X%02X"), text_clr.Red(), text_clr.Green(), text_clr.Blue());
auto bgr_clr_str = wxString::Format(wxT("#%02X%02X%02X"), bgr_clr.Red(), bgr_clr.Green(), bgr_clr.Blue()); auto bgr_clr_str = wxString::Format(wxT("#%02X%02X%02X"), bgr_clr.Red(), bgr_clr.Green(), bgr_clr.Blue());
const int font_size = font.GetPointSize()-1; const int font_size = font.GetPointSize()-1;
int size[] = {font_size, font_size, font_size, font_size, font_size, font_size, font_size}; int size[] = {font_size, font_size, font_size, font_size, font_size, font_size, font_size};
html->SetFonts(font.GetFaceName(), font.GetFaceName(), size); html->SetFonts(font.GetFaceName(), monospace.GetFaceName(), size);
html->SetBorders(2); html->SetBorders(2);
std::string msg_escaped = xml_escape(msg.ToUTF8().data()); std::string msg_escaped = xml_escape(msg.ToUTF8().data());
boost::replace_all(msg_escaped, "\r\n", "<br>"); boost::replace_all(msg_escaped, "\r\n", "<br>");
boost::replace_all(msg_escaped, "\n", "<br>"); boost::replace_all(msg_escaped, "\n", "<br>");
if (monospaced_font)
// Code formatting will be preserved. This is useful for reporting errors from the placeholder parser.
msg_escaped = std::string("<pre><code>") + msg_escaped + "</code></pre>";
html->SetPage("<html><body bgcolor=\"" + bgr_clr_str + "\"><font color=\"" + text_clr_str + "\">" + wxString::FromUTF8(msg_escaped.data()) + "</font></body></html>"); html->SetPage("<html><body bgcolor=\"" + bgr_clr_str + "\"><font color=\"" + text_clr_str + "\">" + wxString::FromUTF8(msg_escaped.data()) + "</font></body></html>");
content_sizer->Add(html, 1, wxEXPAND); content_sizer->Add(html, 1, wxEXPAND);
} }
@ -99,15 +100,12 @@ ErrorDialog::ErrorDialog(wxWindow *parent, const wxString &msg)
btn_ok->SetFocus(); btn_ok->SetFocus();
btn_sizer->Add(btn_ok, 0, wxRIGHT, HORIZ_SPACING); btn_sizer->Add(btn_ok, 0, wxRIGHT, HORIZ_SPACING);
logo->SetBitmap(create_scaled_bitmap("PrusaSlicer_192px_grayscale.png", this, 192)); // Use a small bitmap with monospaced font, as the error text will not be wrapped.
logo->SetBitmap(create_scaled_bitmap("PrusaSlicer_192px_grayscale.png", this, monospaced_font ? 48 : 192));
SetMaxSize(wxSize(-1, CONTENT_MAX_HEIGHT*wxGetApp().em_unit())); SetMaxSize(wxSize(-1, CONTENT_MAX_HEIGHT*wxGetApp().em_unit()));
Fit(); Fit();
} }
ErrorDialog::~ErrorDialog() {}
} }
} }

View File

@ -25,7 +25,7 @@ struct MsgDialog : wxDialog
MsgDialog(const MsgDialog &) = delete; MsgDialog(const MsgDialog &) = delete;
MsgDialog &operator=(MsgDialog &&) = delete; MsgDialog &operator=(MsgDialog &&) = delete;
MsgDialog &operator=(const MsgDialog &) = delete; MsgDialog &operator=(const MsgDialog &) = delete;
virtual ~MsgDialog(); virtual ~MsgDialog() = default;
// TODO: refactor with CreateStdDialogButtonSizer usage // TODO: refactor with CreateStdDialogButtonSizer usage
@ -52,12 +52,14 @@ protected:
class ErrorDialog : public MsgDialog class ErrorDialog : public MsgDialog
{ {
public: public:
ErrorDialog(wxWindow *parent, const wxString &msg); // If monospaced_font is true, the error message is displayed using html <code><pre></pre></code> tags,
// so that the code formatting will be preserved. This is useful for reporting errors from the placeholder parser.
ErrorDialog(wxWindow *parent, const wxString &msg, bool courier_font);
ErrorDialog(ErrorDialog &&) = delete; ErrorDialog(ErrorDialog &&) = delete;
ErrorDialog(const ErrorDialog &) = delete; ErrorDialog(const ErrorDialog &) = delete;
ErrorDialog &operator=(ErrorDialog &&) = delete; ErrorDialog &operator=(ErrorDialog &&) = delete;
ErrorDialog &operator=(const ErrorDialog &) = delete; ErrorDialog &operator=(const ErrorDialog &) = delete;
virtual ~ErrorDialog(); virtual ~ErrorDialog() = default;
private: private:
wxString msg; wxString msg;

View File

@ -387,7 +387,7 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent) :
option = m_og->get_option("fill_density"); option = m_og->get_option("fill_density");
option.opt.label = L("Infill"); option.opt.label = L("Infill");
option.opt.width = 7/*6*/; option.opt.width = 8;
option.opt.sidetext = " "; option.opt.sidetext = " ";
line.append_option(option); line.append_option(option);
@ -2365,7 +2365,8 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
wxGetApp().preset_bundle->load_config_model(filename.string(), std::move(config)); wxGetApp().preset_bundle->load_config_model(filename.string(), std::move(config));
if (printer_technology == ptFFF) if (printer_technology == ptFFF)
CustomGCode::update_custom_gcode_per_print_z_from_config(model.custom_gcode_per_print_z, &wxGetApp().preset_bundle->project_config); CustomGCode::update_custom_gcode_per_print_z_from_config(model.custom_gcode_per_print_z, &wxGetApp().preset_bundle->project_config);
wxGetApp().load_current_presets(); // For exporting from the amf/3mf we shouldn't check printer_presets for the containing information about "Print Host upload"
wxGetApp().load_current_presets(false);
is_project_file = true; is_project_file = true;
} }
wxGetApp().app_config->update_config_dir(path.parent_path().string()); wxGetApp().app_config->update_config_dir(path.parent_path().string());
@ -3645,17 +3646,17 @@ void Plater::priv::on_process_completed(SlicingProcessCompletedEvent &evt)
// This bool stops showing export finished notification even when process_completed_with_error is false // This bool stops showing export finished notification even when process_completed_with_error is false
bool has_error = false; bool has_error = false;
if (evt.error()) { if (evt.error()) {
std::string message = evt.format_error_message(); std::pair<std::string, bool> message = evt.format_error_message();
if (evt.critical_error()) { if (evt.critical_error()) {
if (q->m_tracking_popup_menu) if (q->m_tracking_popup_menu)
// We don't want to pop-up a message box when tracking a pop-up menu. // We don't want to pop-up a message box when tracking a pop-up menu.
// We postpone the error message instead. // We postpone the error message instead.
q->m_tracking_popup_menu_error_message = message; q->m_tracking_popup_menu_error_message = message.first;
else else
show_error(q, message); show_error(q, message.first, message.second);
} else } else
notification_manager->push_slicing_error_notification(message, *q->get_current_canvas3D()); notification_manager->push_slicing_error_notification(message.first, *q->get_current_canvas3D());
this->statusbar()->set_status_text(from_u8(message)); this->statusbar()->set_status_text(from_u8(message.first));
if (evt.invalidate_plater()) if (evt.invalidate_plater())
{ {
const wxString invalid_str = _L("Invalid data"); const wxString invalid_str = _L("Invalid data");
@ -5225,9 +5226,12 @@ void Plater::export_gcode(bool prefer_removable)
if (state & priv::UPDATE_BACKGROUND_PROCESS_INVALID) if (state & priv::UPDATE_BACKGROUND_PROCESS_INVALID)
return; return;
default_output_file = this->p->background_process.output_filepath_for_project(into_path(get_project_filename(".3mf"))); default_output_file = this->p->background_process.output_filepath_for_project(into_path(get_project_filename(".3mf")));
} } catch (const Slic3r::PlaceholderParserError &ex) {
catch (const std::exception &ex) { // Show the error with monospaced font.
show_error(this, ex.what()); show_error(this, ex.what(), true);
return;
} catch (const std::exception &ex) {
show_error(this, ex.what(), false);
return; return;
} }
default_output_file = fs::path(Slic3r::fold_utf8_to_ascii(default_output_file.string())); default_output_file = fs::path(Slic3r::fold_utf8_to_ascii(default_output_file.string()));
@ -5585,9 +5589,12 @@ void Plater::send_gcode()
if (state & priv::UPDATE_BACKGROUND_PROCESS_INVALID) if (state & priv::UPDATE_BACKGROUND_PROCESS_INVALID)
return; return;
default_output_file = this->p->background_process.output_filepath_for_project(into_path(get_project_filename(".3mf"))); default_output_file = this->p->background_process.output_filepath_for_project(into_path(get_project_filename(".3mf")));
} } catch (const Slic3r::PlaceholderParserError& ex) {
catch (const std::exception &ex) { // Show the error with monospaced font.
show_error(this, ex.what()); show_error(this, ex.what(), true);
return;
} catch (const std::exception& ex) {
show_error(this, ex.what(), false);
return; return;
} }
default_output_file = fs::path(Slic3r::fold_utf8_to_ascii(default_output_file.string())); default_output_file = fs::path(Slic3r::fold_utf8_to_ascii(default_output_file.string()));

View File

@ -16,13 +16,11 @@
#include "Plater.hpp" #include "Plater.hpp"
#include "../Utils/MacDarkMode.hpp" #include "../Utils/MacDarkMode.hpp"
#ifdef __Linux__ #ifdef __linux__
#define wxLinux true #define wxLinux true
#else #else
#define wxLinux false #define wxLinux false
#endif // msw_menuitem_bitmaps is used for MSW and OSX
#ifndef __WXGTK__// msw_menuitem_bitmaps is used for MSW and OSX
static std::map<int, std::string> msw_menuitem_bitmaps; static std::map<int, std::string> msw_menuitem_bitmaps;
#ifdef __WXMSW__ #ifdef __WXMSW__
void msw_rescale_menu(wxMenu* menu) void msw_rescale_menu(wxMenu* menu)