Tweaks to TorrentNotification plugin.

This commit is contained in:
Alex Dedul 2007-07-16 12:05:24 +00:00
commit 2e489bb00b

View file

@ -72,16 +72,20 @@ class TorrentNotification:
def set_tray_flashing_on(self): def set_tray_flashing_on(self):
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"