fix pausing of checking torrents

This commit is contained in:
Marcos Pinto 2008-01-09 21:16:13 +00:00
parent cb64ecb282
commit ee4d054582
4 changed files with 24 additions and 22 deletions

View file

@ -2892,3 +2892,4 @@ information is sent.</property>
</child>
</widget>
</glade-interface>

View file

@ -407,21 +407,18 @@ class Manager:
# A separate function, because people may want to call it from time to time
def save_fastresume_data(self, uid=None):
if uid == None:
for unique_ID in self.unique_IDs:
try:
try:
for unique_ID in self.unique_IDs:
os.remove(self.unique_IDs[unique_ID].filename + ".fastresume")
except:
pass
try:
deluge_core.save_fastresume(unique_ID, self.unique_IDs[unique_ID].filename)
except:
pass
except:
pass
else:
try:
os.remove(self.unique_IDs[uid].filename + ".fastresume")
deluge_core.save_fastresume(uid, self.unique_IDs[uid].filename)
except:
pass
deluge_core.save_fastresume(uid, self.unique_IDs[uid].filename)
# State retrieval functions
@ -742,10 +739,13 @@ Space:") + " " + nice_free)
self.config.set("max_active_torrents", \
self.config.get("max_active_torrents_tmp"))
self.apply_prefs()
self.unique_IDs[unique_ID].user_paused = new_value
if enforce_queue:
self.apply_queue()
self.pickle_state()
try:
self.unique_IDs[unique_ID].user_paused = new_value
if enforce_queue:
self.apply_queue()
self.pickle_state()
except:
print "pause failed\n"
def set_ratio(self, unique_ID, num):
deluge_core.set_ratio(unique_ID, float(num))
@ -766,12 +766,12 @@ Space:") + " " + nice_free)
deluge_core.scrape_tracker(unique_ID)
def pause(self, unique_ID):
state = self.get_torrent_state(unique_ID)
if not state["is_paused"]:
try:
try:
state = self.get_torrent_state(unique_ID)
if not state["is_paused"]:
deluge_core.pause(unique_ID)
except:
print "pause failed\n"
except:
print "pause failed\n"
def resume(self, unique_ID):
state = self.get_torrent_state(unique_ID)

View file

@ -830,17 +830,15 @@ window, please enter your password"))
pass
def tor_pause(self, widget):
unique_ids = self.get_selected_torrent_rows()
try:
unique_ids = self.get_selected_torrent_rows()
for uid in unique_ids:
self.manager.set_user_pause(uid, True, True)
torrent_state = self.manager.get_torrent_state(uid)
if torrent_state["is_paused"] == 0:
self.manager.save_fastresume_data(uid)
self.update()
except KeyError:
except:
pass
def show_about_dialog(self, arg=None):
@ -1039,7 +1037,8 @@ window, please enter your password"))
# Load plugins after we showed main window (if not started in tray)
self.load_plugins()
self.load_tabs_order()
self.new_release_check()
if self.config.get("new_releases"):
self.new_release_check()
try:
gobject.threads_init()

View file

@ -130,6 +130,7 @@ if common.windows_check():
"use_lsd" : False,
"use_utpex" : True,
"window_height" : 480,
"new_releases" : True,
"window_maximized" : False,
"window_pane_position" : -1,
"window_width" : 640,
@ -161,6 +162,7 @@ else:
"open_folder_location": "",
"send_info" : True,
"auto_end_seeding" : False,
"new_releases" : True,
"auto_seed_ratio" : 0,
"close_to_tray" : False,
"enable_files_dialog" : False,