Convert Slic3r::GUI::notify() from class method to instance method.

This commit is contained in:
Henrik Brix Andersen 2012-07-15 23:36:18 +02:00
parent 9f3031a069
commit a2a35f47f6
3 changed files with 7 additions and 7 deletions

View file

@ -15,7 +15,6 @@ use Wx 0.9901 qw(:bitmap :dialog :frame :icon :id :misc :systemsettings);
use Wx::Event qw(EVT_CLOSE EVT_MENU); use Wx::Event qw(EVT_CLOSE EVT_MENU);
use base 'Wx::App'; use base 'Wx::App';
my $growler;
our $datadir; our $datadir;
our $small_font = Wx::SystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); our $small_font = Wx::SystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
@ -32,8 +31,8 @@ sub OnInit {
if (eval "use Growl::GNTP; 1") { if (eval "use Growl::GNTP; 1") {
# register growl notifications # register growl notifications
eval { eval {
$growler = Growl::GNTP->new(AppName => 'Slic3r', AppIcon => "$Slic3r::var/Slic3r.png"); $self->{growler} = Growl::GNTP->new(AppName => 'Slic3r', AppIcon => "$Slic3r::var/Slic3r.png");
$growler->register([{Name => 'SKEIN_DONE', DisplayName => 'Slicing Done'}]); $self->{growler}->register([{Name => 'SKEIN_DONE', DisplayName => 'Slicing Done'}]);
}; };
} }
@ -170,11 +169,12 @@ sub warning_catcher {
} }
sub notify { sub notify {
my $self = shift;
my ($message) = @_; my ($message) = @_;
eval { eval {
$growler->notify(Event => 'SKEIN_DONE', Title => 'Slicing Done!', Message => $message) $self->{growler}->notify(Event => 'SKEIN_DONE', Title => 'Slicing Done!', Message => $message)
if $growler; if $self->{growler};
}; };
} }

View file

@ -537,7 +537,7 @@ sub export_gcode2 {
$message .= sprintf " %.1f seconds", $print->processing_time - $minutes*60; $message .= sprintf " %.1f seconds", $print->processing_time - $minutes*60;
} }
$message .= "."; $message .= ".";
Slic3r::GUI::notify($message); &Wx::wxTheApp->notify($message);
$params{on_completed}->($message); $params{on_completed}->($message);
$print->cleanup; $print->cleanup;
}; };

View file

@ -149,7 +149,7 @@ sub do_slice {
$message .= sprintf " %.1f seconds", $print->processing_time - $minutes*60; $message .= sprintf " %.1f seconds", $print->processing_time - $minutes*60;
} }
$message .= "."; $message .= ".";
Slic3r::GUI::notify($message); &Wx::wxTheApp->notify($message);
Wx::MessageDialog->new($self, $message, 'Slicing Done!', Wx::MessageDialog->new($self, $message, 'Slicing Done!',
wxOK | wxICON_INFORMATION)->ShowModal; wxOK | wxICON_INFORMATION)->ShowModal;
}; };