"Background slice now" function, initial implementation by @lordofhyphens

https://github.com/alexrj/Slic3r/pull/3501
This commit is contained in:
bubnikv 2016-10-25 13:24:42 +02:00
parent 34248c2fbf
commit 34fab1566f
5 changed files with 75 additions and 1 deletions

View file

@ -89,6 +89,8 @@ sub new {
# propagate event
$event->Skip;
});
$self->update_ui_from_settings;
return $self;
}
@ -213,6 +215,9 @@ sub _init_menubar {
$self->_append_menu_item($fileMenu, "Slice to SV&G…\tCtrl+G", 'Slice file to SVG', sub {
$self->quick_slice(save_as => 1, export_svg => 1);
}, undef, 'shape_handles.png');
$self->{menu_item_reslice_now} = $self->_append_menu_item(
$fileMenu, "(&Re)Slice Now\tCtrl+S", 'Start new slicing process',
sub { $self->reslice_now; }, undef, 'shape_handles.png');
$fileMenu->AppendSeparator();
$self->_append_menu_item($fileMenu, "Repair STL file…", 'Automatically repair an STL file', sub {
$self->repair_stl;
@ -465,6 +470,13 @@ sub quick_slice {
Slic3r::GUI::catch_error($self, sub { $progress_dialog->Destroy if $progress_dialog });
}
sub reslice_now {
my ($self) = @_;
if ($self->{plater}) {
$self->{plater}->reslice;
}
}
sub repair_stl {
my $self = shift;
@ -828,4 +840,12 @@ sub _set_menu_item_icon {
}
}
# Called after the Preferences dialog is closed and the program settings are saved.
# Update the UI based on the current preferences.
sub update_ui_from_settings {
my ($self) = @_;
$self->{menu_item_reslice_now}->Enable(! $Slic3r::GUI::Settings->{_}{background_processing});
$self->{plater}->update_ui_from_settings if ($self->{plater});
}
1;