FIX:close gcode.3mf not pop window that should not appear

jira: STUDIO-9821
Change-Id: I6c9d4e5231d2c7a9b9629003bdffab1c523fe15f
(cherry picked from commit 22e3f089924149617e3f788abf85cbfe79fa0b45)
This commit is contained in:
zhou.xu
2025-01-23 10:28:05 +08:00
committed by Noisyfox
parent 481405f68c
commit f729554858

View File

@@ -2572,20 +2572,13 @@ void Sidebar::add_custom_filament(wxColour new_col) {
bool Sidebar::is_new_project_in_gcode3mf() bool Sidebar::is_new_project_in_gcode3mf()
{ {
if (p->plater->using_exported_file()) { if (p->plater->using_exported_file()) {
ConfirmBeforeSendDialog confirm_dlg(this, wxID_ANY, _L("Warning")); auto filename = p->plater->get_preview_only_filename();
bool is_cancle = true; auto text = wxString::Format(_L("After completing your operation, %s project will be closed and create a new project."), filename);
confirm_dlg.Bind(EVT_SECONDARY_CHECK_CONFIRM, [this, &is_cancle](wxCommandEvent &e) { MessageDialog dlg(wxGetApp().plater(), text, _L("Warning"),
is_cancle = false; wxOK | wxICON_WARNING);
}); dlg.ShowModal();
confirm_dlg.update_btn_label(_L("Yes"), _L("No")); p->plater->new_project();
auto filename = p->plater->get_preview_only_filename(); return true;
auto text = wxString::Format(_L("After completing your operation, %s project will be closed and create a new project. Do you want to continue?"), filename);
confirm_dlg.update_text(text);
confirm_dlg.on_show();
if (!is_cancle) {
p->plater->new_project();
}
return is_cancle;
} }
return false; return false;
} }
@@ -10291,13 +10284,16 @@ int Plater::new_project(bool skip_confirm, bool silent, const wxString& project_
{ {
bool transfer_preset_changes = false; bool transfer_preset_changes = false;
// BBS: save confirm // BBS: save confirm
auto check = [&transfer_preset_changes](bool yes_or_no) { auto check = [this,&transfer_preset_changes](bool yes_or_no) {
wxString header = _L("Some presets are modified.") + "\n" + wxString header = _L("Some presets are modified.") + "\n" +
(yes_or_no ? _L("You can keep the modified presets to the new project or discard them") : (yes_or_no ? _L("You can keep the modified presets to the new project or discard them") :
_L("You can keep the modified presets to the new project, discard or save changes as new presets.")); _L("You can keep the modified presets to the new project, discard or save changes as new presets."));
int act_buttons = ActionButtons::KEEP | ActionButtons::REMEMBER_CHOISE; int act_buttons = ActionButtons::KEEP | ActionButtons::REMEMBER_CHOISE;
if (!yes_or_no) if (!yes_or_no)
act_buttons |= ActionButtons::SAVE; act_buttons |= ActionButtons::SAVE;
if (m_exported_file) { //.gcode.3mf ignore presets modify
m_exported_file = false;
}
return wxGetApp().check_and_keep_current_preset_changes(_L("Creating a new project"), header, act_buttons, &transfer_preset_changes); return wxGetApp().check_and_keep_current_preset_changes(_L("Creating a new project"), header, act_buttons, &transfer_preset_changes);
}; };
int result; int result;