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
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. * 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..) * Tray locking and other tray options (close to tray, start in tray..)
* Add state saving to listview.. this includes saving column size and position. * 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 * Change the menubar.py gtkui component to menus.py and add support for plugins
to add menuitems to the torrentmenu in an easy way. to add menuitems to the torrentmenu in an easy way.
* Add the tracker responses to the torrent details * Add the tracker responses to the torrent details
* Fast resume saving
* Restart daemon function * Restart daemon function
* Sync the details pane to current trunk * Sync the details pane to current trunk
* Automatically save torrent state every ~5 minutes, much like how * 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..") log.info("Shutting down core..")
self.loop.quit() self.loop.quit()
self.plugins.shutdown() self.plugins.shutdown()
del self.plugins self.torrents.shutdown()
del self.torrents
# Make sure the config file has been saved # Make sure the config file has been saved
self.config.save() self.config.save()
del self.config del self.config
@ -265,7 +264,9 @@ class Core(dbus.service.Object):
status = self.torrents[torrent_id].get_status(nkeys) status = self.torrents[torrent_id].get_status(nkeys)
except KeyError: except KeyError:
# The torrent_id is not found in the torrentmanager, so return None # 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 # Get the leftover fields and ask the plugin manager to fill them
leftover_fields = list(set(nkeys) - set(status.keys())) leftover_fields = list(set(nkeys) - set(status.keys()))
@ -486,4 +487,4 @@ class Core(dbus.service.Object):
# Write the fastresume file # Write the fastresume file
self.torrents.write_fastresume(torrent_id) self.torrents.write_fastresume(torrent_id)
# Emit torrent_paused signal # 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 self.total_uploaded = 0
# Set the allocation mode # Set the allocation mode
self.compact = compact self.compact = compact
def get_state(self): def get_state(self):
"""Returns the state of this torrent for saving to the session state""" """Returns the state of this torrent for saving to the session state"""
return (self.torrent_id, self.filename, self.compact) return (self.torrent_id, self.filename, self.compact)
@ -94,12 +94,12 @@ class Torrent:
progress = status.progress*100 progress = status.progress*100
# Get the total number of seeds and peers # Get the total number of seeds and peers
if status.num_complete is -1: if status.num_complete == -1:
total_seeds = status.num_seeds total_seeds = status.num_seeds
else: else:
total_seeds = status.num_complete total_seeds = status.num_complete
if status.num_incomplete is -1: if status.num_incomplete == -1:
total_peers = status.num_peers - status.num_seeds total_peers = status.num_peers - status.num_seeds
else: else:
total_peers = status.num_incomplete total_peers = status.num_incomplete

View file

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

View file

@ -96,7 +96,11 @@ class TorrentDetails:
status = functions.get_torrent_status(self.core, status = functions.get_torrent_status(self.core,
selected, selected,
status_keys) 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 # We need to adjust the value core gives us for progress
progress = status["progress"]/100 progress = status["progress"]/100
self.progress_bar.set_fraction(progress) self.progress_bar.set_fraction(progress)