From 4fef36e04a9070aab135cdaae9a2eb5006936278 Mon Sep 17 00:00:00 2001 From: tao wang Date: Wed, 1 Nov 2023 16:54:58 +0800 Subject: [PATCH] ENH:display msg dialog once jira:[for http error msg] Change-Id: I12e9c155fdb567cac99c35b6feeef650269ba75d --- src/slic3r/GUI/GUI_App.cpp | 24 ++++++++++++++++++------ src/slic3r/GUI/GUI_App.hpp | 1 + 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 288553e9b..f2c51fa46 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -4074,10 +4074,16 @@ void GUI_App::on_http_error(wxCommandEvent &evt) // Version limit if (code == HttpErrorVersionLimited) { - MessageDialog msg_dlg(nullptr, _L("The version of Bambu studio is too low and needs to be updated to the latest version before it can be used normally"), "", wxAPPLY | wxOK); - if (msg_dlg.ShowModal() == wxOK) { - return; + if (!m_show_http_errpr_msgdlg) { + MessageDialog msg_dlg(nullptr, _L("The version of Bambu studio is too low and needs to be updated to the latest version before it can be used normally"), "", wxAPPLY | wxOK); + m_show_http_errpr_msgdlg = true; + auto modal_result = msg_dlg.ShowModal(); + if (modal_result == wxOK || modal_result == wxCLOSE) { + m_show_http_errpr_msgdlg = false; + return; + } } + } // request login @@ -4085,9 +4091,15 @@ void GUI_App::on_http_error(wxCommandEvent &evt) if (m_agent) { if (m_agent->is_user_login()) { this->request_user_logout(); - MessageDialog msg_dlg(nullptr, _L("Login information expired. Please login again."), "", wxAPPLY | wxOK); - if (msg_dlg.ShowModal() == wxOK) { - return; + + if (!m_show_http_errpr_msgdlg) { + MessageDialog msg_dlg(nullptr, _L("Login information expired. Please login again."), "", wxAPPLY | wxOK); + m_show_http_errpr_msgdlg = true; + auto modal_result = msg_dlg.ShowModal(); + if (modal_result == wxOK || modal_result == wxCLOSE) { + m_show_http_errpr_msgdlg = false; + return; + } } } } diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index 9806bc0f4..28d8eb298 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -293,6 +293,7 @@ private: bool m_is_dark_mode{ false }; bool m_adding_script_handler { false }; bool m_side_popup_status{false}; + bool m_show_http_errpr_msgdlg{false}; wxString m_info_dialog_content; HttpServer m_http_server;