From 489543313cea2b37df67b2f9ba8eb3040b82f536 Mon Sep 17 00:00:00 2001 From: "xin.zhang" Date: Thu, 13 Mar 2025 10:22:05 +0800 Subject: [PATCH] FIX: use wxMessageDialog as warning in MAC jira: [STUDIO-10386] Change-Id: Ic8cc6d09f2eba41ec8cfebf239eb6bd78dd3844a (cherry picked from commit 1537f575927f8d0f0e2658f900296344deb6682c) (cherry picked from commit a856c7cc62636a4897b0e473034579e223808a7b) --- src/slic3r/GUI/StatusPanel.cpp | 36 ++++++++++++---------------- src/slic3r/GUI/StatusPanel.hpp | 1 - src/slic3r/GUI/Widgets/TempInput.hpp | 1 + 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index 8fdce2352e..62a6905466 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -2258,29 +2258,21 @@ StatusPanel::StatusPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, co Bind(wxCUSTOMEVT_SET_TEMP_FINISH, [this](wxCommandEvent e) { int id = e.GetInt(); if (id == m_tempCtrl_bed->GetType()) { - m_tempCtrl_bed->SetOnChanging(); on_set_bed_temp(); - m_tempCtrl_bed->ReSetOnChanging(); - } else if (id == m_tempCtrl_nozzle->GetType()) { - if (e.GetString() == wxString::Format("%d", MAIN_NOZZLE_ID)) { - m_tempCtrl_nozzle->SetOnChanging(); on_set_nozzle_temp(MAIN_NOZZLE_ID); - m_tempCtrl_nozzle->ReSetOnChanging(); } else if (e.GetString() == wxString::Format("%d", DEPUTY_NOZZLE_ID)) { - m_tempCtrl_nozzle_deputy->SetOnChanging(); on_set_nozzle_temp(DEPUTY_NOZZLE_ID); - m_tempCtrl_nozzle_deputy->ReSetOnChanging(); } else { - m_tempCtrl_nozzle->SetOnChanging(); on_set_nozzle_temp(UNIQUE_NOZZLE_ID);//there is only one nozzle - m_tempCtrl_nozzle->ReSetOnChanging(); } } else if (id == m_tempCtrl_chamber->GetType()) { - m_tempCtrl_chamber->SetOnChanging(); - on_set_chamber_temp(); - m_tempCtrl_chamber->ReSetOnChanging(); + if (!m_tempCtrl_chamber->IsOnChanging()) { + m_tempCtrl_chamber->SetOnChanging(); + on_set_chamber_temp(); + m_tempCtrl_chamber->ReSetOnChanging(); + } } }); @@ -3256,6 +3248,7 @@ void StatusPanel::update_ams(MachineObject *obj) ams_info.push_back(info); } } + std::vector ext_info; ext_info.clear(); for (auto slot : obj->vt_slot) { @@ -4125,7 +4118,6 @@ void StatusPanel::on_set_nozzle_temp(int nozzle_id) void StatusPanel::on_set_chamber_temp() { if (!obj) {return;} - if (champer_switch_head_dlg && champer_switch_head_dlg->IsShown()) { return; } /*STUDIO-10386 champer_switch_head_dlg->ShowModal() could wake up another wxCUSTOMEVT_SET_TEMP_FINISH*/ wxString str = m_tempCtrl_chamber->GetTextCtrl()->GetValue(); try { @@ -4140,13 +4132,15 @@ void StatusPanel::on_set_chamber_temp() if (chamber_temp >= obj->chamber_temp_switch_heat) { - if (!champer_switch_head_dlg) - { - champer_switch_head_dlg = new MessageDialog(this, _L("If the chamber temperature exceeds 40\u2103, the system will automatically switch to heating mode. Please confirm whether to switch."), - wxEmptyString, wxICON_WARNING | wxOK | wxCANCEL); - } - - if (champer_switch_head_dlg->ShowModal() != wxID_OK) { return; } +#ifndef __APPLE__ + MessageDialog champer_switch_head_dlg(this, _L("If the chamber temperature exceeds 40\u2103, the system will automatically switch to heating mode. " + "Please confirm whether to switch."), wxEmptyString, wxICON_WARNING | wxOK | wxCANCEL); +#else + /*STUDIO-10386 MessageDialog here may cause block in macOS, use wxMessageDialog*/ + wxMessageDialog champer_switch_head_dlg(this, _L("If the chamber temperature exceeds 40\u2103, the system will automatically switch to heating mode. " + "Please confirm whether to switch."), wxEmptyString, wxICON_WARNING | wxOK | wxCANCEL); +#endif + if (champer_switch_head_dlg.ShowModal() != wxID_OK) { return; } } obj->command_set_chamber(chamber_temp); diff --git a/src/slic3r/GUI/StatusPanel.hpp b/src/slic3r/GUI/StatusPanel.hpp index fd450f286c..7d4d862dc3 100644 --- a/src/slic3r/GUI/StatusPanel.hpp +++ b/src/slic3r/GUI/StatusPanel.hpp @@ -605,7 +605,6 @@ protected: SecondaryCheckDialog* con_load_dlg = nullptr; SecondaryCheckDialog* ctrl_e_hint_dlg = nullptr; SecondaryCheckDialog* sdcard_hint_dlg = nullptr; - MessageDialog* champer_switch_head_dlg = nullptr; FanControlPopupNew* m_fan_control_popup{nullptr}; diff --git a/src/slic3r/GUI/Widgets/TempInput.hpp b/src/slic3r/GUI/Widgets/TempInput.hpp index e9e2dd46b4..55d5ffaa6e 100644 --- a/src/slic3r/GUI/Widgets/TempInput.hpp +++ b/src/slic3r/GUI/Widgets/TempInput.hpp @@ -118,6 +118,7 @@ public: wxTextCtrl const *GetTextCtrl() const { return text_ctrl; } + bool IsOnChanging() const { return m_on_changing; } void SetOnChanging() { m_on_changing = true; } void ReSetOnChanging() { m_on_changing = false; }