ENH:add notification when sending gcode finished

Change-Id: I9a2dac701053591a1c0bd4d8b376ef07b31262f0
This commit is contained in:
tao wang 2022-11-22 15:53:38 +08:00 committed by Lane.Wei
parent df260dd724
commit 00ab44f0a0
4 changed files with 12 additions and 4 deletions

View file

@ -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;
}

View file

@ -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<NotificationManager::ExportFinishedNotification>(data, m_id_provider, m_evt_handler, on_removable, path, dir_path), 0);
set_slicing_progress_hidden();
}

View file

@ -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

View file

@ -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