Increase the per-torrent stop share ratio max to 99999.0 and make the

spinner and remove at ratio checkbox insensitive if stop at ratio not 
checked
This commit is contained in:
Andrew Resch 2008-11-08 06:17:42 +00:00
commit f945a6f597
3 changed files with 636 additions and 675 deletions

View file

@ -26,19 +26,17 @@ Deluge 1.1.0 - "" (In Development)
* Persistent sessions #486 * Persistent sessions #486
* Plugin improvements for easy use of templates and images in eggs. #497 * Plugin improvements for easy use of templates and images in eggs. #497
* Classic template takes over some style elements from white template. * Classic template takes over some style elements from white template.
* Javascript Auto Refresh
* https (for users that know how to create certificates) * https (for users that know how to create certificates)
* easyer apache mod_proxy use. * Easier apache mod_proxy use.
* Redesigned sidebar * Redesigned sidebar
AjaxUI: AjaxUI:
* hosted in a webui template. * Hosted in a webui template.
ConsoleUI (previously null-ui): ConsoleUI (previously null-ui):
* colors and enhancements by idoa01 * New ConsoleUI written by Idoa01
* callable from command-line for scripts. * Callable from command-line for scripts.
Plugins: Plugins:
* Stats plugin for graphs. * Stats plugin for graphs.
* Label plugin for grouping torrents and per torrent settings. * Label plugin for grouping torrents and per torrent settings.

File diff suppressed because it is too large Load diff

View file

