mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-11 12:04:10 +00:00
change the scheduler plugin to use the new plugin architecture
This commit is contained in:
parent
63b02f28d1
commit
da5697490d
@ -1,12 +1,3 @@
|
||||
(function() {
|
||||
function createEl(parent, type) {
|
||||
var el = document.createElement(type);
|
||||
parent.appendChild(el);
|
||||
return el;
|
||||
}
|
||||
|
||||
var DAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
|
||||
|
||||
ScheduleSelectPanel = Ext.extend(Ext.form.FieldSet, {
|
||||
constructor: function(config) {
|
||||
config = Ext.apply({
|
||||
@ -22,7 +13,13 @@
|
||||
var dom = this.body.dom;
|
||||
var table = createEl(dom, 'table');
|
||||
|
||||
Ext.each(DAYS, function(day) {
|
||||
function createEl(parent, type) {
|
||||
var el = document.createElement(type);
|
||||
parent.appendChild(el);
|
||||
return el;
|
||||
}
|
||||
|
||||
Ext.each(['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], function(day) {
|
||||
var row = createEl(table, 'tr');
|
||||
var label = createEl(row, 'th');
|
||||
label.setAttribute('style', 'font-weight: bold; padding-right: 5px;');
|
||||
@ -88,5 +85,25 @@
|
||||
SchedulerPreferences.superclass.onShow.call(this);
|
||||
}
|
||||
});
|
||||
Deluge.Preferences.addPage(new SchedulerPreferences());
|
||||
|
||||
SchedulerPlugin = Ext.extend(Deluge.Plugin, {
|
||||
constructor: function(config) {
|
||||
config = Ext.apply({
|
||||
name: "Scheduler"
|
||||
}, config);
|
||||
SchedulerPlugin.superclass.constructor.call(this, config);
|
||||
},
|
||||
|
||||
onDisable: function() {
|
||||
Deluge.Preferences.removePage(this.prefsPage);
|
||||
},
|
||||
|
||||
onEnable: function() {
|
||||
this.prefsPage = new SchedulerPreferences();
|
||||
Deluge.Preferences.addPage(this.prefsPage);
|
||||
}
|
||||
});
|
||||
|
||||
(function() {
|
||||
var plugin = new SchedulerPlugin();
|
||||
})();
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# webui.py
|
||||
#
|
||||
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
|
||||
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
|
||||
#
|
||||
# Basic plugin template created by:
|
||||
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
|
||||
@ -36,8 +36,6 @@
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
|
||||
import pkg_resources
|
||||
|
||||
from deluge.log import LOG as log
|
||||
from deluge.ui.client import client
|
||||
from deluge import component
|
||||
@ -46,16 +44,5 @@ from deluge.plugins.pluginbase import WebPluginBase
|
||||
from common import get_resource
|
||||
|
||||
class WebUI(WebPluginBase):
|
||||
def enable(self):
|
||||
deluge_web = component.get("DelugeWeb").top_level
|
||||
deluge_web.add_script("/js/scheduler.js")
|
||||
|
||||
javascript = component.get("Javascript").directories
|
||||
javascript.append(get_resource(""))
|
||||
|
||||
def disable(self):
|
||||
deluge_web = component.get("DelugeWeb").top_level
|
||||
deluge_web.remove_script("/js/scheduler.js")
|
||||
|
||||
javascript = component.get("Javascript").directories
|
||||
javascript.remove(get_resource(""))
|
||||
scripts = [get_resource("scheduler.js")]
|
Loading…
x
Reference in New Issue
Block a user