Display a warning when no USB/serial printers were configured
This commit is contained in:
parent
e8ae2d6ec2
commit
8f7e820a01
1 changed files with 16 additions and 1 deletions
|
@ -14,8 +14,17 @@ sub new {
|
||||||
$self->SetScrollbars(0, 1, 0, 1);
|
$self->SetScrollbars(0, 1, 0, 1);
|
||||||
$self->{sizer} = my $sizer = Wx::BoxSizer->new(wxVERTICAL);
|
$self->{sizer} = my $sizer = Wx::BoxSizer->new(wxVERTICAL);
|
||||||
|
|
||||||
|
# warning to show when there are no printers configured
|
||||||
{
|
{
|
||||||
my $btn = Wx::BitmapButton->new($self, -1, Wx::Bitmap->new("$Slic3r::var/add.png", wxBITMAP_TYPE_PNG),
|
$self->{text_no_printers} = Wx::StaticText->new($self, -1,
|
||||||
|
"No printers were configured for USB/serial control.",
|
||||||
|
wxDefaultPosition, wxDefaultSize);
|
||||||
|
$self->{sizer}->Add($self->{text_no_printers}, 0, wxTOP | wxLEFT, 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
# button for adding new printer panels
|
||||||
|
{
|
||||||
|
my $btn = $self->{btn_add} = Wx::BitmapButton->new($self, -1, Wx::Bitmap->new("$Slic3r::var/add.png", wxBITMAP_TYPE_PNG),
|
||||||
wxDefaultPosition, wxDefaultSize, Wx::wxBORDER_NONE);
|
wxDefaultPosition, wxDefaultSize, Wx::wxBORDER_NONE);
|
||||||
$btn->SetToolTipString("Add printer…")
|
$btn->SetToolTipString("Add printer…")
|
||||||
if $btn->can('SetToolTipString');
|
if $btn->can('SetToolTipString');
|
||||||
|
@ -118,6 +127,12 @@ sub OnActivate {
|
||||||
}
|
}
|
||||||
$self->add_printer($_, $presets{$_}) for sort keys %active;
|
$self->add_printer($_, $presets{$_}) for sort keys %active;
|
||||||
|
|
||||||
|
# show/hide the warning about no printers
|
||||||
|
$self->{text_no_printers}->Show(!%presets);
|
||||||
|
|
||||||
|
# show/hide the Add button
|
||||||
|
$self->{btn_add}->Show(keys %presets != keys %active);
|
||||||
|
|
||||||
$self->Layout;
|
$self->Layout;
|
||||||
|
|
||||||
# we need this in order to trigger the OnSize event of wxScrolledWindow which
|
# we need this in order to trigger the OnSize event of wxScrolledWindow which
|
||||||
|
|
Loading…
Reference in a new issue