fix scheduler plugin
This commit is contained in:
parent
47fe9bd11f
commit
2e398cb212
|
@ -1,5 +1,6 @@
|
||||||
Deluge 0.5.6 (xx October 2007)
|
Deluge 0.5.6 (xx October 2007)
|
||||||
* Tray lock password is no longer stored in plain text
|
* Tray lock password is no longer stored in plain text
|
||||||
|
* Update the Scheduler plugin and fix a bunch of bugs on it
|
||||||
* Web Interface Plugin
|
* Web Interface Plugin
|
||||||
* Double-clicking on a torrent opens up its containing folder
|
* Double-clicking on a torrent opens up its containing folder
|
||||||
* Fix SpeedLimiter plugin when setting upload limits
|
* Fix SpeedLimiter plugin when setting upload limits
|
||||||
|
|
|
@ -8,9 +8,12 @@ class plugin_Scheduler:
|
||||||
|
|
||||||
self.days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
|
self.days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
|
||||||
self.conf_file = deluge.common.CONFIG_DIR + "/scheduler.conf"
|
self.conf_file = deluge.common.CONFIG_DIR + "/scheduler.conf"
|
||||||
self.config = self.config = deluge.pref.Preferences()
|
self.config = deluge.pref.Preferences()
|
||||||
self.button_state_temp = [[0] * 7 for dummy in xrange(24)]
|
self.button_state_temp = [[0] * 7 for dummy in xrange(24)]
|
||||||
self.status = -1
|
self.status = -1
|
||||||
|
self.globalactivetor = self.config.get("max_active_torrents")
|
||||||
|
self.globaldlmax = self.config.get("max_download_speed")
|
||||||
|
self.globalulmax = self.config.get("max_upload_speed")
|
||||||
|
|
||||||
#Load config
|
#Load config
|
||||||
try:
|
try:
|
||||||
|
@ -22,8 +25,8 @@ class plugin_Scheduler:
|
||||||
reader.close()
|
reader.close()
|
||||||
except:
|
except:
|
||||||
self.button_state = [[0] * 7 for dummy in xrange(24)]
|
self.button_state = [[0] * 7 for dummy in xrange(24)]
|
||||||
self.dllimit = float(-1)
|
self.dllimit = float(self.globaldlmax)
|
||||||
self.ullimit = float(-1)
|
self.ullimit = float(self.globalulmax)
|
||||||
|
|
||||||
def unload(self):
|
def unload(self):
|
||||||
self.resume()
|
self.resume()
|
||||||
|
@ -50,7 +53,7 @@ class plugin_Scheduler:
|
||||||
self.core.apply_queue()
|
self.core.apply_queue()
|
||||||
|
|
||||||
def resume(self):
|
def resume(self):
|
||||||
self.config.set("max_active_torrents", -1)
|
self.config.set("max_active_torrents", self.globalactivetor)
|
||||||
self.core.apply_queue()
|
self.core.apply_queue()
|
||||||
|
|
||||||
def limit(self):
|
def limit(self):
|
||||||
|
@ -58,6 +61,8 @@ class plugin_Scheduler:
|
||||||
self.config.set("max_upload_speed", float(self.ullimit))
|
self.config.set("max_upload_speed", float(self.ullimit))
|
||||||
|
|
||||||
def unlimit(self):
|
def unlimit(self):
|
||||||
|
self.config.set("max_download_speed", float(self.globaldlmax))
|
||||||
|
self.config.set("max_upload_speed", float(self.globalulmax))
|
||||||
self.interface.apply_prefs()
|
self.interface.apply_prefs()
|
||||||
|
|
||||||
#Configuration dialog
|
#Configuration dialog
|
||||||
|
@ -98,13 +103,18 @@ class plugin_Scheduler:
|
||||||
dlinput.set_numeric(True)
|
dlinput.set_numeric(True)
|
||||||
dlinput.set_range(-1, 2048)
|
dlinput.set_range(-1, 2048)
|
||||||
dlinput.set_increments(1, 10)
|
dlinput.set_increments(1, 10)
|
||||||
|
if self.dllimit != -1:
|
||||||
dlinput.set_value(float(self.dllimit))
|
dlinput.set_value(float(self.dllimit))
|
||||||
|
else:
|
||||||
|
dlinput.set_value(float(-1))
|
||||||
ulinput = gtk.SpinButton()
|
ulinput = gtk.SpinButton()
|
||||||
ulinput.set_numeric(True)
|
ulinput.set_numeric(True)
|
||||||
ulinput.set_range(-1, 1024)
|
ulinput.set_range(-1, 1024)
|
||||||
ulinput.set_increments(1, 10)
|
ulinput.set_increments(1, 10)
|
||||||
|
if self.ullimit != -1:
|
||||||
ulinput.set_value(float(self.ullimit))
|
ulinput.set_value(float(self.ullimit))
|
||||||
|
else:
|
||||||
|
ulinput.set_value(float(-1))
|
||||||
|
|
||||||
#pack
|
#pack
|
||||||
dialog.vbox.pack_start(vbox_main)
|
dialog.vbox.pack_start(vbox_main)
|
||||||
|
@ -132,7 +142,13 @@ class plugin_Scheduler:
|
||||||
if dialog.run() == -5:
|
if dialog.run() == -5:
|
||||||
self.status = -1
|
self.status = -1
|
||||||
self.button_state = copy.deepcopy(drawing.button_state)
|
self.button_state = copy.deepcopy(drawing.button_state)
|
||||||
|
if dlinput.get_value() != -1:
|
||||||
self.dllimit = float(dlinput.get_value())
|
self.dllimit = float(dlinput.get_value())
|
||||||
|
else:
|
||||||
|
self.dllimit = float(dlinput.get_value())
|
||||||
|
if ulinput.get_value() != -1:
|
||||||
|
self.ullimit = float(ulinput.get_value())
|
||||||
|
else:
|
||||||
self.ullimit = float(ulinput.get_value())
|
self.ullimit = float(ulinput.get_value())
|
||||||
self.interface.apply_prefs()
|
self.interface.apply_prefs()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue