From a4373ef156e85ff14638f1826746aeb182f8ff06 Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Wed, 31 Oct 2007 05:45:07 +0000 Subject: [PATCH] use try in case pynotify isnt installed --- plugins/TorrentNotification/__init__.py | 29 ++++++++++++++----------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/plugins/TorrentNotification/__init__.py b/plugins/TorrentNotification/__init__.py index 976b85bc2..0ce40e9f7 100644 --- a/plugins/TorrentNotification/__init__.py +++ b/plugins/TorrentNotification/__init__.py @@ -97,19 +97,22 @@ class TorrentNotification: def show_notification(self, event): if not deluge.common.windows_check(): - import pynotify - file_info = self.interface.manager.get_torrent_file_info(event['unique_ID']) - filelist = "" - for file in file_info[:10]: - filelist += file['path'] + "\n" - if len(file_info) > 10: - filelist += '...' - - if pynotify.init("Deluge"): - n = pynotify.Notification(_("Torrent complete"), - _("Files") + ":\n" + filelist) - n.set_icon_from_pixbuf(deluge.common.get_logo(48)) - n.show() + try: + import pynotify + except: + pass + else: + file_info = self.interface.manager.get_torrent_file_info(event['unique_ID']) + filelist = "" + for file in file_info[:10]: + filelist += file['path'] + "\n" + if len(file_info) > 10: + filelist += '...' + if pynotify.init("Deluge"): + n = pynotify.Notification(_("Torrent complete"), + _("Files") + ":\n" + filelist) + n.set_icon_from_pixbuf(deluge.common.get_logo(48)) + n.show() else: pass