Merge branch 'master' into sender

This commit is contained in:
Alessandro Ranellucci 2015-11-05 11:04:01 +01:00
commit 9f9b5afedb
43 changed files with 267 additions and 242 deletions

View file

@ -346,7 +346,8 @@ sub get_option {
gui_flags => $optdef->{gui_flags},
label => ($self->full_labels && defined $optdef->{full_label}) ? $optdef->{full_label} : $optdef->{label},
sidetext => $optdef->{sidetext},
tooltip => $optdef->{tooltip} . " (default: " . $default_value . ")",
# calling serialize() ensures we get a stringified value
tooltip => $optdef->{tooltip} . " (default: " . $self->config->serialize($opt_key) . ")",
multiline => $optdef->{multiline},
width => $optdef->{width},
min => $optdef->{min},

View file

@ -227,7 +227,6 @@ sub new {
$self->object_list_changed;
EVT_BUTTON($self, $self->{btn_export_gcode}, sub {
$self->export_gcode;
Slic3r::thread_cleanup();
});
EVT_BUTTON($self, $self->{btn_print}, sub {
$self->{print_file} = $self->export_gcode(Wx::StandardPaths::Get->GetTempDir());
@ -791,7 +790,7 @@ sub rotate {
$self->schedule_background_process;
}
sub flip {
sub mirror {
my ($self, $axis) = @_;
my ($obj_idx, $object) = $self->selected_object;
@ -800,13 +799,13 @@ sub flip {
my $model_object = $self->{model}->objects->[$obj_idx];
my $model_instance = $model_object->instances->[0];
# apply Z rotation before flipping
# apply Z rotation before mirroring
if ($model_instance->rotation != 0) {
$model_object->rotate($model_instance->rotation, Z);
$_->set_rotation(0) for @{ $model_object->instances };
}
$model_object->flip($axis);
$model_object->mirror($axis);
$model_object->update_bounding_box;
# realign object to Z = 0
@ -1006,7 +1005,7 @@ sub start_background_process {
$self->{print}->process;
};
if ($@) {
Slic3r::debugf "Discarding background process error: $@\n";
Slic3r::debugf "Background process error: $@\n";
Wx::PostEvent($self, Wx::PlThreadEvent->new(-1, $PROCESS_COMPLETED_EVENT, $@));
} else {
Wx::PostEvent($self, Wx::PlThreadEvent->new(-1, $PROCESS_COMPLETED_EVENT, undef));
@ -1157,6 +1156,12 @@ sub on_process_completed {
$self->{process_thread}->detach if $self->{process_thread};
$self->{process_thread} = undef;
# if we're supposed to perform an explicit export let's display the error in a dialog
if ($error && $self->{export_gcode_output_file}) {
$self->{export_gcode_output_file} = undef;
Slic3r::GUI::show_error($self, $error);
}
return if $error;
$self->{toolpaths2D}->reload_print if $self->{toolpaths2D};
$self->{preview3D}->reload_print if $self->{preview3D};
@ -1721,17 +1726,17 @@ sub object_menu {
$self->rotate(undef, Z);
});
my $flipMenu = Wx::Menu->new;
my $flipMenuItem = $menu->AppendSubMenu($flipMenu, "Flip", 'Mirror the selected object');
$frame->_set_menu_item_icon($flipMenuItem, 'shape_flip_horizontal.png');
$frame->_append_menu_item($flipMenu, "Along X axis…", 'Mirror the selected object along the X axis', sub {
$self->flip(X);
my $mirrorMenu = Wx::Menu->new;
my $mirrorMenuItem = $menu->AppendSubMenu($mirrorMenu, "Mirror", 'Mirror the selected object');
$frame->_set_menu_item_icon($mirrorMenuItem, 'shape_flip_horizontal.png');
$frame->_append_menu_item($mirrorMenu, "Along X axis…", 'Mirror the selected object along the X axis', sub {
$self->mirror(X);
});
$frame->_append_menu_item($flipMenu, "Along Y axis…", 'Mirror the selected object along the Y axis', sub {
$self->flip(Y);
$frame->_append_menu_item($mirrorMenu, "Along Y axis…", 'Mirror the selected object along the Y axis', sub {
$self->mirror(Y);
});
$frame->_append_menu_item($flipMenu, "Along Z axis…", 'Mirror the selected object along the Z axis', sub {
$self->flip(Z);
$frame->_append_menu_item($mirrorMenu, "Along Z axis…", 'Mirror the selected object along the Z axis', sub {
$self->mirror(Z);
});
my $scaleMenu = Wx::Menu->new;

View file

@ -975,7 +975,7 @@ sub _update_description {
package Slic3r::GUI::Tab::Printer;
use base 'Slic3r::GUI::Tab';
use Wx qw(wxTheApp :sizer :button :bitmap :misc :id);
use Wx qw(wxTheApp :sizer :button :bitmap :misc :id :icon :dialog);
use Wx::Event qw(EVT_BUTTON);
sub name { 'printer' }
@ -1360,6 +1360,22 @@ sub _update {
# some options only apply when not using firmware retraction
$self->get_field($_, $i)->toggle($retraction && !$config->use_firmware_retraction)
for qw(retract_speed retract_restart_extra wipe);
if ($config->use_firmware_retraction && $config->get_at('wipe', $i)) {
my $dialog = Wx::MessageDialog->new($self,
"The Wipe option is not available when using the Firmware Retraction mode.\n"
. "\nShall I disable it in order to enable Firmware Retraction?",
'Firmware Retraction', wxICON_WARNING | wxYES | wxNO);
my $new_conf = Slic3r::Config->new;
if ($dialog->ShowModal() == wxID_YES) {
my $wipe = $config->wipe;
$wipe->[$i] = 0;
$new_conf->set("wipe", $wipe);
} else {
$new_conf->set("use_firmware_retraction", 0);
}
$self->load_config($new_conf);
}
$self->get_field('retract_length_toolchange', $i)->toggle($have_multiple_extruders);

View file

@ -56,7 +56,7 @@ sub make_perimeters {
&& $config->perimeter_speed == $other_config->perimeter_speed
&& $config->gap_fill_speed == $other_config->gap_fill_speed
&& $config->overhangs == $other_config->overhangs
&& $config->perimeter_extrusion_width == $other_config->perimeter_extrusion_width
&& $config->serialize('perimeter_extrusion_width') eq $other_config->serialize('perimeter_extrusion_width')
&& $config->thin_walls == $other_config->thin_walls
&& $config->external_perimeters_first == $other_config->external_perimeters_first) {
push @layerms, $other_layerm;

View file

@ -308,7 +308,7 @@ sub slice {
# remove empty layers from bottom
while (@{$self->layers} && !@{$self->get_layer(0)->slices}) {
shift @{$self->layers};
$self->delete_layer(0);
for (my $i = 0; $i <= $#{$self->layers}; $i++) {
$self->get_layer($i)->set_id( $self->get_layer($i)->id-1 );
}
@ -319,7 +319,7 @@ sub slice {
$self->_simplify_slices(scale($self->print->config->resolution));
}
die "No layers were detected. You might want to repair your STL file(s) or check their size and retry.\n"
die "No layers were detected. You might want to repair your STL file(s) or check their size or thickness and retry.\n"
if !@{$self->layers};
$self->set_typed_slices(0);