mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-12 04:24:27 +00:00
Flake8 Autoadd
This commit is contained in:
parent
66ae8bdd5c
commit
a38186857d
@ -1,5 +1,4 @@
|
|||||||
#
|
# -*- coding: utf-8 -*-
|
||||||
# __init__.py
|
|
||||||
#
|
#
|
||||||
# Copyright (C) 2009 GazpachoKing <chase.sterling@gmail.com>
|
# Copyright (C) 2009 GazpachoKing <chase.sterling@gmail.com>
|
||||||
#
|
#
|
||||||
@ -8,49 +7,28 @@
|
|||||||
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
||||||
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
|
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
|
||||||
#
|
#
|
||||||
# Deluge is free software.
|
# 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.
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
# See LICENSE for more details.
|
||||||
# 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.
|
|
||||||
#
|
#
|
||||||
|
|
||||||
from deluge.plugins.init import PluginInitBase
|
from deluge.plugins.init import PluginInitBase
|
||||||
|
|
||||||
|
|
||||||
class CorePlugin(PluginInitBase):
|
class CorePlugin(PluginInitBase):
|
||||||
def __init__(self, plugin_name):
|
def __init__(self, plugin_name):
|
||||||
from core import Core as _plugin_cls
|
from core import Core as _plugin_cls
|
||||||
self._plugin_cls = _plugin_cls
|
self._plugin_cls = _plugin_cls
|
||||||
super(CorePlugin, self).__init__(plugin_name)
|
super(CorePlugin, self).__init__(plugin_name)
|
||||||
|
|
||||||
|
|
||||||
class GtkUIPlugin(PluginInitBase):
|
class GtkUIPlugin(PluginInitBase):
|
||||||
def __init__(self, plugin_name):
|
def __init__(self, plugin_name):
|
||||||
from gtkui import GtkUI as _plugin_cls
|
from gtkui import GtkUI as _plugin_cls
|
||||||
self._plugin_cls = _plugin_cls
|
self._plugin_cls = _plugin_cls
|
||||||
super(GtkUIPlugin, self).__init__(plugin_name)
|
super(GtkUIPlugin, self).__init__(plugin_name)
|
||||||
|
|
||||||
|
|
||||||
class WebUIPlugin(PluginInitBase):
|
class WebUIPlugin(PluginInitBase):
|
||||||
def __init__(self, plugin_name):
|
def __init__(self, plugin_name):
|
||||||
from webui import WebUI as _plugin_cls
|
from webui import WebUI as _plugin_cls
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#
|
# -*- coding: utf-8 -*-
|
||||||
# common.py
|
|
||||||
#
|
#
|
||||||
# Copyright (C) 2009 GazpachoKing <chase.sterling@gmail.com>
|
# Copyright (C) 2009 GazpachoKing <chase.sterling@gmail.com>
|
||||||
#
|
#
|
||||||
@ -8,36 +7,14 @@
|
|||||||
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
||||||
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
|
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
|
||||||
#
|
#
|
||||||
# Deluge is free software.
|
# 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.
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
# See LICENSE for more details.
|
||||||
# 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.
|
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import os
|
||||||
|
import pkg_resources
|
||||||
|
|
||||||
|
|
||||||
def get_resource(filename):
|
def get_resource(filename):
|
||||||
import pkg_resources, os
|
return pkg_resources.resource_filename("deluge.plugins.autoadd", os.path.join("data", filename))
|
||||||
return pkg_resources.resource_filename("deluge.plugins.autoadd",
|
|
||||||
os.path.join("data", filename))
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#
|
# -*- coding: utf-8 -*-
|
||||||
# core.py
|
|
||||||
#
|
#
|
||||||
# Copyright (C) 2009 GazpachoKing <chase.sterling@gmail.com>
|
# Copyright (C) 2009 GazpachoKing <chase.sterling@gmail.com>
|
||||||
# Copyright (C) 2011 Pedro Algarvio <pedro@algarvio.me>
|
# Copyright (C) 2011 Pedro Algarvio <pedro@algarvio.me>
|
||||||
@ -9,33 +8,9 @@
|
|||||||
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
||||||
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
|
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
|
||||||
#
|
#
|
||||||
# Deluge is free software.
|
# 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.
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
# See LICENSE for more details.
|
||||||
# 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.
|
|
||||||
#
|
#
|
||||||
|
|
||||||
from deluge._libtorrent import lt
|
from deluge._libtorrent import lt
|
||||||
@ -55,47 +30,52 @@ from deluge.event import DelugeEvent
|
|||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_PREFS = {
|
DEFAULT_PREFS = {
|
||||||
"watchdirs":{},
|
"watchdirs": {},
|
||||||
"next_id":1
|
"next_id": 1
|
||||||
}
|
}
|
||||||
|
|
||||||
OPTIONS_AVAILABLE = { #option: builtin
|
|
||||||
"enabled":False,
|
OPTIONS_AVAILABLE = { # option: builtin
|
||||||
"path":False,
|
"enabled": False,
|
||||||
"append_extension":False,
|
"path": False,
|
||||||
|
"append_extension": False,
|
||||||
"copy_torrent": False,
|
"copy_torrent": False,
|
||||||
"delete_copy_torrent_toggle": False,
|
"delete_copy_torrent_toggle": False,
|
||||||
"abspath":False,
|
"abspath": False,
|
||||||
"download_location":True,
|
"download_location": True,
|
||||||
"max_download_speed":True,
|
"max_download_speed": True,
|
||||||
"max_upload_speed":True,
|
"max_upload_speed": True,
|
||||||
"max_connections":True,
|
"max_connections": True,
|
||||||
"max_upload_slots":True,
|
"max_upload_slots": True,
|
||||||
"prioritize_first_last":True,
|
"prioritize_first_last": True,
|
||||||
"auto_managed":True,
|
"auto_managed": True,
|
||||||
"stop_at_ratio":True,
|
"stop_at_ratio": True,
|
||||||
"stop_ratio":True,
|
"stop_ratio": True,
|
||||||
"remove_at_ratio":True,
|
"remove_at_ratio": True,
|
||||||
"move_completed":True,
|
"move_completed": True,
|
||||||
"move_completed_path":True,
|
"move_completed_path": True,
|
||||||
"label":False,
|
"label": False,
|
||||||
"add_paused":True,
|
"add_paused": True,
|
||||||
"queue_to_top":False,
|
"queue_to_top": False,
|
||||||
"owner": "localclient"
|
"owner": "localclient"
|
||||||
}
|
}
|
||||||
|
|
||||||
MAX_NUM_ATTEMPTS = 10
|
MAX_NUM_ATTEMPTS = 10
|
||||||
|
|
||||||
|
|
||||||
class AutoaddOptionsChangedEvent(DelugeEvent):
|
class AutoaddOptionsChangedEvent(DelugeEvent):
|
||||||
"""Emitted when the options for the plugin are changed."""
|
"""Emitted when the options for the plugin are changed."""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def CheckInput(cond, message):
|
|
||||||
|
def check_input(cond, message):
|
||||||
if not cond:
|
if not cond:
|
||||||
raise Exception(message)
|
raise Exception(message)
|
||||||
|
|
||||||
|
|
||||||
class Core(CorePluginBase):
|
class Core(CorePluginBase):
|
||||||
def enable(self):
|
def enable(self):
|
||||||
|
|
||||||
@ -138,12 +118,12 @@ class Core(CorePluginBase):
|
|||||||
"""Update the options for a watch folder."""
|
"""Update the options for a watch folder."""
|
||||||
watchdir_id = str(watchdir_id)
|
watchdir_id = str(watchdir_id)
|
||||||
options = self._make_unicode(options)
|
options = self._make_unicode(options)
|
||||||
CheckInput(
|
check_input(
|
||||||
watchdir_id in self.watchdirs, _("Watch folder does not exist.")
|
watchdir_id in self.watchdirs, _("Watch folder does not exist.")
|
||||||
)
|
)
|
||||||
if options.has_key('path'):
|
if "path" in options:
|
||||||
options['abspath'] = os.path.abspath(options['path'])
|
options['abspath'] = os.path.abspath(options['path'])
|
||||||
CheckInput(
|
check_input(
|
||||||
os.path.isdir(options['abspath']), _("Path does not exist.")
|
os.path.isdir(options['abspath']), _("Path does not exist.")
|
||||||
)
|
)
|
||||||
for w_id, w in self.watchdirs.iteritems():
|
for w_id, w in self.watchdirs.iteritems():
|
||||||
@ -174,14 +154,14 @@ class Core(CorePluginBase):
|
|||||||
|
|
||||||
filedump = _file.read()
|
filedump = _file.read()
|
||||||
if not filedump:
|
if not filedump:
|
||||||
raise RuntimeError, "Torrent is 0 bytes!"
|
raise RuntimeError("Torrent is 0 bytes!")
|
||||||
_file.close()
|
_file.close()
|
||||||
except IOError, e:
|
except IOError, e:
|
||||||
log.warning("Unable to open %s: %s", filename, e)
|
log.warning("Unable to open %s: %s", filename, e)
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
# Get the info to see if any exceptions are raised
|
# Get the info to see if any exceptions are raised
|
||||||
if magnet == False:
|
if not magnet:
|
||||||
lt.torrent_info(lt.bdecode(filedump))
|
lt.torrent_info(lt.bdecode(filedump))
|
||||||
|
|
||||||
return base64.encodestring(filedump)
|
return base64.encodestring(filedump)
|
||||||
@ -421,9 +401,9 @@ class Core(CorePluginBase):
|
|||||||
"""Add a watch folder."""
|
"""Add a watch folder."""
|
||||||
options = self._make_unicode(options)
|
options = self._make_unicode(options)
|
||||||
abswatchdir = os.path.abspath(options['path'])
|
abswatchdir = os.path.abspath(options['path'])
|
||||||
CheckInput(os.path.isdir(abswatchdir) , _("Path does not exist."))
|
check_input(os.path.isdir(abswatchdir), _("Path does not exist."))
|
||||||
CheckInput(
|
check_input(
|
||||||
os.access(abswatchdir, os.R_OK|os.W_OK),
|
os.access(abswatchdir, os.R_OK | os.W_OK),
|
||||||
"You must have read and write access to watch folder."
|
"You must have read and write access to watch folder."
|
||||||
)
|
)
|
||||||
if abswatchdir in [wd['abspath'] for wd in self.watchdirs.itervalues()]:
|
if abswatchdir in [wd['abspath'] for wd in self.watchdirs.itervalues()]:
|
||||||
@ -443,8 +423,7 @@ class Core(CorePluginBase):
|
|||||||
def remove(self, watchdir_id):
|
def remove(self, watchdir_id):
|
||||||
"""Remove a watch folder."""
|
"""Remove a watch folder."""
|
||||||
watchdir_id = str(watchdir_id)
|
watchdir_id = str(watchdir_id)
|
||||||
CheckInput(watchdir_id in self.watchdirs,
|
check_input(watchdir_id in self.watchdirs, "Unknown Watchdir: %s" % self.watchdirs)
|
||||||
"Unknown Watchdir: %s" % self.watchdirs)
|
|
||||||
if self.watchdirs[watchdir_id]['enabled']:
|
if self.watchdirs[watchdir_id]['enabled']:
|
||||||
self.disable_watchdir(watchdir_id)
|
self.disable_watchdir(watchdir_id)
|
||||||
del self.watchdirs[watchdir_id]
|
del self.watchdirs[watchdir_id]
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#
|
# -*- coding: utf-8 -*-
|
||||||
# gtkui.py
|
|
||||||
#
|
#
|
||||||
# Copyright (C) 2009 GazpachoKing <chase.sterling@gmail.com>
|
# Copyright (C) 2009 GazpachoKing <chase.sterling@gmail.com>
|
||||||
#
|
#
|
||||||
@ -8,33 +7,9 @@
|
|||||||
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
||||||
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
|
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
|
||||||
#
|
#
|
||||||
# Deluge is free software.
|
# 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.
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
# See LICENSE for more details.
|
||||||
# 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.
|
|
||||||
#
|
#
|
||||||
|
|
||||||
import gtk
|
import gtk
|
||||||
@ -51,9 +26,11 @@ from common import get_resource
|
|||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class IncompatibleOption(Exception):
|
class IncompatibleOption(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class OptionsDialog():
|
class OptionsDialog():
|
||||||
spin_ids = ["max_download_speed", "max_upload_speed", "stop_ratio"]
|
spin_ids = ["max_download_speed", "max_upload_speed", "stop_ratio"]
|
||||||
spin_int_ids = ["max_upload_slots", "max_connections"]
|
spin_int_ids = ["max_upload_slots", "max_connections"]
|
||||||
@ -68,11 +45,11 @@ class OptionsDialog():
|
|||||||
def show(self, options={}, watchdir_id=None):
|
def show(self, options={}, watchdir_id=None):
|
||||||
self.glade = gtk.glade.XML(get_resource("autoadd_options.glade"))
|
self.glade = gtk.glade.XML(get_resource("autoadd_options.glade"))
|
||||||
self.glade.signal_autoconnect({
|
self.glade.signal_autoconnect({
|
||||||
"on_opts_add":self.on_add,
|
"on_opts_add": self.on_add,
|
||||||
"on_opts_apply":self.on_apply,
|
"on_opts_apply": self.on_apply,
|
||||||
"on_opts_cancel":self.on_cancel,
|
"on_opts_cancel": self.on_cancel,
|
||||||
"on_options_dialog_close":self.on_cancel,
|
"on_options_dialog_close": self.on_cancel,
|
||||||
"on_toggle_toggled":self.on_toggle_toggled
|
"on_toggle_toggled": self.on_toggle_toggled
|
||||||
})
|
})
|
||||||
self.dialog = self.glade.get_widget("options_dialog")
|
self.dialog = self.glade.get_widget("options_dialog")
|
||||||
self.dialog.set_transient_for(component.get("Preferences").pref_dialog)
|
self.dialog.set_transient_for(component.get("Preferences").pref_dialog)
|
||||||
@ -287,7 +264,7 @@ class OptionsDialog():
|
|||||||
self.glade.get_widget('stop_ratio').set_sensitive(isactive)
|
self.glade.get_widget('stop_ratio').set_sensitive(isactive)
|
||||||
self.glade.get_widget('remove_at_ratio').set_sensitive(isactive)
|
self.glade.get_widget('remove_at_ratio').set_sensitive(isactive)
|
||||||
|
|
||||||
def on_apply(self, Event=None):
|
def on_apply(self, event=None):
|
||||||
try:
|
try:
|
||||||
options = self.generate_opts()
|
options = self.generate_opts()
|
||||||
client.autoadd.set_options(
|
client.autoadd.set_options(
|
||||||
@ -296,7 +273,6 @@ class OptionsDialog():
|
|||||||
except IncompatibleOption, err:
|
except IncompatibleOption, err:
|
||||||
dialogs.ErrorDialog(_("Incompatible Option"), str(err), self.dialog).run()
|
dialogs.ErrorDialog(_("Incompatible Option"), str(err), self.dialog).run()
|
||||||
|
|
||||||
|
|
||||||
def on_error_show(self, result):
|
def on_error_show(self, result):
|
||||||
d = dialogs.ErrorDialog(_("Error"), result.value.exception_msg, self.dialog)
|
d = dialogs.ErrorDialog(_("Error"), result.value.exception_msg, self.dialog)
|
||||||
result.cleanFailure()
|
result.cleanFailure()
|
||||||
@ -305,14 +281,14 @@ class OptionsDialog():
|
|||||||
def on_added(self, result):
|
def on_added(self, result):
|
||||||
self.dialog.destroy()
|
self.dialog.destroy()
|
||||||
|
|
||||||
def on_add(self, Event=None):
|
def on_add(self, event=None):
|
||||||
try:
|
try:
|
||||||
options = self.generate_opts()
|
options = self.generate_opts()
|
||||||
client.autoadd.add(options).addCallbacks(self.on_added, self.on_error_show)
|
client.autoadd.add(options).addCallbacks(self.on_added, self.on_error_show)
|
||||||
except IncompatibleOption, err:
|
except IncompatibleOption, err:
|
||||||
dialogs.ErrorDialog(_("Incompatible Option"), str(err), self.dialog).run()
|
dialogs.ErrorDialog(_("Incompatible Option"), str(err), self.dialog).run()
|
||||||
|
|
||||||
def on_cancel(self, Event=None):
|
def on_cancel(self, event=None):
|
||||||
self.dialog.destroy()
|
self.dialog.destroy()
|
||||||
|
|
||||||
def generate_opts(self):
|
def generate_opts(self):
|
||||||
@ -424,32 +400,32 @@ class GtkUI(GtkPluginBase):
|
|||||||
])
|
])
|
||||||
return store
|
return store
|
||||||
|
|
||||||
def create_columns(self, treeView):
|
def create_columns(self, treeview):
|
||||||
rendererToggle = gtk.CellRendererToggle()
|
renderer_toggle = gtk.CellRendererToggle()
|
||||||
column = gtk.TreeViewColumn(
|
column = gtk.TreeViewColumn(
|
||||||
_("Active"), rendererToggle, activatable=1, active=1
|
_("Active"), renderer_toggle, activatable=1, active=1
|
||||||
)
|
)
|
||||||
column.set_sort_column_id(1)
|
column.set_sort_column_id(1)
|
||||||
treeView.append_column(column)
|
treeview.append_column(column)
|
||||||
tt = gtk.Tooltip()
|
tt = gtk.Tooltip()
|
||||||
tt.set_text(_('Double-click to toggle'))
|
tt.set_text(_('Double-click to toggle'))
|
||||||
treeView.set_tooltip_cell(tt, None, None, rendererToggle)
|
treeview.set_tooltip_cell(tt, None, None, renderer_toggle)
|
||||||
|
|
||||||
rendererText = gtk.CellRendererText()
|
renderertext = gtk.CellRendererText()
|
||||||
column = gtk.TreeViewColumn(_("Owner"), rendererText, text=2)
|
column = gtk.TreeViewColumn(_("Owner"), renderertext, text=2)
|
||||||
column.set_sort_column_id(2)
|
column.set_sort_column_id(2)
|
||||||
treeView.append_column(column)
|
treeview.append_column(column)
|
||||||
tt2 = gtk.Tooltip()
|
tt2 = gtk.Tooltip()
|
||||||
tt2.set_text(_('Double-click to edit'))
|
tt2.set_text(_('Double-click to edit'))
|
||||||
treeView.set_has_tooltip(True)
|
treeview.set_has_tooltip(True)
|
||||||
|
|
||||||
rendererText = gtk.CellRendererText()
|
renderertext = gtk.CellRendererText()
|
||||||
column = gtk.TreeViewColumn(_("Path"), rendererText, text=3)
|
column = gtk.TreeViewColumn(_("Path"), renderertext, text=3)
|
||||||
column.set_sort_column_id(3)
|
column.set_sort_column_id(3)
|
||||||
treeView.append_column(column)
|
treeview.append_column(column)
|
||||||
tt2 = gtk.Tooltip()
|
tt2 = gtk.Tooltip()
|
||||||
tt2.set_text(_('Double-click to edit'))
|
tt2.set_text(_('Double-click to edit'))
|
||||||
treeView.set_has_tooltip(True)
|
treeview.set_has_tooltip(True)
|
||||||
|
|
||||||
def load_watchdir_list(self):
|
def load_watchdir_list(self):
|
||||||
pass
|
pass
|
||||||
@ -457,17 +433,17 @@ class GtkUI(GtkPluginBase):
|
|||||||
def add_watchdir_entry(self):
|
def add_watchdir_entry(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def on_add_button_clicked(self, Event=None):
|
def on_add_button_clicked(self, event=None):
|
||||||
#display options_window
|
#display options_window
|
||||||
self.opts_dialog.show()
|
self.opts_dialog.show()
|
||||||
|
|
||||||
def on_remove_button_clicked(self, Event=None):
|
def on_remove_button_clicked(self, event=None):
|
||||||
tree, tree_id = self.treeView.get_selection().get_selected()
|
tree, tree_id = self.treeView.get_selection().get_selected()
|
||||||
watchdir_id = str(self.store.get_value(tree_id, 0))
|
watchdir_id = str(self.store.get_value(tree_id, 0))
|
||||||
if watchdir_id:
|
if watchdir_id:
|
||||||
client.autoadd.remove(watchdir_id)
|
client.autoadd.remove(watchdir_id)
|
||||||
|
|
||||||
def on_edit_button_clicked(self, Event=None, a=None, col=None):
|
def on_edit_button_clicked(self, event=None, a=None, col=None):
|
||||||
tree, tree_id = self.treeView.get_selection().get_selected()
|
tree, tree_id = self.treeView.get_selection().get_selected()
|
||||||
watchdir_id = str(self.store.get_value(tree_id, 0))
|
watchdir_id = str(self.store.get_value(tree_id, 0))
|
||||||
if watchdir_id:
|
if watchdir_id:
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#
|
# -*- coding: utf-8 -*-
|
||||||
# webui.py
|
|
||||||
#
|
#
|
||||||
# Copyright (C) 2009 GazpachoKing <chase.sterling@gmail.com>
|
# Copyright (C) 2009 GazpachoKing <chase.sterling@gmail.com>
|
||||||
#
|
#
|
||||||
@ -8,44 +7,19 @@
|
|||||||
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
||||||
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
|
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
|
||||||
#
|
#
|
||||||
# Deluge is free software.
|
# 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.
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
# See LICENSE for more details.
|
||||||
# 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.
|
|
||||||
#
|
#
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from deluge.ui.client import client
|
|
||||||
from deluge import component
|
|
||||||
from deluge.plugins.pluginbase import WebPluginBase
|
from deluge.plugins.pluginbase import WebPluginBase
|
||||||
|
|
||||||
from common import get_resource
|
from common import get_resource
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class WebUI(WebPluginBase):
|
class WebUI(WebPluginBase):
|
||||||
|
|
||||||
scripts = [get_resource("autoadd.js")]
|
scripts = [get_resource("autoadd.js")]
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#
|
# -*- coding: utf-8 -*-
|
||||||
# setup.py
|
|
||||||
#
|
#
|
||||||
# Copyright (C) 2009 GazpachoKing <chase.sterling@gmail.com>
|
# Copyright (C) 2009 GazpachoKing <chase.sterling@gmail.com>
|
||||||
# Copyright (C) 2011 Pedro Algarvio <pedro@algarvio.me>
|
# Copyright (C) 2011 Pedro Algarvio <pedro@algarvio.me>
|
||||||
@ -9,33 +8,9 @@
|
|||||||
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
||||||
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
|
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
|
||||||
#
|
#
|
||||||
# Deluge is free software.
|
# 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.
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
# See LICENSE for more details.
|
||||||
# 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.
|
|
||||||
#
|
#
|
||||||
|
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
@ -60,8 +35,8 @@ setup(
|
|||||||
license=__license__,
|
license=__license__,
|
||||||
long_description=__long_description__ if __long_description__ else __description__,
|
long_description=__long_description__ if __long_description__ else __description__,
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
namespace_packages = ["deluge", "deluge.plugins"],
|
namespace_packages=["deluge", "deluge.plugins"],
|
||||||
package_data = __pkg_data__,
|
package_data=__pkg_data__,
|
||||||
|
|
||||||
entry_points="""
|
entry_points="""
|
||||||
[deluge.plugin.core]
|
[deluge.plugin.core]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user