diff --git a/src/slic3r/GUI/CreatePresetsDialog.cpp b/src/slic3r/GUI/CreatePresetsDialog.cpp index 8113b3037..891e6d0dd 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.cpp +++ b/src/slic3r/GUI/CreatePresetsDialog.cpp @@ -4431,9 +4431,7 @@ void EditFilamentPresetDialog::edit_preset() wxGetApp().get_tab(need_edit_preset->type)->select_preset(need_edit_preset_name); // when some preset have modified, if the printer is not need_edit_preset_name compatible printer, the preset will jump to other preset, need select again if (!need_edit_preset->is_compatible) wxGetApp().get_tab(need_edit_preset->type)->select_preset(need_edit_preset_name); - wxGetApp().params_dialog()->ShowModal(); - get_same_filament_id_presets(m_filament_id); - update_preset_tree(); + wxGetApp().params_dialog()->Popup(true); m_selected_printer.clear(); m_need_edit_preset_index = -1; diff --git a/src/slic3r/GUI/ParamsDialog.cpp b/src/slic3r/GUI/ParamsDialog.cpp index db421a2d0..6089116a8 100644 --- a/src/slic3r/GUI/ParamsDialog.cpp +++ b/src/slic3r/GUI/ParamsDialog.cpp @@ -59,13 +59,16 @@ ParamsDialog::ParamsDialog(wxWindow * parent) //wxGetApp().UpdateDlgDarkUI(this); } -void ParamsDialog::Popup() +void ParamsDialog::Popup(bool just_edit) { wxGetApp().UpdateDlgDarkUI(this); #ifdef __WIN32__ Reparent(wxGetApp().mainframe); #endif Center(); + if (m_panel && m_panel->get_current_tab()) { + dynamic_cast(m_panel->get_current_tab())->set_just_edit(just_edit); + } Show(); } diff --git a/src/slic3r/GUI/ParamsDialog.hpp b/src/slic3r/GUI/ParamsDialog.hpp index 34ef20fc0..683a23ad9 100644 --- a/src/slic3r/GUI/ParamsDialog.hpp +++ b/src/slic3r/GUI/ParamsDialog.hpp @@ -20,7 +20,7 @@ public: ParamsPanel * panel() { return m_panel; } - void Popup(); + void Popup(bool just_edit = false); protected: void on_dpi_changed(const wxRect& suggested_rect) override; diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 55dfc69ce..f30ee42b5 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -4925,8 +4925,10 @@ void Tab::save_preset(std::string name /*= ""*/, bool detach, bool save_to_proje if (name.empty()) { SavePresetDialog dlg(m_parent, m_type, detach ? _u8L("Detached") : ""); - if (dlg.ShowModal() != wxID_OK) - return; + if (!m_just_edit) { + if (dlg.ShowModal() != wxID_OK) + return; + } name = dlg.get_name(); //BBS: add project embedded preset relate logic save_to_project = dlg.get_save_to_project_selection(m_type); @@ -5378,6 +5380,18 @@ bool Tab::validate_custom_gcodes() return valid; } +void Tab::set_just_edit(bool just_edit) +{ + m_just_edit = just_edit; + if (just_edit) { + m_presets_choice->Disable(); + m_btn_delete_preset->Disable(); + } else { + m_presets_choice->Enable(); + m_btn_delete_preset->Enable(); + } +} + void Tab::compatible_widget_reload(PresetDependencies &deps) { Field* field = this->get_field(deps.key_condition); diff --git a/src/slic3r/GUI/Tab.hpp b/src/slic3r/GUI/Tab.hpp index 2017c7046..82168f583 100644 --- a/src/slic3r/GUI/Tab.hpp +++ b/src/slic3r/GUI/Tab.hpp @@ -179,6 +179,9 @@ protected: */ bool m_is_default_preset {false}; + // just be used for edit filament dialog + bool m_just_edit{false}; + ScalableButton* m_undo_btn; ScalableButton* m_undo_to_sys_btn; //ScalableButton* m_question_btn; @@ -405,6 +408,7 @@ public: static bool validate_custom_gcode(const wxString& title, const std::string& gcode); bool validate_custom_gcodes(); bool validate_custom_gcodes_was_shown{ false }; + void set_just_edit(bool just_edit); protected: void create_line_with_widget(ConfigOptionsGroup* optgroup, const std::string& opt_key, const std::string& path, widget_t widget);