FIX: close edit preset paramsDialog, mac unresponsive
Jira: 5298 Change-Id: I021e00567354cfb1f2f5f1f2bf6ba1fc35b164c5
This commit is contained in:
parent
b5f150bbd8
commit
dc9ddade80
|
@ -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;
|
||||
|
|
|
@ -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<Tab *>(m_panel->get_current_tab())->set_just_edit(just_edit);
|
||||
}
|
||||
Show();
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue