From 31f16dc42ecf5cc4c8e2c81115c39f8429778a89 Mon Sep 17 00:00:00 2001 From: "zhou.xu" Date: Fri, 17 Jan 2025 21:08:29 +0800 Subject: [PATCH] FIX:pop error MessageDialog jira: STUDIO-9955 Change-Id: I9ce6a68baaa7fc7548817a37c042091ae4b7e73a (cherry picked from commit 3a6784342a8f965c151e9f8e3cdbc1f7983e6f80) --- src/slic3r/GUI/Plater.cpp | 19 ++++++++++++------- src/slic3r/GUI/Plater.hpp | 5 +++-- src/slic3r/GUI/SyncAmsInfoDialog.cpp | 11 +++++++++-- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index a53734ed24..5339310ce8 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -13143,7 +13143,7 @@ Preset *get_printer_preset(MachineObject *obj) return printer_preset; } -bool check_printer_initialized(MachineObject *obj) +bool check_printer_initialized(MachineObject *obj,bool only_warning) { if (!obj) return false; @@ -13163,12 +13163,17 @@ bool check_printer_initialized(MachineObject *obj) } if (!has_been_initialized) { - MessageDialog dlg(wxGetApp().plater(), _L("The nozzle type is not set. Please set the nozzle and try again."), _L("Warning"), wxOK | wxICON_WARNING); - dlg.ShowModal(); + if (!only_warning) { + MessageDialog dlg(wxGetApp().plater(), _L("The nozzle type is not set. Please set the nozzle and try again."), _L("Warning"), wxOK | wxICON_WARNING); + dlg.ShowModal(); - PrinterPartsDialog* print_parts_dlg = new PrinterPartsDialog(nullptr); - print_parts_dlg->update_machine_obj(obj); - print_parts_dlg->ShowModal(); + PrinterPartsDialog *print_parts_dlg = new PrinterPartsDialog(nullptr); + print_parts_dlg->update_machine_obj(obj); + print_parts_dlg->ShowModal(); + } else { + MessageDialog dlg(wxGetApp().plater(), _L("Printer not connected. Please connect or choose a printer on the Device page and try again."), _L("Warning"), wxOK | wxICON_WARNING); + dlg.ShowModal(); + } return false; } return true; @@ -15155,7 +15160,7 @@ bool Plater::is_same_printer_for_connected_and_selected() if (obj == nullptr) { return false; } - if (!check_printer_initialized(obj)) + if (!check_printer_initialized(obj,true)) return false; std::string machine_print_name = obj->printer_type; PresetBundle *preset_bundle = wxGetApp().preset_bundle; diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 4181b0a813..f05358613b 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -896,8 +896,9 @@ std::vector get_min_flush_volumes(const DynamicPrintConfig &full_config, si Preset *get_printer_preset(MachineObject *obj); wxArrayString get_all_camera_view_type(); -bool check_printer_initialized(MachineObject* obj); - } // namespace GUI + +bool check_printer_initialized(MachineObject *obj, bool only_warning = false); +} // namespace GUI } // namespace Slic3r #endif \ No newline at end of file diff --git a/src/slic3r/GUI/SyncAmsInfoDialog.cpp b/src/slic3r/GUI/SyncAmsInfoDialog.cpp index adbe5c5400..967be925b6 100644 --- a/src/slic3r/GUI/SyncAmsInfoDialog.cpp +++ b/src/slic3r/GUI/SyncAmsInfoDialog.cpp @@ -4414,7 +4414,11 @@ SyncNozzleAndAmsDialog::SyncNozzleAndAmsDialog(wxWindow *parent, InputInfo &inpu SyncNozzleAndAmsDialog::~SyncNozzleAndAmsDialog() {} -void SyncNozzleAndAmsDialog::on_dpi_changed(const wxRect &suggested_rect) {} +void SyncNozzleAndAmsDialog::on_dpi_changed(const wxRect &suggested_rect) +{ + m_button_ok->Rescale(); + m_button_cancel->Rescale(); +} void SyncNozzleAndAmsDialog::deal_ok() { //SyncAmsInfoDialog::SyncInfo temp_info; //temp_info.connected_printer = true; @@ -4507,7 +4511,10 @@ FinishSyncAmsDialog::FinishSyncAmsDialog(wxWindow *parent, InputInfo &input_info wxGetApp().UpdateFrameDarkUI(this); } FinishSyncAmsDialog::~FinishSyncAmsDialog() {} -void FinishSyncAmsDialog::on_dpi_changed(const wxRect &suggested_rect) {} +void FinishSyncAmsDialog::on_dpi_changed(const wxRect &suggested_rect) +{ + m_button_ok->Rescale(); +} void FinishSyncAmsDialog::deal_ok() { on_hide(); } void FinishSyncAmsDialog::deal_cancel() {} void FinishSyncAmsDialog::on_hide()