Some fine tune tweaks to [1004].

This commit is contained in:
Alex Dedul 2007-07-18 19:12:29 +00:00
parent d15442493c
commit 8f96d9318a
2 changed files with 11 additions and 9 deletions

View File

@ -226,7 +226,7 @@ class Manager:
self.event_callbacks = {} self.event_callbacks = {}
# unique_ids removed by core # unique_ids removed by core
self.removed_unique_ids = [] self.removed_unique_ids = {}
PREF_FUNCTIONS["enable_dht"] = self.set_DHT PREF_FUNCTIONS["enable_dht"] = self.set_DHT
@ -462,7 +462,7 @@ class Manager:
torrent_state = self.get_core_torrent_state(unique_ID) torrent_state = self.get_core_torrent_state(unique_ID)
if torrent_state['progress'] == 1.0: if torrent_state['progress'] == 1.0:
self.remove_torrent_ns(unique_ID) self.remove_torrent_ns(unique_ID)
self.removed_unique_ids.append(unique_ID) self.removed_unique_ids[unique_ID] = 1
self.sync() self.sync()
self.apply_queue() self.apply_queue()
@ -492,7 +492,7 @@ class Manager:
torrent_state = self.get_core_torrent_state(unique_ID, efficient) torrent_state = self.get_core_torrent_state(unique_ID, efficient)
ratio = self.calc_ratio(unique_ID, torrent_state) ratio = self.calc_ratio(unique_ID, torrent_state)
if ratio >= self.get_pref('auto_seed_ratio'): if ratio >= self.get_pref('auto_seed_ratio'):
self.removed_unique_ids.append(unique_ID) self.removed_unique_ids[unique_ID] = 1
self.remove_torrent(unique_ID, False, True) self.remove_torrent(unique_ID, False, True)
# Pause and resume torrents # Pause and resume torrents

View File

@ -841,23 +841,25 @@ class DelugeGTK:
while itr is not None: while itr is not None:
uid = self.torrent_model.get_value(itr, 0) uid = self.torrent_model.get_value(itr, 0)
if self.manager.removed_unique_ids.count(uid) > 0:
if uid in self.manager.removed_unique_ids:
selected_unique_id = self.get_selected_torrent() selected_unique_id = self.get_selected_torrent()
# If currently selected torrent was complete and so removed clear # If currently selected torrent was complete and so removed
# details pane # clear details pane
if selected_unique_id == uid: if selected_unique_id == uid:
self.clear_details_pane() self.clear_details_pane()
next = self.torrent_model.iter_next(itr) next = self.torrent_model.iter_next(itr)
self.torrent_model.remove(itr) self.torrent_model.remove(itr)
itr = self.torrent_model.get_iter_first() itr = self.torrent_model.get_iter_first()
if itr is None: if itr is None:
return True return True
itr = next itr = next
self.manager.removed_unique_ids.pop(self.manager.removed_unique_ids.index(uid))
del self.manager.removed_unique_ids[uid]
else: else:
state = self.manager.get_torrent_state(uid)
tlist = self.get_list_from_unique_id(uid) tlist = self.get_list_from_unique_id(uid)
for i in range(len(tlist)): for i in xrange(len(tlist)):
try: try:
self.torrent_model.set_value(itr, i, tlist[i]) self.torrent_model.set_value(itr, i, tlist[i])
except: except: