From 795f633bc4e481564a3441f63f21aca29cfc5603 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Wed, 15 Jun 2011 22:29:52 +0100 Subject: [PATCH] Fix #491: Add auto_manage_prefer_seeds to prefs manager and UIs --- deluge/core/preferencesmanager.py | 5 +++++ deluge/ui/console/modes/preference_panes.py | 1 + deluge/ui/gtkui/glade/preferences_dialog.glade | 15 +++++++++++++++ deluge/ui/gtkui/preferences.py | 4 ++++ .../ui/web/js/deluge-all/preferences/QueuePage.js | 9 ++++++++- 5 files changed, 33 insertions(+), 1 deletion(-) diff --git a/deluge/core/preferencesmanager.py b/deluge/core/preferencesmanager.py index 77b89159b..bdc7f1c43 100644 --- a/deluge/core/preferencesmanager.py +++ b/deluge/core/preferencesmanager.py @@ -140,6 +140,7 @@ DEFAULT_PREFS = { "geoip_db_location": "/usr/share/GeoIP/GeoIP.dat", "cache_size": 512, "cache_expiry": 60, + "auto_manage_prefer_seeds": False, "shared": False } @@ -470,3 +471,7 @@ class PreferencesManager(component.Component): def _on_set_cache_expiry(self, key, value): log.debug("%s: %s", key, value) self.session_set_setting("cache_expiry", value) + + def _on_auto_manage_prefer_seeds(self, key, value): + log.debug("%s set to %s..", key, value) + self.session_set_setting("auto_manage_prefer_seeds", value) diff --git a/deluge/ui/console/modes/preference_panes.py b/deluge/ui/console/modes/preference_panes.py index e24921629..3a64a1068 100644 --- a/deluge/ui/console/modes/preference_panes.py +++ b/deluge/ui/console/modes/preference_panes.py @@ -354,6 +354,7 @@ class QueuePane(BasePane): self.add_int_spin_input("max_active_downloading","Total active downloading:",parent.core_config["max_active_downloading"],-1,9999) self.add_int_spin_input("max_active_seeding","Total active seeding:",parent.core_config["max_active_seeding"],-1,9999) self.add_checked_input("dont_count_slow_torrents","Do not count slow torrents",parent.core_config["dont_count_slow_torrents"]) + self.add_checked_input("auto_manage_prefer_seeds","Prefer Seeding over Downloading",parent.core_config["auto_manage_prefer_seeds"]) self.add_header("Seeding",True) self.add_float_spin_input("share_ratio_limit","Share Ratio Limit:",parent.core_config["share_ratio_limit"],1.0,2,-1.0,100.0) self.add_float_spin_input("seed_time_ratio_limit","Share Time Ratio:",parent.core_config["seed_time_ratio_limit"],1.0,2,-1.0,100.0) diff --git a/deluge/ui/gtkui/glade/preferences_dialog.glade b/deluge/ui/gtkui/glade/preferences_dialog.glade index 1bfd4d340..99bd0ca96 100644 --- a/deluge/ui/gtkui/glade/preferences_dialog.glade +++ b/deluge/ui/gtkui/glade/preferences_dialog.glade @@ -3846,6 +3846,21 @@ status tab (<b>EXPERIMENTAL!!!</b>) 1 + + + Prefer Seeding over Downloading + True + True + False + False + True + + + True + True + 2 + + diff --git a/deluge/ui/gtkui/preferences.py b/deluge/ui/gtkui/preferences.py index c732f339f..6e637fc66 100644 --- a/deluge/ui/gtkui/preferences.py +++ b/deluge/ui/gtkui/preferences.py @@ -363,6 +363,7 @@ class Preferences(component.Component): "spin_seeding": ("value", self.core_config["max_active_seeding"]), "spin_downloading": ("value", self.core_config["max_active_downloading"]), "chk_dont_count_slow_torrents": ("active", self.core_config["dont_count_slow_torrents"]), + "chk_auto_manage_prefer_seeds": ("active", self.core_config["auto_manage_prefer_seeds"]), "chk_queue_new_top": ("active", self.core_config["queue_new_to_top"]), "spin_share_ratio_limit": ("value", self.core_config["share_ratio_limit"]), "spin_seed_time_ratio_limit": \ @@ -503,6 +504,7 @@ class Preferences(component.Component): "spin_downloading", "spin_active", "chk_dont_count_slow_torrents", + "chk_auto_manage_prefer_seeds", "chk_queue_new_top", "chk_seed_ratio", "spin_share_ratio", @@ -781,6 +783,8 @@ class Preferences(component.Component): self.glade.get_widget("spin_active").get_value_as_int() new_core_config["dont_count_slow_torrents"] = \ self.glade.get_widget("chk_dont_count_slow_torrents").get_active() + new_core_config["auto_manage_prefer_seeds"] = \ + self.glade.get_widget("chk_auto_manage_prefer_seeds").get_active() new_core_config["stop_seed_at_ratio"] = \ self.glade.get_widget("chk_seed_ratio").get_active() new_core_config["remove_seed_at_ratio"] = \ diff --git a/deluge/ui/web/js/deluge-all/preferences/QueuePage.js b/deluge/ui/web/js/deluge-all/preferences/QueuePage.js index cee5a1557..9a6b4cf69 100644 --- a/deluge/ui/web/js/deluge-all/preferences/QueuePage.js +++ b/deluge/ui/web/js/deluge-all/preferences/QueuePage.js @@ -102,10 +102,17 @@ Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, { om.bind('dont_count_slow_torrents', fieldset.add({ xtype: 'checkbox', name: 'dont_count_slow_torrents', - height: 40, + height: 22, hideLabel: true, boxLabel: _('Do not count slow torrents') })); + om.bind('auto_manage_prefer_seeds', fieldset.add({ + xtype: 'checkbox', + name: 'auto_manage_prefer_seeds', + height: 40, + hideLabel: true, + boxLabel: _('Prefer Seeding over Downloading') + })); fieldset = this.add({ xtype: 'fieldset',