Prompt user when using 100% infill with a pattern that does not support it

This commit is contained in:
Alessandro Ranellucci 2015-05-28 18:56:35 +02:00
parent 2f4fa41ce4
commit 6e280ab8cb

View file

@ -431,6 +431,7 @@ sub set_value {
package Slic3r::GUI::Tab::Print; package Slic3r::GUI::Tab::Print;
use base 'Slic3r::GUI::Tab'; use base 'Slic3r::GUI::Tab';
use List::Util qw(first);
use Wx qw(:icon :dialog :id); use Wx qw(:icon :dialog :id);
sub name { 'print' } sub name { 'print' }
@ -738,6 +739,22 @@ sub _update {
} }
} }
if ($config->fill_density == 100
&& !first { $_ eq $config->fill_pattern } @{$Slic3r::Config::Options->{external_fill_pattern}{values}}) {
my $dialog = Wx::MessageDialog->new($self,
"The " . $config->fill_pattern . " infill pattern is not supposed to work at 100% density.\n"
. "\nShall I switch to rectilinear fill pattern?",
'Infill', wxICON_WARNING | wxYES | wxNO);
my $new_conf = Slic3r::Config->new;
if ($dialog->ShowModal() == wxID_YES) {
$new_conf->set("fill_pattern", 1);
} else {
$new_conf->set("fill_density", 40);
}
$self->load_config($new_conf);
}
my $have_perimeters = $config->perimeters > 0; my $have_perimeters = $config->perimeters > 0;
$self->get_field($_)->toggle($have_perimeters) $self->get_field($_)->toggle($have_perimeters)
for qw(extra_perimeters thin_walls overhangs seam_position external_perimeters_first for qw(extra_perimeters thin_walls overhangs seam_position external_perimeters_first
@ -1295,7 +1312,7 @@ sub load_config_file {
} }
package Slic3r::GUI::Tab::Page; package Slic3r::GUI::Tab::Page;
use Wx qw(:misc :panel :sizer); use Wx qw(wxTheApp :misc :panel :sizer);
use base 'Wx::ScrolledWindow'; use base 'Wx::ScrolledWindow';
sub new { sub new {
@ -1323,8 +1340,11 @@ sub new_optgroup {
config => $self->GetParent->{config}, config => $self->GetParent->{config},
label_width => $params{label_width} // 200, label_width => $params{label_width} // 200,
on_change => sub { on_change => sub {
my ($opt_key, $value) = @_;
wxTheApp->CallAfter(sub {
$self->GetParent->update_dirty; $self->GetParent->update_dirty;
$self->GetParent->_on_value_change(@_); $self->GetParent->_on_value_change($opt_key, $value);
});
}, },
); );