From 1618aef2fa7e7c270423dc7011b8219ac78be7e5 Mon Sep 17 00:00:00 2001 From: Sergey Alirzaev Date: Wed, 1 May 2019 06:37:55 +0300 Subject: [PATCH] Show estimated printing time after exporting gcode fixes https://github.com/slic3r/Slic3r/issues/4758 --- lib/Slic3r/GUI/Plater.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 1218a25b4..2959cc4a6 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -599,6 +599,7 @@ sub new { my @info = ( fil => "Used Filament", cost => "Cost", + tim => "Time", ); while (my $field = shift @info) { my $label = shift @info; @@ -2282,6 +2283,17 @@ sub on_export_completed { } else { $message = "Export failed"; } + # Estimate print duration + { + my $estimator = Slic3r::GCode::TimeEstimator->new; + $estimator->parse_file($self->{export_gcode_output_file}); + my $time = $estimator->time; + $self->{print_info_tim}->SetLabel(sprintf( + "%d minutes and %d seconds", + int($time / 60), + int($time % 60), + )); + } $self->{export_gcode_output_file} = undef; $self->statusbar->SetStatusText($message); wxTheApp->notify($message);