From d889639d49adfd6d08a6ecc158871e56580fe91e Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci <aar@cpan.org> Date: Fri, 4 May 2012 13:00:34 +0200 Subject: [PATCH] Use the embedded progress bar for feedback about slicing --- lib/Slic3r/GUI/Plater.pm | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 3c555ec05..47b782205 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -393,7 +393,6 @@ sub split_object { sub export_gcode { my $self = shift; - my $process_dialog; eval { # validate configuration Slic3r::Config->validate; @@ -414,11 +413,7 @@ sub export_gcode { $dlg->Destroy; } - # show processbar dialog - $process_dialog = Wx::ProgressDialog->new('Slicing...', "Processing input file...", - 100, $self, 0); - $process_dialog->Pulse; - + $self->statusbar->StartBusy; { my @warnings = (); local $SIG{__WARN__} = sub { push @warnings, $_[0] }; @@ -426,9 +421,8 @@ sub export_gcode { output_file => $output_file, status_cb => sub { my ($percent, $message) = @_; - if (&Wx::wxVERSION_STRING =~ / 2\.(8\.|9\.[2-9])/) { - $process_dialog->Update($percent, "$message..."); - } + $self->statusbar->SetProgress($percent); + $self->statusbar->SetStatusText("$message..."); }, keep_meshes => 1, ); @@ -439,8 +433,7 @@ sub export_gcode { } Slic3r::GUI::warning_catcher($self)->($_) for @warnings; } - $process_dialog->Destroy; - undef $process_dialog; + $self->statusbar->StopBusy; my $message = "Your files were successfully sliced"; $message .= sprintf " in %d minutes and %.3f seconds", @@ -457,7 +450,10 @@ sub export_gcode { wxOK | wxICON_INFORMATION)->ShowModal; $print->cleanup; }; - Slic3r::GUI::catch_error($self, sub { $process_dialog->Destroy if $process_dialog }); + Slic3r::GUI::catch_error($self, sub { + $self->statusbar->StartBusy; + $self->statusbar->SetStatusText(""); + }); } sub export_stl {