Merge pull request #450 from henrikbrixandersen/growl
Move Growl::GNTP handling to Slic3r::GUI
This commit is contained in:
commit
b00d960f4d
3 changed files with 21 additions and 17 deletions
|
@ -12,6 +12,8 @@ use Wx 0.9901 qw(:sizer :frame wxID_EXIT wxID_ABOUT);
|
||||||
use Wx::Event qw(EVT_MENU);
|
use Wx::Event qw(EVT_MENU);
|
||||||
use base 'Wx::App';
|
use base 'Wx::App';
|
||||||
|
|
||||||
|
my $growler;
|
||||||
|
|
||||||
sub OnInit {
|
sub OnInit {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
|
@ -27,6 +29,14 @@ sub OnInit {
|
||||||
my $box = Wx::BoxSizer->new(wxVERTICAL);
|
my $box = Wx::BoxSizer->new(wxVERTICAL);
|
||||||
$box->Add($panel, 0);
|
$box->Add($panel, 0);
|
||||||
|
|
||||||
|
if (eval "use Growl::GNTP; 1") {
|
||||||
|
# register growl notifications
|
||||||
|
eval {
|
||||||
|
$growler = Growl::GNTP->new(AppName => 'Slic3r', AppIcon => "$Slic3r::var/Slic3r.png");
|
||||||
|
$growler->register([{Name => 'SKEIN_DONE', DisplayName => 'Slicing Done'}]);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
# menubar
|
# menubar
|
||||||
my $menubar = Wx::MenuBar->new;
|
my $menubar = Wx::MenuBar->new;
|
||||||
|
|
||||||
|
@ -108,6 +118,15 @@ sub warning_catcher {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub notify {
|
||||||
|
my ($message) = @_;
|
||||||
|
|
||||||
|
eval {
|
||||||
|
$growler->notify(Event => 'SKEIN_DONE', Title => 'Slicing Done!', Message => $message)
|
||||||
|
if $growler;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
package Slic3r::GUI::ProgressStatusBar;
|
package Slic3r::GUI::ProgressStatusBar;
|
||||||
use base 'Wx::StatusBar';
|
use base 'Wx::StatusBar';
|
||||||
|
|
||||||
|
|
|
@ -519,11 +519,7 @@ sub export_gcode2 {
|
||||||
$print->processing_time - int($print->processing_time/60)*60
|
$print->processing_time - int($print->processing_time/60)*60
|
||||||
if $print->processing_time;
|
if $print->processing_time;
|
||||||
$message .= ".";
|
$message .= ".";
|
||||||
eval {
|
Slic3r::GUI::notify($message);
|
||||||
# TODO: fix it as we don't have $self->{growler}
|
|
||||||
$self->{growler}->notify(Event => 'SKEIN_DONE', Title => 'Slicing Done!', Message => $message)
|
|
||||||
if ($self->{growler});
|
|
||||||
};
|
|
||||||
$params{on_completed}->($message);
|
$params{on_completed}->($message);
|
||||||
$print->cleanup;
|
$print->cleanup;
|
||||||
};
|
};
|
||||||
|
|
|
@ -86,14 +86,6 @@ sub new {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
$self->{panels} = \%panels;
|
$self->{panels} = \%panels;
|
||||||
|
|
||||||
if (eval "use Growl::GNTP; 1") {
|
|
||||||
# register growl notifications
|
|
||||||
eval {
|
|
||||||
$self->{growler} = Growl::GNTP->new(AppName => 'Slic3r', AppIcon => "$Slic3r::var/Slic3r.png");
|
|
||||||
$self->{growler}->register([{Name => 'SKEIN_DONE', DisplayName => 'Slicing Done'}]);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
my $tabpanel = Wx::Notebook->new($self, -1, Wx::wxDefaultPosition, Wx::wxDefaultSize, &Wx::wxNB_TOP);
|
my $tabpanel = Wx::Notebook->new($self, -1, Wx::wxDefaultPosition, Wx::wxDefaultSize, &Wx::wxNB_TOP);
|
||||||
my $make_tab = sub {
|
my $make_tab = sub {
|
||||||
|
@ -272,10 +264,7 @@ sub do_slice {
|
||||||
$print->processing_time - int($print->processing_time/60)*60
|
$print->processing_time - int($print->processing_time/60)*60
|
||||||
if $print->processing_time;
|
if $print->processing_time;
|
||||||
$message .= ".";
|
$message .= ".";
|
||||||
eval {
|
Slic3r::GUI::notify($message);
|
||||||
$self->{growler}->notify(Event => 'SKEIN_DONE', Title => 'Slicing Done!', Message => $message)
|
|
||||||
if ($self->{growler});
|
|
||||||
};
|
|
||||||
Wx::MessageDialog->new($self, $message, 'Done!',
|
Wx::MessageDialog->new($self, $message, 'Done!',
|
||||||
wxOK | wxICON_INFORMATION)->ShowModal;
|
wxOK | wxICON_INFORMATION)->ShowModal;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue