Show estimated printing time after exporting gcode

fixes https://github.com/slic3r/Slic3r/issues/4758
This commit is contained in:
Sergey Alirzaev 2019-05-01 06:37:55 +03:00 committed by Joseph Lenox
parent 233320384e
commit 1618aef2fa

View File

@ -599,6 +599,7 @@ sub new {
my @info = ( my @info = (
fil => "Used Filament", fil => "Used Filament",
cost => "Cost", cost => "Cost",
tim => "Time",
); );
while (my $field = shift @info) { while (my $field = shift @info) {
my $label = shift @info; my $label = shift @info;
@ -2282,6 +2283,17 @@ sub on_export_completed {
} else { } else {
$message = "Export failed"; $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->{export_gcode_output_file} = undef;
$self->statusbar->SetStatusText($message); $self->statusbar->SetStatusText($message);
wxTheApp->notify($message); wxTheApp->notify($message);