summaryrefslogtreecommitdiffstats
path: root/deluge/plugins/Notifications/deluge_notifications/gtkui.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-19 15:05:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-19 16:15:47 +0000
commitb686174b07bd56af4e5ffaa23c24f27f417fc305 (patch)
tree1ce335620d99341d94e88c159c0b9b0f6f0de5a0 /deluge/plugins/Notifications/deluge_notifications/gtkui.py
parentAdding debian version 2.0.3-4. (diff)
downloaddeluge-b686174b07bd56af4e5ffaa23c24f27f417fc305.tar.xz
deluge-b686174b07bd56af4e5ffaa23c24f27f417fc305.zip
Merging upstream version 2.1.1 (Closes: #1026291).
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'deluge/plugins/Notifications/deluge_notifications/gtkui.py')
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/gtkui.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/deluge/plugins/Notifications/deluge_notifications/gtkui.py b/deluge/plugins/Notifications/deluge_notifications/gtkui.py
index 816cb36..4dc5ff8 100644
--- a/deluge/plugins/Notifications/deluge_notifications/gtkui.py
+++ b/deluge/plugins/Notifications/deluge_notifications/gtkui.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2010 Pedro Algarvio <pedro@algarvio.me>
#
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from os.path import basename
@@ -42,7 +39,7 @@ except ImportError:
try:
require_version('Notify', '0.7')
- from gi.repository import Notify
+ from gi.repository import GLib, Notify
except (ValueError, ImportError):
POPUP_AVAILABLE = False
else:
@@ -174,15 +171,17 @@ class GtkUiNotifications(CustomNotifications):
if not self.config['popup_enabled']:
return defer.succeed(_('Popup notification is not enabled.'))
if not POPUP_AVAILABLE:
- return defer.fail(_('libnotify is not installed'))
+ err_msg = _('libnotify is not installed')
+ log.warning(err_msg)
+ return defer.fail(ImportError(err_msg))
if Notify.init('Deluge'):
self.note = Notify.Notification.new(title, message, 'deluge-panel')
- self.note.set_hint('desktop-entry', 'deluge')
+ self.note.set_hint('desktop-entry', GLib.Variant.new_string('deluge'))
if not self.note.show():
err_msg = _('Failed to popup notification')
log.warning(err_msg)
- return defer.fail(err_msg)
+ return defer.fail(Exception(err_msg))
return defer.succeed(_('Notification popup shown'))
def __play_sound(self, sound_path=''):
@@ -191,7 +190,7 @@ class GtkUiNotifications(CustomNotifications):
if not SOUND_AVAILABLE:
err_msg = _('pygame is not installed')
log.warning(err_msg)
- return defer.fail(err_msg)
+ return defer.fail(ImportError(err_msg))
pygame.init()
try:
@@ -203,7 +202,7 @@ class GtkUiNotifications(CustomNotifications):
except pygame.error as ex:
err_msg = _('Sound notification failed %s') % ex
log.warning(err_msg)
- return defer.fail(err_msg)
+ return defer.fail(ex)
else:
msg = _('Sound notification Success')
log.info(msg)