Fix exception when removing multiple torrents at once.

Updated TODO.
This commit is contained in:
Andrew Resch 2007-09-30 05:33:53 +00:00
parent 466292d38e
commit f2f73b8539
5 changed files with 15 additions and 12 deletions

2
TODO
View File

@ -1,4 +1,3 @@
* Have peer numbers show what we receive from tracker_reply_alert
* Have the ui better handle not being able to connect to the daemon.
* Tray locking and other tray options (close to tray, start in tray..)
* Add state saving to listview.. this includes saving column size and position.
@ -14,7 +13,6 @@
* Change the menubar.py gtkui component to menus.py and add support for plugins
to add menuitems to the torrentmenu in an easy way.
* Add the tracker responses to the torrent details
* Fast resume saving
* Restart daemon function
* Sync the details pane to current trunk
* Automatically save torrent state every ~5 minutes, much like how

View File

@ -151,8 +151,7 @@ class Core(dbus.service.Object):
log.info("Shutting down core..")
self.loop.quit()
self.plugins.shutdown()
del self.plugins
del self.torrents
self.torrents.shutdown()
# Make sure the config file has been saved
self.config.save()
del self.config
@ -265,7 +264,9 @@ class Core(dbus.service.Object):
status = self.torrents[torrent_id].get_status(nkeys)
except KeyError:
# The torrent_id is not found in the torrentmanager, so return None
return None
status = None
status = pickle.dumps(status)
return status
# Get the leftover fields and ask the plugin manager to fill them
leftover_fields = list(set(nkeys) - set(status.keys()))
@ -486,4 +487,4 @@ class Core(dbus.service.Object):
# Write the fastresume file
self.torrents.write_fastresume(torrent_id)
# Emit torrent_paused signal
self.torrent_paused(torrent_id)
self.torrent_paused(torrent_id)

View File

@ -49,7 +49,7 @@ class Torrent:
self.total_uploaded = 0
# Set the allocation mode
self.compact = compact
def get_state(self):
"""Returns the state of this torrent for saving to the session state"""
return (self.torrent_id, self.filename, self.compact)
@ -94,12 +94,12 @@ class Torrent:
progress = status.progress*100
# Get the total number of seeds and peers
if status.num_complete is -1:
if status.num_complete == -1:
total_seeds = status.num_seeds
else:
total_seeds = status.num_complete
if status.num_incomplete is -1:
if status.num_incomplete == -1:
total_peers = status.num_peers - status.num_seeds
else:
total_peers = status.num_incomplete

View File

@ -78,8 +78,8 @@ class TorrentManager:
self.on_set_max_connections_per_torrent)
self.config.register_set_function("max_upload_slots_per_torrent",
self.on_set_max_upload_slots_per_torrent)
def __del__(self):
def shutdown(self):
log.debug("TorrentManager shutting down..")
# Save state on shutdown
self.save_state()

View File

@ -96,7 +96,11 @@ class TorrentDetails:
status = functions.get_torrent_status(self.core,
selected,
status_keys)
# Check to see if we got valid data from the core
if status is None:
return
# We need to adjust the value core gives us for progress
progress = status["progress"]/100
self.progress_bar.set_fraction(progress)