Move Growl::GNTP handling to Slic3r::GUI to allow notifications from both Slic3r::GUI::SkeinPanel and Slic3r::GUI::Plater.

This commit is contained in:
Henrik Brix Andersen 2012-06-14 13:49:50 +02:00
parent 3c66ea3134
commit 129f0fa904
3 changed files with 21 additions and 17 deletions

View file

@ -12,6 +12,8 @@ use Wx 0.9901 qw(:sizer :frame wxID_EXIT wxID_ABOUT);
use Wx::Event qw(EVT_MENU);
use base 'Wx::App';
my $growler;
sub OnInit {
my $self = shift;
@ -27,6 +29,14 @@ sub OnInit {
my $box = Wx::BoxSizer->new(wxVERTICAL);
$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
my $menubar = Wx::MenuBar->new;
$frame->SetMenuBar($menubar);
@ -98,6 +108,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;
use base 'Wx::StatusBar';