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};

View file

@ -87,9 +87,6 @@ sub new {
$self->item_changed_selection($obj_idx) if (defined($obj_idx));
}
};
my $on_double_click = sub {
$self->object_settings_dialog if $self->selected_object;
};
my $on_right_click = sub {
my ($canvas, $click_pos_x, $click_pos_y) = @_;
@ -243,7 +240,7 @@ sub new {
$self->{canvas3D} = Slic3r::GUI::Plater::3D->new($self->{preview_notebook}, $self->{objects}, $self->{model}, $self->{print}, $self->{config});
$self->{preview_notebook}->AddPage($self->{canvas3D}, L('3D'));
Slic3r::GUI::_3DScene::register_on_select_object_callback($self->{canvas3D}, $on_select_object);
Slic3r::GUI::_3DScene::register_on_double_click_callback($self->{canvas3D}, $on_double_click);
# Slic3r::GUI::_3DScene::register_on_double_click_callback($self->{canvas3D}, $on_double_click);
Slic3r::GUI::_3DScene::register_on_right_click_callback($self->{canvas3D}, sub { $on_right_click->($self->{canvas3D}, @_); });
Slic3r::GUI::_3DScene::register_on_arrange_callback($self->{canvas3D}, sub { $self->arrange });
Slic3r::GUI::_3DScene::register_on_rotate_object_left_callback($self->{canvas3D}, sub { $self->rotate(-45, Z, 'relative') });
@ -1988,14 +1985,6 @@ sub collect_selections {
return $selections;
}
# doesn't used now
sub list_item_activated {
my ($self, $event, $obj_idx) = @_;
$obj_idx //= $event->GetIndex;
$self->object_settings_dialog($obj_idx);
}
# Called when clicked on the filament preset combo box.
# When clicked on the icon, show the color picker.
sub filament_color_box_lmouse_down
@ -2049,45 +2038,6 @@ sub filament_color_box_lmouse_down
# }
#}
sub object_settings_dialog {
my ($self, $obj_idx) = @_;
($obj_idx, undef) = $self->selected_object if !defined $obj_idx;
my $model_object = $self->{model}->objects->[$obj_idx];
# validate config before opening the settings dialog because
# that dialog can't be closed if validation fails, but user
# can't fix any error which is outside that dialog
eval { wxTheApp->{preset_bundle}->full_config->validate; };
return if Slic3r::GUI::catch_error($_[0]);
my $dlg = Slic3r::GUI::Plater::ObjectSettingsDialog->new($self,
object => $self->{objects}[$obj_idx],
model_object => $model_object,
config => wxTheApp->{preset_bundle}->full_config,
);
$self->stop_background_process;
$dlg->ShowModal;
# # update thumbnail since parts may have changed
# if ($dlg->PartsChanged) {
# # recenter and re-align to Z = 0
# $model_object->center_around_origin;
# $self->reset_thumbnail($obj_idx);
# }
# update print
if ($dlg->PartsChanged || $dlg->PartSettingsChanged) {
$self->{print}->reload_object($obj_idx);
$self->schedule_background_process;
# $self->{canvas}->reload_scene if $self->{canvas};
my $selections = $self->collect_selections;
Slic3r::GUI::_3DScene::set_objects_selections($self->{canvas3D}, \@$selections);
Slic3r::GUI::_3DScene::reload_scene($self->{canvas3D}, 0);
} else {
$self->resume_background_process;
}
}
sub changed_object_settings {
my ($self, $obj_idx, $parts_changed, $part_settings_changed) = @_;