Removed "Slice to SVG" and "Quick Slice"

This commit is contained in:
bubnikv 2018-09-14 11:16:54 +02:00
parent 2c9dc4dbbf
commit bb7f504296
8 changed files with 3 additions and 351 deletions

View file

@ -305,31 +305,8 @@ sub _init_menubar {
$self->export_configbundle;
}, undef, 'lorry_go.png');
$fileMenu->AppendSeparator();
my $repeat;
$self->_append_menu_item($fileMenu, L("Q&uick Slice…\tCtrl+U"), L('Slice a file into a G-code'), sub {
wxTheApp->CallAfter(sub {
$self->quick_slice;
$repeat->Enable(defined $Slic3r::GUI::MainFrame::last_input_file);
});
}, undef, 'cog_go.png');
$self->_append_menu_item($fileMenu, L("Quick Slice and Save &As…\tCtrl+Alt+U"), L('Slice a file into a G-code, save as'), sub {
wxTheApp->CallAfter(sub {
$self->quick_slice(save_as => 1);
$repeat->Enable(defined $Slic3r::GUI::MainFrame::last_input_file);
});
}, undef, 'cog_go.png');
$repeat = $self->_append_menu_item($fileMenu, L("&Repeat Last Quick Slice\tCtrl+Shift+U"), L('Repeat last quick slice'), sub {
wxTheApp->CallAfter(sub {
$self->quick_slice(reslice => 1);
});
}, undef, 'cog_go.png');
$repeat->Enable(0);
$fileMenu->AppendSeparator();
$self->_append_menu_item($fileMenu, L("Slice to SV&G…\tCtrl+G"), L('Slice file to a multi-layer SVG'), sub {
$self->quick_slice(save_as => 1, export_svg => 1);
}, undef, 'shape_handles.png');
$self->_append_menu_item($fileMenu, L("Slice to PNG…"), L('Slice file to a set of PNG files'), sub {
$self->slice_to_png; #$self->quick_slice(save_as => 0, export_png => 1);
$self->slice_to_png;
}, undef, 'shape_handles.png');
$self->{menu_item_reslice_now} = $self->_append_menu_item(
$fileMenu, L("(&Re)Slice Now\tCtrl+S"), L('Start new slicing process'),
@ -483,130 +460,6 @@ sub slice_to_png {
$appController->print_ctl()->slice_to_png();
}
# To perform the "Quck Slice", "Quick Slice and Save As", "Repeat last Quick Slice" and "Slice to SVG".
sub quick_slice {
my ($self, %params) = @_;
my $progress_dialog;
eval {
# validate configuration
my $config = wxTheApp->{preset_bundle}->full_config();
$config->validate;
# select input file
my $input_file;
if (!$params{reslice}) {
my $dialog = Wx::FileDialog->new($self, L('Choose a file to slice (STL/OBJ/AMF/3MF/PRUSA):'),
wxTheApp->{app_config}->get_last_dir, "",
&Slic3r::GUI::MODEL_WILDCARD, wxFD_OPEN | wxFD_FILE_MUST_EXIST);
if ($dialog->ShowModal != wxID_OK) {
$dialog->Destroy;
return;
}
$input_file = $dialog->GetPaths;
$dialog->Destroy;
$qs_last_input_file = $input_file unless $params{export_svg};
} else {
if (!defined $qs_last_input_file) {
Wx::MessageDialog->new($self, L("No previously sliced file."),
L('Error'), wxICON_ERROR | wxOK)->ShowModal();
return;
}
if (! -e $qs_last_input_file) {
Wx::MessageDialog->new($self, L("Previously sliced file (").$qs_last_input_file.L(") not found."),
L('File Not Found'), wxICON_ERROR | wxOK)->ShowModal();
return;
}
$input_file = $qs_last_input_file;
}
my $input_file_basename = basename($input_file);
wxTheApp->{app_config}->update_skein_dir(dirname($input_file));
my $print_center;
{
my $bed_shape = Slic3r::Polygon->new_scale(@{$config->bed_shape});
$print_center = Slic3r::Pointf->new_unscale(@{$bed_shape->bounding_box->center});
}
my $sprint = Slic3r::Print::Simple->new(print_center => $print_center);
# The C++ slicing core will post a wxCommand message to the main window.
Slic3r::GUI::set_print_callback_event($sprint, $PROGRESS_BAR_EVENT);
# keep model around
my $model = Slic3r::Model->read_from_file($input_file);
$sprint->apply_config($config);
$sprint->set_model($model);
# Copy the names of active presets into the placeholder parser.
wxTheApp->{preset_bundle}->export_selections_pp($sprint->placeholder_parser);
# select output file
my $output_file;
if ($params{reslice}) {
$output_file = $qs_last_output_file if defined $qs_last_output_file;
} elsif ($params{save_as}) {
# The following line may die if the output_filename_format template substitution fails.
$output_file = $sprint->output_filepath;
$output_file =~ s/\.[gG][cC][oO][dD][eE]$/.svg/ if $params{export_svg};
my $dlg = Wx::FileDialog->new($self, L('Save ') . ($params{export_svg} ? L('SVG') : L('G-code')) . L(' file as:'),
wxTheApp->{app_config}->get_last_output_dir(dirname($output_file)),
basename($output_file), $params{export_svg} ? &Slic3r::GUI::FILE_WILDCARDS->{svg} : &Slic3r::GUI::FILE_WILDCARDS->{gcode}, wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
if ($dlg->ShowModal != wxID_OK) {
$dlg->Destroy;
return;
}
$output_file = $dlg->GetPath;
$qs_last_output_file = $output_file unless $params{export_svg};
wxTheApp->{app_config}->update_last_output_dir(dirname($output_file));
$dlg->Destroy;
} elsif($params{export_png}) {
$output_file = $sprint->output_filepath;
$output_file =~ s/\.[gG][cC][oO][dD][eE]$/.zip/;
# my $dlg = Wx::DirDialog->new($self, L('Choose output directory'));
my $dlg = Wx::FileDialog->new($self, L('Save zip file as:'),
wxTheApp->{app_config}->get_last_output_dir(dirname($output_file)),
basename($output_file), '*.zip', wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
if ($dlg->ShowModal != wxID_OK) {
$dlg->Destroy;
return;
}
$output_file = $dlg->GetPath;
$dlg->Destroy;
}
# show processbar dialog
$progress_dialog = Wx::ProgressDialog->new(L('Slicing…'), L("Processing ").$input_file_basename."…",
100, $self, 4);
$progress_dialog->Pulse;
{
my @warnings = ();
local $SIG{__WARN__} = sub { push @warnings, $_[0] };
$sprint->output_file($output_file);
if ($params{export_svg}) {
$sprint->export_svg;
}
elsif($params{export_png}) {
$sprint->export_png;
}
else {
$sprint->export_gcode;
}
Slic3r::GUI::warning_catcher($self)->($_) for @warnings;
}
$self->{progress_dialog}->Destroy;
undef $self->{progress_dialog};
my $message = $input_file_basename.L(" was successfully sliced.");
wxTheApp->notify($message);
Wx::MessageDialog->new($self, $message, L('Slicing Done!'),
wxOK | wxICON_INFORMATION)->ShowModal;
};
Slic3r::GUI::catch_error($self, sub { $self->{progress_dialog}->Destroy if $self->{progress_dialog} });
}
sub reslice_now {
my ($self) = @_;
$self->{plater}->reslice if $self->{plater};