From 37da0956cb0a316c1d486a9cbbc63666e0f22f1c Mon Sep 17 00:00:00 2001 From: YuSanka Date: Fri, 26 Aug 2022 17:34:49 +0200 Subject: [PATCH] Fix for SPE-1267 "All" checkbox wasn\t correctly updated. A compatible_widget_reload() function is called when "Dependencies" page is activated and when "compatible_*" value is changed. --- src/slic3r/GUI/Tab.cpp | 51 +++++++++++------------------------------- src/slic3r/GUI/Tab.hpp | 4 ---- 2 files changed, 13 insertions(+), 42 deletions(-) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index f899d3d3f..8d3f78401 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -836,19 +836,11 @@ void Tab::on_roll_back_value(const bool to_sys /*= true*/) if (m_type != Preset::TYPE_PRINTER && (m_options_list["compatible_printers"] & os) == 0) { to_sys ? group->back_to_sys_value("compatible_printers") : group->back_to_initial_value("compatible_printers"); load_key_value("compatible_printers", true/*some value*/, true); - - bool is_empty = m_config->option("compatible_printers")->values.empty(); - m_compatible_printers.checkbox->SetValue(is_empty); - is_empty ? m_compatible_printers.btn->Disable() : m_compatible_printers.btn->Enable(); } // "compatible_prints" option exists only in Filament Settimgs and Materials Tabs if ((m_type == Preset::TYPE_FILAMENT || m_type == Preset::TYPE_SLA_MATERIAL) && (m_options_list["compatible_prints"] & os) == 0) { to_sys ? group->back_to_sys_value("compatible_prints") : group->back_to_initial_value("compatible_prints"); load_key_value("compatible_prints", true/*some value*/, true); - - bool is_empty = m_config->option("compatible_prints")->values.empty(); - m_compatible_prints.checkbox->SetValue(is_empty); - is_empty ? m_compatible_prints.btn->Disable() : m_compatible_prints.btn->Enable(); } } for (const auto &kvp : group->opt_map()) { @@ -1075,6 +1067,11 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value) return; } + if (opt_key == "compatible_prints") + this->compatible_widget_reload(m_compatible_prints); + if (opt_key == "compatible_printers") + this->compatible_widget_reload(m_compatible_printers); + const bool is_fff = supports_printer_technology(ptFFF); ConfigOptionsGroup* og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(is_fff); if (opt_key == "fill_density" || opt_key == "pad_enable") @@ -1691,13 +1688,6 @@ void TabPrint::build() build_preset_description_line(optgroup.get()); } -// Reload current config (aka presets->edited_preset->config) into the UI fields. -void TabPrint::reload_config() -{ - this->compatible_widget_reload(m_compatible_printers); - Tab::reload_config(); -} - void TabPrint::update_description_lines() { Tab::update_description_lines(); @@ -2086,14 +2076,6 @@ void TabFilament::build() build_preset_description_line(optgroup.get()); } -// Reload current config (aka presets->edited_preset->config) into the UI fields. -void TabFilament::reload_config() -{ - this->compatible_widget_reload(m_compatible_printers); - this->compatible_widget_reload(m_compatible_prints); - Tab::reload_config(); -} - void TabFilament::update_volumetric_flow_preset_hints() { wxString text; @@ -3480,6 +3462,14 @@ void Tab::activate_selected_page(std::function throw_if_canceled) return; m_active_page->activate(m_mode, throw_if_canceled); + + if (m_active_page->title() == "Dependencies") { + if (m_compatible_printers.checkbox) + this->compatible_widget_reload(m_compatible_printers); + if (m_compatible_prints.checkbox) + this->compatible_widget_reload(m_compatible_prints); + } + update_changed_ui(); update_description_lines(); toggle_options(); @@ -4609,14 +4599,6 @@ void TabSLAMaterial::build() optgroup->append_single_option_line(option); } -// Reload current config (aka presets->edited_preset->config) into the UI fields. -void TabSLAMaterial::reload_config() -{ - this->compatible_widget_reload(m_compatible_printers); - this->compatible_widget_reload(m_compatible_prints); - Tab::reload_config(); -} - void TabSLAMaterial::toggle_options() { const Preset ¤t_printer = wxGetApp().preset_bundle->printers.get_edited_preset(); @@ -4743,13 +4725,6 @@ void TabSLAPrint::build() build_preset_description_line(optgroup.get()); } -// Reload current config (aka presets->edited_preset->config) into the UI fields. -void TabSLAPrint::reload_config() -{ - this->compatible_widget_reload(m_compatible_printers); - Tab::reload_config(); -} - void TabSLAPrint::update_description_lines() { Tab::update_description_lines(); diff --git a/src/slic3r/GUI/Tab.hpp b/src/slic3r/GUI/Tab.hpp index 6625f71f6..40ceb1682 100644 --- a/src/slic3r/GUI/Tab.hpp +++ b/src/slic3r/GUI/Tab.hpp @@ -408,7 +408,6 @@ public: ~TabPrint() {} void build() override; - void reload_config() override; void update_description_lines() override; void toggle_options() override; void update() override; @@ -442,7 +441,6 @@ public: ~TabFilament() {} void build() override; - void reload_config() override; void update_description_lines() override; void toggle_options() override; void update() override; @@ -515,7 +513,6 @@ public: ~TabSLAMaterial() {} void build() override; - void reload_config() override; void toggle_options() override; void update() override; void init_options_list() override; @@ -532,7 +529,6 @@ public: ogStaticText* m_support_object_elevation_description_line = nullptr; void build() override; - void reload_config() override; void update_description_lines() override; void toggle_options() override; void update() override;