& values = conf_substitution.opt_def->enum_values;
+ int val = conf_substitution.new_value->getInt();
+
+ bool is_infill = conf_substitution.opt_def->opt_key == "top_fill_pattern" ||
+ conf_substitution.opt_def->opt_key == "bottom_fill_pattern" ||
+ conf_substitution.opt_def->opt_key == "fill_pattern";
+
+ // Each infill doesn't use all list of infill declared in PrintConfig.hpp.
+ // So we should "convert" val to the correct one
+ if (is_infill) {
+ for (const auto& key_val : *conf_substitution.opt_def->enum_keys_map)
+ if ((int)key_val.second == val) {
+ auto it = std::find(values.begin(), values.end(), key_val.first);
+ if (it == values.end())
+ break;
+ new_val = from_u8(_utf8(labels[it - values.begin()]));
+ break;
+ }
+ new_val = _L("Undef");
+ }
+ else
+ new_val = from_u8(_utf8(labels[val]));
+ }
+ else if (conf_substitution.opt_def->type == coBool)
+ new_val = conf_substitution.new_value->getBool() ? "true" : "false";
+
+ changes += "\n" + GUI::format(_L("New unknown value \"%1%\" was changed to defaul value \"%2%\""), conf_substitution.old_value, new_val);
+ }
+}
+
+void show_substitutions_info(const PresetsConfigSubstitutions& presets_config_substitutions)
+{
+ wxString changes;
+
+ auto preset_type_name = [](Preset::Type type) {
+ return type == Slic3r::Preset::TYPE_PRINT ? _L("Print") :
+ type == Slic3r::Preset::TYPE_SLA_PRINT ? _L("SLA Print") :
+ type == Slic3r::Preset::TYPE_FILAMENT ? _L("Filament") :
+ type == Slic3r::Preset::TYPE_SLA_MATERIAL ? _L("SLA Material") :
+ type == Slic3r::Preset::TYPE_PRINTER ? _L("Printer") : "";
+ };
+
+ for (const PresetConfigSubstitutions& substitution : presets_config_substitutions) {
+ changes += "\n" + GUI::format(_L(" %1% Preset : %2%"), preset_type_name(substitution.preset_type), substitution.preset_name);
+ if (!substitution.preset_file.empty())
+ changes += GUI::format(" (%1%)", substitution.preset_file);
+ changes += "
";
+
+ add_config_substitutions(substitution.substitutions, changes);
+ }
+ if (!changes.IsEmpty())
+ changes += "\n\n";
+
+ wxString message = format(_L("Loading profiles found following incompatibilities:%1%"
+ " To recover these files, incompatible values were changed to default values.\n"
+ " But data in files won't be changed until you save them in PrusaSlicer."), changes);
+
+ InfoDialog msg(nullptr, message);
+ msg.ShowModal();
+}
+
+void show_substitutions_info(const ConfigSubstitutions& config_substitutions, const std::string& filename)
+{
+ wxString changes = "\n";
+
+ add_config_substitutions(config_substitutions, changes);
+
+ if (!changes.IsEmpty())
+ changes += "\n\n";
+
+ wxString message = format(_L("Loading %1% file found incompatibilities.\n"
+ "To recover this file, incompatible values were changed to default values:%2%"
+ "But data in files won't be changed until you save them in PrusaSlicer."), from_u8(filename), changes);
+
+ InfoDialog msg(nullptr, message);
+ msg.ShowModal();
+}
+
void create_combochecklist(wxComboCtrl* comboCtrl, const std::string& text, const std::string& items)
{
if (comboCtrl == nullptr)
diff --git a/src/slic3r/GUI/GUI.hpp b/src/slic3r/GUI/GUI.hpp
index a90115933..f80d18344 100644
--- a/src/slic3r/GUI/GUI.hpp
+++ b/src/slic3r/GUI/GUI.hpp
@@ -7,6 +7,7 @@ namespace boost::filesystem { class path; }
#include
#include "libslic3r/Config.hpp"
+#include "libslic3r/Preset.hpp"
class wxWindow;
class wxMenuBar;
@@ -49,6 +50,8 @@ void show_info(wxWindow* parent, const wxString& message, const wxString& title
void show_info(wxWindow* parent, const char* message, const char* title = nullptr);
inline void show_info(wxWindow* parent, const std::string& message,const std::string& title = std::string()) { show_info(parent, message.c_str(), title.c_str()); }
void warning_catcher(wxWindow* parent, const wxString& message);
+void show_substitutions_info(const PresetsConfigSubstitutions& presets_config_substitutions);
+void show_substitutions_info(const ConfigSubstitutions& config_substitutions, const std::string& filename);
// Creates a wxCheckListBoxComboPopup inside the given wxComboCtrl, filled with the given text and items.
// Items data must be separated by '|', and contain the item name to be shown followed by its initial value (0 for false, 1 for true).
diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp
index 319b408d7..9653e56f0 100644
--- a/src/slic3r/GUI/GUI_App.cpp
+++ b/src/slic3r/GUI/GUI_App.cpp
@@ -618,12 +618,8 @@ void GUI_App::post_init()
this->plater()->load_gcode(wxString::FromUTF8(this->init_params->input_files[0].c_str()));
}
else {
- if (! this->init_params->preset_substitutions.empty()) {
- // TODO: Add list of changes from all_substitutions
- show_error(nullptr, GUI::format(_L("Loading profiles found following incompatibilities."
- " To recover these files, incompatible values were changed to default values."
- " But data in files won't be changed until you save them in PrusaSlicer.")));
- }
+ if (! this->init_params->preset_substitutions.empty())
+ show_substitutions_info(this->init_params->preset_substitutions);
#if 0
// Load the cummulative config over the currently active profiles.
@@ -1681,12 +1677,9 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
try {
app_config->set("on_snapshot", Config::SnapshotDB::singleton().restore_snapshot(dlg.snapshot_to_activate(), *app_config).id);
if (PresetsConfigSubstitutions all_substitutions = preset_bundle->load_presets(*app_config, ForwardCompatibilitySubstitutionRule::Enable);
- ! all_substitutions.empty()) {
- // TODO:
- show_error(nullptr, GUI::format(_L("Loading profiles found following incompatibilities."
- " To recover these files, incompatible values were changed to default values."
- " But data in files won't be changed until you save them in PrusaSlicer.")));
- }
+ ! all_substitutions.empty())
+ show_substitutions_info(all_substitutions);
+
// Load the currently selected preset into the GUI, update the preset selection box.
load_current_presets();
} catch (std::exception &ex) {
diff --git a/src/slic3r/GUI/Jobs/SLAImportJob.cpp b/src/slic3r/GUI/Jobs/SLAImportJob.cpp
index 52cbb5ac9..567adbc4c 100644
--- a/src/slic3r/GUI/Jobs/SLAImportJob.cpp
+++ b/src/slic3r/GUI/Jobs/SLAImportJob.cpp
@@ -158,7 +158,7 @@ void SLAImportJob::process()
}
if (! config_substitutions.empty()) {
- //FIXME Add reporting here "Loading profiles found following incompatibilities."
+ show_substitutions_info(config_substitutions, path);
}
update_status(100, was_canceled() ? _(L("Importing canceled.")) :
diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp
index 8a3bd6c01..018f06fb2 100644
--- a/src/slic3r/GUI/MainFrame.cpp
+++ b/src/slic3r/GUI/MainFrame.cpp
@@ -1518,12 +1518,8 @@ bool MainFrame::load_config_file(const std::string &path)
{
try {
ConfigSubstitutions config_substitutions = wxGetApp().preset_bundle->load_config_file(path, ForwardCompatibilitySubstitutionRule::Enable);
- if (! config_substitutions.empty()) {
- // TODO: Add list of changes from all_substitutions
- show_error(nullptr, GUI::format(_L("Loading profiles found following incompatibilities."
- " To recover these files, incompatible values were changed to default values."
- " But data in files won't be changed until you save them in PrusaSlicer.")));
- }
+ if (!config_substitutions.empty())
+ show_substitutions_info(config_substitutions, path);
} catch (const std::exception &ex) {
show_error(this, ex.what());
return false;
@@ -1588,12 +1584,8 @@ void MainFrame::load_configbundle(wxString file/* = wxEmptyString, const bool re
return;
}
- if (! config_substitutions.empty()) {
- // TODO: Add list of changes from all_substitutions
- show_error(nullptr, GUI::format(_L("Loading profiles found following incompatibilities."
- " To recover these files, incompatible values were changed to default values."
- " But data in files won't be changed until you save them in PrusaSlicer.")));
- }
+ if (! config_substitutions.empty())
+ show_substitutions_info(config_substitutions);
// Load the currently selected preset into the GUI, update the preset selection box.
wxGetApp().load_current_presets();
diff --git a/src/slic3r/GUI/MsgDialog.cpp b/src/slic3r/GUI/MsgDialog.cpp
index d90f4de10..e8dc80c53 100644
--- a/src/slic3r/GUI/MsgDialog.cpp
+++ b/src/slic3r/GUI/MsgDialog.cpp
@@ -58,7 +58,7 @@ MsgDialog::MsgDialog(wxWindow *parent, const wxString &title, const wxString &he
logo = new wxStaticBitmap(this, wxID_ANY, wxNullBitmap);
- topsizer->Add(logo, 0, wxALL, BORDER);
+ topsizer->Add(logo, 0, /*wxALL*/wxTOP | wxBOTTOM | wxLEFT, BORDER);
topsizer->Add(rightsizer, 1, wxALL | wxEXPAND, BORDER);
SetSizerAndFit(topsizer);
@@ -107,5 +107,43 @@ ErrorDialog::ErrorDialog(wxWindow *parent, const wxString &msg, bool monospaced_
Fit();
}
+
+// InfoDialog
+
+InfoDialog::InfoDialog(wxWindow* parent, const wxString& msg)
+ : MsgDialog(parent, wxString::Format(_L("%s information"), SLIC3R_APP_NAME), _L("Note that"))
+ , msg(msg)
+{
+ this->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
+
+ // 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);
+ {
+ html->SetMinSize(wxSize(40 * wxGetApp().em_unit(), -1));
+ wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
+ wxFont monospace = wxGetApp().code_font();
+ wxColour text_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
+ 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 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;
+ int size[] = { font_size, font_size, font_size, font_size, font_size, font_size, font_size };
+ html->SetFonts(font.GetFaceName(), monospace.GetFaceName(), size);
+ html->SetBorders(2);
+ std::string msg_escaped = xml_escape(msg.ToUTF8().data(), true);
+ boost::replace_all(msg_escaped, "\r\n", "
");
+ boost::replace_all(msg_escaped, "\n", "
");
+ html->SetPage("" + wxString::FromUTF8(msg_escaped.data()) + "");
+ content_sizer->Add(html, 1, wxEXPAND);
+ }
+
+ // Set info bitmap
+ logo->SetBitmap(create_scaled_bitmap("info", this, 84));
+
+ SetMinSize(wxSize(60 * wxGetApp().em_unit(), 30 * wxGetApp().em_unit()));
+ Fit();
+}
+
+
}
}
diff --git a/src/slic3r/GUI/MsgDialog.hpp b/src/slic3r/GUI/MsgDialog.hpp
index 70032089b..dcc6bdca6 100644
--- a/src/slic3r/GUI/MsgDialog.hpp
+++ b/src/slic3r/GUI/MsgDialog.hpp
@@ -66,6 +66,22 @@ private:
};
+// Generic info dialog, used for displaying exceptions
+class InfoDialog : public MsgDialog
+{
+public:
+ InfoDialog(wxWindow *parent, const wxString &msg);
+ InfoDialog(InfoDialog&&) = delete;
+ InfoDialog(const InfoDialog&) = delete;
+ InfoDialog&operator=(InfoDialog&&) = delete;
+ InfoDialog&operator=(const InfoDialog&) = delete;
+ virtual ~InfoDialog() = default;
+
+private:
+ wxString msg;
+};
+
+
}
}
diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp
index 79014474e..1fe45b718 100644
--- a/src/slic3r/GUI/Plater.cpp
+++ b/src/slic3r/GUI/Plater.cpp
@@ -2369,12 +2369,8 @@ std::vector Plater::priv::load_files(const std::vector& input_
// and place the loaded config over the base.
config += std::move(config_loaded);
}
- if (! config_substitutions.empty()) {
- // TODO:
- show_error(nullptr, GUI::format(_L("Loading profiles found following incompatibilities."
- " To recover these files, incompatible values were changed to default values."
- " But data in files won't be changed until you save them in PrusaSlicer.")));
- }
+ if (! config_substitutions.empty())
+ show_substitutions_info(config_substitutions.substitutions, filename.string());
this->model.custom_gcode_per_print_z = model.custom_gcode_per_print_z;
}