Add PreTorrentRemovedEvent event

This commit is contained in:
Andrew Resch 2009-03-26 21:23:56 +00:00
parent 8373377c10
commit 42dce915df
2 changed files with 13 additions and 0 deletions

View File

@ -430,6 +430,9 @@ class TorrentManager(component.Component):
def remove(self, torrent_id, remove_data=False):
"""Remove a torrent from the manager"""
# Emit the signal to the clients
component.get("EventManager").emit(PreTorrentRemovedEvent(torrent_id))
try:
self.session.remove_torrent(self.torrents[torrent_id].handle,
1 if remove_data else 0)

View File

@ -69,6 +69,16 @@ class TorrentRemovedEvent(DelugeEvent):
"""
self._args = [torrent_id]
class PreTorrentRemovedEvent(DelugeEvent):
"""
Emitted when a torrent is about to be removed from the session.
"""
def __init__(self, torrent_id):
"""
:param torrent_id: str, the torrent_id
"""
self._args = [torrent_id]
class TorrentStateChangedEvent(DelugeEvent):
"""
Emitted when a torrent changes state.