Module: deluge
Branch: 1.3-stable
Commit: b75abc70e57381988fde0d97696f85e1098c52c1

Author: Chase Sterling <[email protected]>
Date:   Tue Aug 24 00:30:54 2010 -0400

Add max active downloading and seeding options to scheduler.

---

 deluge/plugins/scheduler/scheduler/core.py  |    8 +++++++
 deluge/plugins/scheduler/scheduler/gtkui.py |   28 ++++++++++++++++++++++++--
 deluge/plugins/scheduler/setup.py           |    2 +-
 3 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/deluge/plugins/scheduler/scheduler/core.py 
b/deluge/plugins/scheduler/scheduler/core.py
index 2e6f24a..50bc3fc 100644
--- a/deluge/plugins/scheduler/scheduler/core.py
+++ b/deluge/plugins/scheduler/scheduler/core.py
@@ -51,6 +51,8 @@ DEFAULT_PREFS = {
     "low_down": -1.0,
     "low_up": -1.0,
     "low_active": -1,
+    "low_active_down": -1,
+    "low_active_up": -1,
     "button_state": [[0] * 7 for dummy in xrange(24)]
 }
 
@@ -77,6 +79,8 @@ class Core(CorePluginBase):
         DEFAULT_PREFS["low_down"] = core_config["max_download_speed"]
         DEFAULT_PREFS["low_up"] = core_config["max_upload_speed"]
         DEFAULT_PREFS["low_active"] = core_config["max_active_limit"]
+        DEFAULT_PREFS["low_active_down"] = 
core_config["max_active_downloading"]
+        DEFAULT_PREFS["low_active_up"] = core_config["max_active_seeding"]
 
         self.config = deluge.configmanager.ConfigManager("scheduler.conf", 
DEFAULT_PREFS)
 
@@ -110,6 +114,8 @@ class Core(CorePluginBase):
         core_config.apply_set_functions("max_download_speed")
         core_config.apply_set_functions("max_upload_speed")
         core_config.apply_set_functions("max_active_limit")
+        core_config.apply_set_functions("max_active_downloading")
+        core_config.apply_set_functions("max_active_seeding")
         # Resume the session if necessary
         component.get("Core").session.resume()
 
@@ -131,6 +137,8 @@ class Core(CorePluginBase):
             session.set_upload_rate_limit(int(self.config["low_up"] * 1024))
             settings = session.settings()
             settings.active_limit = self.config["low_active"]
+            settings.active_downloads = self.config["low_active_down"]
+            settings.active_seeds = self.config["low_active_up"]
             session.set_settings(settings)
             # Resume the session if necessary
             component.get("Core").session.resume()
diff --git a/deluge/plugins/scheduler/scheduler/gtkui.py 
b/deluge/plugins/scheduler/scheduler/gtkui.py
index 020962b..e688d34 100644
--- a/deluge/plugins/scheduler/scheduler/gtkui.py
+++ b/deluge/plugins/scheduler/scheduler/gtkui.py
@@ -183,6 +183,8 @@ class GtkUI(GtkPluginBase):
         config["low_down"] = self.spin_download.get_value()
         config["low_up"] = self.spin_upload.get_value()
         config["low_active"] = self.spin_active.get_value_as_int()
+        config["low_active_down"] = self.spin_active_down.get_value_as_int()
+        config["low_active_up"] = self.spin_active_up.get_value_as_int()
         config["button_state"] = self.scheduler_select.button_state
         client.scheduler.set_config(config)
 
@@ -193,6 +195,8 @@ class GtkUI(GtkPluginBase):
             self.spin_download.set_value(config["low_down"])
             self.spin_upload.set_value(config["low_up"])
             self.spin_active.set_value(config["low_active"])
+            self.spin_active_down.set_value(config["low_active_down"])
+            self.spin_active_up.set_value(config["low_active_up"])
 
 
         client.scheduler.get_config().addCallback(on_get_config)
@@ -229,7 +233,7 @@ class GtkUI(GtkPluginBase):
         vbox.pack_start(frame, True, True)
         vbox.pack_start(hover)
 
-        table = gtk.Table(3, 2)
+        table = gtk.Table(3, 4)
 
         label = gtk.Label(_("Download Limit:"))
         label.set_alignment(0.0, 0.6)
@@ -251,12 +255,30 @@ class GtkUI(GtkPluginBase):
 
         label = gtk.Label(_("Active Torrents:"))
         label.set_alignment(0.0, 0.6)
-        table.attach(label, 0, 1, 2, 3, gtk.FILL)
+        table.attach(label, 2, 3, 0, 1, gtk.FILL)
         self.spin_active = gtk.SpinButton()
         self.spin_active.set_numeric(True)
         self.spin_active.set_range(-1, 9999)
         self.spin_active.set_increments(1, 10)
-        table.attach(self.spin_active, 1, 2, 2, 3, gtk.FILL)
+        table.attach(self.spin_active, 3, 4, 0, 1, gtk.FILL)
+
+        label = gtk.Label(_("Active Downloading:"))
+        label.set_alignment(0.0, 0.6)
+        table.attach(label, 2, 3, 1, 2, gtk.FILL)
+        self.spin_active_down = gtk.SpinButton()
+        self.spin_active_down.set_numeric(True)
+        self.spin_active_down.set_range(-1, 9999)
+        self.spin_active_down.set_increments(1, 10)
+        table.attach(self.spin_active_down, 3, 4, 1, 2, gtk.FILL)
+
+        label = gtk.Label(_("Active Seeding:"))
+        label.set_alignment(0.0, 0.6)
+        table.attach(label, 2, 3, 2, 3, gtk.FILL)
+        self.spin_active_up = gtk.SpinButton()
+        self.spin_active_up.set_numeric(True)
+        self.spin_active_up.set_range(-1, 9999)
+        self.spin_active_up.set_increments(1, 10)
+        table.attach(self.spin_active_up, 3, 4, 2, 3, gtk.FILL)
 
         eventbox = gtk.EventBox()
         eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("#EDD400"))
diff --git a/deluge/plugins/scheduler/setup.py 
b/deluge/plugins/scheduler/setup.py
index 0746e46..28d95d9 100644
--- a/deluge/plugins/scheduler/setup.py
+++ b/deluge/plugins/scheduler/setup.py
@@ -41,7 +41,7 @@ from setuptools import setup
 __plugin_name__ = "Scheduler"
 __author__ = "Andrew Resch"
 __author_email__ = "[email protected]"
-__version__ = "0.1"
+__version__ = "0.2"
 __url__ = "http://deluge-torrent.org";
 __license__ = "GPLv3"
 __description__ = "Schedule limits on a per-hour per-day basis."

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

Reply via email to