Flip Y changed back to BOTTOM_LEFT

Merge remote-tracking branch 'origin/master' into feature_slice_to_png
This commit is contained in:
tamasmeszaros 2018-07-25 17:27:02 +02:00
commit 93ae3a0f1a
50 changed files with 1244 additions and 860 deletions

View file

@ -127,6 +127,8 @@ sub new {
$range->[1] *= $variation;
}
$_->set_scaling_factor($scale) for @{ $model_object->instances };
$self->{list}->SetItem($obj_idx, 2, ($model_object->instances->[0]->scaling_factor * 100) . "%");
$object->transform_thumbnail($self->{model}, $obj_idx);
#update print and start background processing
@ -194,7 +196,7 @@ sub new {
$self->schedule_background_process;
} else {
# Hide the print info box, it is no more valid.
$self->{"print_info_box_show"}->(0);
$self->print_info_box_show(0);
}
});
@ -292,9 +294,9 @@ sub new {
$self->{right_panel} = Wx::Panel->new($self, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
### Scrolled Window for info boxes
my $scrolled_window_sizer = Wx::BoxSizer->new(wxVERTICAL);
my $scrolled_window_sizer = $self->{scrolled_window_sizer} = Wx::BoxSizer->new(wxVERTICAL);
$scrolled_window_sizer->SetMinSize([310, -1]);
my $scrolled_window_panel = Wx::ScrolledWindow->new($self->{right_panel}, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
my $scrolled_window_panel = $self->{scrolled_window_panel} = Wx::ScrolledWindow->new($self->{right_panel}, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
$scrolled_window_panel->SetSizer($scrolled_window_sizer);
$scrolled_window_panel->SetScrollbars(1, 1, 1, 1);
@ -520,38 +522,9 @@ sub new {
}
}
my $print_info_sizer;
{
my $box = Wx::StaticBox->new($scrolled_window_panel, -1, L("Sliced Info"));
$print_info_sizer = Wx::StaticBoxSizer->new($box, wxVERTICAL);
$print_info_sizer->SetMinSize([300,-1]);
my $grid_sizer = Wx::FlexGridSizer->new(2, 2, 5, 5);
$grid_sizer->SetFlexibleDirection(wxHORIZONTAL);
$grid_sizer->AddGrowableCol(1, 1);
$grid_sizer->AddGrowableCol(3, 1);
$print_info_sizer->Add($grid_sizer, 0, wxEXPAND);
my @info = (
fil_m => L("Used Filament (m)"),
fil_mm3 => L("Used Filament (mm³)"),
fil_g => L("Used Filament (g)"),
cost => L("Cost"),
#==========================================================================================================================================
normal_time => L("Estimated printing time (normal mode)"),
# default_time => L("Estimated printing time (default mode)"),
#==========================================================================================================================================
silent_time => L("Estimated printing time (silent mode)"),
);
while (my $field = shift @info) {
my $label = shift @info;
my $text = Wx::StaticText->new($scrolled_window_panel, -1, "$label:", wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
$text->SetFont($Slic3r::GUI::small_font);
$grid_sizer->Add($text, 0);
$self->{"print_info_$field"} = Wx::StaticText->new($scrolled_window_panel, -1, "", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
$self->{"print_info_$field"}->SetFont($Slic3r::GUI::small_font);
$grid_sizer->Add($self->{"print_info_$field"}, 0);
}
}
my $print_info_sizer = $self->{print_info_sizer} = Wx::StaticBoxSizer->new(
Wx::StaticBox->new($scrolled_window_panel, -1, L("Sliced Info")), wxVERTICAL);
$print_info_sizer->SetMinSize([300,-1]);
my $buttons_sizer = Wx::BoxSizer->new(wxHORIZONTAL);
$self->{buttons_sizer} = $buttons_sizer;
@ -572,19 +545,8 @@ sub new {
$right_sizer->Add($frequently_changed_parameters_sizer, 0, wxEXPAND | wxTOP, 0) if defined $frequently_changed_parameters_sizer;
$right_sizer->Add($buttons_sizer, 0, wxEXPAND | wxBOTTOM, 5);
$right_sizer->Add($scrolled_window_panel, 1, wxEXPAND | wxALL, 1);
# Callback for showing / hiding the print info box.
$self->{"print_info_box_show"} = sub {
# if ($right_sizer->IsShown(5) != $_[0]) {
# $right_sizer->Show(5, $_[0]);
# $self->Layout
# }
if ($scrolled_window_sizer->IsShown(2) != $_[0]) {
$scrolled_window_sizer->Show(2, $_[0]);
$scrolled_window_panel->Layout
}
};
# Show the box initially, let it be shown after the slicing is finished.
$self->{"print_info_box_show"}->(0);
$self->print_info_box_show(0);
$self->{right_panel}->SetSizer($right_sizer);
@ -1300,7 +1262,7 @@ sub async_apply_config {
$self->{canvas3D}->Refresh if Slic3r::GUI::_3DScene::is_layers_editing_enabled($self->{canvas3D});
# Hide the slicing results if the current slicing status is no more valid.
$self->{"print_info_box_show"}->(0) if $invalidated;
$self->print_info_box_show(0) if $invalidated;
if (wxTheApp->{app_config}->get("background_processing")) {
if ($invalidated) {
@ -1618,16 +1580,7 @@ sub on_export_completed {
$self->{print_file} = undef;
$self->{send_gcode_file} = undef;
$self->{"print_info_cost"}->SetLabel(sprintf("%.2f" , $self->{print}->total_cost));
$self->{"print_info_fil_g"}->SetLabel(sprintf("%.2f" , $self->{print}->total_weight));
$self->{"print_info_fil_mm3"}->SetLabel(sprintf("%.2f" , $self->{print}->total_extruded_volume));
#==========================================================================================================================================
$self->{"print_info_normal_time"}->SetLabel($self->{print}->estimated_normal_print_time);
# $self->{"print_info_default_time"}->SetLabel($self->{print}->estimated_default_print_time);
#==========================================================================================================================================
$self->{"print_info_silent_time"}->SetLabel($self->{print}->estimated_silent_print_time);
$self->{"print_info_fil_m"}->SetLabel(sprintf("%.2f" , $self->{print}->total_used_filament / 1000));
$self->{"print_info_box_show"}->(1);
$self->print_info_box_show(1);
# this updates buttons status
$self->object_list_changed;
@ -1637,6 +1590,51 @@ sub on_export_completed {
$self->{preview3D}->reload_print if $self->{preview3D};
}
# Fill in the "Sliced info" box with the result of the G-code generator.
sub print_info_box_show {
my ($self, $show) = @_;
my $scrolled_window_panel = $self->{scrolled_window_panel};
my $scrolled_window_sizer = $self->{scrolled_window_sizer};
return if $scrolled_window_sizer->IsShown(2) == $show;
if ($show) {
my $print_info_sizer = $self->{print_info_sizer};
$print_info_sizer->Clear(1);
my $grid_sizer = Wx::FlexGridSizer->new(2, 2, 5, 5);
$grid_sizer->SetFlexibleDirection(wxHORIZONTAL);
$grid_sizer->AddGrowableCol(1, 1);
$grid_sizer->AddGrowableCol(3, 1);
$print_info_sizer->Add($grid_sizer, 0, wxEXPAND);
my @info = (
L("Used Filament (m)")
=> sprintf("%.2f" , $self->{print}->total_used_filament / 1000),
L("Used Filament (mm³)")
=> sprintf("%.2f" , $self->{print}->total_extruded_volume),
L("Used Filament (g)"),
=> sprintf("%.2f" , $self->{print}->total_weight),
L("Cost"),
=> sprintf("%.2f" , $self->{print}->total_cost),
L("Estimated printing time (normal mode)")
=> $self->{print}->estimated_normal_print_time,
L("Estimated printing time (silent mode)")
=> $self->{print}->estimated_silent_print_time
);
while ( my $label = shift @info) {
my $value = shift @info;
next if $value eq "N/A";
my $text = Wx::StaticText->new($scrolled_window_panel, -1, "$label:", wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
$text->SetFont($Slic3r::GUI::small_font);
$grid_sizer->Add($text, 0);
my $field = Wx::StaticText->new($scrolled_window_panel, -1, $value, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
$field->SetFont($Slic3r::GUI::small_font);
$grid_sizer->Add($field, 0);
}
}
$scrolled_window_sizer->Show(2, $show);
$scrolled_window_panel->Layout;
}
sub do_print {
my ($self) = @_;
@ -1669,7 +1667,7 @@ sub reload_from_disk {
my $model_object = $self->{model}->objects->[$obj_idx];
#FIXME convert to local file encoding
return if !$model_object->input_file
|| !-e $model_object->input_file;
|| !-e Slic3r::encode_path($model_object->input_file);
my @new_obj_idx = $self->load_files([$model_object->input_file]);
return if !@new_obj_idx;
@ -2104,7 +2102,8 @@ sub object_list_changed {
my $export_in_progress = $self->{export_gcode_output_file} || $self->{send_gcode_file};
my $model_fits = $self->{canvas3D} ? Slic3r::GUI::_3DScene::check_volumes_outside_state($self->{canvas3D}, $self->{config}) : 1;
my $method = ($have_objects && ! $export_in_progress && $model_fits) ? 'Enable' : 'Disable';
# $model_fits == 1 -> ModelInstance::PVS_Partly_Outside
my $method = ($have_objects && ! $export_in_progress && ($model_fits != 1)) ? 'Enable' : 'Disable';
$self->{"btn_$_"}->$method
for grep $self->{"btn_$_"}, qw(reslice export_gcode print send_gcode);
}