PrusaSlicer-NonPlainar/lib/Slic3r/GUI/Tab.pm

258 lines
6.8 KiB
Perl
Raw Normal View History

2012-06-17 20:27:05 +00:00
package Slic3r::GUI::Tab;
use strict;
use warnings;
use utf8;
use Wx qw(:sizer :progressdialog);
use Wx::Event qw();
use base 'Wx::Treebook';
sub new {
my $class = shift;
my ($parent) = @_;
my $self = $class->SUPER::new($parent, -1, [-1,-1], [-1,-1], &Wx::wxBK_LEFT);
2012-06-17 20:54:08 +00:00
$self->{images} = Wx::ImageList->new(16, 16, 1);
$self->AssignImageList($self->{images});
$self->{imagecount} = -1;
2012-06-17 20:27:05 +00:00
return $self;
}
sub AddOptionsPage {
my $self = shift;
my $title = shift;
2012-06-17 20:54:08 +00:00
my $image = (ref $_[1]) ? undef : shift;
2012-06-17 20:27:05 +00:00
my $page = Slic3r::GUI::Tab::Page->new($self, @_);
2012-06-17 20:54:08 +00:00
my $bitmap = $image
? Wx::Bitmap->new("$Slic3r::var/$image", &Wx::wxBITMAP_TYPE_PNG)
: undef;
if ($bitmap) {
$self->{images}->Add($bitmap);
$self->{imagecount}++;
}
$self->AddPage($page, $title, undef, $self->{imagecount});
2012-06-17 20:27:05 +00:00
}
package Slic3r::GUI::Tab::Print;
use Wx qw(:sizer :progressdialog);
use Wx::Event qw();
use base 'Slic3r::GUI::Tab';
sub new {
my $class = shift;
my ($parent) = @_;
my $self = $class->SUPER::new($parent, -1);
2012-06-17 20:54:08 +00:00
$self->AddOptionsPage('Layers and perimeters', 'layers.png', optgroups => [
2012-06-17 20:27:05 +00:00
{
title => 'Layer height',
options => [qw(layer_height first_layer_height)],
},
{
title => 'Vertical shells',
options => [qw(perimeters randomize_start)],
},
{
title => 'Horizontal shells',
options => [qw(solid_layers)],
},
]);
2012-06-17 20:54:08 +00:00
$self->AddOptionsPage('Infill', 'shading.png', optgroups => [
2012-06-17 20:27:05 +00:00
{
title => 'Infill',
options => [qw(fill_density fill_angle fill_pattern solid_fill_pattern infill_every_layers)],
2012-06-17 20:27:05 +00:00
},
]);
2012-06-17 20:54:08 +00:00
$self->AddOptionsPage('Speed', 'time.png', optgroups => [
2012-06-17 20:27:05 +00:00
{
title => 'Speed for print moves',
options => [qw(perimeter_speed small_perimeter_speed infill_speed solid_infill_speed top_solid_infill_speed bridge_speed)],
},
{
title => 'Speed for non-print moves',
options => [qw(travel_speed)],
},
{
title => 'Modifiers',
2012-06-17 20:27:05 +00:00
options => [qw(first_layer_speed)],
},
]);
2012-06-17 20:54:08 +00:00
$self->AddOptionsPage('Skirt', 'box.png', optgroups => [
2012-06-17 20:27:05 +00:00
{
title => 'Skirt',
options => [qw(skirts skirt_distance skirt_height)],
},
]);
2012-06-17 20:54:08 +00:00
$self->AddOptionsPage('Cooling', 'hourglass.png', optgroups => [
2012-06-17 20:27:05 +00:00
{
title => 'Enable',
options => [qw(cooling)],
},
{
title => 'Fan settings',
options => [qw(min_fan_speed max_fan_speed bridge_fan_speed disable_fan_first_layers fan_always_on)],
},
{
title => 'Cooling thresholds',
2012-06-18 09:26:21 +00:00
label_width => 250,
2012-06-17 20:27:05 +00:00
options => [qw(fan_below_layer_time slowdown_below_layer_time min_print_speed)],
},
]);
2012-06-17 20:54:08 +00:00
$self->AddOptionsPage('Support material', 'building.png', optgroups => [
2012-06-17 20:27:05 +00:00
{
title => 'Support material',
options => [qw(support_material support_material_tool)],
},
]);
2012-06-17 20:54:08 +00:00
$self->AddOptionsPage('Notes', 'note.png', optgroups => [
2012-06-17 20:27:05 +00:00
{
title => 'Notes',
2012-06-17 21:24:10 +00:00
no_labels => 1,
2012-06-17 20:27:05 +00:00
options => [qw(notes)],
},
]);
2012-06-17 20:54:08 +00:00
$self->AddOptionsPage('Output options', 'page_white_go.png', optgroups => [
2012-06-17 20:27:05 +00:00
{
title => 'Sequential printing',
options => [qw(complete_objects extruder_clearance_radius extruder_clearance_height)],
},
{
title => 'Output file',
options => [qw(gcode_comments output_filename_format)],
},
{
2012-06-17 21:24:10 +00:00
title => 'Post-processing scripts',
no_labels => 1,
2012-06-18 09:26:21 +00:00
options => [qw(post_process)],
2012-06-17 20:27:05 +00:00
},
]);
2012-06-17 20:54:08 +00:00
$self->AddOptionsPage('Advanced', 'wrench.png', optgroups => [
2012-06-17 20:27:05 +00:00
{
title => 'Extrusion width',
options => [qw(extrusion_width first_layer_extrusion_width perimeters_extrusion_width infill_extrusion_width)],
},
{
title => 'Flow',
options => [qw(bridge_flow_ratio)],
},
2012-06-18 09:26:21 +00:00
{
title => 'Other',
options => [qw(duplicate_distance)],
},
2012-06-17 20:27:05 +00:00
]);
return $self;
}
package Slic3r::GUI::Tab::Printer;
use Wx qw(:sizer :progressdialog);
use Wx::Event qw();
use base 'Slic3r::GUI::Tab';
sub new {
my $class = shift;
my ($parent) = @_;
my $self = $class->SUPER::new($parent, -1);
2012-06-17 20:54:08 +00:00
$self->AddOptionsPage('General', 'printer_empty.png', optgroups => [
2012-06-17 20:27:05 +00:00
{
title => 'Size and coordinates',
options => [qw(bed_size print_center z_offset)],
},
{
title => 'Firmware',
options => [qw(gcode_flavor use_relative_e_distances)],
},
]);
2012-06-17 20:54:08 +00:00
$self->AddOptionsPage('Extruder and filament', 'spool.png', optgroups => [
2012-06-17 20:27:05 +00:00
{
title => 'Size',
options => [qw(nozzle_diameter)],
},
{
title => 'Filament',
options => [qw(filament_diameter extrusion_multiplier)],
},
{
title => 'Temperature',
options => [qw(temperature first_layer_temperature bed_temperature first_layer_bed_temperature)],
},
]);
2012-06-17 20:54:08 +00:00
$self->AddOptionsPage('Custom G-code', 'cog.png', optgroups => [
2012-06-17 20:27:05 +00:00
{
2012-06-17 21:24:10 +00:00
title => 'Start G-code',
no_labels => 1,
options => [qw(start_gcode)],
},
{
title => 'End G-code',
no_labels => 1,
options => [qw(end_gcode)],
},
{
title => 'Layer change G-code',
no_labels => 1,
options => [qw(layer_gcode)],
2012-06-17 20:27:05 +00:00
},
]);
2012-06-17 20:54:08 +00:00
$self->AddOptionsPage('Retraction', 'arrow_up.png', optgroups => [
2012-06-17 20:27:05 +00:00
{
title => 'Retraction',
options => [qw(retract_length retract_lift retract_speed)],
},
{
title => 'Advanced',
options => [qw(retract_restart_extra retract_before_travel)],
},
]);
return $self;
}
package Slic3r::GUI::Tab::Page;
use Wx qw(:sizer :progressdialog);
use Wx::Event qw();
2012-06-18 09:26:21 +00:00
use base 'Wx::ScrolledWindow';
2012-06-17 20:27:05 +00:00
sub new {
my $class = shift;
my ($parent, %params) = @_;
my $self = $class->SUPER::new($parent, -1);
2012-06-18 09:26:21 +00:00
$self->SetScrollbars(1, 1, 1, 1);
2012-06-17 20:27:05 +00:00
$self->{vsizer} = Wx::BoxSizer->new(&Wx::wxVERTICAL);
$self->SetSizer($self->{vsizer});
if ($params{optgroups}) {
$self->append_optgroup(%$_) for @{$params{optgroups}};
}
return $self;
}
sub append_optgroup {
my $self = shift;
2012-06-18 09:26:21 +00:00
my $optgroup = Slic3r::GUI::OptionsGroup->new($self, label_width => 200, @_);
2012-06-17 20:27:05 +00:00
$self->{vsizer}->Add($optgroup, 0, wxEXPAND | wxALL, 5);
}
1;