From a2a35f47f6bc5af52bfc8f24f44ba7eba19ffb11 Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Sun, 15 Jul 2012 23:36:18 +0200 Subject: [PATCH] Convert Slic3r::GUI::notify() from class method to instance method. --- lib/Slic3r/GUI.pm | 10 +++++----- lib/Slic3r/GUI/Plater.pm | 2 +- lib/Slic3r/GUI/SkeinPanel.pm | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/Slic3r/GUI.pm b/lib/Slic3r/GUI.pm index 817056e31..7945678f0 100644 --- a/lib/Slic3r/GUI.pm +++ b/lib/Slic3r/GUI.pm @@ -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 base 'Wx::App'; -my $growler; our $datadir; our $small_font = Wx::SystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); @@ -32,8 +31,8 @@ sub OnInit { 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'}]); + $self->{growler} = Growl::GNTP->new(AppName => 'Slic3r', AppIcon => "$Slic3r::var/Slic3r.png"); + $self->{growler}->register([{Name => 'SKEIN_DONE', DisplayName => 'Slicing Done'}]); }; } @@ -170,11 +169,12 @@ sub warning_catcher { } sub notify { + my $self = shift; my ($message) = @_; eval { - $growler->notify(Event => 'SKEIN_DONE', Title => 'Slicing Done!', Message => $message) - if $growler; + $self->{growler}->notify(Event => 'SKEIN_DONE', Title => 'Slicing Done!', Message => $message) + if $self->{growler}; }; } diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 3cc96adc1..9568c9984 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -537,7 +537,7 @@ sub export_gcode2 { $message .= sprintf " %.1f seconds", $print->processing_time - $minutes*60; } $message .= "."; - Slic3r::GUI::notify($message); + &Wx::wxTheApp->notify($message); $params{on_completed}->($message); $print->cleanup; }; diff --git a/lib/Slic3r/GUI/SkeinPanel.pm b/lib/Slic3r/GUI/SkeinPanel.pm index 4b720f61d..aaf7c5cd1 100644 --- a/lib/Slic3r/GUI/SkeinPanel.pm +++ b/lib/Slic3r/GUI/SkeinPanel.pm @@ -149,7 +149,7 @@ sub do_slice { $message .= sprintf " %.1f seconds", $print->processing_time - $minutes*60; } $message .= "."; - Slic3r::GUI::notify($message); + &Wx::wxTheApp->notify($message); Wx::MessageDialog->new($self, $message, 'Slicing Done!', wxOK | wxICON_INFORMATION)->ShowModal; };