Tweaks to TorrentNotification plugin.

This commit is contained in:
Alex Dedul 2007-07-16 12:05:24 +00:00
parent 3115498790
commit 2e489bb00b
1 changed files with 9 additions and 5 deletions

View File

@ -73,15 +73,19 @@ class TorrentNotification:
if self.window.has_toplevel_focus() is not True: if self.window.has_toplevel_focus() is not True:
self.interface.tray_icon.set_blinking(True) self.interface.tray_icon.set_blinking(True)
def show_notification(self, event): def show_notification(self, event):
import pynotify import pynotify
file_info = self.interface.manager.get_torrent_file_info(event['unique_ID']) file_info = self.interface.manager.get_torrent_file_info(event['unique_ID'])
self.filelist = "" filelist = ""
for file in file_info: for file in file_info[:10]:
self.filelist += file['path']+"\n" filelist += file['path'] + "\n"
if len(file_info) > 10:
filelist += '...'
if pynotify.init("My Application Name"): if pynotify.init("My Application Name"):
n = pynotify.Notification("Torrent complete", "Files:\n"+self.filelist) n = pynotify.Notification("Torrent complete",
"Files:\n" + filelist)
n.show() n.show()
else: else:
print "there was a problem initializing the pynotify module" print "there was a problem initializing the pynotify module"