Keep print job order

This commit is contained in:
Alessandro Ranellucci 2015-11-02 16:54:02 +01:00
parent 9438289fc1
commit cb8f8a24b0

View file

@ -389,15 +389,16 @@ sub print_completed {
$self->set_status('Print completed.');
$self->{log_textctrl}->AppendText(sprintf "Print completed at %s\n", $self->_timestamp);
# reorder jobs
@{$self->jobs} = sort { $a->printed <=> $b->printed } @{$self->jobs};
$self->reload_jobs;
}
sub reload_jobs {
my ($self) = @_;
# reorder jobs
@{$self->jobs} = sort { ($a->printed <=> $b->printed) || ($a->timestamp <=> $b->timestamp) }
@{$self->jobs};
# remove all panels
foreach my $child ($self->{jobs_panel_sizer}->GetChildren) {
my $window = $child->GetWindow;
@ -476,6 +477,7 @@ use Moo;
use File::Basename qw(basename);
has 'id' => (is => 'ro', required => 1);
has 'timestamp' => (is => 'ro', default => sub { time });
has 'gcode_file' => (is => 'ro', required => 1);
has 'filament_stats' => (is => 'rw');
has 'printing' => (is => 'rw', default => sub { 0 });