Module: deluge
Branch: master
Commit: 795f633bc4e481564a3441f63f21aca29cfc5603

Author: Calum Lind <calumlind+del...@gmail.com>
Date:   Wed Jun 15 22:29:52 2011 +0100

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 deletions(-)

diff --git a/deluge/core/preferencesmanager.py 
b/deluge/core/preferencesmanager.py
index 77b8915..bdc7f1c 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 e249216..3a64a10 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 1bfd4d3..99bd0ca 100644
--- a/deluge/ui/gtkui/glade/preferences_dialog.glade
+++ b/deluge/ui/gtkui/glade/preferences_dialog.glade
@@ -3846,6 +3846,21 @@ status tab 
(&lt;b&gt;EXPERIMENTAL!!!&lt;/b&gt;)</property>
                                                 <property 
name="position">1</property>
                                               </packing>
                                             </child>
+                                            <child>
+                                              <widget class="GtkCheckButton" 
id="chk_auto_manage_prefer_seeds">
+                                                <property name="label" 
translatable="yes">Prefer Seeding over Downloading</property>
+                                                <property 
name="visible">True</property>
+                                                <property 
name="can_focus">True</property>
+                                                <property 
name="receives_default">False</property>
+                                                <property 
name="use_action_appearance">False</property>
+                                                <property 
name="draw_indicator">True</property>
+                                              </widget>
+                                              <packing>
+                                                <property 
name="expand">True</property>
+                                                <property 
name="fill">True</property>
+                                                <property 
name="position">2</property>
+                                              </packing>
+                                            </child>
                                           </widget>
                                         </child>
                                       </widget>
diff --git a/deluge/ui/gtkui/preferences.py b/deluge/ui/gtkui/preferences.py
index c732f33..6e637fc 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 cee5a15..9a6b4cf 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',

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to deluge-commit@googlegroups.com.
To unsubscribe from this group, send email to 
deluge-commit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to