Fix #491: Add auto_manage_prefer_seeds to prefs manager and UIs

This commit is contained in:
Calum Lind 2011-06-15 22:29:52 +01:00
parent b6596a27bc
commit 795f633bc4
5 changed files with 33 additions and 1 deletions

View File

@ -140,6 +140,7 @@ DEFAULT_PREFS = {
"geoip_db_location": "/usr/share/GeoIP/GeoIP.dat", "geoip_db_location": "/usr/share/GeoIP/GeoIP.dat",
"cache_size": 512, "cache_size": 512,
"cache_expiry": 60, "cache_expiry": 60,
"auto_manage_prefer_seeds": False,
"shared": False "shared": False
} }
@ -470,3 +471,7 @@ class PreferencesManager(component.Component):
def _on_set_cache_expiry(self, key, value): def _on_set_cache_expiry(self, key, value):
log.debug("%s: %s", key, value) log.debug("%s: %s", key, value)
self.session_set_setting("cache_expiry", 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)

View File

@ -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_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_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("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_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("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) 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)

View File

@ -3846,6 +3846,21 @@ status tab (&lt;b&gt;EXPERIMENTAL!!!&lt;/b&gt;)</property>
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </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> </widget>
</child> </child>
</widget> </widget>

View File

@ -363,6 +363,7 @@ class Preferences(component.Component):
"spin_seeding": ("value", self.core_config["max_active_seeding"]), "spin_seeding": ("value", self.core_config["max_active_seeding"]),
"spin_downloading": ("value", self.core_config["max_active_downloading"]), "spin_downloading": ("value", self.core_config["max_active_downloading"]),
"chk_dont_count_slow_torrents": ("active", self.core_config["dont_count_slow_torrents"]), "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"]), "chk_queue_new_top": ("active", self.core_config["queue_new_to_top"]),
"spin_share_ratio_limit": ("value", self.core_config["share_ratio_limit"]), "spin_share_ratio_limit": ("value", self.core_config["share_ratio_limit"]),
"spin_seed_time_ratio_limit": \ "spin_seed_time_ratio_limit": \
@ -503,6 +504,7 @@ class Preferences(component.Component):
"spin_downloading", "spin_downloading",
"spin_active", "spin_active",
"chk_dont_count_slow_torrents", "chk_dont_count_slow_torrents",
"chk_auto_manage_prefer_seeds",
"chk_queue_new_top", "chk_queue_new_top",
"chk_seed_ratio", "chk_seed_ratio",
"spin_share_ratio", "spin_share_ratio",
@ -781,6 +783,8 @@ class Preferences(component.Component):
self.glade.get_widget("spin_active").get_value_as_int() self.glade.get_widget("spin_active").get_value_as_int()
new_core_config["dont_count_slow_torrents"] = \ new_core_config["dont_count_slow_torrents"] = \
self.glade.get_widget("chk_dont_count_slow_torrents").get_active() 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"] = \ new_core_config["stop_seed_at_ratio"] = \
self.glade.get_widget("chk_seed_ratio").get_active() self.glade.get_widget("chk_seed_ratio").get_active()
new_core_config["remove_seed_at_ratio"] = \ new_core_config["remove_seed_at_ratio"] = \

View File

@ -102,10 +102,17 @@ Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, {
om.bind('dont_count_slow_torrents', fieldset.add({ om.bind('dont_count_slow_torrents', fieldset.add({
xtype: 'checkbox', xtype: 'checkbox',
name: 'dont_count_slow_torrents', name: 'dont_count_slow_torrents',
height: 40, height: 22,
hideLabel: true, hideLabel: true,
boxLabel: _('Do not count slow torrents') 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({ fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',