Skip to content

Commit

Permalink
Prompt user when using 100% infill with a pattern that does not suppo…
Browse files Browse the repository at this point in the history
…rt it
  • Loading branch information
alranel committed May 28, 2015
1 parent 2f4fa41 commit 6e280ab
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions lib/Slic3r/GUI/Tab.pm
Expand Up @@ -431,6 +431,7 @@ sub set_value {
package Slic3r::GUI::Tab::Print;
use base 'Slic3r::GUI::Tab';

use List::Util qw(first);
use Wx qw(:icon :dialog :id);

sub name { 'print' }
Expand Down Expand Up @@ -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;
$self->get_field($_)->toggle($have_perimeters)
for qw(extra_perimeters thin_walls overhangs seam_position external_perimeters_first
Expand Down Expand Up @@ -1295,7 +1312,7 @@ sub load_config_file {
}

package Slic3r::GUI::Tab::Page;
use Wx qw(:misc :panel :sizer);
use Wx qw(wxTheApp :misc :panel :sizer);
use base 'Wx::ScrolledWindow';

sub new {
Expand Down Expand Up @@ -1323,8 +1340,11 @@ sub new_optgroup {
config => $self->GetParent->{config},
label_width => $params{label_width} // 200,
on_change => sub {
$self->GetParent->update_dirty;
$self->GetParent->_on_value_change(@_);
my ($opt_key, $value) = @_;
wxTheApp->CallAfter(sub {
$self->GetParent->update_dirty;
$self->GetParent->_on_value_change($opt_key, $value);
});
},
);

Expand Down

0 comments on commit 6e280ab

Please sign in to comment.