diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index ae8afabc2..8dd9f0225 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -2558,11 +2558,10 @@ bool GUI_App::on_init_inner() Bind(EVT_SHOW_DIALOG, [this](const wxCommandEvent& evt) { wxString msg = evt.GetString(); InfoDialog dlg(this->mainframe, _L("Info"), msg); + dlg.Bind(wxEVT_DESTROY, [this](auto& e) { + m_info_dialog_content = wxEmptyString; + }); dlg.ShowModal(); - - /*wxString text = evt.GetString(); - Slic3r::GUI::MessageDialog msg_dlg(this->mainframe, text, "", wxAPPLY | wxOK); - msg_dlg.ShowModal();*/ }); } else { @@ -4489,9 +4488,12 @@ std::string GUI_App::format_display_version() void GUI_App::show_dialog(wxString msg) { - wxCommandEvent* evt = new wxCommandEvent(EVT_SHOW_DIALOG); - evt->SetString(msg); - GUI::wxGetApp().QueueEvent(evt); + if (m_info_dialog_content.empty()) { + wxCommandEvent* evt = new wxCommandEvent(EVT_SHOW_DIALOG); + evt->SetString(msg); + GUI::wxGetApp().QueueEvent(evt); + m_info_dialog_content = msg; + } } void GUI_App::reload_settings() diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index 1a7315f08..9f5c6d548 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -292,6 +292,7 @@ private: bool m_is_dark_mode{ false }; bool m_adding_script_handler { false }; bool m_side_popup_status{false}; + wxString m_info_dialog_content; HttpServer m_http_server; boost::thread m_check_network_thread; @@ -308,6 +309,7 @@ public: //explicit GUI_App(EAppMode mode = EAppMode::Editor); ~GUI_App() override; + void show_message_box(std::string msg) { wxMessageBox(msg); } EAppMode get_app_mode() const { return m_app_mode; } Slic3r::DeviceManager* getDeviceManager() { return m_device_manager; } @@ -317,6 +319,7 @@ public: bool is_gcode_viewer() const { return m_app_mode == EAppMode::GCodeViewer; } bool is_recreating_gui() const { return m_is_recreating_gui; } std::string logo_name() const { return is_editor() ? "BambuStudio" : "BambuStudio-gcodeviewer"; } + wxString get_inf_dialog_contect () {return m_info_dialog_content;}; std::vector split_str(std::string src, std::string separator); // To be called after the GUI is fully built up. diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index adbf0f8f9..b88b436e3 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1989,6 +1989,13 @@ struct Plater::priv if (m_select_machine_dlg) m_select_machine_dlg->EndModal(wxID_OK); } + + void enter_prepare_mode() + { + if (m_select_machine_dlg) + m_select_machine_dlg->prepare_mode(); + } + void hide_send_to_printer_dlg() { m_send_to_sdcard_dlg->EndModal(wxID_OK); } void update_preview_bottom_toolbar(); @@ -10854,8 +10861,15 @@ void Plater::send_calibration_job_finished(wxCommandEvent & evt) void Plater::print_job_finished(wxCommandEvent &evt) { - p->hide_select_machine_dlg(); + //start print failed + if (Slic3r::GUI::wxGetApp().get_inf_dialog_contect().empty()) { + p->hide_select_machine_dlg(); + } + else { + p->enter_prepare_mode(); + } + Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); if (!dev) return;