little code cleanup

This commit is contained in:
Marcos Pinto 2007-11-09 01:12:42 +00:00
commit 24b6def6bd
2 changed files with 9 additions and 9 deletions

View file

@ -526,7 +526,7 @@ class Manager:
# Before we resume, we should check if the torrent is using Full Allocation # Before we resume, we should check if the torrent is using Full Allocation
# and if there is enough space on to finish this file. # 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\ avail = self.calc_free_space(directory = self.unique_IDs\
[unique_ID].save_dir) [unique_ID].save_dir)
total_needed = torrent_state["total_wanted"] - torrent_state["total_wanted_done"] 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: for pref in PREF_FUNCTIONS:
if PREF_FUNCTIONS[pref] is not None: if PREF_FUNCTIONS[pref] is not None:
if (PREF_FUNCTIONS[pref] == PREF_FUNCTIONS["listen_on"]): 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)) PREF_FUNCTIONS[pref](self.get_pref(pref))
else: else:
if deluge_core.listening_port() != 0: 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")) self.get_pref("max_upload_slots_per_torrent"))
def set_DHT(self, start=False): def set_DHT(self, start=False):
if start == True and self.dht_running != True: if start and not self.dht_running:
print "Starting DHT..." print "Starting DHT..."
deluge_core.start_DHT(os.path.join(self.base_dir, DHT_FILENAME)) deluge_core.start_DHT(os.path.join(self.base_dir, DHT_FILENAME))
self.dht_running = True self.dht_running = True
elif start == False and self.dht_running == True: elif not start and self.dht_running:
print "Stopping DHT..." print "Stopping DHT..."
deluge_core.stop_DHT(os.path.join(self.base_dir, DHT_FILENAME)) deluge_core.stop_DHT(os.path.join(self.base_dir, DHT_FILENAME))
self.dht_running = False self.dht_running = False

View file

@ -520,7 +520,7 @@ window, please enter your password"))
# Force UI update as we don't update it while minimized # Force UI update as we don't update it while minimized
self.update() self.update()
else: else:
if self.config.get("lock_tray") == True: if self.config.get("lock_tray"):
self.unlock_tray("mainwinshow") self.unlock_tray("mainwinshow")
else: else:
self.load_window_geometry() self.load_window_geometry()
@ -530,7 +530,7 @@ window, please enter your password"))
def show_hide_window_toggled(self, widget): def show_hide_window_toggled(self, widget):
if widget.get_active() and not self.window.get_property("visible"): 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") self.unlock_tray("mainwinshow")
else: else:
self.window.show() self.window.show()
@ -1597,7 +1597,7 @@ want to remove all seeding torrents?")):
i = i + 1 i = i + 1
def window_configure_event(self, widget, event): 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_x_pos", self.window.get_position()[0])
self.config.set("window_y_pos", self.window.get_position()[1]) self.config.set("window_y_pos", self.window.get_position()[1])
self.config.set("window_width", event.width) self.config.set("window_width", event.width)
@ -1625,7 +1625,7 @@ want to remove all seeding torrents?")):
h = self.config.get('window_height') h = self.config.get('window_height')
self.window.move(x, y) self.window.move(x, y)
self.window.resize(w, h) self.window.resize(w, h)
if self.config.get("window_maximized") == True: if self.config.get("window_maximized"):
self.window.maximize() self.window.maximize()
def close(self, widget, event): def close(self, widget, event):
@ -1641,7 +1641,7 @@ want to remove all seeding torrents?")):
self.window.hide() self.window.hide()
self.shutdown() self.shutdown()
else: else:
if self.config.get("lock_tray") == True: if self.config.get("lock_tray"):
self.unlock_tray("quitus") self.unlock_tray("quitus")
else: else:
self.window.hide() self.window.hide()