FIX: use wxMessageDialog as warning in MAC

jira: [STUDIO-10386]
Change-Id: Ic8cc6d09f2eba41ec8cfebf239eb6bd78dd3844a
(cherry picked from commit 1537f575927f8d0f0e2658f900296344deb6682c)
(cherry picked from commit a856c7cc62636a4897b0e473034579e223808a7b)
This commit is contained in:
xin.zhang 2025-03-13 10:22:05 +08:00 committed by Noisyfox
parent 2c365fba63
commit 489543313c
3 changed files with 16 additions and 22 deletions

View file

@ -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<AMSinfo> 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);