FIX: edit preset dialog can't close on mac
Jira: 5696 Change-Id: Ib33dfd07cc588ddd3805e3490a4d8c36dcd890ac
This commit is contained in:
parent
f2661ca15d
commit
8b82f68f57
|
@ -4456,27 +4456,10 @@ void EditFilamentPresetDialog::edit_preset()
|
|||
}
|
||||
|
||||
// edit preset
|
||||
std::shared_ptr<Preset> need_edit_preset = filament_presets[m_need_edit_preset_index];
|
||||
std::string need_edit_preset_name = need_edit_preset->name;
|
||||
Tab * tab = wxGetApp().get_tab(need_edit_preset->type);
|
||||
if (tab == nullptr) {
|
||||
m_selected_printer.clear();
|
||||
m_need_edit_preset_index = -1;
|
||||
return;
|
||||
}
|
||||
m_need_edit_preset = filament_presets[m_need_edit_preset_index];
|
||||
wxGetApp().params_dialog()->set_editing_filament_id(m_filament_id);
|
||||
|
||||
EndModal(wxID_EDIT);
|
||||
//Popup needs to be called before "restore_last_select_item", otherwise the page may not be updated
|
||||
wxGetApp().params_dialog()->set_editing_filament_id(m_filament_id);
|
||||
wxGetApp().params_dialog()->Popup();
|
||||
tab->restore_last_select_item();
|
||||
|
||||
tab->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) tab->select_preset(need_edit_preset_name);
|
||||
|
||||
m_selected_printer.clear();
|
||||
m_need_edit_preset_index = -1;
|
||||
}
|
||||
|
||||
wxBoxSizer *EditFilamentPresetDialog::create_filament_basic_info()
|
||||
|
|
|
@ -356,6 +356,7 @@ public:
|
|||
~EditFilamentPresetDialog();
|
||||
|
||||
wxPanel *get_preset_tree_panel() { return m_preset_tree_panel; }
|
||||
std::shared_ptr<Preset> get_need_edit_preset() { return m_need_edit_preset; }
|
||||
void set_printer_name(const std::string &printer_name) { m_selected_printer = printer_name; }
|
||||
void set_need_delete_preset_index(int need_delete_preset_index) { m_need_delete_preset_index = need_delete_preset_index; }
|
||||
void set_need_edit_preset_index(int need_edit_preset_index) { m_need_edit_preset_index = need_edit_preset_index; }
|
||||
|
@ -388,6 +389,7 @@ private:
|
|||
wxStaticText * m_note_text = nullptr;
|
||||
int m_need_delete_preset_index = -1;
|
||||
int m_need_edit_preset_index = -1;
|
||||
std::shared_ptr<Preset> m_need_edit_preset;
|
||||
std::string m_selected_printer = "";
|
||||
std::unordered_map<std::string, std::vector<std::shared_ptr<Preset>>> m_printer_compatible_presets;
|
||||
|
||||
|
|
|
@ -7746,13 +7746,29 @@ void Plater::priv::on_modify_filament(SimpleEvent &evt)
|
|||
{
|
||||
FilamentInfomation *filament_info = static_cast<FilamentInfomation *>(evt.GetEventObject());
|
||||
int res;
|
||||
std::shared_ptr<Preset> need_edit_preset;
|
||||
{
|
||||
EditFilamentPresetDialog dlg(wxGetApp().mainframe, filament_info);
|
||||
res = dlg.ShowModal();
|
||||
need_edit_preset = dlg.get_need_edit_preset();
|
||||
}
|
||||
wxGetApp().mainframe->update_side_preset_ui();
|
||||
update_ui_from_settings();
|
||||
sidebar->update_all_preset_comboboxes();
|
||||
if (wxID_EDIT == res) {
|
||||
Tab *tab = wxGetApp().get_tab(Preset::Type::TYPE_FILAMENT);
|
||||
//tab->restore_last_select_item();
|
||||
if (tab == nullptr) { return; }
|
||||
// Popup needs to be called before "restore_last_select_item", otherwise the page may not be updated
|
||||
wxGetApp().params_dialog()->Popup();
|
||||
tab->restore_last_select_item();
|
||||
// Opening Studio and directly accessing the Filament settings interface through the edit preset button will not take effect and requires manual settings.
|
||||
tab->set_just_edit(true);
|
||||
tab->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) tab->select_preset(need_edit_preset->name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Plater::priv::enter_gizmos_stack()
|
||||
|
|
Loading…
Reference in New Issue