From ddde10ec99c1fdae51a1a0c253ecec8e89c66631 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Sat, 19 Jul 2014 20:15:24 +0100 Subject: [Extractor] Add webui page --- .../plugins/extractor/extractor/data/extractor.js | 101 +++++++++++++++++++++ deluge/plugins/extractor/extractor/webui.py | 5 + 2 files changed, 106 insertions(+) create mode 100644 deluge/plugins/extractor/extractor/data/extractor.js diff --git a/deluge/plugins/extractor/extractor/data/extractor.js b/deluge/plugins/extractor/extractor/data/extractor.js new file mode 100644 index 000000000..4b29c5b9d --- /dev/null +++ b/deluge/plugins/extractor/extractor/data/extractor.js @@ -0,0 +1,101 @@ +/*! + * extractor.js + * + * Copyright (c) Damien Churchill 2010 + * + * This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with + * the additional special exception to link portions of this program with the OpenSSL library. + * See LICENSE for more details. + * + */ + +Ext.ns('Deluge.ux.preferences'); + +/** + * @class Deluge.ux.preferences.ExtractorPage + * @extends Ext.Panel + */ +Deluge.ux.preferences.ExtractorPage = Ext.extend(Ext.Panel, { + + title: _('Extractor'), + layout: 'fit', + border: false, + + initComponent: function() { + Deluge.ux.preferences.ExtractorPage.superclass.initComponent.call(this); + + this.form = this.add({ + xtype: 'form', + layout: 'form', + border: false, + autoHeight: true + }); + + fieldset = this.form.add({ + xtype: 'fieldset', + border: false, + title: '', + autoHeight: true, + labelAlign: 'top', + labelWidth: 80, + defaultType: 'textfield' + }); + + this.extract_path = fieldset.add({ + fieldLabel: _('Extract to:'), + labelSeparator : '', + name: 'extract_path', + width: '97%' + }); + + + this.use_name_folder = fieldset.add({ + xtype: 'checkbox', + name: 'use_name_folder', + height: 22, + hideLabel: true, + boxLabel: _('Create torrent name sub-folder') + }); + + deluge.preferences.on('show', this.updateConfig, this); + }, + + onApply: function() { + // build settings object + var config = { } + + config['extract_path'] = this.extract_path.getValue(); + config['use_name_folder'] = this.use_name_folder.getValue(); + + deluge.client.extractor.set_config(config); + }, + + onOk: function() { + this.onApply(); + }, + + updateConfig: function() { + deluge.client.extractor.get_config({ + success: function(config) { + this.extract_path.setValue(config['extract_path']); + this.use_name_folder.setValue(config['use_name_folder']); + }, + scope: this + }); + } +}); + + +Deluge.plugins.ExtractorPlugin = Ext.extend(Deluge.Plugin, { + + name: 'Extractor', + + onDisable: function() { + deluge.preferences.removePage(this.prefsPage); + }, + + onEnable: function() { + this.prefsPage = deluge.preferences.addPage(new Deluge.ux.preferences.ExtractorPage()); + } +}); +Deluge.registerPlugin('Extractor', Deluge.plugins.ExtractorPlugin); diff --git a/deluge/plugins/extractor/extractor/webui.py b/deluge/plugins/extractor/extractor/webui.py index 3cc135bf7..4db1d3add 100644 --- a/deluge/plugins/extractor/extractor/webui.py +++ b/deluge/plugins/extractor/extractor/webui.py @@ -42,9 +42,14 @@ from deluge.ui.client import client from deluge import component from deluge.plugins.pluginbase import WebPluginBase +from common import get_resource + class WebUI(WebPluginBase): def enable(self): pass def disable(self): pass + + scripts = [get_resource("extractor.js")] + debug_scripts = scripts -- cgit