Descriptive textual feedback for cooling settings
This commit is contained in:
parent
f9b6caaecb
commit
deea02b444
@ -698,7 +698,7 @@ END
|
||||
default => 100,
|
||||
},
|
||||
'bridge_fan_speed' => {
|
||||
label => 'Bridges',
|
||||
label => 'Bridges fan speed',
|
||||
tooltip => 'This fan speed is enforced during all bridges.',
|
||||
sidetext => '%',
|
||||
cli => 'bridge-fan-speed=i',
|
||||
|
@ -67,11 +67,19 @@ sub BUILD {
|
||||
$grid_sizer->SetFlexibleDirection(wxHORIZONTAL);
|
||||
$grid_sizer->AddGrowableCol($self->no_labels ? 0 : 1);
|
||||
|
||||
$self->{sidetext_font} = Wx::SystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
|
||||
$self->_build_line($_, $grid_sizer) for @{$self->lines};
|
||||
|
||||
# TODO: border size may be related to wxWidgets 2.8.x vs. 2.9.x instead of wxMAC specific
|
||||
$self->sizer->Add($grid_sizer, 0, wxEXPAND | wxALL, &Wx::wxMAC ? 0 : 5);
|
||||
|
||||
$self->{sidetext_font} = Wx::SystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
|
||||
|
||||
foreach my $line (@{$self->lines}) {
|
||||
if ($line->{widget}) {
|
||||
my $window = $line->{widget}->GetWindow($self->parent);
|
||||
$self->sizer->Add($window, 0, wxEXPAND | wxALL, &Wx::wxMAC ? 0 : 15);
|
||||
} else {
|
||||
$self->_build_line($line, $grid_sizer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# default behavior: one option per line
|
||||
@ -107,7 +115,7 @@ sub _build_line {
|
||||
|
||||
my $label;
|
||||
if (!$self->no_labels) {
|
||||
$label = Wx::StaticText->new($self->parent, -1, "$line->{label}:", wxDefaultPosition, [$self->label_width, -1]);
|
||||
$label = Wx::StaticText->new($self->parent, -1, $line->{label} ? "$line->{label}:" : "", wxDefaultPosition, [$self->label_width, -1]);
|
||||
$label->Wrap($self->label_width) ; # needed to avoid Linux/GTK bug
|
||||
$grid_sizer->Add($label, 0, wxALIGN_CENTER_VERTICAL, 0);
|
||||
$label->SetToolTipString($line->{tooltip}) if $line->{tooltip};
|
||||
@ -363,4 +371,27 @@ sub _config_methods {
|
||||
: qw(get 0);
|
||||
}
|
||||
|
||||
package Slic3r::GUI::OptionsGroup::StaticTextLine;
|
||||
use Moo;
|
||||
use Wx qw(:misc :systemsettings);
|
||||
|
||||
sub GetWindow {
|
||||
my $self = shift;
|
||||
my ($parent) = @_;
|
||||
|
||||
$self->{statictext} = Wx::StaticText->new($parent, -1, "foo", wxDefaultPosition, wxDefaultSize);
|
||||
my $font = Wx::SystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
|
||||
$self->{statictext}->SetFont($font);
|
||||
return $self->{statictext};
|
||||
}
|
||||
|
||||
sub SetText {
|
||||
my $self = shift;
|
||||
my ($value) = @_;
|
||||
|
||||
$self->{statictext}->SetLabel($value);
|
||||
$self->{statictext}->Wrap(400);
|
||||
$self->{statictext}->GetParent->Layout;
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -541,6 +541,13 @@ sub build {
|
||||
{
|
||||
title => 'Enable',
|
||||
options => [qw(cooling)],
|
||||
lines => [
|
||||
Slic3r::GUI::OptionsGroup->single_option_line('cooling'),
|
||||
{
|
||||
label => '',
|
||||
widget => ($self->{description_line} = Slic3r::GUI::OptionsGroup::StaticTextLine->new),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title => 'Fan settings',
|
||||
@ -548,8 +555,9 @@ sub build {
|
||||
lines => [
|
||||
{
|
||||
label => 'Fan speed',
|
||||
options => [qw(min_fan_speed max_fan_speed bridge_fan_speed)],
|
||||
options => [qw(min_fan_speed max_fan_speed)],
|
||||
},
|
||||
Slic3r::GUI::OptionsGroup->single_option_line('bridge_fan_speed'),
|
||||
Slic3r::GUI::OptionsGroup->single_option_line('disable_fan_first_layers'),
|
||||
Slic3r::GUI::OptionsGroup->single_option_line('fan_always_on'),
|
||||
],
|
||||
@ -562,6 +570,36 @@ sub build {
|
||||
]);
|
||||
}
|
||||
|
||||
sub _update_description {
|
||||
my $self = shift;
|
||||
|
||||
my $config = $self->config;
|
||||
|
||||
my $msg = "";
|
||||
if ($config->cooling) {
|
||||
$msg = sprintf "If estimated layer time is below ~%ds, fan will run at 100%% and print speed will be reduced so that no less than %ds are spent on that layer (however, speed will never be reduced below %dmm/s).",
|
||||
$config->slowdown_below_layer_time, $config->slowdown_below_layer_time, $config->min_print_speed;
|
||||
if ($config->fan_below_layer_time > $config->slowdown_below_layer_time) {
|
||||
$msg .= sprintf "\nIf estimated layer time is greater, but still below ~%ds, fan will run at a proportionally decreasing speed between %d%% and %d%%.",
|
||||
$config->fan_below_layer_time, $config->max_fan_speed, $config->min_fan_speed;
|
||||
}
|
||||
if ($config->fan_always_on) {
|
||||
$msg .= sprintf "\nDuring the other layers, fan will always run at %d%%.", $config->min_fan_speed;
|
||||
} else {
|
||||
$msg .= "\nDuring the other layers, fan will be turned off."
|
||||
}
|
||||
}
|
||||
$self->{description_line}->SetText($msg);
|
||||
}
|
||||
|
||||
sub on_value_change {
|
||||
my $self = shift;
|
||||
my ($opt_key) = @_;
|
||||
$self->SUPER::on_value_change(@_);
|
||||
|
||||
$self->_update_description;
|
||||
}
|
||||
|
||||
package Slic3r::GUI::Tab::Printer;
|
||||
use base 'Slic3r::GUI::Tab';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user