add torrent in paused state option

This commit is contained in:
Marcos Pinto 2007-11-13 23:15:17 +00:00
parent f7a1db3be7
commit edfd988cf9
7 changed files with 565 additions and 546 deletions

View File

@ -3,7 +3,7 @@ Deluge 0.5.7 (xx November 2007)
* Blocklist plugin will now display errors, instead of just crashing on a bad
list or wrong type
* Local discovery of peers
* Add advanced progress bar option - adapted from Arnab Bose
* Add torrent in paused state option
* Fix ratio bugs (hopefully for the last time)
* Scheduler plugin revamp by Ben Klein
* Fix ETA from going backwards

1
TODO
View File

@ -1,4 +1,3 @@
for 0.5.7
* remap filenames
* preference for starting torrents in paused state
* copy over active torrents when user changes location of torrent files

File diff suppressed because it is too large Load Diff

View File

@ -157,11 +157,11 @@ class cached_data:
# Persistent information for a single torrent
class torrent_info:
def __init__(self, filename, save_dir, compact):
def __init__(self, filename, save_dir, compact, user_paused=False):
self.filename = filename
self.save_dir = save_dir
self.compact = compact
self.user_paused = False
self.user_paused = user_paused
self.uploaded_memory = 0
self.initial_uploaded_memory = 0
self.upload_rate_limit = 0
@ -352,8 +352,8 @@ class Manager:
# Torrent addition and removal functions
def add_torrent(self, filename, save_dir, compact):
self.add_torrent_ns(filename, save_dir, compact)
def add_torrent(self, filename, save_dir, compact, user_paused=False):
self.add_torrent_ns(filename, save_dir, compact, user_paused)
return self.sync() # Syncing will create a new torrent in the core, and return it's ID
# When duplicate torrent error, use to find duplicate when merging tracker lists
@ -791,7 +791,7 @@ of HD space! Oops!\nWe had to pause at least one torrent"))
# Non-syncing functions. Used when we loop over such events, and sync manually at the end
def add_torrent_ns(self, filename, save_dir, compact):
def add_torrent_ns(self, filename, save_dir, compact, user_paused):
# Cache torrent file
(temp, filename_short) = os.path.split(filename)
@ -809,7 +809,7 @@ of HD space! Oops!\nWe had to pause at least one torrent"))
raise
# Create torrent object
new_torrent = torrent_info(full_new_name, save_dir, compact)
new_torrent = torrent_info(full_new_name, save_dir, compact, user_paused)
self.state.torrents[new_torrent] = None
def remove_torrent_ns(self, unique_ID, data_also):

View File

@ -150,6 +150,7 @@ class PreferencesDlg:
self.glade.get_widget("chk_autoseed").set_active(self.preferences.get("auto_end_seeding"))
self.glade.get_widget("chk_clear_max_ratio_torrents").set_sensitive(self.preferences.get("auto_end_seeding"))
self.glade.get_widget("chk_clear_max_ratio_torrents").set_active(self.preferences.get("clear_max_ratio_torrents"))
self.glade.get_widget("chk_paused").set_active(self.preferences.get("start_paused"))
self.glade.get_widget("ratio_spinner").set_value(self.preferences.get("auto_seed_ratio"))
self.glade.get_widget("chk_dht").set_active(self.preferences.get("enable_dht"))
self.glade.get_widget("spin_gui").set_value(self.preferences.get("gui_update_interval"))
@ -269,6 +270,7 @@ class PreferencesDlg:
self.preferences.set("gui_update_interval", self.glade.get_widget("spin_gui").get_value())
self.preferences.set("clear_max_ratio_torrents", self.glade.get_widget("chk_clear_max_ratio_torrents").get_active())
self.preferences.set("queue_above_completed", self.glade.get_widget("chk_queue_above_completed").get_active())
self.preferences.set("start_paused", self.glade.get_widget("chk_paused").get_active())
interface.apply_prefs()
interface.config.save()

View File

@ -760,7 +760,8 @@ window, please enter your password"))
self.manager.remove_torrent(uid, False, False)
self.torrent_model_remove(uid)
self.update()
unique_ID = self.manager.add_torrent(save_info[0], save_info[1], self.config.get("use_compact_storage"))
unique_ID = self.manager.add_torrent(save_info[0], save_info[1], \
self.config.get("use_compact_storage"))
self.torrent_model_append(unique_ID)
self.update()
self.manager.prioritize_files(unique_ID, priorities, update_files_removed=False)
@ -1301,7 +1302,8 @@ window, please enter your password"))
files_dialog = dialogs.FilesDlg(dumped_torrent)
if files_dialog.show(self.window) == 1:
unique_id = self.manager.add_torrent(torrent, path,
self.config.get('use_compact_storage'))
self.config.get('use_compact_storage'), \
self.config.get('start_paused'))
self.manager.prioritize_files(unique_id,
files_dialog.get_priorities())
if files_dialog.is_private_flag_checked():
@ -1310,7 +1312,8 @@ window, please enter your password"))
return False
else:
unique_id = self.manager.add_torrent(torrent, path,
self.config.get('use_compact_storage'))
self.config.get('use_compact_storage'), \
self.config.get('start_paused'))
except core.InvalidEncodingError, e:
print "InvalidEncodingError", e
dialogs.show_popup_warning(self.window, _("An error occured while \

View File

@ -146,7 +146,8 @@ if common.windows_check():
"status_width" : 150,
"filename_f_width" : 220,
"size_f_width" : 90,
"priority_f_width" : 140
"priority_f_width" : 140,
"start_paused": False
}
else:
DEFAULT_PREFS = {
@ -255,7 +256,8 @@ else:
"status_width" : 150,
"filename_f_width" : 220,
"size_f_width" : 90,
"priority_f_width" : 140
"priority_f_width" : 140,
"start_paused": False
}
class Preferences: