Updated log method calls

This commit is contained in:
Alessandro Ranellucci 2017-03-25 13:59:29 +01:00 committed by GitHub
parent 67f0fe3344
commit 42e9ec90be

View File

@ -43,9 +43,7 @@ sub new {
$self->print_completed; $self->print_completed;
} }
} }
$self->{log_textctrl}->AppendText("$_\n") for @{$self->sender->purge_log}; $self->append_to_log("$_\n") for @{$self->sender->purge_log};
$self->{manual_control_dialog}->update_log($self->{log_textctrl}->GetValue)
if $self->{manual_control_dialog};
{ {
my $temp = $self->sender->getT; my $temp = $self->sender->getT;
if ($temp eq '') { if ($temp eq '') {
@ -272,6 +270,12 @@ sub new {
return $self; return $self;
} }
sub append_to_log {
my ($self, $text) = @_;
$self->{log_textctrl}->AppendText($text);
}
sub is_connected { sub is_connected {
my ($self) = @_; my ($self) = @_;
return $self->sender && $self->sender->is_connected; return $self->sender && $self->sender->is_connected;
@ -409,9 +413,9 @@ sub print_job {
$self->Layout; $self->Layout;
$self->set_status('Printing...'); $self->set_status('Printing...');
$self->{log_textctrl}->AppendText(sprintf "=====\n"); $self->append_to_log(sprintf "=====\n");
$self->{log_textctrl}->AppendText(sprintf "Printing %s\n", $job->name); $self->append_to_log(sprintf "Printing %s\n", $job->name);
$self->{log_textctrl}->AppendText(sprintf "Print started at %s\n", $self->_timestamp); $self->append_to_log(sprintf "Print started at %s\n", $self->_timestamp);
} }
sub print_completed { sub print_completed {
@ -426,7 +430,7 @@ sub print_completed {
$self->Layout; $self->Layout;
$self->set_status('Print completed.'); $self->set_status('Print completed.');
$self->{log_textctrl}->AppendText(sprintf "Print completed at %s\n", $self->_timestamp); $self->append_to_log(sprintf "Print completed at %s\n", $self->_timestamp);
$self->reload_jobs; $self->reload_jobs;
} }
@ -479,7 +483,7 @@ sub reload_jobs {
$self->{gauge}->Disable; $self->{gauge}->Disable;
$self->{gauge}->Hide; $self->{gauge}->Hide;
$self->set_status('Print was aborted.'); $self->set_status('Print was aborted.');
$self->{log_textctrl}->AppendText(sprintf "Print aborted at %s\n", $self->_timestamp); $self->append_to_log(sprintf "Print aborted at %s\n", $self->_timestamp);
}); });
$panel->on_resume_print(sub { $panel->on_resume_print(sub {
my ($job) = @_; my ($job) = @_;