From ae394ca97dbf10085c0b5b585b76457ee7358e0d Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Tue, 22 May 2018 13:57:28 +0200 Subject: [PATCH 1/4] Fixed remember output directory default value set to true --- xs/src/slic3r/GUI/AppConfig.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xs/src/slic3r/GUI/AppConfig.cpp b/xs/src/slic3r/GUI/AppConfig.cpp index c1c90fb72..2a33cd733 100644 --- a/xs/src/slic3r/GUI/AppConfig.cpp +++ b/xs/src/slic3r/GUI/AppConfig.cpp @@ -57,6 +57,9 @@ void AppConfig::set_defaults() // https://github.com/prusa3d/Slic3r/issues/233 if (get("use_legacy_opengl").empty()) set("use_legacy_opengl", "0"); + + if (get("remember_output_path").empty()) + set("remember_output_path", "1"); } void AppConfig::load() From 6ea81279ff1a49d60e5000148b3f82f9bfbbf101 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 22 May 2018 14:00:42 +0200 Subject: [PATCH 2/4] Fixed correct updating of the modified preset on Plater tab. --- lib/Slic3r/GUI/Plater.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 0fa651b19..c870adde2 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -567,7 +567,8 @@ sub _on_select_preset { wxTheApp->{preset_bundle}->update_platter_filament_ui($idx, $choice); } else { my $selected_item = $choice->GetSelection(); - return if ($selected_item == $self->{"selected_item_$group"}); + return if ($selected_item == $self->{"selected_item_$group"} && + !Slic3r::GUI::get_preset_tab($group)->current_preset_is_dirty); my $selected_string = $choice->GetString($selected_item); if ($selected_string eq ("------- ".L("System presets")." -------") || From e8247c5646d512da4c8060ecd7d0a6a3232a6c28 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Tue, 22 May 2018 14:17:27 +0200 Subject: [PATCH 3/4] When loading a config bundle, make sure a config value is not accepted if it is placed in a wrong group (for example, max_print_height does not belong to print settings, but a printer settings, so Slic3r will now complain about it being in print settings, and it will remove the value from the print settings). --- xs/src/slic3r/GUI/Preset.hpp | 1 + xs/src/slic3r/GUI/PresetBundle.cpp | 52 +++++++++++++++++++++--------- 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/xs/src/slic3r/GUI/Preset.hpp b/xs/src/slic3r/GUI/Preset.hpp index ab01a48ff..31fb69aa8 100644 --- a/xs/src/slic3r/GUI/Preset.hpp +++ b/xs/src/slic3r/GUI/Preset.hpp @@ -244,6 +244,7 @@ public: const std::string& get_suffix_modified(); // Return a preset possibly with modifications. + Preset& default_preset() { return m_presets.front(); } const Preset& default_preset() const { return m_presets.front(); } // Return a preset by an index. If the preset is active, a temporary copy is returned. Preset& preset(size_t idx) { return (int(idx) == m_idx_selected) ? m_edited_preset : m_presets[idx]; } diff --git a/xs/src/slic3r/GUI/PresetBundle.cpp b/xs/src/slic3r/GUI/PresetBundle.cpp index ef48eb6d4..a34640da7 100644 --- a/xs/src/slic3r/GUI/PresetBundle.cpp +++ b/xs/src/slic3r/GUI/PresetBundle.cpp @@ -53,27 +53,31 @@ PresetBundle::PresetBundle() : wxImage::AddHandler(new wxPNGHandler); // Create the ID config keys, as they are not part of the Static print config classes. - this->prints.preset(0).config.opt_string("print_settings_id", true); - this->filaments.preset(0).config.opt_string("filament_settings_id", true); - this->printers.preset(0).config.opt_string("print_settings_id", true); + this->prints.default_preset().config.opt_string("print_settings_id", true); + this->filaments.default_preset().config.opt_string("filament_settings_id", true); + this->printers.default_preset().config.opt_string("printer_settings_id", true); // Create the "compatible printers" keys, as they are not part of the Static print config classes. - this->filaments.preset(0).config.optptr("compatible_printers", true); - this->filaments.preset(0).config.optptr("compatible_printers_condition", true); - this->prints.preset(0).config.optptr("compatible_printers", true); - this->prints.preset(0).config.optptr("compatible_printers_condition", true); + this->filaments.default_preset().config.optptr("compatible_printers", true); + this->filaments.default_preset().config.optptr("compatible_printers_condition", true); + this->prints.default_preset().config.optptr("compatible_printers", true); + this->prints.default_preset().config.optptr("compatible_printers_condition", true); // Create the "inherits" keys. - this->prints.preset(0).config.optptr("inherits", true); - this->filaments.preset(0).config.optptr("inherits", true); - this->printers.preset(0).config.optptr("inherits", true); + this->prints.default_preset().config.optptr("inherits", true); + this->filaments.default_preset().config.optptr("inherits", true); + this->printers.default_preset().config.optptr("inherits", true); // Create the "printer_vendor", "printer_model" and "printer_variant" keys. - this->printers.preset(0).config.optptr("printer_vendor", true); - this->printers.preset(0).config.optptr("printer_model", true); - this->printers.preset(0).config.optptr("printer_variant", true); - + this->printers.default_preset().config.optptr("printer_vendor", true); + this->printers.default_preset().config.optptr("printer_model", true); + this->printers.default_preset().config.optptr("printer_variant", true); + // Load the default preset bitmaps. this->prints .load_bitmap_default("cog.png"); this->filaments.load_bitmap_default("spool.png"); this->printers .load_bitmap_default("printer_empty.png"); this->load_compatible_bitmaps(); + // Re-activate the default presets, so their "edited" preset copies will be updated with the additional configuration values above. + this->prints .select_preset(0); + this->filaments.select_preset(0); + this->printers .select_preset(0); this->project_config.apply_only(FullPrintConfig::defaults(), s_project_options); } @@ -832,10 +836,28 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla continue; if (presets != nullptr) { // Load the print, filament or printer preset. - DynamicPrintConfig config(presets->default_preset().config); + const DynamicPrintConfig &default_config = presets->default_preset().config; + DynamicPrintConfig config(default_config); for (auto &kvp : section.second) config.set_deserialize(kvp.first, kvp.second.data()); Preset::normalize(config); + // Report configuration fields, which are misplaced into a wrong group. + std::string incorrect_keys; + size_t n_incorrect_keys = 0; + for (const std::string &key : config.keys()) + if (! default_config.has(key)) { + if (incorrect_keys.empty()) + incorrect_keys = key; + else { + incorrect_keys += ", "; + incorrect_keys += key; + } + config.erase(key); + ++ n_incorrect_keys; + } + if (! incorrect_keys.empty()) + BOOST_LOG_TRIVIAL(error) << "Error in a Vendor Config Bundle \"" << path << "\": The printer preset \"" << + section.first << "\" contains the following incorrect keys: " << incorrect_keys << ", which were removed"; if ((flags & LOAD_CFGBNDLE_SYSTEM) && presets == &printers) { // Filter out printer presets, which are not mentioned in the vendor profile. // These presets are considered not installed. From 360b34944d830655f8d0966d2140a1d293b7b724 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Tue, 22 May 2018 14:33:11 +0200 Subject: [PATCH 4/4] ErrorDialog: Fix size and message encoding --- xs/src/slic3r/GUI/GUI.cpp | 2 +- xs/src/slic3r/GUI/MsgDialog.cpp | 3 ++- xs/src/slic3r/GUI/MsgDialog.hpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/xs/src/slic3r/GUI/GUI.cpp b/xs/src/slic3r/GUI/GUI.cpp index aad970236..b00813a71 100644 --- a/xs/src/slic3r/GUI/GUI.cpp +++ b/xs/src/slic3r/GUI/GUI.cpp @@ -607,7 +607,7 @@ void show_error(wxWindow* parent, const wxString& message) { void show_error_id(int id, const std::string& message) { auto *parent = id != 0 ? wxWindow::FindWindowById(id) : nullptr; - show_error(parent, message); + show_error(parent, wxString::FromUTF8(message.data())); } void show_info(wxWindow* parent, const wxString& message, const wxString& title){ diff --git a/xs/src/slic3r/GUI/MsgDialog.cpp b/xs/src/slic3r/GUI/MsgDialog.cpp index 6fba47a37..58679ed9e 100644 --- a/xs/src/slic3r/GUI/MsgDialog.cpp +++ b/xs/src/slic3r/GUI/MsgDialog.cpp @@ -71,11 +71,12 @@ ErrorDialog::ErrorDialog(wxWindow *parent, const wxString &msg) : text->Wrap(CONTENT_WIDTH); p_sizer->Add(text, 1, wxEXPAND); - panel->SetMinSize(wxSize(CONTENT_WIDTH, CONTENT_HEIGHT)); + panel->SetMinSize(wxSize(CONTENT_WIDTH, 0)); panel->SetScrollRate(0, 5); content_sizer->Add(panel, 1, wxEXPAND); + SetMaxSize(wxSize(-1, CONTENT_MAX_HEIGHT)); Fit(); } diff --git a/xs/src/slic3r/GUI/MsgDialog.hpp b/xs/src/slic3r/GUI/MsgDialog.hpp index a01127023..2d570a0bf 100644 --- a/xs/src/slic3r/GUI/MsgDialog.hpp +++ b/xs/src/slic3r/GUI/MsgDialog.hpp @@ -31,7 +31,7 @@ struct MsgDialog : wxDialog protected: enum { CONTENT_WIDTH = 500, - CONTENT_HEIGHT = 300, + CONTENT_MAX_HEIGHT = 600, BORDER = 30, VERT_SPACING = 15, HORIZ_SPACING = 5,