From cf5f7b778dad1e8fe6a41b44e98a1ff3d69bd03c Mon Sep 17 00:00:00 2001 From: Kris Austin Date: Sat, 10 Oct 2026 07:30:17 -0500 Subject: [PATCH] Show OK instead of Yes on notice dialogs (#16332) Several warning and info dialogs passed wxYES as their only button, so the only choice was "Yes" even though nothing is asked. Use wxOK. None of the callers act on wxID_YES. They ignore the result, except Field.cpp, which only checks that it's nonzero, and every button id is. wxYES_DEFAULT is 0, so dropping it next to wxOK changes nothing. Also drop the empty `if (ShowModal() == wxID_YES) {}` in Plater::priv::load_files. --- src/slic3r/GUI/CreatePresetsDialog.cpp | 58 ++++++++++----------- src/slic3r/GUI/ExportPresetBundleDialog.cpp | 12 ++--- src/slic3r/GUI/Field.cpp | 2 +- src/slic3r/GUI/Plater.cpp | 4 +- src/slic3r/GUI/StatusPanel.cpp | 2 +- 5 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/slic3r/GUI/CreatePresetsDialog.cpp b/src/slic3r/GUI/CreatePresetsDialog.cpp index 1ae4e3b81b..12d966fbc5 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.cpp +++ b/src/slic3r/GUI/CreatePresetsDialog.cpp @@ -1112,7 +1112,7 @@ wxWindow *CreateFilamentPresetDialog::create_dialog_buttons() if (!m_can_not_find_vendor_checkbox->GetValue()) { if (_L("Select Vendor") == vendor_str) { MessageDialog dlg(this, _L("Vendor is not selected; please reselect vendor."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), - wxYES | wxYES_DEFAULT | wxCENTRE); + wxOK | wxCENTRE); dlg.ShowModal(); return; } else { @@ -1121,14 +1121,14 @@ wxWindow *CreateFilamentPresetDialog::create_dialog_buttons() } else { if (m_filament_custom_vendor_input->GetTextCtrl()->GetValue().empty()) { MessageDialog dlg(this, _L("Custom vendor missing; please input custom vendor."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), - wxYES | wxYES_DEFAULT | wxCENTRE); + wxOK | wxCENTRE); dlg.ShowModal(); return; } else { vendor_name = into_u8(m_filament_custom_vendor_input->GetTextCtrl()->GetValue()); if (vendor_name == "Bambu" || vendor_name == "Generic") { MessageDialog dlg(this, _L("\"Bambu\" or \"Generic\" cannot be used as a Vendor for custom filaments."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), - wxYES | wxYES_DEFAULT | wxCENTRE); + wxOK | wxCENTRE); dlg.ShowModal(); return; } @@ -1139,7 +1139,7 @@ wxWindow *CreateFilamentPresetDialog::create_dialog_buttons() wxString type_str = m_filament_type_combobox->GetLabel(); std::string type_name; if (_L("Select Type") == type_str) { - MessageDialog dlg(this, _L("Filament type is not selected, please reselect type."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE); + MessageDialog dlg(this, _L("Filament type is not selected, please reselect type."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxOK | wxCENTRE); dlg.ShowModal(); return; } else { @@ -1150,7 +1150,7 @@ wxWindow *CreateFilamentPresetDialog::create_dialog_buttons() std::string serial_name; if (serial_str.empty()) { MessageDialog dlg(this, _L("Filament serial missing; please input serial."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), - wxYES | wxYES_DEFAULT | wxCENTRE); + wxOK | wxCENTRE); dlg.ShowModal(); return; } else { @@ -1161,7 +1161,7 @@ wxWindow *CreateFilamentPresetDialog::create_dialog_buttons() if (vendor_name.empty() || serial_name.empty()) { MessageDialog dlg(this, _L("There may be disallowed characters in the vendor or serial input of the filament. Please delete and re-enter."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), - wxYES | wxYES_DEFAULT | wxCENTRE); + wxOK | wxCENTRE); dlg.ShowModal(); return; } @@ -1169,20 +1169,20 @@ wxWindow *CreateFilamentPresetDialog::create_dialog_buttons() boost::algorithm::trim(serial_name); if (vendor_name.empty() || serial_name.empty()) { MessageDialog dlg(this, _L("All inputs in the custom vendor or serial are spaces. Please re-enter."), - wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE); + wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxOK | wxCENTRE); dlg.ShowModal(); return; } if (m_can_not_find_vendor_checkbox->GetValue() && str_is_all_digit(vendor_name)) { MessageDialog dlg(this, _L("The vendor cannot be a number; please re-enter."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), - wxYES | wxYES_DEFAULT | wxCENTRE); + wxOK | wxCENTRE); dlg.ShowModal(); return; } if (!is_check_box_selected()) { MessageDialog dlg(this, _L("You have not selected a printer or preset yet. Please select at least one."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), - wxYES | wxYES_DEFAULT | wxCENTRE); + wxOK | wxCENTRE); dlg.ShowModal(); return; } @@ -1818,7 +1818,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_printer_item(wxWindow *parent) m_select_model->SetLabelColor(*wxBLACK); } } else { - MessageDialog dlg(this, _L("The model was not found; please reselect vendor."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE); + MessageDialog dlg(this, _L("The model was not found; please reselect vendor."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxOK | wxCENTRE); dlg.ShowModal(); } @@ -2818,14 +2818,14 @@ wxWindow *CreatePrinterPresetDialog::create_page2_dialog_buttons(wxWindow *paren // Confirm if the printer preset exists if (!m_printer_preset) { MessageDialog dlg(this, _L("You have not yet chosen which printer preset to create based on. Please choose the vendor and model of the printer"), - wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE); + wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxOK | wxCENTRE); dlg.ShowModal(); return; } if (!save_printable_area_config(m_printer_preset)) { MessageDialog dlg(this, _L("You have entered a disallowed character in the printable area section on the first page. Please use only numbers."), - wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE); + wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxOK | wxCENTRE); dlg.ShowModal(); show_page1(); return; @@ -2865,7 +2865,7 @@ wxWindow *CreatePrinterPresetDialog::create_page2_dialog_buttons(wxWindow *paren } } if (selected_filament_presets.empty() && !filament_preset_is_exist) { - MessageDialog dlg(this, _L("You need to select at least one filament preset."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE); + MessageDialog dlg(this, _L("You need to select at least one filament preset."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxOK | wxCENTRE); dlg.ShowModal(); return; } @@ -2880,7 +2880,7 @@ wxWindow *CreatePrinterPresetDialog::create_page2_dialog_buttons(wxWindow *paren } } if (selected_process_presets.empty() && !process_preset_is_exist) { - MessageDialog dlg(this, _L("You need to select at least one process preset."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE); + MessageDialog dlg(this, _L("You need to select at least one process preset."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxOK | wxCENTRE); dlg.ShowModal(); return; } @@ -3125,7 +3125,7 @@ void CreatePrinterPresetDialog::on_select_printer_model(wxCommandEvent &e) wxArrayString printer_preset_model = printer_preset_sort_with_nozzle_diameter(m_printer_preset_vendor_selected, nozzle); if (printer_preset_model.size() == 0) { - MessageDialog dlg(this, _L("Current vendor has no models, please reselect."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE); + MessageDialog dlg(this, _L("Current vendor has no models, please reselect."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxOK | wxCENTRE); dlg.ShowModal(); return; } @@ -3386,7 +3386,7 @@ bool CreatePrinterPresetDialog::validate_input_valid() std::string model_name = get_printer_model(); if ((vendor_name.empty() || model_name.empty())) { MessageDialog dlg(this, _L("You have not selected the vendor and model or input the custom vendor and model."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), - wxYES | wxYES_DEFAULT | wxCENTRE); + wxOK | wxCENTRE); dlg.ShowModal(); return false; } @@ -3395,7 +3395,7 @@ bool CreatePrinterPresetDialog::validate_input_valid() model_name = remove_special_key(model_name); if (vendor_name.empty() || model_name.empty()) { MessageDialog dlg(this, _L("There may be escape characters in the custom printer vendor or model. Please delete and re-enter."), - wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE); + wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxOK | wxCENTRE); dlg.ShowModal(); return false; } @@ -3403,13 +3403,13 @@ bool CreatePrinterPresetDialog::validate_input_valid() boost::algorithm::trim(model_name); if (vendor_name.empty() || model_name.empty()) { MessageDialog dlg(this, _L("All inputs in the custom printer vendor or model are spaces. Please re-enter."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), - wxYES | wxYES_DEFAULT | wxCENTRE); + wxOK | wxCENTRE); dlg.ShowModal(); return false; } if (check_printable_area() == false) { - MessageDialog dlg(this, _L("Please check bed printable shape and origin input."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE); + MessageDialog dlg(this, _L("Please check bed printable shape and origin input."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxOK | wxCENTRE); dlg.ShowModal(); return false; } @@ -3417,7 +3417,7 @@ bool CreatePrinterPresetDialog::validate_input_valid() wxString printer_name = m_select_printer->GetStringSelection(); if (printer_name.empty()) { MessageDialog dlg(this, _L("You have not yet selected the printer to replace the nozzle for; please choose a printer."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), - wxYES | wxYES_DEFAULT | wxCENTRE); + wxOK | wxCENTRE); dlg.ShowModal(); return false; } @@ -3682,22 +3682,22 @@ void ExportConfigsDialog::show_export_result(const ExportCase &export_case) MessageDialog *msg_dlg = nullptr; switch (export_case) { case ExportCase::INITIALIZE_FAIL: - msg_dlg = new MessageDialog(this, _L("initialize fail"), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE); + msg_dlg = new MessageDialog(this, _L("initialize fail"), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxOK | wxCENTRE); break; case ExportCase::ADD_FILE_FAIL: - msg_dlg = new MessageDialog(this, _L("add file fail"), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE); + msg_dlg = new MessageDialog(this, _L("add file fail"), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxOK | wxCENTRE); break; case ExportCase::ADD_BUNDLE_STRUCTURE_FAIL: - msg_dlg = new MessageDialog(this, _L("add bundle structure file fail"), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE); + msg_dlg = new MessageDialog(this, _L("add bundle structure file fail"), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxOK | wxCENTRE); break; case ExportCase::FINALIZE_FAIL: - msg_dlg = new MessageDialog(this, _L("finalize fail"), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE); + msg_dlg = new MessageDialog(this, _L("finalize fail"), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxOK | wxCENTRE); break; case ExportCase::OPEN_ZIP_WRITTEN_FILE: - msg_dlg = new MessageDialog(this, _L("open zip written fail"), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE); + msg_dlg = new MessageDialog(this, _L("open zip written fail"), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxOK | wxCENTRE); break; case ExportCase::EXPORT_SUCCESS: - msg_dlg = new MessageDialog(this, _L("Export successful"), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE); + msg_dlg = new MessageDialog(this, _L("Export successful"), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxOK | wxCENTRE); break; } @@ -3768,7 +3768,7 @@ std::string ExportConfigsDialog::initial_file_name(const wxString &path, const s MessageDialog dlg(this, wxString::Format(_L("The file: %s\nmay have been opened by another program.\nPlease close it and try again."), encode_path(printer_export_path.string().c_str())), - wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE); + wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxOK | wxCENTRE); dlg.ShowModal(); return "initial_failed"; } @@ -4324,7 +4324,7 @@ wxWindow *ExportConfigsDialog::create_dialog_buttons(wxWindow* parent) dlg_btns->GetOK()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { if (!has_check_box_selected()) { MessageDialog dlg(this, _L("Please select at least one printer or filament."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), - wxYES | wxYES_DEFAULT | wxCENTRE); + wxOK | wxCENTRE); dlg.ShowModal(); return; } @@ -5042,7 +5042,7 @@ wxWindow *CreatePresetForPrinterDialog::create_dialog_buttons() } else { BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "filament choice not find filament preset and choice is:" << filament_preset_name; MessageDialog dlg(this, _L("The filament choice not find filament preset, please reselect it"), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), - wxYES | wxYES_DEFAULT | wxCENTRE); + wxOK | wxCENTRE); dlg.ShowModal(); return; } diff --git a/src/slic3r/GUI/ExportPresetBundleDialog.cpp b/src/slic3r/GUI/ExportPresetBundleDialog.cpp index 9af3e3c7bc..631fe132af 100644 --- a/src/slic3r/GUI/ExportPresetBundleDialog.cpp +++ b/src/slic3r/GUI/ExportPresetBundleDialog.cpp @@ -477,27 +477,27 @@ void ExportPresetBundleDialog::show_export_result(const ExportCase& export_case) switch (export_case) { case ExportCase::INITIALIZE_FAIL: msg_dlg = new MessageDialog(this, _L("initialize fail"), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), - wxYES | wxYES_DEFAULT | wxCENTRE); + wxOK | wxCENTRE); break; case ExportCase::ADD_FILE_FAIL: msg_dlg = new MessageDialog(this, _L("add file fail"), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), - wxYES | wxYES_DEFAULT | wxCENTRE); + wxOK | wxCENTRE); break; case ExportCase::ADD_BUNDLE_STRUCTURE_FAIL: msg_dlg = new MessageDialog(this, _L("add bundle structure file fail"), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), - wxYES | wxYES_DEFAULT | wxCENTRE); + wxOK | wxCENTRE); break; case ExportCase::FINALIZE_FAIL: msg_dlg = new MessageDialog(this, _L("finalize fail"), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), - wxYES | wxYES_DEFAULT | wxCENTRE); + wxOK | wxCENTRE); break; case ExportCase::OPEN_ZIP_WRITTEN_FILE: msg_dlg = new MessageDialog(this, _L("open zip written fail"), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), - wxYES | wxYES_DEFAULT | wxCENTRE); + wxOK | wxCENTRE); break; case ExportCase::EXPORT_SUCCESS: msg_dlg = new MessageDialog(this, _L("Export successful"), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), - wxYES | wxYES_DEFAULT | wxCENTRE); + wxOK | wxCENTRE); break; } diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index fda86e854d..c7d98bfd6f 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -559,7 +559,7 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true else if(m_opt_id == "filament_retraction_distances_when_cut" || opt_key_without_idx == "retraction_distances_when_cut"){ if (m_value.empty() || boost::any_cast(m_value) != val) { wxString msg_text = format_wxstr(_L("Value %s is out of range. The valid range is from %d to %d."), str, m_opt.min, m_opt.max); - WarningDialog dialog(m_parent, msg_text, _L("Parameter validation") + ": " + m_opt_id, wxYES); + WarningDialog dialog(m_parent, msg_text, _L("Parameter validation") + ": " + m_opt_id, wxOK); if (dialog.ShowModal()) { if (m_value.empty()) { if (m_opt.min > val) val = m_opt.min; diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index f1e9631119..d2c5fe8de3 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -10279,8 +10279,8 @@ std::vector Plater::priv::load_files(const std::vector& input_ "Enable \"CAD feature (experimental)\" in Preferences and restart to see and edit it; " "it is kept when the project is saved.") : _L("The file does not contain any geometry data."); - MessageDialog msg(wxGetApp().mainframe, text, _L("Warning"), wxYES | wxICON_WARNING); - if (msg.ShowModal() == wxID_YES) {} + MessageDialog msg(wxGetApp().mainframe, text, _L("Warning"), wxOK | wxICON_WARNING); + msg.ShowModal(); } } q->schedule_background_process(true); diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index c720494dff..1f2779b02b 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -4817,7 +4817,7 @@ void StatusPanel::on_ams_refresh_rfid(wxCommandEvent &event) if (has_filament_at_extruder) { MessageDialog msg_dlg(nullptr, _L("Cannot read filament info: the filament is loaded to the tool head. Please unload the filament and try again."), wxEmptyString, - wxICON_WARNING | wxYES); + wxICON_WARNING | wxOK); msg_dlg.ShowModal(); return; }