From ee4d054582c84e8c0db02ec5a80f6ed38a11a8bd Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Wed, 9 Jan 2008 21:16:13 +0000 Subject: [PATCH] fix pausing of checking torrents --- glade/preferences_dialog.glade | 1 + src/core.py | 34 +++++++++++++++++----------------- src/interface.py | 9 ++++----- src/pref.py | 2 ++ 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/glade/preferences_dialog.glade b/glade/preferences_dialog.glade index 9118e3065..0e8084aba 100644 --- a/glade/preferences_dialog.glade +++ b/glade/preferences_dialog.glade @@ -2892,3 +2892,4 @@ information is sent. + diff --git a/src/core.py b/src/core.py index 6911c0942..9c241ef42 100644 --- a/src/core.py +++ b/src/core.py @@ -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) diff --git a/src/interface.py b/src/interface.py index 0186fb3d8..61a436f6e 100644 --- a/src/interface.py +++ b/src/interface.py @@ -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() diff --git a/src/pref.py b/src/pref.py index 621c652a4..19d4b4bae 100644 --- a/src/pref.py +++ b/src/pref.py @@ -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,