use try in case pynotify isnt installed

This commit is contained in:
Marcos Pinto 2007-10-31 05:45:07 +00:00
commit a4373ef156

View file

@ -97,19 +97,22 @@ class TorrentNotification:
def show_notification(self, event): def show_notification(self, event):
if not deluge.common.windows_check(): if not deluge.common.windows_check():
import pynotify try:
file_info = self.interface.manager.get_torrent_file_info(event['unique_ID']) import pynotify
filelist = "" except:
for file in file_info[:10]: pass
filelist += file['path'] + "\n" else:
if len(file_info) > 10: file_info = self.interface.manager.get_torrent_file_info(event['unique_ID'])
filelist += '...' filelist = ""
for file in file_info[:10]:
if pynotify.init("Deluge"): filelist += file['path'] + "\n"
n = pynotify.Notification(_("Torrent complete"), if len(file_info) > 10:
_("Files") + ":\n" + filelist) filelist += '...'
n.set_icon_from_pixbuf(deluge.common.get_logo(48)) if pynotify.init("Deluge"):
n.show() n = pynotify.Notification(_("Torrent complete"),
_("Files") + ":\n" + filelist)
n.set_icon_from_pixbuf(deluge.common.get_logo(48))
n.show()
else: else:
pass pass