From 00ab44f0a0508dd67f4af29990b0abf053685b7d Mon Sep 17 00:00:00 2001 From: tao wang Date: Tue, 22 Nov 2022 15:53:38 +0800 Subject: [PATCH] ENH:add notification when sending gcode finished Change-Id: I9a2dac701053591a1c0bd4d8b376ef07b31262f0 --- src/slic3r/GUI/Jobs/SendJob.cpp | 2 +- src/slic3r/GUI/NotificationManager.cpp | 4 ++-- src/slic3r/GUI/Plater.cpp | 9 ++++++++- src/slic3r/GUI/Plater.hpp | 1 + 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/Jobs/SendJob.cpp b/src/slic3r/GUI/Jobs/SendJob.cpp index 9359dc5c6..dcb1feee0 100644 --- a/src/slic3r/GUI/Jobs/SendJob.cpp +++ b/src/slic3r/GUI/Jobs/SendJob.cpp @@ -307,7 +307,7 @@ void SendJob::process() BOOST_LOG_TRIVIAL(error) << "send_job: send ok."; //m_success_fun(); wxCommandEvent* evt = new wxCommandEvent(m_print_job_completed_id); - evt->SetString(m_dev_id); + evt->SetString(params.project_name); wxQueueEvent(m_plater, evt); m_job_finished = true; } diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp index 9694ec50f..17262c843 100644 --- a/src/slic3r/GUI/NotificationManager.cpp +++ b/src/slic3r/GUI/NotificationManager.cpp @@ -799,7 +799,7 @@ void NotificationManager::ExportFinishedNotification::render_text(ImGuiWrapper& ImGui::SetCursorPosY(starting_y + i * shift_y); imgui.text(line.c_str()); //hyperlink text - if ( i == 0 && !m_eject_pending) { + if ( i == 0 && !m_eject_pending && !m_export_dir_path.empty()) { render_hypertext(imgui, x_offset + ImGui::CalcTextSize(line.c_str()).x + ImGui::CalcTextSize(" ").x, starting_y, _u8L("Open Folder.")); } } @@ -1783,7 +1783,7 @@ void NotificationManager::set_simplify_suggestion_multiline(const ObjectID oid, void NotificationManager::push_exporting_finished_notification(const std::string& path, const std::string& dir_path, bool on_removable) { close_notification_of_type(NotificationType::ExportFinished); - NotificationData data{ NotificationType::ExportFinished, NotificationLevel::RegularNotificationLevel, on_removable ? 0 : 20, _u8L("Export ok.") + "\n" + path }; + NotificationData data{ NotificationType::ExportFinished, NotificationLevel::RegularNotificationLevel, on_removable ? 0 : 20, _u8L("Export successfully.") + "\n" + path }; push_notification_data(std::make_unique(data, m_id_provider, m_evt_handler, on_removable, path, dir_path), 0); set_slicing_progress_hidden(); } diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 8f7b66b3e..90ec0718d 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -8869,6 +8869,12 @@ void Plater::export_gcode_3mf(bool export_all) } } +void Plater::send_gcode_finish(wxString name) +{ + wxString out_str = wxString::Format(_L("The file %s has been sent to the printer's storage space and can be viewed on the printer."), name); + p->notification_manager->push_exporting_finished_notification(out_str.ToStdString(), "", false); +} + void Plater::export_core_3mf() { wxString path = p->get_export_file(FT_3MF); @@ -9572,8 +9578,9 @@ void Plater::send_job_finished(wxCommandEvent& evt) { Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); if (!dev) return; - dev->set_selected_machine(evt.GetString().ToStdString()); + //dev->set_selected_machine(evt.GetString().ToStdString()); + send_gcode_finish(evt.GetString()); p->hide_send_to_printer_dlg(); //p->main_frame->request_select_tab(MainFrame::TabPosition::tpMonitor); ////jump to monitor and select device status panel diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 6f7e63789..4255ce239 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -306,6 +306,7 @@ public: void send_to_printer(); void export_gcode(bool prefer_removable); void export_gcode_3mf(bool export_all = false); + void send_gcode_finish(wxString name); void export_core_3mf(); void export_stl(bool extended = false, bool selection_only = false); //BBS: remove amf