From 588e79c76d3f9f49fbfee68b5a3e093d3eab40cf Mon Sep 17 00:00:00 2001 From: "chunmao.guo" Date: Mon, 5 Dec 2022 11:24:12 +0800 Subject: [PATCH] FIX: [STUDIO-1574] not switch filament preset after wizard Change-Id: Id830b6c8f4ffd76a0b58c51ba892a79f075c0cea --- src/slic3r/GUI/PresetComboBoxes.cpp | 3 +++ src/slic3r/GUI/WebGuideDialog.cpp | 4 +++- src/slic3r/GUI/Widgets/ComboBox.cpp | 8 +------- src/slic3r/GUI/Widgets/ComboBox.hpp | 4 ++-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp index c52e9a6043..9e2a05e8db 100644 --- a/src/slic3r/GUI/PresetComboBoxes.cpp +++ b/src/slic3r/GUI/PresetComboBoxes.cpp @@ -1094,6 +1094,9 @@ void PlaterPresetComboBox::update() } update_selection(); + if (selected_system_preset != GetValue()) { + sendComboBoxEvent(); + } Thaw(); if (!tooltip.IsEmpty()) { diff --git a/src/slic3r/GUI/WebGuideDialog.cpp b/src/slic3r/GUI/WebGuideDialog.cpp index 8cfc9919a2..c8f3dd6474 100644 --- a/src/slic3r/GUI/WebGuideDialog.cpp +++ b/src/slic3r/GUI/WebGuideDialog.cpp @@ -795,7 +795,8 @@ bool GuideFrame::apply_config(AppConfig *app_config, PresetBundle *preset_bundle first_added_preset = get_first_added_preset(old_presets, m_appconfig_new.get_section(section_name)); } }; - get_first_added_material_preset(AppConfig::SECTION_FILAMENTS, first_added_filament); + // Not switch filament + //get_first_added_material_preset(AppConfig::SECTION_FILAMENTS, first_added_filament); //update the app_config app_config->set_section(AppConfig::SECTION_FILAMENTS, enabled_filaments); @@ -819,6 +820,7 @@ bool GuideFrame::run() //p->set_run_reason(reason); //p->set_start_page(start_page); + app.preset_bundle->export_selections(*app.app_config); BOOST_LOG_TRIVIAL(info) << "GuideFrame before ShowModal"; if (this->ShowModal() == wxID_OK) { diff --git a/src/slic3r/GUI/Widgets/ComboBox.cpp b/src/slic3r/GUI/Widgets/ComboBox.cpp index d2cd6797b1..800e93a58d 100644 --- a/src/slic3r/GUI/Widgets/ComboBox.cpp +++ b/src/slic3r/GUI/Widgets/ComboBox.cpp @@ -263,13 +263,7 @@ void ComboBox::keyDown(wxKeyEvent& event) } else { break; } - { - wxCommandEvent e(wxEVT_COMBOBOX); - e.SetEventObject(this); - e.SetId(GetId()); - e.SetInt(GetSelection()); - GetEventHandler()->ProcessEvent(e); - } + sendComboBoxEvent(); break; case WXK_TAB: HandleAsNavigationKey(event); diff --git a/src/slic3r/GUI/Widgets/ComboBox.hpp b/src/slic3r/GUI/Widgets/ComboBox.hpp index 86d57ff2fd..7158cb2fb4 100644 --- a/src/slic3r/GUI/Widgets/ComboBox.hpp +++ b/src/slic3r/GUI/Widgets/ComboBox.hpp @@ -74,6 +74,8 @@ class ComboBox : public wxWindowWithItems void OnEdit() override; + void sendComboBoxEvent(); + #ifdef __WIN32__ WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) override; #endif @@ -85,8 +87,6 @@ class ComboBox : public wxWindowWithItems void mouseWheelMoved(wxMouseEvent &event); void keyDown(wxKeyEvent &event); - void sendComboBoxEvent(); - DECLARE_EVENT_TABLE() };