mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
Merged SkeinPanel into MainFrame
This commit is contained in:
parent
93b9116565
commit
ddac2d1570
12 changed files with 835 additions and 846 deletions
41
lib/Slic3r/GUI/Notifier.pm
Normal file
41
lib/Slic3r/GUI/Notifier.pm
Normal file
|
@ -0,0 +1,41 @@
|
|||
package Slic3r::GUI::Notifier;
|
||||
use Moo;
|
||||
|
||||
has 'growler' => (is => 'rw');
|
||||
|
||||
my $icon = "$Slic3r::var/Slic3r.png";
|
||||
|
||||
sub BUILD {
|
||||
my ($self) = @_;
|
||||
|
||||
if (eval 'use Growl::GNTP; 1') {
|
||||
# register with growl
|
||||
eval {
|
||||
$self->growler(Growl::GNTP->new(AppName => 'Slic3r', AppIcon => $icon));
|
||||
$self->growler->register([{Name => 'SKEIN_DONE', DisplayName => 'Slicing Done'}]);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
sub notify {
|
||||
my ($self, $message) = @_;
|
||||
my $title = 'Slicing Done!';
|
||||
|
||||
eval {
|
||||
$self->growler->notify(Event => 'SKEIN_DONE', Title => $title, Message => $message)
|
||||
if $self->growler;
|
||||
};
|
||||
# Net::DBus is broken in multithreaded environment
|
||||
if (0 && eval 'use Net::DBus; 1') {
|
||||
eval {
|
||||
my $session = Net::DBus->session;
|
||||
my $serv = $session->get_service('org.freedesktop.Notifications');
|
||||
my $notifier = $serv->get_object('/org/freedesktop/Notifications',
|
||||
'org.freedesktop.Notifications');
|
||||
$notifier->Notify('Slic3r', 0, $icon, $title, $message, [], {}, -1);
|
||||
undef $Net::DBus::bus_session;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
Loading…
Add table
Add a link
Reference in a new issue