Updates to GUI projector: fix buttons not updating when print finished; ring a bell at that time; disable screensaver not just when printing but until the DLP projector window gets closed

This commit is contained in:
Alessandro Ranellucci 2015-12-11 01:13:47 +01:00
parent e2f2761a00
commit 9bd10b3b5e

View file

@ -418,6 +418,7 @@ sub new {
on_print_completed => sub { on_print_completed => sub {
$self->_update_buttons; $self->_update_buttons;
$self->_set_status(''); $self->_set_status('');
Wx::Bell();
}, },
)); ));
{ {
@ -533,6 +534,8 @@ has '_timer_cb' => (is => 'rw');
sub BUILD { sub BUILD {
my ($self) = @_; my ($self) = @_;
Slic3r::GUI::disable_screensaver();
$self->set_print(wxTheApp->{mainframe}->{plater}->{print}); $self->set_print(wxTheApp->{mainframe}->{plater}->{print});
# projection timer # projection timer
@ -595,8 +598,6 @@ sub current_layer_height {
sub start_print { sub start_print {
my ($self) = @_; my ($self) = @_;
Slic3r::GUI::disable_screensaver();
{ {
$self->sender(Slic3r::GCode::Sender->new); $self->sender(Slic3r::GCode::Sender->new);
my $res = $self->sender->connect( my $res = $self->sender->connect(
@ -634,7 +635,6 @@ sub stop_print {
my ($self) = @_; my ($self) = @_;
$self->is_printing(0); $self->is_printing(0);
Slic3r::GUI::enable_screensaver();
$self->timer->Stop; $self->timer->Stop;
$self->_timer_cb(undef); $self->_timer_cb(undef);
$self->screen->project_layers(undef); $self->screen->project_layers(undef);
@ -649,10 +649,12 @@ sub print_completed {
$self->sender->disconnect; $self->sender->disconnect;
} }
# call this before the on_print_completed callback otherwise buttons
# won't be updated correctly
$self->stop_print;
$self->on_print_completed->() $self->on_print_completed->()
if $self->is_printing && $self->on_print_completed; if $self->is_printing && $self->on_print_completed;
$self->stop_print;
} }
sub is_projecting { sub is_projecting {
@ -737,6 +739,7 @@ sub DESTROY {
$self->timer->Stop if $self->timer; $self->timer->Stop if $self->timer;
$self->sender->disconnect if $self->sender; $self->sender->disconnect if $self->sender;
Slic3r::GUI::enable_screensaver();
} }
package Slic3r::GUI::Projector::Screen; package Slic3r::GUI::Projector::Screen;