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

jira: STUDIO-9821
Change-Id: I6c9d4e5231d2c7a9b9629003bdffab1c523fe15f
This commit is contained in:
zhou.xu 2025-01-23 10:28:05 +08:00 committed by lane.wei
parent 9eee96ead7
commit 22e3f08992
1 changed files with 11 additions and 17 deletions

View File

@ -2693,22 +2693,13 @@ void Sidebar::add_custom_filament(wxColour new_col) {
bool Sidebar::is_new_project_in_gcode3mf()
{
if (p->plater->using_exported_file()) {
ConfirmBeforeSendDialog confirm_dlg(this, wxID_ANY, _L("Warning"));
bool is_cancle = true;
confirm_dlg.Bind(EVT_SECONDARY_CHECK_CONFIRM, [this, &is_cancle](wxCommandEvent &e) {
is_cancle = false;
});
confirm_dlg.update_btn_label(_L("Yes"), _L("No"));
auto filename = p->plater->get_preview_only_filename();
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) {
this->printer_combox()->update();
} else {
p->plater->new_project();
}
return is_cancle;
auto filename = p->plater->get_preview_only_filename();
auto text = wxString::Format(_L("After completing your operation, %s project will be closed and create a new project."), filename);
MessageDialog dlg(wxGetApp().plater(), text, _L("Warning"),
wxOK | wxICON_WARNING);
dlg.ShowModal();
p->plater->new_project();
return true;
}
return false;
}
@ -10529,7 +10520,7 @@ int Plater::new_project(bool skip_confirm, bool silent, const wxString &project_
{
bool transfer_preset_changes = false;
// 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" +
(yes_or_no ? _L("You can keep the modified presets to the new project or discard them") :
_L("You can keep the modified presets for the new project, discard or save changes as new presets."));
@ -10537,6 +10528,9 @@ int Plater::new_project(bool skip_confirm, bool silent, const wxString &project_
int act_buttons = ab::KEEP | ab::REMEMBER_CHOISE;
if (!yes_or_no)
act_buttons |= ab::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);
};
int result;