Leave the Spiral Vase checkbox always enabled but prompt user when incompatible options are set. This should be more user-friendly than blindly disabling the Spiral Vase checkbox. #2360

This commit is contained in:
Alessandro Ranellucci 2014-11-22 22:52:12 +01:00
parent 6010297465
commit 399fc519e6

View File

@ -418,6 +418,8 @@ sub set_value {
package Slic3r::GUI::Tab::Print; package Slic3r::GUI::Tab::Print;
use base 'Slic3r::GUI::Tab'; use base 'Slic3r::GUI::Tab';
use Wx qw(:icon :dialog :id);
sub name { 'print' } sub name { 'print' }
sub title { 'Print Settings' } sub title { 'Print Settings' }
@ -693,13 +695,21 @@ sub _update {
my $config = $self->{config}; my $config = $self->{config};
# we enable spiral vase if other settings are compatible with it if ($config->spiral_vase && !($config->perimeters == 1 && $config->top_solid_layers == 0 && $config->fill_density == 0)) {
# or if it is enabled (this prevents the checkbox from being disabled my $dialog = Wx::MessageDialog->new($self, "The Spiral Vase mode requires one perimeter, no top solid layers and 0% fill density. Shall I adjust those settings in order to enable Spiral Vase?",
# when an incompatible setting is set) 'Spiral Vase', wxICON_WARNING | wxYES | wxNO);
$self->get_field('spiral_vase')->toggle( if ($dialog->ShowModal() == wxID_YES) {
($config->perimeters == 1 && $config->top_solid_layers == 0 && $config->fill_density == 0) my $new_conf = Slic3r::Config->new;
|| $config->spiral_vase $new_conf->set("perimeters", 1);
); $new_conf->set("top_solid_layers", 0);
$new_conf->set("fill_density", 0);
$self->load_config($new_conf);
} else {
my $new_conf = Slic3r::Config->new;
$new_conf->set("spiral_vase", 0);
$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)