mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-29 00:21:56 -05:00
Let OrcaSlicer Exit After a Device Warning Dialog Was Shown (#16764)
wx leaves the main loop only when no other top-level window exists, hidden ones included. The unsupported-control and chamber temperature warnings were parentless frames that are hidden, never destroyed, and the printer parts dialog was heap-allocated without being destroyed, so after any of them had been shown the process stayed alive once the main window closed. Parent the warnings to the main frame and put the parts dialog on the stack.
This commit is contained in:
1 parent
5b39df5723
commit
04a9aecf01
2 files changed
+9
-5
No files matched your search
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "GUI_App.hpp"
|
||||
#include "DeviceErrorDialog.hpp"
|
||||
#include "MainFrame.hpp"
|
||||
#include "Plater.hpp"
|
||||
#include "ReleaseNote.hpp"
|
||||
#include <string>
|
||||
@@ -4751,7 +4752,9 @@ int MachineObject::parse_json(std::string tunnel, std::string payload, bool key_
|
||||
void MachineObject::set_ctt_dlg( wxString text){
|
||||
if (!m_set_ctt_dlg) {
|
||||
m_set_ctt_dlg = true;
|
||||
auto print_error_dlg = new GUI::SecondaryCheckDialog(nullptr, wxID_ANY, _L("Warning"), GUI::SecondaryCheckDialog::VisibleButtons::ONLY_CONFIRM); // ORCA VisibleButtons instead ButtonStyle
|
||||
// Parented so it is destroyed with the main frame: a parentless top-level window,
|
||||
// even hidden, keeps wx from leaving the event loop on exit.
|
||||
auto print_error_dlg = new GUI::SecondaryCheckDialog(GUI::wxGetApp().mainframe, wxID_ANY, _L("Warning"), GUI::SecondaryCheckDialog::VisibleButtons::ONLY_CONFIRM); // ORCA VisibleButtons instead ButtonStyle
|
||||
print_error_dlg->update_text(text);
|
||||
print_error_dlg->Bind(wxEVT_SHOW, [this](auto& e) {
|
||||
if (!e.IsShown()) {
|
||||
@@ -4786,7 +4789,8 @@ void MachineObject::show_unsupported_dlg(int code)
|
||||
// note: constructed directly rather than through CallAfter because every publish_json caller
|
||||
// is on the UI thread - clicks come from wx handlers, and the agent marshals its own push
|
||||
// callbacks back to main before parse_json runs. set_ctt_dlg relies on the same property.
|
||||
auto unsupported_dlg = new GUI::SecondaryCheckDialog(nullptr, wxID_ANY, _L("Warning"),
|
||||
// Parented for the same reason as in set_ctt_dlg.
|
||||
auto unsupported_dlg = new GUI::SecondaryCheckDialog(GUI::wxGetApp().mainframe, wxID_ANY, _L("Warning"),
|
||||
GUI::SecondaryCheckDialog::VisibleButtons::ONLY_CONFIRM);
|
||||
unsupported_dlg->update_text(text);
|
||||
unsupported_dlg->Bind(wxEVT_SHOW, [this](auto& e) {
|
||||
|
||||
Reference in new issue
Block a user