@ -2,19 +2,19 @@
# options_tab.py # options_tab.py
# #
# Copyright (C) 2008 Andrew Resch ('andar') <andrewresch@gmail.com> # Copyright (C) 2008 Andrew Resch ('andar') <andrewresch@gmail.com>
# #
# Deluge is free software. # Deluge is free software.
# #
# You may redistribute it and/or modify it under the terms of the # You may redistribute it and/or modify it under the terms of the
# GNU General Public License, as published by the Free Software # GNU General Public License, as published by the Free Software
# Foundation; either version 3 of the License, or (at your option) # Foundation; either version 3 of the License, or (at your option)
# any later version. # any later version.
# #
# deluge is distributed in the hope that it will be useful, # deluge is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details. # See the GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with deluge. If not, write to: # along with deluge. If not, write to:
# The Free Software Foundation, Inc., # The Free Software Foundation, Inc.,
@ -39,11 +39,11 @@ class OptionsTab(Tab):
def __init__(self): def __init__(self):
Tab.__init__(self) Tab.__init__(self)
glade = component.get("MainWindow").get_glade() glade = component.get("MainWindow").get_glade()
self._name = "Options" self._name = "Options"
self._child_widget = glade.get_widget("options_tab") self._child_widget = glade.get_widget("options_tab")
self._tab_label = glade.get_widget("options_tab_label") self._tab_label = glade.get_widget("options_tab_label")
self.spin_max_download = glade.get_widget("spin_max_download") self.spin_max_download = glade.get_widget("spin_max_download")
self.spin_max_upload = glade.get_widget("spin_max_upload") self.spin_max_upload = glade.get_widget("spin_max_upload")
self.spin_max_connections = glade.get_widget("spin_max_connections") self.spin_max_connections = glade.get_widget("spin_max_connections")
@ -57,14 +57,15 @@ class OptionsTab(Tab):
self.chk_move_completed = glade.get_widget("chk_move_completed") self.chk_move_completed = glade.get_widget("chk_move_completed")
self.filechooser_move_completed = glade.get_widget("filechooser_move_completed") self.filechooser_move_completed = glade.get_widget("filechooser_move_completed")
self.entry_move_completed = glade.get_widget("entry_move_completed") self.entry_move_completed = glade.get_widget("entry_move_completed")
self.prev_torrent_id = None self.prev_torrent_id = None
self.prev_status = None self.prev_status = None
glade.signal_autoconnect({ glade.signal_autoconnect({
"on_button_apply_clicked": self._on_button_apply_clicked, "on_button_apply_clicked": self._on_button_apply_clicked,
"on_button_edit_trackers_clicked": self._on_button_edit_trackers_clicked, "on_button_edit_trackers_clicked": self._on_button_edit_trackers_clicked,
"on_chk_move_completed_toggled": self._on_chk_move_completed_toggled "on_chk_move_completed_toggled": self._on_chk_move_completed_toggled,
"on_chk_stop_at_ratio_toggled": self._on_chk_stop_at_ratio_toggled
}) })
def start(self): def start(self):
@ -74,7 +75,7 @@ class OptionsTab(Tab):
else: else:
self.filechooser_move_completed.hide() self.filechooser_move_completed.hide()
self.entry_move_completed.show() self.entry_move_completed.show()
def stop(self): def stop(self):
pass pass
@ -90,7 +91,7 @@ class OptionsTab(Tab):
# No torrent is selected in the torrentview # No torrent is selected in the torrentview
self._child_widget.set_sensitive(False) self._child_widget.set_sensitive(False)
return return
if torrent_id != self.prev_torrent_id: if torrent_id != self.prev_torrent_id:
self.prev_status = None self.prev_status = None
@ -112,13 +113,13 @@ class OptionsTab(Tab):
def clear(self): def clear(self):
self.prev_torrent_id = None self.prev_torrent_id = None
self.prev_status = None self.prev_status = None
def _on_get_torrent_status(self, status): def _on_get_torrent_status(self, status):
# We only want to update values that have been applied in the core. This # We only want to update values that have been applied in the core. This
# is so we don't overwrite the user changes that haven't been applied yet. # is so we don't overwrite the user changes that haven't been applied yet.
if self.prev_status == None: if self.prev_status == None:
self.prev_status = {}.fromkeys(status.keys(), None) self.prev_status = {}.fromkeys(status.keys(), None)
if status != self.prev_status: if status != self.prev_status:
if status["max_download_speed"] != self.prev_status["max_download_speed"]: if status["max_download_speed"] != self.prev_status["max_download_speed"]:
self.spin_max_download.set_value(status["max_download_speed"]) self.spin_max_download.set_value(status["max_download_speed"])
@ -136,6 +137,8 @@ class OptionsTab(Tab):
self.chk_auto_managed.set_active(status["is_auto_managed"]) self.chk_auto_managed.set_active(status["is_auto_managed"])
if status["stop_at_ratio"] != self.prev_status["stop_at_ratio"]: if status["stop_at_ratio"] != self.prev_status["stop_at_ratio"]:
self.chk_stop_at_ratio.set_active(status["stop_at_ratio"]) self.chk_stop_at_ratio.set_active(status["stop_at_ratio"])
self.spin_stop_ratio.set_sensitive(status["stop_at_ratio"])
self.chk_remove_at_ratio.set_sensitive(status["stop_at_ratio"])
if status["stop_ratio"] != self.prev_status["stop_ratio"]: if status["stop_ratio"] != self.prev_status["stop_ratio"]:
self.spin_stop_ratio.set_value(status["stop_ratio"]) self.spin_stop_ratio.set_value(status["stop_ratio"])
if status["remove_at_ratio"] != self.prev_status["remove_at_ratio"]: if status["remove_at_ratio"] != self.prev_status["remove_at_ratio"]:
@ -147,9 +150,9 @@ class OptionsTab(Tab):
self.filechooser_move_completed.set_current_folder(status["move_on_completed_path"]) self.filechooser_move_completed.set_current_folder(status["move_on_completed_path"])
else: else:
self.entry_move_completed.set_text(status["move_on_completed_path"]) self.entry_move_completed.set_text(status["move_on_completed_path"])
self.prev_status = status self.prev_status = status
def _on_button_apply_clicked(self, button): def _on_button_apply_clicked(self, button):
if self.spin_max_download.get_value() != self.prev_status["max_download_speed"]: if self.spin_max_download.get_value() != self.prev_status["max_download_speed"]:
client.set_torrent_max_download_speed(self.prev_torrent_id, self.spin_max_download.get_value()) client.set_torrent_max_download_speed(self.prev_torrent_id, self.spin_max_download.get_value())
@ -177,20 +180,26 @@ class OptionsTab(Tab):
else: else:
path = self.entry_move_completed.get_text() path = self.entry_move_completed.get_text()
client.set_torrent_move_on_completed_path(self.prev_torrent_id, path) client.set_torrent_move_on_completed_path(self.prev_torrent_id, path)
def _on_button_edit_trackers_clicked(self, button): def _on_button_edit_trackers_clicked(self, button):
from edittrackersdialog import EditTrackersDialog from edittrackersdialog import EditTrackersDialog
dialog = EditTrackersDialog( dialog = EditTrackersDialog(
self.prev_torrent_id, self.prev_torrent_id,
component.get("MainWindow").window) component.get("MainWindow").window)
dialog.run() dialog.run()
def _on_chk_move_completed_toggled(self, widget): def _on_chk_move_completed_toggled(self, widget):
value = self.chk_move_completed.get_active() value = self.chk_move_completed.get_active()
if client.is_localhost(): if client.is_localhost():
widget = self.filechooser_move_completed widget = self.filechooser_move_completed
else: else:
widget = self.entry_move_completed widget = self.entry_move_completed
widget.set_sensitive(value) widget.set_sensitive(value)
def _on_chk_stop_at_ratio_toggled(self, widget):
value = widget.get_active()
self.spin_stop_ratio.set_sensitive(value)
self.chk_remove_at_ratio.set_sensitive(value)