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

@ -72,16 +72,20 @@ class TorrentNotification:
def set_tray_flashing_on(self):
if self.window.has_toplevel_focus() is not True:
self.interface.tray_icon.set_blinking(True)
def show_notification(self, event):
import pynotify
file_info = self.interface.manager.get_torrent_file_info(event['unique_ID'])
self.filelist = ""
for file in file_info:
self.filelist += file['path']+"\n"
filelist = ""
for file in file_info[:10]:
filelist += file['path'] + "\n"
if len(file_info) > 10:
filelist += '...'
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()
else:
print "there was a problem initializing the pynotify module"