From 24b6def6bdedf36d119b7b1dc2f1f605bcaef2f2 Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Fri, 9 Nov 2007 01:12:42 +0000 Subject: [PATCH] little code cleanup --- src/core.py | 8 ++++---- src/interface.py | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/core.py b/src/core.py index 4bcc8ccc8..d36cf1706 100644 --- a/src/core.py +++ b/src/core.py @@ -526,7 +526,7 @@ class Manager: # Before we resume, we should check if the torrent is using Full Allocation # and if there is enough space on to finish this file. - if self.unique_IDs[unique_ID].compact == False: + if not self.unique_IDs[unique_ID].compact: avail = self.calc_free_space(directory = self.unique_IDs\ [unique_ID].save_dir) total_needed = torrent_state["total_wanted"] - torrent_state["total_wanted_done"] @@ -929,7 +929,7 @@ of HD space! Oops!\nWe had to pause at least one torrent")) for pref in PREF_FUNCTIONS: if PREF_FUNCTIONS[pref] is not None: if (PREF_FUNCTIONS[pref] == PREF_FUNCTIONS["listen_on"]): - if self.get_pref("random_port") == False: + if not self.get_pref("random_port"): PREF_FUNCTIONS[pref](self.get_pref(pref)) else: if deluge_core.listening_port() != 0: @@ -962,11 +962,11 @@ of HD space! Oops!\nWe had to pause at least one torrent")) self.get_pref("max_upload_slots_per_torrent")) def set_DHT(self, start=False): - if start == True and self.dht_running != True: + if start and not self.dht_running: print "Starting DHT..." deluge_core.start_DHT(os.path.join(self.base_dir, DHT_FILENAME)) self.dht_running = True - elif start == False and self.dht_running == True: + elif not start and self.dht_running: print "Stopping DHT..." deluge_core.stop_DHT(os.path.join(self.base_dir, DHT_FILENAME)) self.dht_running = False diff --git a/src/interface.py b/src/interface.py index d97c2ea11..11bf33080 100644 --- a/src/interface.py +++ b/src/interface.py @@ -520,7 +520,7 @@ window, please enter your password")) # Force UI update as we don't update it while minimized self.update() else: - if self.config.get("lock_tray") == True: + if self.config.get("lock_tray"): self.unlock_tray("mainwinshow") else: self.load_window_geometry() @@ -530,7 +530,7 @@ window, please enter your password")) def show_hide_window_toggled(self, widget): if widget.get_active() and not self.window.get_property("visible"): - if self.config.get("lock_tray") == True: + if self.config.get("lock_tray"): self.unlock_tray("mainwinshow") else: self.window.show() @@ -1597,7 +1597,7 @@ want to remove all seeding torrents?")): i = i + 1 def window_configure_event(self, widget, event): - if self.config.get("window_maximized") == False: + if not self.config.get("window_maximized"): self.config.set("window_x_pos", self.window.get_position()[0]) self.config.set("window_y_pos", self.window.get_position()[1]) self.config.set("window_width", event.width) @@ -1625,7 +1625,7 @@ want to remove all seeding torrents?")): h = self.config.get('window_height') self.window.move(x, y) self.window.resize(w, h) - if self.config.get("window_maximized") == True: + if self.config.get("window_maximized"): self.window.maximize() def close(self, widget, event): @@ -1641,7 +1641,7 @@ want to remove all seeding torrents?")): self.window.hide() self.shutdown() else: - if self.config.get("lock_tray") == True: + if self.config.get("lock_tray"): self.unlock_tray("quitus") else: self.window.hide()