diff --git a/deluge/plugins/Extractor/deluge/plugins/extractor/__init__.py b/deluge/plugins/Extractor/deluge/plugins/extractor/__init__.py index ad38ed6b1..59ab6fffc 100644 --- a/deluge/plugins/Extractor/deluge/plugins/extractor/__init__.py +++ b/deluge/plugins/Extractor/deluge/plugins/extractor/__init__.py @@ -1,5 +1,4 @@ -# -# __init__.py +# -*- coding: utf-8 -*- # # Copyright (C) 2009 Andrew Resch # @@ -7,50 +6,28 @@ # Copyright (C) 2008 Martijn Voncken # Copyright (C) 2007-2009 Andrew Resch # -# Deluge is free software. -# -# You may redistribute it and/or modify it under the terms of the -# GNU General Public License, as published by the Free Software -# Foundation; either version 3 of the License, or (at your option) -# any later version. -# -# deluge is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with deluge. If not, write to: -# The Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor -# Boston, MA 02110-1301, USA. -# -# In addition, as a special exception, the copyright holders give -# permission to link the code of portions of this program with the OpenSSL -# library. -# You must obey the GNU General Public License in all respects for all of -# the code used other than OpenSSL. If you modify file(s) with this -# exception, you may extend this exception to your version of the file(s), -# but you are not obligated to do so. If you do not wish to do so, delete -# this exception statement from your version. If you delete this exception -# statement from all source files in the program, then also delete it here. -# +# 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. # from deluge.plugins.init import PluginInitBase + class CorePlugin(PluginInitBase): def __init__(self, plugin_name): from core import Core as _plugin_cls self._plugin_cls = _plugin_cls super(CorePlugin, self).__init__(plugin_name) + class GtkUIPlugin(PluginInitBase): def __init__(self, plugin_name): from gtkui import GtkUI as _plugin_cls self._plugin_cls = _plugin_cls super(GtkUIPlugin, self).__init__(plugin_name) + class WebUIPlugin(PluginInitBase): def __init__(self, plugin_name): from webui import WebUI as _plugin_cls diff --git a/deluge/plugins/Extractor/deluge/plugins/extractor/common.py b/deluge/plugins/Extractor/deluge/plugins/extractor/common.py index 0517f41db..9a83b84aa 100644 --- a/deluge/plugins/Extractor/deluge/plugins/extractor/common.py +++ b/deluge/plugins/Extractor/deluge/plugins/extractor/common.py @@ -1,39 +1,16 @@ -# -# common.py +# -*- coding: utf-8 -*- # # Copyright (C) 2009 Andrew Resch # -# Deluge is free software. -# -# You may redistribute it and/or modify it under the terms of the -# GNU General Public License, as published by the Free Software -# Foundation; either version 3 of the License, or (at your option) -# any later version. -# -# deluge is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with deluge. If not, write to: -# The Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor -# Boston, MA 02110-1301, USA. -# -# In addition, as a special exception, the copyright holders give -# permission to link the code of portions of this program with the OpenSSL -# library. -# You must obey the GNU General Public License in all respects for all of -# the code used other than OpenSSL. If you modify file(s) with this -# exception, you may extend this exception to your version of the file(s), -# but you are not obligated to do so. If you do not wish to do so, delete -# this exception statement from your version. If you delete this exception -# statement from all source files in the program, then also delete it here. -# +# 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. # +import os +import pkg_resources + + def get_resource(filename): - import pkg_resources, os return pkg_resources.resource_filename("deluge.plugins.extractor", os.path.join("data", filename)) diff --git a/deluge/plugins/Extractor/deluge/plugins/extractor/core.py b/deluge/plugins/Extractor/deluge/plugins/extractor/core.py index c9ae4b9f6..c73cc6724 100644 --- a/deluge/plugins/Extractor/deluge/plugins/extractor/core.py +++ b/deluge/plugins/Extractor/deluge/plugins/extractor/core.py @@ -1,5 +1,4 @@ -# -# core.py +# -*- coding: utf-8 -*- # # Copyright (C) 2009 Andrew Resch # @@ -7,34 +6,9 @@ # Copyright (C) 2008 Martijn Voncken # Copyright (C) 2007-2009 Andrew Resch # -# Deluge is free software. -# -# You may redistribute it and/or modify it under the terms of the -# GNU General Public License, as published by the Free Software -# Foundation; either version 3 of the License, or (at your option) -# any later version. -# -# deluge is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with deluge. If not, write to: -# The Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor -# Boston, MA 02110-1301, USA. -# -# In addition, as a special exception, the copyright holders give -# permission to link the code of portions of this program with the OpenSSL -# library. -# You must obey the GNU General Public License in all respects for all of -# the code used other than OpenSSL. If you modify file(s) with this -# exception, you may extend this exception to your version of the file(s), -# but you are not obligated to do so. If you do not wish to do so, delete -# this exception statement from your version. If you delete this exception -# statement from all source files in the program, then also delete it here. -# +# 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. # import os @@ -78,7 +52,7 @@ if windows_check(): EXTRACT_COMMANDS = dict.fromkeys(exts_7z, [win_7z_exe, switch_7z]) break else: - required_cmds=["unrar", "unzip", "tar", "unxz", "unlzma", "7zr", "bunzip2"] + required_cmds = ["unrar", "unzip", "tar", "unxz", "unlzma", "7zr", "bunzip2"] ## Possible future suport: # gunzip: gz (cmd will delete original archive) ## the following do not extract to dest dir @@ -99,7 +73,7 @@ else: # Test command exists and if not, remove. for cmd in required_cmds: if not which(cmd): - for k,v in EXTRACT_COMMANDS.items(): + for k, v in EXTRACT_COMMANDS.items(): if cmd in v[0]: log.warning("%s not found, disabling support for %s", cmd, k) del EXTRACT_COMMANDS[k] @@ -107,12 +81,14 @@ else: if not EXTRACT_COMMANDS: raise Exception("No archive extracting programs found, plugin will be disabled") + class Core(CorePluginBase): def enable(self): self.config = deluge.configmanager.ConfigManager("extractor.conf", DEFAULT_PREFS) if not self.config["extract_path"]: self.config["extract_path"] = deluge.configmanager.ConfigManager("core.conf")["download_location"] component.get("EventManager").register_event_handler("TorrentFinishedEvent", self._on_torrent_finished) + def disable(self): component.get("EventManager").deregister_event_handler("TorrentFinishedEvent", self._on_torrent_finished) diff --git a/deluge/plugins/Extractor/deluge/plugins/extractor/data/extractor.js b/deluge/plugins/Extractor/deluge/plugins/extractor/data/extractor.js new file mode 100644 index 000000000..4b29c5b9d --- /dev/null +++ b/deluge/plugins/Extractor/deluge/plugins/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/deluge/plugins/extractor/gtkui.py b/deluge/plugins/Extractor/deluge/plugins/extractor/gtkui.py index 8ee08ee92..f70d251cf 100644 --- a/deluge/plugins/Extractor/deluge/plugins/extractor/gtkui.py +++ b/deluge/plugins/Extractor/deluge/plugins/extractor/gtkui.py @@ -1,5 +1,4 @@ -# -# gtkui.py +# -*- coding: utf-8 -*- # # Copyright (C) 2009 Andrew Resch # @@ -7,34 +6,9 @@ # Copyright (C) 2008 Martijn Voncken # Copyright (C) 2007-2009 Andrew Resch # -# Deluge is free software. -# -# You may redistribute it and/or modify it under the terms of the -# GNU General Public License, as published by the Free Software -# Foundation; either version 3 of the License, or (at your option) -# any later version. -# -# deluge is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with deluge. If not, write to: -# The Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor -# Boston, MA 02110-1301, USA. -# -# In addition, as a special exception, the copyright holders give -# permission to link the code of portions of this program with the OpenSSL -# library. -# You must obey the GNU General Public License in all respects for all of -# the code used other than OpenSSL. If you modify file(s) with this -# exception, you may extend this exception to your version of the file(s), -# but you are not obligated to do so. If you do not wish to do so, delete -# this exception statement from your version. If you delete this exception -# statement from all source files in the program, then also delete it here. -# +# 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. # import gtk @@ -44,12 +18,12 @@ import logging from deluge.ui.client import client from deluge.plugins.pluginbase import GtkPluginBase import deluge.component as component -import deluge.common -from common import get_resource +from deluge.plugins.extractor.common import get_resource log = logging.getLogger(__name__) + class GtkUI(GtkPluginBase): def enable(self): self.glade = gtk.glade.XML(get_resource("extractor_prefs.glade")) diff --git a/deluge/plugins/Extractor/deluge/plugins/extractor/webui.py b/deluge/plugins/Extractor/deluge/plugins/extractor/webui.py index 025ac728e..2962abc7c 100644 --- a/deluge/plugins/Extractor/deluge/plugins/extractor/webui.py +++ b/deluge/plugins/Extractor/deluge/plugins/extractor/webui.py @@ -1,5 +1,4 @@ -# -# webui.py +# -*- coding: utf-8 -*- # # Copyright (C) 2009 Andrew Resch # @@ -7,46 +6,20 @@ # Copyright (C) 2008 Martijn Voncken # Copyright (C) 2007-2009 Andrew Resch # -# Deluge is free software. -# -# You may redistribute it and/or modify it under the terms of the -# GNU General Public License, as published by the Free Software -# Foundation; either version 3 of the License, or (at your option) -# any later version. -# -# deluge is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with deluge. If not, write to: -# The Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor -# Boston, MA 02110-1301, USA. -# -# In addition, as a special exception, the copyright holders give -# permission to link the code of portions of this program with the OpenSSL -# library. -# You must obey the GNU General Public License in all respects for all of -# the code used other than OpenSSL. If you modify file(s) with this -# exception, you may extend this exception to your version of the file(s), -# but you are not obligated to do so. If you do not wish to do so, delete -# this exception statement from your version. If you delete this exception -# statement from all source files in the program, then also delete it here. -# +# 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. # import logging -from deluge.ui.client import client -from deluge import component from deluge.plugins.pluginbase import WebPluginBase +from deluge.plugins.extractor.common import get_resource + log = logging.getLogger(__name__) -class WebUI(WebPluginBase): - def enable(self): - pass - def disable(self): - pass +class WebUI(WebPluginBase): + + scripts = [get_resource("extractor.js")] + debug_scripts = scripts diff --git a/deluge/plugins/Extractor/setup.py b/deluge/plugins/Extractor/setup.py index 0a2beedc9..5398e5146 100644 --- a/deluge/plugins/Extractor/setup.py +++ b/deluge/plugins/Extractor/setup.py @@ -1,5 +1,4 @@ -# -# setup.py +# -*- coding: utf-8 -*- # # Copyright (C) 2009 Andrew Resch # @@ -7,34 +6,9 @@ # Copyright (C) 2008 Martijn Voncken # Copyright (C) 2007-2009 Andrew Resch # -# Deluge is free software. -# -# You may redistribute it and/or modify it under the terms of the -# GNU General Public License, as published by the Free Software -# Foundation; either version 3 of the License, or (at your option) -# any later version. -# -# deluge is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with deluge. If not, write to: -# The Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor -# Boston, MA 02110-1301, USA. -# -# In addition, as a special exception, the copyright holders give -# permission to link the code of portions of this program with the OpenSSL -# library. -# You must obey the GNU General Public License in all respects for all of -# the code used other than OpenSSL. If you modify file(s) with this -# exception, you may extend this exception to your version of the file(s), -# but you are not obligated to do so. If you do not wish to do so, delete -# this exception statement from your version. If you delete this exception -# statement from all source files in the program, then also delete it here. -# +# 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. # from setuptools import setup, find_packages @@ -69,21 +43,15 @@ setup( long_description=__long_description__ if __long_description__ else __description__, packages=find_packages(), - namespace_packages = ["deluge", "deluge.plugins"], - package_data = __pkg_data__, + namespace_packages=["deluge", "deluge.plugins"], + package_data=__pkg_data__, entry_points=""" [deluge.plugin.core] %s = deluge.plugins.%s:CorePlugin [deluge.plugin.gtkui] -<<<<<<< HEAD:deluge/plugins/Extractor/setup.py %s = deluge.plugins.%s:GtkUIPlugin [deluge.plugin.web] %s = deluge.plugins.%s:WebUIPlugin -======= - %s = %s:GtkUIPlugin - [deluge.plugin.web] - %s = %s:WebUIPlugin ->>>>>>> fa7edd0... Fix plugins not showing enabled in webui:deluge/plugins/extractor/setup.py """ % ((__plugin_name__, __plugin_name__.lower())*3) )