GUI text boxes for start/end GCODE. #12
This commit is contained in:
parent
b2f0f85d96
commit
60f6ce363e
@ -107,12 +107,18 @@ our $Options = {
|
|||||||
'start_gcode' => {
|
'start_gcode' => {
|
||||||
label => 'Start GCODE',
|
label => 'Start GCODE',
|
||||||
type => 's',
|
type => 's',
|
||||||
|
multiline => 1,
|
||||||
|
width => 350,
|
||||||
|
height => 150,
|
||||||
serialize => sub { join '\n', split /\R+/, $_[0] },
|
serialize => sub { join '\n', split /\R+/, $_[0] },
|
||||||
deserialize => sub { join "\n", split /\\n/, $_[0] },
|
deserialize => sub { join "\n", split /\\n/, $_[0] },
|
||||||
},
|
},
|
||||||
'end_gcode' => {
|
'end_gcode' => {
|
||||||
label => 'End GCODE',
|
label => 'End GCODE',
|
||||||
type => 's',
|
type => 's',
|
||||||
|
multiline => 1,
|
||||||
|
width => 350,
|
||||||
|
height => 150,
|
||||||
serialize => sub { join '\n', split /\R+/, $_[0] },
|
serialize => sub { join '\n', split /\R+/, $_[0] },
|
||||||
deserialize => sub { join "\n", split /\\n/, $_[0] },
|
deserialize => sub { join "\n", split /\\n/, $_[0] },
|
||||||
},
|
},
|
||||||
|
@ -23,8 +23,17 @@ sub new {
|
|||||||
my $label = Wx::StaticText->new($parent, -1, "$opt->{label}:", Wx::wxDefaultPosition, [180,-1]);
|
my $label = Wx::StaticText->new($parent, -1, "$opt->{label}:", Wx::wxDefaultPosition, [180,-1]);
|
||||||
$label->Wrap(180); # needed to avoid Linux/GTK bug
|
$label->Wrap(180); # needed to avoid Linux/GTK bug
|
||||||
my $field;
|
my $field;
|
||||||
if ($opt->{type} =~ /^(i|f)$/) {
|
if ($opt->{type} =~ /^(i|f|s)$/) {
|
||||||
$field = Wx::TextCtrl->new($parent, -1, Slic3r::Config->get($opt_key));
|
my $style = 0;
|
||||||
|
my $size = Wx::wxDefaultSize;
|
||||||
|
|
||||||
|
if ($opt->{multiline}) {
|
||||||
|
$style = &Wx::wxTE_MULTILINE;
|
||||||
|
$size = Wx::Size->new($opt->{width} || -1, $opt->{height} || -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$field = Wx::TextCtrl->new($parent, -1, Slic3r::Config->get($opt_key),
|
||||||
|
Wx::wxDefaultPosition, $size, $style);
|
||||||
EVT_TEXT($parent, $field, sub { Slic3r::Config->set($opt_key, $field->GetValue) });
|
EVT_TEXT($parent, $field, sub { Slic3r::Config->set($opt_key, $field->GetValue) });
|
||||||
push @reload_callbacks, sub { $field->SetValue(Slic3r::Config->get($opt_key)) };
|
push @reload_callbacks, sub { $field->SetValue(Slic3r::Config->get($opt_key)) };
|
||||||
} elsif ($opt->{type} eq 'bool') {
|
} elsif ($opt->{type} eq 'bool') {
|
||||||
|
@ -47,6 +47,10 @@ sub new {
|
|||||||
title => 'Transform',
|
title => 'Transform',
|
||||||
options => [qw(scale rotate duplicate_x duplicate_y duplicate_distance)],
|
options => [qw(scale rotate duplicate_x duplicate_y duplicate_distance)],
|
||||||
},
|
},
|
||||||
|
gcode => {
|
||||||
|
title => 'Custom GCODE',
|
||||||
|
options => [qw(start_gcode end_gcode)],
|
||||||
|
},
|
||||||
);
|
);
|
||||||
$self->{panels} = \%panels;
|
$self->{panels} = \%panels;
|
||||||
|
|
||||||
@ -71,9 +75,11 @@ sub new {
|
|||||||
|
|
||||||
my $tab1 = $make_tab->([qw(printer filament)], [qw(speed)]);
|
my $tab1 = $make_tab->([qw(printer filament)], [qw(speed)]);
|
||||||
my $tab2 = $make_tab->([qw(transform accuracy skirt)], [qw(print retract)]);
|
my $tab2 = $make_tab->([qw(transform accuracy skirt)], [qw(print retract)]);
|
||||||
|
my $tab3 = $make_tab->([qw(gcode)]);
|
||||||
|
|
||||||
$tabpanel->AddPage($tab1, "Printer and Filament");
|
$tabpanel->AddPage($tab1, "Printer and Filament");
|
||||||
$tabpanel->AddPage($tab2, "Print Settings");
|
$tabpanel->AddPage($tab2, "Print Settings");
|
||||||
|
$tabpanel->AddPage($tab3, "Start/End GCODE");
|
||||||
|
|
||||||
my $buttons_sizer;
|
my $buttons_sizer;
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user