summaryrefslogtreecommitdiffstats
path: root/deluge/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'deluge/plugins')
-rw-r--r--deluge/plugins/AutoAdd/deluge_autoadd/__init__.py9
-rw-r--r--deluge/plugins/AutoAdd/deluge_autoadd/common.py3
-rw-r--r--deluge/plugins/AutoAdd/deluge_autoadd/core.py35
-rw-r--r--deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd.js79
-rw-r--r--deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options.js69
-rw-r--r--deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options.ui20
-rw-r--r--deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/main_tab.js14
-rw-r--r--deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/options_tab.js12
-rw-r--r--deluge/plugins/AutoAdd/deluge_autoadd/gtkui.py10
-rw-r--r--deluge/plugins/AutoAdd/deluge_autoadd/webui.py3
-rw-r--r--deluge/plugins/AutoAdd/setup.py1
-rw-r--r--deluge/plugins/Blocklist/deluge_blocklist/__init__.py9
-rw-r--r--deluge/plugins/Blocklist/deluge_blocklist/common.py14
-rw-r--r--deluge/plugins/Blocklist/deluge_blocklist/core.py10
-rw-r--r--deluge/plugins/Blocklist/deluge_blocklist/data/blocklist.js38
-rw-r--r--deluge/plugins/Blocklist/deluge_blocklist/data/blocklist_pref.ui6
-rw-r--r--deluge/plugins/Blocklist/deluge_blocklist/data/blocklist_pref.ui~603
-rw-r--r--deluge/plugins/Blocklist/deluge_blocklist/decompressers.py3
-rw-r--r--deluge/plugins/Blocklist/deluge_blocklist/detect.py3
-rw-r--r--deluge/plugins/Blocklist/deluge_blocklist/gtkui.py5
-rw-r--r--deluge/plugins/Blocklist/deluge_blocklist/peerguardian.py10
-rw-r--r--deluge/plugins/Blocklist/deluge_blocklist/readers.py5
-rw-r--r--deluge/plugins/Blocklist/deluge_blocklist/webui.py3
-rw-r--r--deluge/plugins/Blocklist/setup.py1
-rw-r--r--deluge/plugins/Execute/deluge_execute/__init__.py9
-rw-r--r--deluge/plugins/Execute/deluge_execute/common.py3
-rw-r--r--deluge/plugins/Execute/deluge_execute/core.py5
-rw-r--r--deluge/plugins/Execute/deluge_execute/data/execute.js68
-rw-r--r--deluge/plugins/Execute/deluge_execute/data/execute_prefs.ui2
-rw-r--r--deluge/plugins/Execute/deluge_execute/data/execute_prefs.ui~190
-rw-r--r--deluge/plugins/Execute/deluge_execute/gtkui.py7
-rw-r--r--deluge/plugins/Execute/deluge_execute/webui.py3
-rw-r--r--deluge/plugins/Execute/setup.py1
-rw-r--r--deluge/plugins/Extractor/deluge_extractor/__init__.py9
-rw-r--r--deluge/plugins/Extractor/deluge_extractor/common.py3
-rw-r--r--deluge/plugins/Extractor/deluge_extractor/core.py10
-rw-r--r--deluge/plugins/Extractor/deluge_extractor/data/extractor.js14
-rw-r--r--deluge/plugins/Extractor/deluge_extractor/data/extractor_prefs.ui2
-rw-r--r--deluge/plugins/Extractor/deluge_extractor/data/extractor_prefs.ui~120
-rw-r--r--deluge/plugins/Extractor/deluge_extractor/gtkui.py5
-rw-r--r--deluge/plugins/Extractor/deluge_extractor/webui.py3
-rw-r--r--deluge/plugins/Extractor/setup.py1
-rw-r--r--deluge/plugins/Label/deluge_label/__init__.py9
-rw-r--r--deluge/plugins/Label/deluge_label/common.py3
-rw-r--r--deluge/plugins/Label/deluge_label/core.py3
-rw-r--r--deluge/plugins/Label/deluge_label/data/label.js95
-rw-r--r--deluge/plugins/Label/deluge_label/data/label_add.ui2
-rw-r--r--deluge/plugins/Label/deluge_label/data/label_options.ui12
-rw-r--r--deluge/plugins/Label/deluge_label/gtkui/__init__.py3
-rw-r--r--deluge/plugins/Label/deluge_label/gtkui/label_config.py5
-rw-r--r--deluge/plugins/Label/deluge_label/gtkui/sidebar_menu.py15
-rw-r--r--deluge/plugins/Label/deluge_label/gtkui/submenu.py3
-rw-r--r--deluge/plugins/Label/deluge_label/test.py3
-rw-r--r--deluge/plugins/Label/deluge_label/webui.py3
-rw-r--r--deluge/plugins/Label/setup.py1
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/__init__.py9
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/common.py5
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/core.py8
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/data/config.ui10
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/data/config.ui~643
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/data/notifications.js46
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/gtkui.py17
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/test.py11
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/webui.py3
-rwxr-xr-xdeluge/plugins/Notifications/setup.py3
-rw-r--r--deluge/plugins/Scheduler/deluge_scheduler/__init__.py9
-rw-r--r--deluge/plugins/Scheduler/deluge_scheduler/common.py3
-rw-r--r--deluge/plugins/Scheduler/deluge_scheduler/core.py3
-rw-r--r--deluge/plugins/Scheduler/deluge_scheduler/data/scheduler.js62
-rw-r--r--deluge/plugins/Scheduler/deluge_scheduler/gtkui.py5
-rw-r--r--deluge/plugins/Scheduler/deluge_scheduler/webui.py3
-rw-r--r--deluge/plugins/Scheduler/setup.py1
-rw-r--r--deluge/plugins/Stats/deluge_stats/__init__.py9
-rw-r--r--deluge/plugins/Stats/deluge_stats/common.py3
-rw-r--r--deluge/plugins/Stats/deluge_stats/core.py65
-rw-r--r--deluge/plugins/Stats/deluge_stats/data/config.ui~280
-rw-r--r--deluge/plugins/Stats/deluge_stats/data/stats.js6
-rw-r--r--deluge/plugins/Stats/deluge_stats/graph.py13
-rw-r--r--deluge/plugins/Stats/deluge_stats/gtkui.py9
-rw-r--r--deluge/plugins/Stats/deluge_stats/tests/test_stats.py60
-rw-r--r--deluge/plugins/Stats/deluge_stats/webui.py3
-rw-r--r--deluge/plugins/Stats/setup.py1
-rw-r--r--deluge/plugins/Toggle/deluge_toggle/__init__.py9
-rw-r--r--deluge/plugins/Toggle/deluge_toggle/common.py3
-rw-r--r--deluge/plugins/Toggle/deluge_toggle/core.py3
-rw-r--r--deluge/plugins/Toggle/deluge_toggle/data/toggle.js6
-rw-r--r--deluge/plugins/Toggle/deluge_toggle/gtkui.py3
-rw-r--r--deluge/plugins/Toggle/deluge_toggle/webui.py3
-rw-r--r--deluge/plugins/Toggle/setup.py1
-rw-r--r--deluge/plugins/WebUi/deluge_webui/__init__.py9
-rw-r--r--deluge/plugins/WebUi/deluge_webui/common.py3
-rw-r--r--deluge/plugins/WebUi/deluge_webui/core.py3
-rw-r--r--deluge/plugins/WebUi/deluge_webui/data/config.ui2
-rw-r--r--deluge/plugins/WebUi/deluge_webui/data/config.ui~126
-rw-r--r--deluge/plugins/WebUi/deluge_webui/gtkui.py3
-rw-r--r--deluge/plugins/WebUi/deluge_webui/tests/test_plugin_webui.py27
-rw-r--r--deluge/plugins/WebUi/setup.py1
-rw-r--r--deluge/plugins/init.py5
-rw-r--r--deluge/plugins/pluginbase.py19
99 files changed, 421 insertions, 2672 deletions
diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/__init__.py b/deluge/plugins/AutoAdd/deluge_autoadd/__init__.py
index a409cfc..5f5e766 100644
--- a/deluge/plugins/AutoAdd/deluge_autoadd/__init__.py
+++ b/deluge/plugins/AutoAdd/deluge_autoadd/__init__.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 GazpachoKing <chase.sterling@gmail.com>
#
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.plugins.init import PluginInitBase
@@ -22,7 +19,7 @@ class CorePlugin(PluginInitBase):
from .core import Core as _pluginCls
self._plugin_cls = _pluginCls
- super(CorePlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
class Gtk3UIPlugin(PluginInitBase):
@@ -30,7 +27,7 @@ class Gtk3UIPlugin(PluginInitBase):
from .gtkui import GtkUI as _pluginCls
self._plugin_cls = _pluginCls
- super(Gtk3UIPlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
class WebUIPlugin(PluginInitBase):
@@ -38,4 +35,4 @@ class WebUIPlugin(PluginInitBase):
from .webui import WebUI as _pluginCls
self._plugin_cls = _pluginCls
- super(WebUIPlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/common.py b/deluge/plugins/AutoAdd/deluge_autoadd/common.py
index 9b4b1e7..6a790cb 100644
--- a/deluge/plugins/AutoAdd/deluge_autoadd/common.py
+++ b/deluge/plugins/AutoAdd/deluge_autoadd/common.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Basic plugin template created by:
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os.path
from pkg_resources import resource_filename
diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/core.py b/deluge/plugins/AutoAdd/deluge_autoadd/core.py
index 79e5327..07ad53a 100644
--- a/deluge/plugins/AutoAdd/deluge_autoadd/core.py
+++ b/deluge/plugins/AutoAdd/deluge_autoadd/core.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 GazpachoKing <chase.sterling@gmail.com>
# Copyright (C) 2011 Pedro Algarvio <pedro@algarvio.me>
@@ -13,22 +12,22 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os
import shutil
from base64 import b64encode
from twisted.internet import reactor
+from twisted.internet.defer import maybeDeferred
from twisted.internet.task import LoopingCall, deferLater
+from twisted.python.failure import Failure
import deluge.component as component
import deluge.configmanager
from deluge._libtorrent import lt
from deluge.common import AUTH_LEVEL_ADMIN, is_magnet
from deluge.core.rpcserver import export
-from deluge.error import AddTorrentError
+from deluge.error import AddTorrentError, InvalidTorrentError
from deluge.event import DelugeEvent
from deluge.plugins.pluginbase import CorePluginBase
@@ -150,7 +149,7 @@ class Core(CorePluginBase):
try:
with open(filename, file_mode) as _file:
filedump = _file.read()
- except IOError as ex:
+ except OSError as ex:
log.warning('Unable to open %s: %s', filename, ex)
raise ex
@@ -159,7 +158,10 @@ class Core(CorePluginBase):
# Get the info to see if any exceptions are raised
if not magnet:
- lt.torrent_info(lt.bdecode(filedump))
+ decoded_torrent = lt.bdecode(filedump)
+ if decoded_torrent is None:
+ raise InvalidTorrentError('Torrent file failed decoding.')
+ lt.torrent_info(decoded_torrent)
return filedump
@@ -167,9 +169,9 @@ class Core(CorePluginBase):
log.debug('Attempting to open %s for splitting magnets.', filename)
magnets = []
try:
- with open(filename, 'r') as _file:
+ with open(filename) as _file:
magnets = list(filter(len, _file.read().splitlines()))
- except IOError as ex:
+ except OSError as ex:
log.warning('Unable to open %s: %s', filename, ex)
if len(magnets) < 2:
@@ -194,7 +196,7 @@ class Core(CorePluginBase):
try:
with open(mname, 'w') as _mfile:
_mfile.write(magnet)
- except IOError as ex:
+ except OSError as ex:
log.warning('Unable to open %s: %s', mname, ex)
return magnets
@@ -269,7 +271,7 @@ class Core(CorePluginBase):
try:
filedump = self.load_torrent(filepath, magnet)
- except (IOError, EOFError) as ex:
+ except (OSError, EOFError, InvalidTorrentError) as ex:
# If torrent is invalid, keep track of it so can try again on the next pass.
# This catches torrent files that may not be fully saved to disk at load time.
log.debug('Torrent is invalid: %s', ex)
@@ -325,6 +327,9 @@ class Core(CorePluginBase):
os.remove(filepath)
def fail_torrent_add(err_msg, filepath, magnet):
+ if isinstance(err_msg, Failure):
+ err_msg = err_msg.getErrorMessage()
+
# torrent handle is invalid and so is the magnet link
log.error(
'Cannot Autoadd %s: %s: %s',
@@ -337,15 +342,17 @@ class Core(CorePluginBase):
try:
# The torrent looks good, so lets add it to the session.
if magnet:
- d = component.get('Core').add_torrent_magnet(
- filedump.strip(), options
+ d = maybeDeferred(
+ component.get('Core').add_torrent_magnet,
+ filedump.strip(),
+ options,
)
else:
d = component.get('Core').add_torrent_file_async(
filename, b64encode(filedump), options
)
- d.addCallback(on_torrent_added, filename, filepath)
- d.addErrback(fail_torrent_add, filepath, magnet)
+ d.addCallback(on_torrent_added, filename, filepath)
+ d.addErrback(fail_torrent_add, filepath, magnet)
except AddTorrentError as ex:
fail_torrent_add(str(ex), filepath, magnet)
diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd.js b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd.js
index 40086b3..e68fce3 100644
--- a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd.js
+++ b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd.js
@@ -25,7 +25,7 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, {
border: false,
watchdirs: {},
- initComponent: function() {
+ initComponent: function () {
Deluge.ux.preferences.AutoAddPage.superclass.initComponent.call(this);
var autoAdd = this;
@@ -41,23 +41,22 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, {
sortable: true,
dataIndex: 'enabled',
tpl: new Ext.XTemplate('{enabled:this.getCheckbox}', {
- getCheckbox: function(checked, selected) {
- Deluge.ux.AutoAdd.onClickFunctions[
- selected.id
- ] = function() {
- if (selected.enabled) {
- deluge.client.autoadd.disable_watchdir(
- selected.id
- );
- checked = false;
- } else {
- deluge.client.autoadd.enable_watchdir(
- selected.id
- );
- checked = true;
- }
- autoAdd.updateWatchDirs();
- };
+ getCheckbox: function (checked, selected) {
+ Deluge.ux.AutoAdd.onClickFunctions[selected.id] =
+ function () {
+ if (selected.enabled) {
+ deluge.client.autoadd.disable_watchdir(
+ selected.id
+ );
+ checked = false;
+ } else {
+ deluge.client.autoadd.enable_watchdir(
+ selected.id
+ );
+ checked = true;
+ }
+ autoAdd.updateWatchDirs();
+ };
return (
'<input id="enabled-' +
selected.id +
@@ -122,9 +121,9 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, {
this.on('show', this.onPreferencesShow, this);
},
- updateWatchDirs: function() {
+ updateWatchDirs: function () {
deluge.client.autoadd.get_watchdirs({
- success: function(watchdirs) {
+ success: function (watchdirs) {
this.watchdirs = watchdirs;
var watchdirsArray = [];
for (var id in watchdirs) {
@@ -145,12 +144,12 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, {
});
},
- onAddClick: function() {
+ onAddClick: function () {
if (!this.addWin) {
this.addWin = new Deluge.ux.AutoAdd.AddAutoAddCommandWindow();
this.addWin.on(
'watchdiradd',
- function() {
+ function () {
this.updateWatchDirs();
},
this
@@ -159,12 +158,12 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, {
this.addWin.show();
},
- onEditClick: function() {
+ onEditClick: function () {
if (!this.editWin) {
this.editWin = new Deluge.ux.AutoAdd.EditAutoAddCommandWindow();
this.editWin.on(
'watchdiredit',
- function() {
+ function () {
this.updateWatchDirs();
},
this
@@ -174,39 +173,27 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, {
this.editWin.show(id, this.watchdirs[id]);
},
- onPreferencesShow: function() {
+ onPreferencesShow: function () {
this.updateWatchDirs();
},
- onRemoveClick: function() {
+ onRemoveClick: function () {
var record = this.list.getSelectedRecords()[0];
deluge.client.autoadd.remove(record.id, {
- success: function() {
+ success: function () {
this.updateWatchDirs();
},
scope: this,
});
},
- onSelectionChange: function(dv, selections) {
+ onSelectionChange: function (dv, selections) {
if (selections.length) {
- this.panel
- .getBottomToolbar()
- .items.get(1)
- .enable();
- this.panel
- .getBottomToolbar()
- .items.get(3)
- .enable();
+ this.panel.getBottomToolbar().items.get(1).enable();
+ this.panel.getBottomToolbar().items.get(3).enable();
} else {
- this.panel
- .getBottomToolbar()
- .items.get(1)
- .disable();
- this.panel
- .getBottomToolbar()
- .items.get(3)
- .disable();
+ this.panel.getBottomToolbar().items.get(1).disable();
+ this.panel.getBottomToolbar().items.get(3).disable();
}
},
});
@@ -218,12 +205,12 @@ Deluge.plugins.AutoAddPlugin = Ext.extend(Deluge.Plugin, {
prefsPage: null,
},
- onDisable: function() {
+ onDisable: function () {
deluge.preferences.removePage(Deluge.plugins.AutoAddPlugin.prefsPage);
Deluge.plugins.AutoAddPlugin.prefsPage = null;
},
- onEnable: function() {
+ onEnable: function () {
/*
* Called for each of the JavaScript files.
* This will prevent adding unnecessary tabs to the preferences window.
diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options.js b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options.js
index 49f752f..7ec4448 100644
--- a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options.js
+++ b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options.js
@@ -60,7 +60,7 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, {
],
}),
- initComponent: function() {
+ initComponent: function () {
Deluge.ux.AutoAdd.AutoAddWindowBase.superclass.initComponent.call(this);
this.addButton(_('Cancel'), this.onCancelClick, this);
@@ -81,18 +81,17 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, {
});
},
- onCancelClick: function() {
+ onCancelClick: function () {
this.hide();
},
- getOptions: function() {
+ getOptions: function () {
var options = {};
options['enabled'] = Ext.getCmp('enabled').getValue();
options['path'] = Ext.getCmp('path').getValue();
- options['download_location'] = Ext.getCmp(
- 'download_location'
- ).getValue();
+ options['download_location'] =
+ Ext.getCmp('download_location').getValue();
options['move_completed_path'] = Ext.getCmp(
'move_completed_path'
).getValue();
@@ -102,22 +101,22 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, {
options['append_extension'] = Ext.getCmp('append_extension').getValue();
options['owner'] = Ext.getCmp('owner').getValue();
- this.toggle_ids.forEach(function(toggle_id) {
+ this.toggle_ids.forEach(function (toggle_id) {
options[toggle_id] = Ext.getCmp(toggle_id).getValue();
});
- this.spin_ids.forEach(function(spin_id) {
+ this.spin_ids.forEach(function (spin_id) {
options[spin_id] = Ext.getCmp(spin_id).getValue();
options[spin_id + '_toggle'] = Ext.getCmp(
spin_id + '_toggle'
).getValue();
});
- this.spin_int_ids.forEach(function(spin_int_id) {
+ this.spin_int_ids.forEach(function (spin_int_id) {
options[spin_int_id] = Ext.getCmp(spin_int_id).getValue();
options[spin_int_id + '_toggle'] = Ext.getCmp(
spin_int_id + '_toggle'
).getValue();
});
- this.chk_ids.forEach(function(chk_id) {
+ this.chk_ids.forEach(function (chk_id) {
options[chk_id] = Ext.getCmp(chk_id).getValue();
options[chk_id + '_toggle'] = Ext.getCmp(
chk_id + '_toggle'
@@ -137,7 +136,7 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, {
return options;
},
- loadOptions: function(options) {
+ loadOptions: function (options) {
/*
* Populate all available options data to the UI
*/
@@ -193,7 +192,7 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, {
: false
);
- this.spin_ids.forEach(function(spin_id) {
+ this.spin_ids.forEach(function (spin_id) {
Ext.getCmp(spin_id).setValue(
options[spin_id] !== undefined ? options[spin_id] : 0
);
@@ -203,7 +202,7 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, {
: false
);
});
- this.chk_ids.forEach(function(chk_id) {
+ this.chk_ids.forEach(function (chk_id) {
Ext.getCmp(chk_id).setValue(
options[chk_id] !== undefined ? options[chk_id] : true
);
@@ -237,14 +236,14 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, {
'path',
'download_location',
'copy_torrent',
- ].forEach(function(field) {
+ ].forEach(function (field) {
value = options[field] !== undefined ? options[field] : '';
Ext.getCmp(field).setValue(value);
});
if (Object.keys(options).length === 0) {
deluge.client.core.get_config({
- success: function(config) {
+ success: function (config) {
var value;
Ext.getCmp('download_location').setValue(
options['download_location'] !== undefined
@@ -291,11 +290,11 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, {
}
deluge.client.core.get_enabled_plugins({
- success: function(plugins) {
+ success: function (plugins) {
if (plugins !== undefined && plugins.indexOf('Label') > -1) {
this.MainTab.LabelFset.setVisible(true);
deluge.client.label.get_labels({
- success: function(labels) {
+ success: function (labels) {
for (
var index = 0;
index < labels.length;
@@ -305,7 +304,7 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, {
}
this.labels.loadData(labels, false);
},
- failure: function(failure) {
+ failure: function (failure) {
console.error(failure);
},
scope: this,
@@ -324,30 +323,26 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, {
accounts[index] = [accounts[index]['username']];
}
me.accounts.loadData(accounts, false);
- Ext.getCmp('owner')
- .setValue(owner)
- .enable();
+ Ext.getCmp('owner').setValue(owner).enable();
}
function on_accounts_failure(failure) {
deluge.client.autoadd.get_auth_user({
- success: function(user) {
+ success: function (user) {
me.accounts.loadData([[user]], false);
- Ext.getCmp('owner')
- .setValue(user)
- .disable(true);
+ Ext.getCmp('owner').setValue(user).disable(true);
},
scope: this,
});
}
deluge.client.autoadd.is_admin_level({
- success: function(is_admin) {
+ success: function (is_admin) {
if (is_admin) {
deluge.client.core.get_known_accounts({
- success: function(accounts) {
+ success: function (accounts) {
deluge.client.autoadd.get_auth_user({
- success: function(user) {
+ success: function (user) {
on_accounts(
accounts,
options['owner'] !== undefined
@@ -379,7 +374,7 @@ Deluge.ux.AutoAdd.EditAutoAddCommandWindow = Ext.extend(
{
title: _('Edit Watch Folder'),
- initComponent: function() {
+ initComponent: function () {
Deluge.ux.AutoAdd.EditAutoAddCommandWindow.superclass.initComponent.call(
this
);
@@ -389,7 +384,7 @@ Deluge.ux.AutoAdd.EditAutoAddCommandWindow = Ext.extend(
});
},
- show: function(watchdir_id, options) {
+ show: function (watchdir_id, options) {
Deluge.ux.AutoAdd.EditAutoAddCommandWindow.superclass.show.call(
this
);
@@ -397,11 +392,11 @@ Deluge.ux.AutoAdd.EditAutoAddCommandWindow = Ext.extend(
this.loadOptions(options);
},
- onSaveClick: function() {
+ onSaveClick: function () {
try {
var options = this.getOptions();
deluge.client.autoadd.set_options(this.watchdir_id, options, {
- success: function() {
+ success: function () {
this.fireEvent('watchdiredit', this, options);
},
scope: this,
@@ -429,7 +424,7 @@ Deluge.ux.AutoAdd.AddAutoAddCommandWindow = Ext.extend(
{
title: _('Add Watch Folder'),
- initComponent: function() {
+ initComponent: function () {
Deluge.ux.AutoAdd.AddAutoAddCommandWindow.superclass.initComponent.call(
this
);
@@ -439,21 +434,21 @@ Deluge.ux.AutoAdd.AddAutoAddCommandWindow = Ext.extend(
});
},
- show: function() {
+ show: function () {
Deluge.ux.AutoAdd.AddAutoAddCommandWindow.superclass.show.call(
this
);
this.loadOptions();
},
- onAddClick: function() {
+ onAddClick: function () {
var options = this.getOptions();
deluge.client.autoadd.add(options, {
- success: function() {
+ success: function () {
this.fireEvent('watchdiradd', this, options);
this.hide();
},
- failure: function(err) {
+ failure: function (err) {
const regex = /: (.*\n)\n?\]/m;
var error;
if ((error = regex.exec(err.error.message)) !== null) {
diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options.ui b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options.ui
index a4cd364..f1870f1 100644
--- a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options.ui
+++ b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options.ui
@@ -150,8 +150,6 @@
<property name="tooltip_text" translatable="yes">If a .torrent file is added to this directory,
it will be added to the session.</property>
<property name="invisible_char">●</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
</object>
<packing>
<property name="expand">True</property>
@@ -284,8 +282,6 @@ and it will remain in the same directory.</property>
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
<property name="text" translatable="yes">.added</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
</object>
<packing>
<property name="expand">True</property>
@@ -329,8 +325,6 @@ and deleted from the watch folder.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
</object>
<packing>
<property name="expand">True</property>
@@ -445,8 +439,6 @@ also delete the .torrent file used to add it.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
</object>
<packing>
<property name="expand">True</property>
@@ -534,8 +526,6 @@ also delete the .torrent file used to add it.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
</object>
<packing>
<property name="expand">True</property>
@@ -799,8 +789,6 @@ also delete the .torrent file used to add it.</property>
<object class="GtkSpinButton" id="max_download_speed">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
<property name="adjustment">adjustment1</property>
<property name="climb_rate">1</property>
<property name="digits">1</property>
@@ -815,8 +803,6 @@ also delete the .torrent file used to add it.</property>
<object class="GtkSpinButton" id="max_upload_speed">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
<property name="adjustment">adjustment2</property>
<property name="climb_rate">1</property>
<property name="digits">1</property>
@@ -833,8 +819,6 @@ also delete the .torrent file used to add it.</property>
<object class="GtkSpinButton" id="max_connections">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
<property name="adjustment">adjustment3</property>
<property name="climb_rate">1</property>
</object>
@@ -850,8 +834,6 @@ also delete the .torrent file used to add it.</property>
<object class="GtkSpinButton" id="max_upload_slots">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
<property name="adjustment">adjustment4</property>
<property name="climb_rate">1</property>
</object>
@@ -1063,8 +1045,6 @@ also delete the .torrent file used to add it.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
<property name="adjustment">adjustment5</property>
<property name="climb_rate">1</property>
<property name="digits">1</property>
diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/main_tab.js b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/main_tab.js
index 79d2600..f685ff2 100644
--- a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/main_tab.js
+++ b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/main_tab.js
@@ -19,7 +19,7 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, {
id: 'main_tab_panel',
title: _('Main'),
- initComponent: function() {
+ initComponent: function () {
Deluge.ux.AutoAdd.AutoAddMainPanel.superclass.initComponent.call(this);
this.watchFolderFset = new Ext.form.FieldSet({
xtype: 'fieldset',
@@ -69,7 +69,7 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, {
checked: true,
hideLabel: true,
listeners: {
- check: function(cb, newValue) {
+ check: function (cb, newValue) {
if (newValue) {
Ext.getCmp(
'append_extension'
@@ -98,7 +98,7 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, {
),
hideLabel: true,
listeners: {
- check: function(cb, newValue) {
+ check: function (cb, newValue) {
if (newValue) {
Ext.getCmp(
'append_extension'
@@ -141,7 +141,7 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, {
),
hideLabel: true,
listeners: {
- check: function(cb, newValue) {
+ check: function (cb, newValue) {
if (newValue) {
Ext.getCmp(
'append_extension'
@@ -201,7 +201,7 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, {
xtype: 'checkbox',
boxLabel: _('Set download folder'),
listeners: {
- check: function(cb, checked) {
+ check: function (cb, checked) {
Ext.getCmp('download_location').setDisabled(
!checked
);
@@ -233,7 +233,7 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, {
xtype: 'checkbox',
boxLabel: _('Set move completed folder'),
listeners: {
- check: function(cb, checked) {
+ check: function (cb, checked) {
Ext.getCmp('move_completed_path').setDisabled(
!checked
);
@@ -271,7 +271,7 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, {
xtype: 'checkbox',
boxLabel: _('Label:'),
listeners: {
- check: function(cb, checked) {
+ check: function (cb, checked) {
Ext.getCmp('label').setDisabled(!checked);
},
},
diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/options_tab.js b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/options_tab.js
index a69490c..4ce030e 100644
--- a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/options_tab.js
+++ b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/options_tab.js
@@ -19,7 +19,7 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, {
id: 'options_tab_panel',
title: _('Options'),
- initComponent: function() {
+ initComponent: function () {
Deluge.ux.AutoAdd.AutoAddOptionsPanel.superclass.initComponent.call(
this
);
@@ -149,7 +149,7 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, {
hideLabel: true,
width: 175,
listeners: {
- check: function(cb, checked) {
+ check: function (cb, checked) {
Ext.getCmp('stop_ratio').setDisabled(
!checked
);
@@ -223,7 +223,7 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, {
this.add([this.ownerFset, this.bandwidthFset, this.queueFset]);
},
- _getBandwidthContainer: function(values) {
+ _getBandwidthContainer: function (values) {
return new Ext.Container({
xtype: 'container',
layout: 'hbox',
@@ -236,7 +236,7 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, {
boxLabel: _(values.labelCheckbox),
width: 175,
listeners: {
- check: function(cb, checked) {
+ check: function (cb, checked) {
Ext.getCmp(values.idSpinner).setDisabled(!checked);
},
},
@@ -257,7 +257,7 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, {
});
},
- _getQueueContainer: function(values) {
+ _getQueueContainer: function (values) {
return new Ext.Container({
xtype: 'container',
layout: 'hbox',
@@ -270,7 +270,7 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, {
boxLabel: _(values.labelCheckbox),
width: 175,
listeners: {
- check: function(cb, checked) {
+ check: function (cb, checked) {
Ext.getCmp(values.nameRadio).setDisabled(!checked);
Ext.getCmp('not_' + values.nameRadio).setDisabled(
!checked
diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/gtkui.py b/deluge/plugins/AutoAdd/deluge_autoadd/gtkui.py
index 16f0f7a..80fb9fc 100644
--- a/deluge/plugins/AutoAdd/deluge_autoadd/gtkui.py
+++ b/deluge/plugins/AutoAdd/deluge_autoadd/gtkui.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 GazpachoKing <chase.sterling@gmail.com>
#
@@ -12,14 +11,12 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os
import gi # isort:skip (Required before Gtk import).
-gi.require_version('Gtk', '3.0') # NOQA: E402
+gi.require_version('Gtk', '3.0')
# isort:imports-thirdparty
from gi.repository import Gtk
@@ -41,7 +38,7 @@ class IncompatibleOption(Exception):
pass
-class OptionsDialog(object):
+class OptionsDialog:
spin_ids = ['max_download_speed', 'max_upload_speed', 'stop_ratio']
spin_int_ids = ['max_upload_slots', 'max_connections']
chk_ids = [
@@ -327,7 +324,7 @@ class OptionsDialog(object):
dialogs.ErrorDialog(_('Incompatible Option'), str(ex), self.dialog).run()
def on_error_show(self, result):
- d = dialogs.ErrorDialog(_('Error'), result.value.exception_msg, self.dialog)
+ d = dialogs.ErrorDialog(_('Error'), result.value.message, self.dialog)
result.cleanFailure()
d.run()
@@ -453,7 +450,6 @@ class GtkUI(Gtk3PluginBase):
self.treeView = Gtk.TreeView(self.store)
self.treeView.connect('cursor-changed', self.on_listitem_activated)
self.treeView.connect('row-activated', self.on_edit_button_clicked)
- self.treeView.set_rules_hint(True)
self.create_columns(self.treeView)
sw.add(self.treeView)
diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/webui.py b/deluge/plugins/AutoAdd/deluge_autoadd/webui.py
index 7f36ba6..d328432 100644
--- a/deluge/plugins/AutoAdd/deluge_autoadd/webui.py
+++ b/deluge/plugins/AutoAdd/deluge_autoadd/webui.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 GazpachoKing <chase.sterling@gmail.com>
#
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge.plugins.pluginbase import WebPluginBase
diff --git a/deluge/plugins/AutoAdd/setup.py b/deluge/plugins/AutoAdd/setup.py
index fcd0183..5a01ee9 100644
--- a/deluge/plugins/AutoAdd/setup.py
+++ b/deluge/plugins/AutoAdd/setup.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 GazpachoKing <chase.sterling@gmail.com>
# Copyright (C) 2011 Pedro Algarvio <pedro@algarvio.me>
diff --git a/deluge/plugins/Blocklist/deluge_blocklist/__init__.py b/deluge/plugins/Blocklist/deluge_blocklist/__init__.py
index 96ccc02..40ce1d1 100644
--- a/deluge/plugins/Blocklist/deluge_blocklist/__init__.py
+++ b/deluge/plugins/Blocklist/deluge_blocklist/__init__.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
#
@@ -7,8 +6,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.plugins.init import PluginInitBase
@@ -17,7 +14,7 @@ class CorePlugin(PluginInitBase):
from .core import Core as _pluginCls
self._plugin_cls = _pluginCls
- super(CorePlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
class GtkUIPlugin(PluginInitBase):
@@ -25,7 +22,7 @@ class GtkUIPlugin(PluginInitBase):
from .gtkui import GtkUI as _pluginCls
self._plugin_cls = _pluginCls
- super(GtkUIPlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
class WebUIPlugin(PluginInitBase):
@@ -33,4 +30,4 @@ class WebUIPlugin(PluginInitBase):
from .webui import WebUI as _pluginCls
self._plugin_cls = _pluginCls
- super(WebUIPlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
diff --git a/deluge/plugins/Blocklist/deluge_blocklist/common.py b/deluge/plugins/Blocklist/deluge_blocklist/common.py
index a9299cd..35b2f87 100644
--- a/deluge/plugins/Blocklist/deluge_blocklist/common.py
+++ b/deluge/plugins/Blocklist/deluge_blocklist/common.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Basic plugin template created by:
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
@@ -12,13 +11,10 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os.path
from functools import wraps
from sys import exc_info
-import six
from pkg_resources import resource_filename
@@ -47,7 +43,7 @@ def raises_errors_as(error):
return func(self, *args, **kwargs)
except Exception:
(value, tb) = exc_info()[1:]
- six.reraise(error, value, tb)
+ raise error(value).with_traceback(tb) from None
return wrapper
@@ -74,7 +70,7 @@ class BadIP(Exception):
_message = None
def __init__(self, message):
- super(BadIP, self).__init__(message)
+ super().__init__(message)
def __set_message(self, message):
self._message = message
@@ -86,7 +82,7 @@ class BadIP(Exception):
del __get_message, __set_message
-class IP(object):
+class IP:
__slots__ = ('q1', 'q2', 'q3', 'q4', '_long')
def __init__(self, q1, q2, q3, q4):
@@ -109,7 +105,7 @@ class IP(object):
@classmethod
def parse(cls, ip):
try:
- q1, q2, q3, q4 = [int(q) for q in ip.split('.')]
+ q1, q2, q3, q4 = (int(q) for q in ip.split('.'))
except ValueError:
raise BadIP(_('The IP address "%s" is badly formed' % ip))
if q1 < 0 or q2 < 0 or q3 < 0 or q4 < 0:
@@ -169,7 +165,7 @@ class IP(object):
return self.long == other.long
def __repr__(self):
- return '<%s long=%s address="%s">' % (
+ return '<{} long={} address="{}">'.format(
self.__class__.__name__,
self.long,
self.address,
diff --git a/deluge/plugins/Blocklist/deluge_blocklist/core.py b/deluge/plugins/Blocklist/deluge_blocklist/core.py
index a096b8a..1765767 100644
--- a/deluge/plugins/Blocklist/deluge_blocklist/core.py
+++ b/deluge/plugins/Blocklist/deluge_blocklist/core.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2008 Andrew Resch <andrewresch@gmail.com>
# Copyright (C) 2009-2010 John Garland <johnnybg+deluge@gmail.com>
@@ -8,14 +7,13 @@
# See LICENSE for more details.
#
-from __future__ import division, unicode_literals
-
import logging
import os
import shutil
import time
from datetime import datetime, timedelta
from email.utils import formatdate
+from urllib.parse import urljoin
from twisted.internet import defer, threads
from twisted.internet.task import LoopingCall
@@ -32,12 +30,6 @@ from .common import IP, BadIP
from .detect import UnknownFormatError, create_reader, detect_compression, detect_format
from .readers import ReaderParseError
-try:
- from urllib.parse import urljoin
-except ImportError:
- # PY2 fallback
- from urlparse import urljoin # pylint: disable=ungrouped-imports
-
# TODO: check return values for deferred callbacks
# TODO: review class attributes for redundancy
diff --git a/deluge/plugins/Blocklist/deluge_blocklist/data/blocklist.js b/deluge/plugins/Blocklist/deluge_blocklist/data/blocklist.js
index 8e4769c..3c10b81 100644
--- a/deluge/plugins/Blocklist/deluge_blocklist/data/blocklist.js
+++ b/deluge/plugins/Blocklist/deluge_blocklist/data/blocklist.js
@@ -22,7 +22,7 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
border: false,
autoScroll: true,
- initComponent: function() {
+ initComponent: function () {
Deluge.ux.preferences.BlocklistPage.superclass.initComponent.call(this);
this.URLFset = this.add({
@@ -55,7 +55,7 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
});
this.checkListDays = this.SettingsFset.add({
- fieldLabel: _('Check for new list every:'),
+ fieldLabel: _('Check for new list every (days):'),
labelSeparator: '',
name: 'check_list_days',
value: 4,
@@ -210,11 +210,11 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
fields: [{ name: 'ip' }],
}),
listeners: {
- afteredit: function(e) {
+ afteredit: function (e) {
e.record.commit();
},
},
- setEmptyText: function(text) {
+ setEmptyText: function (text) {
if (this.viewReady) {
this.getView().emptyText = text;
this.getView().refresh();
@@ -222,7 +222,7 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
Ext.apply(this.viewConfig, { emptyText: text });
}
},
- loadData: function(data) {
+ loadData: function (data) {
this.getStore().loadData(data);
if (this.viewReady) {
this.getView().updateHeaders();
@@ -264,7 +264,7 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
this.forceDownload.setHandler(this.forceDown, this);
},
- onApply: function() {
+ onApply: function () {
var config = {};
config['url'] = this.URL.getValue();
@@ -285,13 +285,13 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
deluge.client.blocklist.set_config(config);
},
- onOk: function() {
+ onOk: function () {
this.onApply();
},
- onUpdate: function() {
+ onUpdate: function () {
deluge.client.blocklist.get_status({
- success: function(status) {
+ success: function (status) {
if (status['state'] == 'Downloading') {
this.InfoFset.hide();
this.checkDownload.getComponent(0).setDisabled(true);
@@ -339,19 +339,19 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
});
},
- checkDown: function() {
+ checkDown: function () {
this.onApply();
deluge.client.blocklist.check_import();
},
- forceDown: function() {
+ forceDown: function () {
this.onApply();
deluge.client.blocklist.check_import((force = true));
},
- updateConfig: function() {
+ updateConfig: function () {
deluge.client.blocklist.get_config({
- success: function(config) {
+ success: function (config) {
this.URL.setValue(config['url']);
this.checkListDays.setValue(config['check_after_days']);
this.chkImportOnStart.setValue(config['load_on_start']);
@@ -369,7 +369,7 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
});
deluge.client.blocklist.get_status({
- success: function(status) {
+ success: function (status) {
this.lblFileSize.setText(fsize(status['file_size']));
this.lblDate.setText(fdate(status['file_date']));
this.lblType.setText(status['file_type']);
@@ -381,7 +381,7 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
});
},
- addIP: function() {
+ addIP: function () {
var store = this.WhitelistFset.getComponent(0).getStore();
var IP = store.recordType;
var i = new IP({
@@ -392,7 +392,7 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
this.WhitelistFset.getComponent(0).startEditing(0, 0);
},
- deleteIP: function() {
+ deleteIP: function () {
var selections = this.WhitelistFset.getComponent(0)
.getSelectionModel()
.getSelections();
@@ -403,7 +403,7 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
store.commitChanges();
},
- onDestroy: function() {
+ onDestroy: function () {
Ext.TaskMgr.stop(this.updateTask);
deluge.preferences.un('show', this.updateConfig, this);
@@ -415,11 +415,11 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
Deluge.plugins.BlocklistPlugin = Ext.extend(Deluge.Plugin, {
name: 'Blocklist',
- onDisable: function() {
+ onDisable: function () {
deluge.preferences.removePage(this.prefsPage);
},
- onEnable: function() {
+ onEnable: function () {
this.prefsPage = deluge.preferences.addPage(
new Deluge.ux.preferences.BlocklistPage()
);
diff --git a/deluge/plugins/Blocklist/deluge_blocklist/data/blocklist_pref.ui b/deluge/plugins/Blocklist/deluge_blocklist/data/blocklist_pref.ui
index 013d8e7..8c1f7a7 100644
--- a/deluge/plugins/Blocklist/deluge_blocklist/data/blocklist_pref.ui
+++ b/deluge/plugins/Blocklist/deluge_blocklist/data/blocklist_pref.ui
@@ -53,8 +53,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
</object>
<packing>
<property name="expand">True</property>
@@ -124,8 +122,6 @@
<object class="GtkSpinButton" id="spin_check_days">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
<property name="adjustment">adjustment1</property>
</object>
<packing>
@@ -139,7 +135,7 @@
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Check for new list every:</property>
+ <property name="label" translatable="yes">Check for new list every (days):</property>
<property name="xalign">0</property>
</object>
<packing>
diff --git a/deluge/plugins/Blocklist/deluge_blocklist/data/blocklist_pref.ui~ b/deluge/plugins/Blocklist/deluge_blocklist/data/blocklist_pref.ui~
deleted file mode 100644
index e8b48c3..0000000
--- a/deluge/plugins/Blocklist/deluge_blocklist/data/blocklist_pref.ui~
+++ /dev/null
@@ -1,603 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
- <requires lib="gtk+" version="3.0"/>
- <!-- interface-naming-policy toplevel-contextual -->
- <object class="GtkAdjustment" id="adjustment1">
- <property name="lower">1</property>
- <property name="upper">100</property>
- <property name="value">1</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
- <object class="GtkWindow" id="window1">
- <property name="can_focus">False</property>
- <child>
- <object class="GtkVBox" id="blocklist_prefs_box">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">5</property>
- <child>
- <object class="GtkFrame" id="frame1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkAlignment" id="alignment1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="left_padding">12</property>
- <child>
- <object class="GtkHBox" id="hbox2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">5</property>
- <child>
- <object class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">URL:</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="entry_url">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
- <property name="primary_icon_sensitive">True</property>
- <property name="secondary_icon_sensitive">True</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="ypad">5</property>
- <property name="label" translatable="yes">&lt;b&gt;General&lt;/b&gt;</property>
- <property name="use_markup">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkFrame" id="frame2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkAlignment" id="alignment2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="left_padding">12</property>
- <child>
- <object class="GtkVBox" id="vbox1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">5</property>
- <child>
- <object class="GtkTable" id="table1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="n_columns">3</property>
- <property name="column_spacing">5</property>
- <property name="row_spacing">5</property>
- <child>
- <object class="GtkLabel" id="label8">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Days</property>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="spin_check_days">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
- <property name="primary_icon_sensitive">True</property>
- <property name="secondary_icon_sensitive">True</property>
- <property name="adjustment">adjustment1</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Check for new list every:</property>
- </object>
- <packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="chk_import_on_start">
- <property name="label" translatable="yes">Import blocklist on startup</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label10">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="ypad">5</property>
- <property name="label" translatable="yes">&lt;b&gt;Settings&lt;/b&gt;</property>
- <property name="use_markup">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkFrame" id="frame3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkAlignment" id="alignment3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="xscale">0</property>
- <property name="left_padding">12</property>
- <child>
- <object class="GtkHBox" id="hbox3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkVBox" id="vbox3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkButton" id="button_check_download">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Download the blocklist file if necessary and import the file.</property>
- <signal name="clicked" handler="on_button_check_download_clicked" swapped="no"/>
- <child>
- <object class="GtkHBox" id="hbox4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">5</property>
- <child>
- <object class="GtkImage" id="image_download">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-missing-image</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label12">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Check Download and Import</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button_force_download">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Download a new blocklist file and import it.</property>
- <signal name="clicked" handler="on_button_force_download_clicked" swapped="no"/>
- <child>
- <object class="GtkHBox" id="hbox5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">5</property>
- <child>
- <object class="GtkImage" id="image_import">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-missing-image</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label7">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Force Download and Import</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkImage" id="image_up_to_date">
- <property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes">Blocklist is up to date</property>
- <property name="yalign">0.15000000596046448</property>
- <property name="xpad">2</property>
- <property name="stock">gtk-yes</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label11">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="ypad">5</property>
- <property name="label" translatable="yes">&lt;b&gt;Options&lt;/b&gt;</property>
- <property name="use_markup">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkFrame" id="frame4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkAlignment" id="alignment4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="top_padding">5</property>
- <property name="left_padding">12</property>
- <child>
- <object class="GtkVBox" id="vbox4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkProgressBar" id="progressbar">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkTable" id="table_info">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="n_rows">4</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">5</property>
- <child>
- <object class="GtkLabel" id="label_url">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_type">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_modified">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_filesize">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label17">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">URL:</property>
- </object>
- <packing>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label16">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Type:</property>
- </object>
- <packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label15">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Date:</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label14">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">File Size:</property>
- </object>
- <packing>
- <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label13">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">&lt;b&gt;Info&lt;/b&gt;</property>
- <property name="use_markup">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkFrame" id="whitelist_frame">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkAlignment" id="alignment5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="left_padding">12</property>
- <child>
- <object class="GtkHBox" id="hbox1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkScrolledWindow" id="scrolledwindow1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">automatic</property>
- <property name="vscrollbar_policy">automatic</property>
- <child>
- <object class="GtkTreeView" id="whitelist_treeview">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="headers_visible">False</property>
- <property name="headers_clickable">False</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkVButtonBox" id="vbuttonbox1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="homogeneous">True</property>
- <property name="layout_style">start</property>
- <child>
- <object class="GtkButton" id="whitelist_add">
- <property name="label">gtk-add</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- <signal name="clicked" handler="on_whitelist_add_clicked" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="whitelist_delete">
- <property name="label">gtk-delete</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- <signal name="clicked" handler="on_whitelist_remove_clicked" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">&lt;b&gt;Whitelist&lt;/b&gt;</property>
- <property name="use_markup">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">4</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
-</interface>
diff --git a/deluge/plugins/Blocklist/deluge_blocklist/decompressers.py b/deluge/plugins/Blocklist/deluge_blocklist/decompressers.py
index 35211b7..cd2ee8c 100644
--- a/deluge/plugins/Blocklist/deluge_blocklist/decompressers.py
+++ b/deluge/plugins/Blocklist/deluge_blocklist/decompressers.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2010 John Garland <johnnybg+deluge@gmail.com>
#
@@ -8,8 +7,6 @@
#
# pylint: disable=redefined-builtin
-from __future__ import unicode_literals
-
import bz2
import gzip
import zipfile
diff --git a/deluge/plugins/Blocklist/deluge_blocklist/detect.py b/deluge/plugins/Blocklist/deluge_blocklist/detect.py
index 262d5de..43ad305 100644
--- a/deluge/plugins/Blocklist/deluge_blocklist/detect.py
+++ b/deluge/plugins/Blocklist/deluge_blocklist/detect.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2010 John Garland <johnnybg+deluge@gmail.com>
#
@@ -7,8 +6,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from .decompressers import BZipped2, GZipped, Zipped
from .readers import EmuleReader, PeerGuardianReader, SafePeerReader
diff --git a/deluge/plugins/Blocklist/deluge_blocklist/gtkui.py b/deluge/plugins/Blocklist/deluge_blocklist/gtkui.py
index b6e5d55..e6105cd 100644
--- a/deluge/plugins/Blocklist/deluge_blocklist/gtkui.py
+++ b/deluge/plugins/Blocklist/deluge_blocklist/gtkui.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2008 Andrew Resch <andrewresch@gmail.com>
#
@@ -7,14 +6,12 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from datetime import datetime
import gi # isort:skip (Required before Gtk import).
-gi.require_version('Gtk', '3.0') # NOQA: E402
+gi.require_version('Gtk', '3.0')
# isort:imports-thirdparty
from gi.repository import Gtk
diff --git a/deluge/plugins/Blocklist/deluge_blocklist/peerguardian.py b/deluge/plugins/Blocklist/deluge_blocklist/peerguardian.py
index ba410c2..b5fb181 100644
--- a/deluge/plugins/Blocklist/deluge_blocklist/peerguardian.py
+++ b/deluge/plugins/Blocklist/deluge_blocklist/peerguardian.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2007 Steve 'Tarka' Smith (tarka@internode.on.net)
#
@@ -7,8 +6,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import gzip
import logging
import socket
@@ -23,14 +20,14 @@ class PGException(Exception):
# Incrementally reads PeerGuardian blocklists v1 and v2.
# See http://wiki.phoenixlabs.org/wiki/P2B_Format
-class PGReader(object):
+class PGReader:
def __init__(self, filename):
log.debug('PGReader loading: %s', filename)
try:
with gzip.open(filename, 'rb') as _file:
self.fd = _file
- except IOError:
+ except OSError:
log.debug('Blocklist: PGReader: Incorrect file type or list is corrupt')
# 4 bytes, should be 0xffffffff
@@ -65,8 +62,5 @@ class PGReader(object):
return (start, end)
- # Python 2 compatibility
- next = __next__
-
def close(self):
self.fd.close()
diff --git a/deluge/plugins/Blocklist/deluge_blocklist/readers.py b/deluge/plugins/Blocklist/deluge_blocklist/readers.py
index 4079e84..14230ed 100644
--- a/deluge/plugins/Blocklist/deluge_blocklist/readers.py
+++ b/deluge/plugins/Blocklist/deluge_blocklist/readers.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2010 John Garland <johnnybg+deluge@gmail.com>
#
@@ -7,8 +6,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import re
@@ -23,7 +20,7 @@ class ReaderParseError(Exception):
pass
-class BaseReader(object):
+class BaseReader:
"""Base reader for blocklist files"""
def __init__(self, _file):
diff --git a/deluge/plugins/Blocklist/deluge_blocklist/webui.py b/deluge/plugins/Blocklist/deluge_blocklist/webui.py
index 3da43c4..b8a0ca2 100644
--- a/deluge/plugins/Blocklist/deluge_blocklist/webui.py
+++ b/deluge/plugins/Blocklist/deluge_blocklist/webui.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
#
@@ -7,8 +6,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge.plugins.pluginbase import WebPluginBase
diff --git a/deluge/plugins/Blocklist/setup.py b/deluge/plugins/Blocklist/setup.py
index 54ad002..2aa6834 100644
--- a/deluge/plugins/Blocklist/setup.py
+++ b/deluge/plugins/Blocklist/setup.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
#
diff --git a/deluge/plugins/Execute/deluge_execute/__init__.py b/deluge/plugins/Execute/deluge_execute/__init__.py
index c6d55f4..3edfc4b 100644
--- a/deluge/plugins/Execute/deluge_execute/__init__.py
+++ b/deluge/plugins/Execute/deluge_execute/__init__.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
#
@@ -7,8 +6,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.plugins.init import PluginInitBase
@@ -17,7 +14,7 @@ class CorePlugin(PluginInitBase):
from .core import Core as _pluginCls
self._plugin_cls = _pluginCls
- super(CorePlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
class GtkUIPlugin(PluginInitBase):
@@ -25,7 +22,7 @@ class GtkUIPlugin(PluginInitBase):
from .gtkui import GtkUI as _pluginCls
self._plugin_cls = _pluginCls
- super(GtkUIPlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
class WebUIPlugin(PluginInitBase):
@@ -33,4 +30,4 @@ class WebUIPlugin(PluginInitBase):
from .webui import WebUI as _pluginCls
self._plugin_cls = _pluginCls
- super(WebUIPlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
diff --git a/deluge/plugins/Execute/deluge_execute/common.py b/deluge/plugins/Execute/deluge_execute/common.py
index 4c9db09..eb47f13 100644
--- a/deluge/plugins/Execute/deluge_execute/common.py
+++ b/deluge/plugins/Execute/deluge_execute/common.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Basic plugin template created by:
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os.path
from pkg_resources import resource_filename
diff --git a/deluge/plugins/Execute/deluge_execute/core.py b/deluge/plugins/Execute/deluge_execute/core.py
index 9dcd97a..6d33e54 100644
--- a/deluge/plugins/Execute/deluge_execute/core.py
+++ b/deluge/plugins/Execute/deluge_execute/core.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
#
@@ -7,8 +6,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import hashlib
import logging
import os
@@ -135,7 +132,7 @@ class Core(CorePluginBase):
]
if windows_check():
# Escape ampersand on windows (see #2784)
- cmd_args = [cmd_arg.replace('&', '^^^&') for cmd_arg in cmd_args]
+ cmd_args = [cmd_arg.replace(b'&', b'^^^&') for cmd_arg in cmd_args]
if os.path.isfile(command) and os.access(command, os.X_OK):
log.debug('Running %s with args: %s', command, cmd_args)
diff --git a/deluge/plugins/Execute/deluge_execute/data/execute.js b/deluge/plugins/Execute/deluge_execute/data/execute.js
index bd6ac98..dc0b111 100644
--- a/deluge/plugins/Execute/deluge_execute/data/execute.js
+++ b/deluge/plugins/Execute/deluge_execute/data/execute.js
@@ -18,7 +18,7 @@ Deluge.ux.ExecuteWindowBase = Ext.extend(Ext.Window, {
height: 130,
closeAction: 'hide',
- initComponent: function() {
+ initComponent: function () {
Deluge.ux.ExecuteWindowBase.superclass.initComponent.call(this);
this.addButton(_('Cancel'), this.onCancelClick, this);
@@ -56,7 +56,7 @@ Deluge.ux.ExecuteWindowBase = Ext.extend(Ext.Window, {
});
},
- onCancelClick: function() {
+ onCancelClick: function () {
this.hide();
},
});
@@ -64,7 +64,7 @@ Deluge.ux.ExecuteWindowBase = Ext.extend(Ext.Window, {
Deluge.ux.EditExecuteCommandWindow = Ext.extend(Deluge.ux.ExecuteWindowBase, {
title: _('Edit Command'),
- initComponent: function() {
+ initComponent: function () {
Deluge.ux.EditExecuteCommandWindow.superclass.initComponent.call(this);
this.addButton(_('Save'), this.onSaveClick, this);
this.addEvents({
@@ -72,7 +72,7 @@ Deluge.ux.EditExecuteCommandWindow = Ext.extend(Deluge.ux.ExecuteWindowBase, {
});
},
- show: function(command) {
+ show: function (command) {
Deluge.ux.EditExecuteCommandWindow.superclass.show.call(this);
this.command = command;
this.form.getForm().setValues({
@@ -81,14 +81,14 @@ Deluge.ux.EditExecuteCommandWindow = Ext.extend(Deluge.ux.ExecuteWindowBase, {
});
},
- onSaveClick: function() {
+ onSaveClick: function () {
var values = this.form.getForm().getFieldValues();
deluge.client.execute.save_command(
this.command.id,
values.event,
values.command,
{
- success: function() {
+ success: function () {
this.fireEvent(
'commandedit',
this,
@@ -106,7 +106,7 @@ Deluge.ux.EditExecuteCommandWindow = Ext.extend(Deluge.ux.ExecuteWindowBase, {
Deluge.ux.AddExecuteCommandWindow = Ext.extend(Deluge.ux.ExecuteWindowBase, {
title: _('Add Command'),
- initComponent: function() {
+ initComponent: function () {
Deluge.ux.AddExecuteCommandWindow.superclass.initComponent.call(this);
this.addButton(_('Add'), this.onAddClick, this);
this.addEvents({
@@ -114,10 +114,10 @@ Deluge.ux.AddExecuteCommandWindow = Ext.extend(Deluge.ux.ExecuteWindowBase, {
});
},
- onAddClick: function() {
+ onAddClick: function () {
var values = this.form.getForm().getFieldValues();
deluge.client.execute.add_command(values.event, values.command, {
- success: function() {
+ success: function () {
this.fireEvent(
'commandadd',
this,
@@ -143,7 +143,7 @@ Deluge.ux.preferences.ExecutePage = Ext.extend(Ext.Panel, {
layout: 'fit',
border: false,
- initComponent: function() {
+ initComponent: function () {
Deluge.ux.preferences.ExecutePage.superclass.initComponent.call(this);
var event_map = (this.event_map = {
complete: _('Torrent Complete'),
@@ -166,7 +166,7 @@ Deluge.ux.preferences.ExecutePage = Ext.extend(Ext.Panel, {
sortable: true,
dataIndex: 'event',
tpl: new Ext.XTemplate('{[this.getEvent(values.event)]}', {
- getEvent: function(e) {
+ getEvent: function (e) {
return event_map[e] ? event_map[e] : e;
},
}),
@@ -215,21 +215,21 @@ Deluge.ux.preferences.ExecutePage = Ext.extend(Ext.Panel, {
this.on('show', this.onPreferencesShow, this);
},
- updateCommands: function() {
+ updateCommands: function () {
deluge.client.execute.get_commands({
- success: function(commands) {
+ success: function (commands) {
this.list.getStore().loadData(commands);
},
scope: this,
});
},
- onAddClick: function() {
+ onAddClick: function () {
if (!this.addWin) {
this.addWin = new Deluge.ux.AddExecuteCommandWindow();
this.addWin.on(
'commandadd',
- function() {
+ function () {
this.updateCommands();
},
this
@@ -238,19 +238,19 @@ Deluge.ux.preferences.ExecutePage = Ext.extend(Ext.Panel, {
this.addWin.show();
},
- onCommandAdded: function(win, evt, cmd) {
+ onCommandAdded: function (win, evt, cmd) {
var record = new this.list.getStore().recordType({
event: evt,
command: cmd,
});
},
- onEditClick: function() {
+ onEditClick: function () {
if (!this.editWin) {
this.editWin = new Deluge.ux.EditExecuteCommandWindow();
this.editWin.on(
'commandedit',
- function() {
+ function () {
this.updateCommands();
},
this
@@ -259,39 +259,27 @@ Deluge.ux.preferences.ExecutePage = Ext.extend(Ext.Panel, {
this.editWin.show(this.list.getSelectedRecords()[0]);
},
- onPreferencesShow: function() {
+ onPreferencesShow: function () {
this.updateCommands();
},
- onRemoveClick: function() {
+ onRemoveClick: function () {
var record = this.list.getSelectedRecords()[0];
deluge.client.execute.remove_command(record.id, {
- success: function() {
+ success: function () {
this.updateCommands();
},
scope: this,
});
},
- onSelectionChange: function(dv, selections) {
+ onSelectionChange: function (dv, selections) {
if (selections.length) {
- this.panel
- .getBottomToolbar()
- .items.get(1)
- .enable();
- this.panel
- .getBottomToolbar()
- .items.get(3)
- .enable();
+ this.panel.getBottomToolbar().items.get(1).enable();
+ this.panel.getBottomToolbar().items.get(3).enable();
} else {
- this.panel
- .getBottomToolbar()
- .items.get(1)
- .disable();
- this.panel
- .getBottomToolbar()
- .items.get(3)
- .disable();
+ this.panel.getBottomToolbar().items.get(1).disable();
+ this.panel.getBottomToolbar().items.get(3).disable();
}
},
});
@@ -299,11 +287,11 @@ Deluge.ux.preferences.ExecutePage = Ext.extend(Ext.Panel, {
Deluge.plugins.ExecutePlugin = Ext.extend(Deluge.Plugin, {
name: 'Execute',
- onDisable: function() {
+ onDisable: function () {
deluge.preferences.removePage(this.prefsPage);
},
- onEnable: function() {
+ onEnable: function () {
this.prefsPage = deluge.preferences.addPage(
new Deluge.ux.preferences.ExecutePage()
);
diff --git a/deluge/plugins/Execute/deluge_execute/data/execute_prefs.ui b/deluge/plugins/Execute/deluge_execute/data/execute_prefs.ui
index e2a5cd5..5d6354b 100644
--- a/deluge/plugins/Execute/deluge_execute/data/execute_prefs.ui
+++ b/deluge/plugins/Execute/deluge_execute/data/execute_prefs.ui
@@ -71,8 +71,6 @@
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
</object>
<packing>
<property name="left_attach">1</property>
diff --git a/deluge/plugins/Execute/deluge_execute/data/execute_prefs.ui~ b/deluge/plugins/Execute/deluge_execute/data/execute_prefs.ui~
deleted file mode 100644
index cd9b4d4..0000000
--- a/deluge/plugins/Execute/deluge_execute/data/execute_prefs.ui~
+++ /dev/null
@@ -1,190 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
- <requires lib="gtk+" version="3.0"/>
- <!-- interface-naming-policy project-wide -->
- <object class="GtkListStore" id="liststore1">
- <columns>
- <!-- column-name item text -->
- <column type="gchararray"/>
- </columns>
- </object>
- <object class="GtkWindow" id="execute_window">
- <property name="can_focus">False</property>
- <child>
- <object class="GtkVBox" id="execute_box">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkFrame" id="add_frame">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkAlignment" id="add_alignment">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="top_padding">5</property>
- <property name="left_padding">12</property>
- <child>
- <object class="GtkTable" id="add_table">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="n_rows">3</property>
- <property name="n_columns">2</property>
- <child>
- <object class="GtkLabel" id="event_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Event</property>
- </object>
- <packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
- <property name="x_padding">5</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="command_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Command</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
- <property name="x_padding">5</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="command_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
- <property name="primary_icon_sensitive">True</property>
- <property name="secondary_icon_sensitive">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="event_combobox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="model">liststore1</property>
- <child>
- <object class="GtkCellRendererText" id="cellrenderertext1"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
- <object class="GtkHButtonBox" id="hbuttonbox1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="button_add">
- <property name="label">gtk-add</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- <signal name="clicked" handler="on_add_button_clicked" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="add_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">&lt;b&gt;Add Command&lt;/b&gt;</property>
- <property name="use_markup">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkFrame" id="commands_frame">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkAlignment" id="commands_alignment">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="top_padding">5</property>
- <property name="left_padding">12</property>
- <child>
- <object class="GtkVBox" id="commands_vbox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <child>
- <placeholder/>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="commands_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">&lt;b&gt;Commands&lt;/b&gt;</property>
- <property name="use_markup">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
-</interface>
diff --git a/deluge/plugins/Execute/deluge_execute/gtkui.py b/deluge/plugins/Execute/deluge_execute/gtkui.py
index c0c7200..f56a6de 100644
--- a/deluge/plugins/Execute/deluge_execute/gtkui.py
+++ b/deluge/plugins/Execute/deluge_execute/gtkui.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
#
@@ -7,13 +6,11 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import gi # isort:skip (Required before Gtk import).
-gi.require_version('Gtk', '3.0') # NOQA: E402
+gi.require_version('Gtk', '3.0')
# isort:imports-thirdparty
from gi.repository import Gtk
@@ -41,7 +38,7 @@ EVENT_MAP = {
EVENTS = ['complete', 'added', 'removed']
-class ExecutePreferences(object):
+class ExecutePreferences:
def __init__(self, plugin):
self.plugin = plugin
diff --git a/deluge/plugins/Execute/deluge_execute/webui.py b/deluge/plugins/Execute/deluge_execute/webui.py
index 8327001..26a4445 100644
--- a/deluge/plugins/Execute/deluge_execute/webui.py
+++ b/deluge/plugins/Execute/deluge_execute/webui.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
#
@@ -7,8 +6,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge.plugins.pluginbase import WebPluginBase
diff --git a/deluge/plugins/Execute/setup.py b/deluge/plugins/Execute/setup.py
index 174d1a3..b65c1bd 100644
--- a/deluge/plugins/Execute/setup.py
+++ b/deluge/plugins/Execute/setup.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
#
diff --git a/deluge/plugins/Extractor/deluge_extractor/__init__.py b/deluge/plugins/Extractor/deluge_extractor/__init__.py
index 6db72b6..87d1584 100644
--- a/deluge/plugins/Extractor/deluge_extractor/__init__.py
+++ b/deluge/plugins/Extractor/deluge_extractor/__init__.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
#
@@ -11,8 +10,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.plugins.init import PluginInitBase
@@ -21,7 +18,7 @@ class CorePlugin(PluginInitBase):
from .core import Core as _pluginCls
self._plugin_cls = _pluginCls
- super(CorePlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
class GtkUIPlugin(PluginInitBase):
@@ -29,7 +26,7 @@ class GtkUIPlugin(PluginInitBase):
from .gtkui import GtkUI as _pluginCls
self._plugin_cls = _pluginCls
- super(GtkUIPlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
class WebUIPlugin(PluginInitBase):
@@ -37,4 +34,4 @@ class WebUIPlugin(PluginInitBase):
from .webui import WebUI as _pluginCls
self._plugin_cls = _pluginCls
- super(WebUIPlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
diff --git a/deluge/plugins/Extractor/deluge_extractor/common.py b/deluge/plugins/Extractor/deluge_extractor/common.py
index 4c9db09..eb47f13 100644
--- a/deluge/plugins/Extractor/deluge_extractor/common.py
+++ b/deluge/plugins/Extractor/deluge_extractor/common.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Basic plugin template created by:
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os.path
from pkg_resources import resource_filename
diff --git a/deluge/plugins/Extractor/deluge_extractor/core.py b/deluge/plugins/Extractor/deluge_extractor/core.py
index 8fa5bd3..23b2a00 100644
--- a/deluge/plugins/Extractor/deluge_extractor/core.py
+++ b/deluge/plugins/Extractor/deluge_extractor/core.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
#
@@ -11,8 +10,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import errno
import logging
import os
@@ -37,14 +34,11 @@ if windows_check():
'C:\\Program Files (x86)\\7-Zip\\7z.exe',
]
- try:
- import winreg
- except ImportError:
- import _winreg as winreg # For Python 2.
+ import winreg
try:
hkey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, 'Software\\7-Zip')
- except WindowsError:
+ except OSError:
pass
else:
win_7z_path = os.path.join(winreg.QueryValueEx(hkey, 'Path')[0], '7z.exe')
diff --git a/deluge/plugins/Extractor/deluge_extractor/data/extractor.js b/deluge/plugins/Extractor/deluge_extractor/data/extractor.js
index b11cb30..952b645 100644
--- a/deluge/plugins/Extractor/deluge_extractor/data/extractor.js
+++ b/deluge/plugins/Extractor/deluge_extractor/data/extractor.js
@@ -21,7 +21,7 @@ Deluge.ux.preferences.ExtractorPage = Ext.extend(Ext.Panel, {
layout: 'fit',
border: false,
- initComponent: function() {
+ initComponent: function () {
Deluge.ux.preferences.ExtractorPage.superclass.initComponent.call(this);
this.form = this.add({
@@ -59,7 +59,7 @@ Deluge.ux.preferences.ExtractorPage = Ext.extend(Ext.Panel, {
this.on('show', this.updateConfig, this);
},
- onApply: function() {
+ onApply: function () {
// build settings object
var config = {};
@@ -69,13 +69,13 @@ Deluge.ux.preferences.ExtractorPage = Ext.extend(Ext.Panel, {
deluge.client.extractor.set_config(config);
},
- onOk: function() {
+ onOk: function () {
this.onApply();
},
- updateConfig: function() {
+ updateConfig: function () {
deluge.client.extractor.get_config({
- success: function(config) {
+ success: function (config) {
this.extract_path.setValue(config['extract_path']);
this.use_name_folder.setValue(config['use_name_folder']);
},
@@ -87,11 +87,11 @@ Deluge.ux.preferences.ExtractorPage = Ext.extend(Ext.Panel, {
Deluge.plugins.ExtractorPlugin = Ext.extend(Deluge.Plugin, {
name: 'Extractor',
- onDisable: function() {
+ onDisable: function () {
deluge.preferences.removePage(this.prefsPage);
},
- onEnable: function() {
+ onEnable: function () {
this.prefsPage = deluge.preferences.addPage(
new Deluge.ux.preferences.ExtractorPage()
);
diff --git a/deluge/plugins/Extractor/deluge_extractor/data/extractor_prefs.ui b/deluge/plugins/Extractor/deluge_extractor/data/extractor_prefs.ui
index 6f34b44..9e8070b 100644
--- a/deluge/plugins/Extractor/deluge_extractor/data/extractor_prefs.ui
+++ b/deluge/plugins/Extractor/deluge_extractor/data/extractor_prefs.ui
@@ -62,8 +62,6 @@
<child>
<object class="GtkEntry" id="entry_path">
<property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
</object>
<packing>
<property name="expand">True</property>
diff --git a/deluge/plugins/Extractor/deluge_extractor/data/extractor_prefs.ui~ b/deluge/plugins/Extractor/deluge_extractor/data/extractor_prefs.ui~
deleted file mode 100644
index 040e3d0..0000000
--- a/deluge/plugins/Extractor/deluge_extractor/data/extractor_prefs.ui~
+++ /dev/null
@@ -1,120 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
- <requires lib="gtk+" version="3.0"/>
- <!-- interface-naming-policy toplevel-contextual -->
- <object class="GtkWindow" id="window1">
- <property name="can_focus">False</property>
- <child>
- <object class="GtkVBox" id="extractor_prefs_box">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">5</property>
- <child>
- <object class="GtkFrame" id="frame1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkVBox" id="vbox1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="spacing">5</property>
- <child>
- <object class="GtkHBox" id="hbox1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">5</property>
- <child>
- <object class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Extract to:</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkFileChooserButton" id="folderchooser_path">
- <property name="can_focus">False</property>
- <property name="action">select-folder</property>
- <property name="title" translatable="yes">Select A Folder</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="entry_path">
- <property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
- <property name="primary_icon_sensitive">True</property>
- <property name="secondary_icon_sensitive">True</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="chk_use_name">
- <property name="label" translatable="yes">Create torrent name sub-folder</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">This option will create a sub-folder using the torrent's name within the selected extract folder and put the extracted files there.</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">&lt;b&gt;General&lt;/b&gt;</property>
- <property name="use_markup">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
-</interface>
diff --git a/deluge/plugins/Extractor/deluge_extractor/gtkui.py b/deluge/plugins/Extractor/deluge_extractor/gtkui.py
index 113b33f..a754a5f 100644
--- a/deluge/plugins/Extractor/deluge_extractor/gtkui.py
+++ b/deluge/plugins/Extractor/deluge_extractor/gtkui.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
#
@@ -11,13 +10,11 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import gi # isort:skip (Required before Gtk import).
-gi.require_version('Gtk', '3.0') # NOQA: E402
+gi.require_version('Gtk', '3.0')
# isort:imports-thirdparty
from gi.repository import Gtk
diff --git a/deluge/plugins/Extractor/deluge_extractor/webui.py b/deluge/plugins/Extractor/deluge_extractor/webui.py
index feb7b4a..715733c 100644
--- a/deluge/plugins/Extractor/deluge_extractor/webui.py
+++ b/deluge/plugins/Extractor/deluge_extractor/webui.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
#
@@ -11,8 +10,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge.plugins.pluginbase import WebPluginBase
diff --git a/deluge/plugins/Extractor/setup.py b/deluge/plugins/Extractor/setup.py
index 25ab153..09385c6 100644
--- a/deluge/plugins/Extractor/setup.py
+++ b/deluge/plugins/Extractor/setup.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
#
diff --git a/deluge/plugins/Label/deluge_label/__init__.py b/deluge/plugins/Label/deluge_label/__init__.py
index bc0b0f2..a6c72f8 100644
--- a/deluge/plugins/Label/deluge_label/__init__.py
+++ b/deluge/plugins/Label/deluge_label/__init__.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
#
@@ -11,8 +10,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.plugins.init import PluginInitBase
@@ -21,7 +18,7 @@ class CorePlugin(PluginInitBase):
from .core import Core as _pluginCls
self._plugin_cls = _pluginCls
- super(CorePlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
class GtkUIPlugin(PluginInitBase):
@@ -29,7 +26,7 @@ class GtkUIPlugin(PluginInitBase):
from .gtkui import GtkUI as _pluginCls
self._plugin_cls = _pluginCls
- super(GtkUIPlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
class WebUIPlugin(PluginInitBase):
@@ -37,4 +34,4 @@ class WebUIPlugin(PluginInitBase):
from .webui import WebUI as _pluginCls
self._plugin_cls = _pluginCls
- super(WebUIPlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
diff --git a/deluge/plugins/Label/deluge_label/common.py b/deluge/plugins/Label/deluge_label/common.py
index 4c9db09..eb47f13 100644
--- a/deluge/plugins/Label/deluge_label/common.py
+++ b/deluge/plugins/Label/deluge_label/common.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Basic plugin template created by:
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os.path
from pkg_resources import resource_filename
diff --git a/deluge/plugins/Label/deluge_label/core.py b/deluge/plugins/Label/deluge_label/core.py
index b16156c..a91275f 100644
--- a/deluge/plugins/Label/deluge_label/core.py
+++ b/deluge/plugins/Label/deluge_label/core.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
#
@@ -15,8 +14,6 @@
torrent-label core plugin.
adds a status field for tracker.
"""
-from __future__ import unicode_literals
-
import logging
import re
diff --git a/deluge/plugins/Label/deluge_label/data/label.js b/deluge/plugins/Label/deluge_label/data/label.js
index cb0c1fe..a0327e3 100644
--- a/deluge/plugins/Label/deluge_label/data/label.js
+++ b/deluge/plugins/Label/deluge_label/data/label.js
@@ -20,7 +20,7 @@ Deluge.ux.preferences.LabelPage = Ext.extend(Ext.Panel, {
layout: 'fit',
border: false,
- initComponent: function() {
+ initComponent: function () {
Deluge.ux.preferences.LabelPage.superclass.initComponent.call(this);
fieldset = this.add({
xtype: 'fieldset',
@@ -54,8 +54,9 @@ Deluge.ux.AddLabelWindow = Ext.extend(Ext.Window, {
title: _('Add Label'),
width: 300,
height: 100,
+ closeAction: 'hide',
- initComponent: function() {
+ initComponent: function () {
Deluge.ux.AddLabelWindow.superclass.initComponent.call(this);
this.addButton(_('Cancel'), this.onCancelClick, this);
this.addButton(_('Ok'), this.onOkClick, this);
@@ -75,7 +76,7 @@ Deluge.ux.AddLabelWindow = Ext.extend(Ext.Window, {
width: 220,
listeners: {
specialkey: {
- fn: function(field, e) {
+ fn: function (field, e) {
if (e.getKey() == 13) this.onOkClick();
},
scope: this,
@@ -86,14 +87,14 @@ Deluge.ux.AddLabelWindow = Ext.extend(Ext.Window, {
});
},
- onCancelClick: function() {
+ onCancelClick: function () {
this.hide();
},
- onOkClick: function() {
+ onOkClick: function () {
var label = this.form.getForm().getValues().name;
deluge.client.label.add(label, {
- success: function() {
+ success: function () {
deluge.ui.update();
this.fireEvent('labeladded', label);
},
@@ -102,17 +103,14 @@ Deluge.ux.AddLabelWindow = Ext.extend(Ext.Window, {
this.hide();
},
- onHide: function(comp) {
+ onHide: function (comp) {
Deluge.ux.AddLabelWindow.superclass.onHide.call(this, comp);
this.form.getForm().reset();
},
- onShow: function(comp) {
+ onShow: function (comp) {
Deluge.ux.AddLabelWindow.superclass.onShow.call(this, comp);
- this.form
- .getForm()
- .findField('name')
- .focus(false, 150);
+ this.form.getForm().findField('name').focus(false, 150);
},
});
@@ -124,8 +122,9 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
title: _('Label Options'),
width: 325,
height: 240,
+ closeAction: 'hide',
- initComponent: function() {
+ initComponent: function () {
Deluge.ux.LabelOptionsWindow.superclass.initComponent.call(this);
this.addButton(_('Cancel'), this.onCancelClick, this);
this.addButton(_('Ok'), this.onOkClick, this);
@@ -149,8 +148,7 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
xtype: 'fieldset',
border: false,
labelWidth: 1,
- style:
- 'margin-bottom: 0px; padding-bottom: 0px;',
+ style: 'margin-bottom: 0px; padding-bottom: 0px;',
items: [
{
xtype: 'checkbox',
@@ -219,8 +217,7 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
xtype: 'fieldset',
border: false,
labelWidth: 1,
- style:
- 'margin-bottom: 0px; padding-bottom: 0px;',
+ style: 'margin-bottom: 0px; padding-bottom: 0px;',
items: [
{
xtype: 'checkbox',
@@ -261,8 +258,7 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
width: 60,
decimalPrecision: 2,
incrementValue: 0.1,
- style:
- 'position: relative; left: 100px',
+ style: 'position: relative; left: 100px',
disabled: true,
},
{
@@ -286,8 +282,7 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
xtype: 'fieldset',
border: false,
labelWidth: 1,
- style:
- 'margin-bottom: 0px; padding-bottom: 0px;',
+ style: 'margin-bottom: 0px; padding-bottom: 0px;',
items: [
{
xtype: 'checkbox',
@@ -340,8 +335,7 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
xtype: 'fieldset',
border: false,
labelWidth: 1,
- style:
- 'margin-bottom: 0px; padding-bottom: 0px;',
+ style: 'margin-bottom: 0px; padding-bottom: 0px;',
items: [
{
xtype: 'checkbox',
@@ -383,18 +377,18 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
});
},
- getLabelOptions: function() {
+ getLabelOptions: function () {
deluge.client.label.get_options(this.label, {
success: this.gotOptions,
scope: this,
});
},
- gotOptions: function(options) {
+ gotOptions: function (options) {
this.form.getForm().setValues(options);
},
- show: function(label) {
+ show: function (label) {
Deluge.ux.LabelOptionsWindow.superclass.show.call(this);
this.label = label;
this.setTitle(_('Label Options') + ': ' + this.label);
@@ -402,24 +396,23 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
this.getLabelOptions();
},
- onCancelClick: function() {
+ onCancelClick: function () {
this.hide();
},
- onOkClick: function() {
+ onOkClick: function () {
var values = this.form.getForm().getFieldValues();
if (values['auto_add_trackers']) {
- values['auto_add_trackers'] = values['auto_add_trackers'].split(
- '\n'
- );
+ values['auto_add_trackers'] =
+ values['auto_add_trackers'].split('\n');
}
deluge.client.label.set_options(this.label, values);
this.hide();
},
- onFieldChecked: function(field, checked) {
+ onFieldChecked: function (field, checked) {
var fs = field.ownerCt.nextSibling();
- fs.items.each(function(field) {
+ fs.items.each(function (field) {
field.setDisabled(!checked);
});
},
@@ -434,7 +427,7 @@ Ext.ns('Deluge.plugins');
Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
name: 'Label',
- createMenu: function() {
+ createMenu: function () {
this.labelMenu = new Ext.menu.Menu({
items: [
{
@@ -460,7 +453,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
});
},
- setFilter: function(filter) {
+ setFilter: function (filter) {
filter.show_zero = true;
filter.list.on('contextmenu', this.onLabelContextMenu, this);
@@ -468,7 +461,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
this.filter = filter;
},
- updateTorrentMenu: function(states) {
+ updateTorrentMenu: function (states) {
this.torrentMenu.removeAll(true);
this.torrentMenu.addMenuItem({
text: _('No Label'),
@@ -487,7 +480,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
}
},
- onDisable: function() {
+ onDisable: function () {
deluge.sidebar.un('filtercreate', this.onFilterCreate);
deluge.sidebar.un('afterfiltercreate', this.onAfterFilterCreate);
delete Deluge.FilterPanel.templates.label;
@@ -497,7 +490,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
deluge.preferences.removePage(this.prefsPage);
},
- onEnable: function() {
+ onEnable: function () {
this.prefsPage = deluge.preferences.addPage(
new Deluge.ux.preferences.LabelPage()
);
@@ -537,17 +530,17 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
this.registerTorrentStatus('label', _('Label'));
},
- onAfterFilterCreate: function(sidebar, filter) {
+ onAfterFilterCreate: function (sidebar, filter) {
if (filter.filter != 'label') return;
this.updateTorrentMenu(filter.getStates());
},
- onFilterCreate: function(sidebar, filter) {
+ onFilterCreate: function (sidebar, filter) {
if (filter.filter != 'label') return;
this.setFilter(filter);
},
- onLabelAddClick: function() {
+ onLabelAddClick: function () {
if (!this.addWindow) {
this.addWindow = new Deluge.ux.AddLabelWindow();
this.addWindow.on('labeladded', this.onLabelAdded, this);
@@ -555,7 +548,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
this.addWindow.show();
},
- onLabelAdded: function(label) {
+ onLabelAdded: function (label) {
var filter = deluge.sidebar.getFilter('label');
var states = filter.getStates();
var statesArray = [];
@@ -580,7 +573,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
this.updateTorrentMenu(states);
},
- onLabelContextMenu: function(dv, i, node, e) {
+ onLabelContextMenu: function (dv, i, node, e) {
e.preventDefault();
if (!this.labelMenu) this.createMenu();
var r = dv.getRecord(node).get('filter');
@@ -595,7 +588,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
this.labelMenu.showAt(e.getXY());
},
- onLabelHeaderContextMenu: function(e, t) {
+ onLabelHeaderContextMenu: function (e, t) {
e.preventDefault();
if (!this.labelMenu) this.createMenu();
this.labelMenu.items.get(1).setDisabled(true);
@@ -603,18 +596,18 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
this.labelMenu.showAt(e.getXY());
},
- onLabelOptionsClick: function() {
+ onLabelOptionsClick: function () {
if (!this.labelOpts)
this.labelOpts = new Deluge.ux.LabelOptionsWindow();
this.labelOpts.show(this.filter.getState());
},
- onLabelRemoveClick: function() {
+ onLabelRemoveClick: function () {
var state = this.filter.getState();
deluge.client.label.remove(state, {
- success: function() {
+ success: function () {
deluge.ui.update();
- this.torrentMenu.items.each(function(item) {
+ this.torrentMenu.items.each(function (item) {
if (item.text != state) return;
this.torrentMenu.remove(item);
var i = item;
@@ -624,12 +617,12 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
});
},
- onTorrentMenuClick: function(item, e) {
+ onTorrentMenuClick: function (item, e) {
var ids = deluge.torrents.getSelectedIds();
- Ext.each(ids, function(id, i) {
+ Ext.each(ids, function (id, i) {
if (ids.length == i + 1) {
deluge.client.label.set_torrent(id, item.label, {
- success: function() {
+ success: function () {
deluge.ui.update();
},
});
diff --git a/deluge/plugins/Label/deluge_label/data/label_add.ui b/deluge/plugins/Label/deluge_label/data/label_add.ui
index 68f8a72..e550675 100644
--- a/deluge/plugins/Label/deluge_label/data/label_add.ui
+++ b/deluge/plugins/Label/deluge_label/data/label_add.ui
@@ -141,8 +141,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activates_default">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
</object>
<packing>
<property name="expand">True</property>
diff --git a/deluge/plugins/Label/deluge_label/data/label_options.ui b/deluge/plugins/Label/deluge_label/data/label_options.ui
index c0fca4f..d390865 100644
--- a/deluge/plugins/Label/deluge_label/data/label_options.ui
+++ b/deluge/plugins/Label/deluge_label/data/label_options.ui
@@ -209,8 +209,6 @@
<object class="GtkSpinButton" id="max_upload_speed">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
<property name="adjustment">adjustment1</property>
</object>
<packing>
@@ -239,8 +237,6 @@
<object class="GtkSpinButton" id="max_download_speed">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
<property name="adjustment">adjustment2</property>
</object>
<packing>
@@ -310,8 +306,6 @@
<object class="GtkSpinButton" id="max_upload_slots">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
<property name="adjustment">adjustment3</property>
<property name="numeric">True</property>
</object>
@@ -342,8 +336,6 @@
<object class="GtkSpinButton" id="max_connections">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
<property name="adjustment">adjustment4</property>
<property name="numeric">True</property>
</object>
@@ -483,8 +475,6 @@
<object class="GtkSpinButton" id="stop_ratio">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
<property name="adjustment">adjustment5</property>
<property name="digits">2</property>
</object>
@@ -599,8 +589,6 @@
<child>
<object class="GtkEntry" id="move_completed_path_entry">
<property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
</object>
<packing>
<property name="left_attach">1</property>
diff --git a/deluge/plugins/Label/deluge_label/gtkui/__init__.py b/deluge/plugins/Label/deluge_label/gtkui/__init__.py
index eeaeadc..6170716 100644
--- a/deluge/plugins/Label/deluge_label/gtkui/__init__.py
+++ b/deluge/plugins/Label/deluge_label/gtkui/__init__.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
#
@@ -7,8 +6,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge import component # for systray
diff --git a/deluge/plugins/Label/deluge_label/gtkui/label_config.py b/deluge/plugins/Label/deluge_label/gtkui/label_config.py
index b1bf56d..26c827e 100644
--- a/deluge/plugins/Label/deluge_label/gtkui/label_config.py
+++ b/deluge/plugins/Label/deluge_label/gtkui/label_config.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
#
@@ -7,8 +6,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from gi.repository.Gtk import Builder
@@ -20,7 +17,7 @@ from ..common import get_resource
log = logging.getLogger(__name__)
-class LabelConfig(object):
+class LabelConfig:
"""
there used to be some options here...
"""
diff --git a/deluge/plugins/Label/deluge_label/gtkui/sidebar_menu.py b/deluge/plugins/Label/deluge_label/gtkui/sidebar_menu.py
index 34358db..da18302 100644
--- a/deluge/plugins/Label/deluge_label/gtkui/sidebar_menu.py
+++ b/deluge/plugins/Label/deluge_label/gtkui/sidebar_menu.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
@@ -8,13 +7,11 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import gi # isort:skip (Required before Gtk import).
-gi.require_version('Gtk', '3.0') # NOQA: E402
+gi.require_version('Gtk', '3.0')
# isort:imports-thirdparty
from gi.repository import Gtk
@@ -32,7 +29,7 @@ NO_LABEL = 'No Label'
# menu
-class LabelSidebarMenu(object):
+class LabelSidebarMenu:
def __init__(self):
self.treeview = component.get('FilterTreeView')
@@ -90,7 +87,7 @@ class LabelSidebarMenu(object):
for item in self.items:
item.set_sensitive(sensitive)
- # add is allways enabled.
+ # add is always enabled.
self.item_add.set_sensitive(True)
else:
# not a label -->hide everything.
@@ -107,7 +104,7 @@ class LabelSidebarMenu(object):
# dialogs:
-class AddDialog(object):
+class AddDialog:
def __init__(self):
pass
@@ -129,7 +126,7 @@ class AddDialog(object):
self.dialog.destroy()
-class OptionsDialog(object):
+class OptionsDialog:
spin_ids = ['max_download_speed', 'max_upload_speed', 'stop_ratio']
spin_int_ids = ['max_upload_slots', 'max_connections']
chk_ids = [
@@ -174,7 +171,7 @@ class OptionsDialog(object):
self.builder.connect_signals(self)
# Show the label name in the header label
self.builder.get_object('label_header').set_markup(
- '<b>%s:</b> %s' % (_('Label Options'), self.label)
+ '<b>{}:</b> {}'.format(_('Label Options'), self.label)
)
for chk_id, group in self.sensitive_groups:
diff --git a/deluge/plugins/Label/deluge_label/gtkui/submenu.py b/deluge/plugins/Label/deluge_label/gtkui/submenu.py
index c5f80e7..ba9324b 100644
--- a/deluge/plugins/Label/deluge_label/gtkui/submenu.py
+++ b/deluge/plugins/Label/deluge_label/gtkui/submenu.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
#
@@ -8,8 +7,6 @@
#
-from __future__ import unicode_literals
-
import logging
from gi.repository.Gtk import Menu, MenuItem
diff --git a/deluge/plugins/Label/deluge_label/test.py b/deluge/plugins/Label/deluge_label/test.py
index 5c9ffcd..739bae4 100644
--- a/deluge/plugins/Label/deluge_label/test.py
+++ b/deluge/plugins/Label/deluge_label/test.py
@@ -1,5 +1,4 @@
#!/usr/bin/env python
-# -*- coding: utf-8 -*-
#
# -*- coding: utf-8 -*-
#
@@ -10,8 +9,6 @@
# See LICENSE for more details.
#
-from __future__ import print_function, unicode_literals
-
from deluge.ui.client import sclient
sclient.set_core_uri()
diff --git a/deluge/plugins/Label/deluge_label/webui.py b/deluge/plugins/Label/deluge_label/webui.py
index 58c38e9..9ccfa92 100644
--- a/deluge/plugins/Label/deluge_label/webui.py
+++ b/deluge/plugins/Label/deluge_label/webui.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
#
@@ -11,8 +10,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge.plugins.pluginbase import WebPluginBase
diff --git a/deluge/plugins/Label/setup.py b/deluge/plugins/Label/setup.py
index 567335b..f8f2c5d 100644
--- a/deluge/plugins/Label/setup.py
+++ b/deluge/plugins/Label/setup.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
#
diff --git a/deluge/plugins/Notifications/deluge_notifications/__init__.py b/deluge/plugins/Notifications/deluge_notifications/__init__.py
index 810e284..d52b48d 100644
--- a/deluge/plugins/Notifications/deluge_notifications/__init__.py
+++ b/deluge/plugins/Notifications/deluge_notifications/__init__.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2010 Pedro Algarvio <pedro@algarvio.me>
#
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.plugins.init import PluginInitBase
@@ -22,7 +19,7 @@ class CorePlugin(PluginInitBase):
from .core import Core as _pluginCls
self._plugin_cls = _pluginCls
- super(CorePlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
class GtkUIPlugin(PluginInitBase):
@@ -30,7 +27,7 @@ class GtkUIPlugin(PluginInitBase):
from .gtkui import GtkUI as _pluginCls
self._plugin_cls = _pluginCls
- super(GtkUIPlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
class WebUIPlugin(PluginInitBase):
@@ -38,4 +35,4 @@ class WebUIPlugin(PluginInitBase):
from .webui import WebUI as _pluginCls
self._plugin_cls = _pluginCls
- super(WebUIPlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
diff --git a/deluge/plugins/Notifications/deluge_notifications/common.py b/deluge/plugins/Notifications/deluge_notifications/common.py
index 6966122..9993f5c 100644
--- a/deluge/plugins/Notifications/deluge_notifications/common.py
+++ b/deluge/plugins/Notifications/deluge_notifications/common.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2010 Pedro Algarvio <pedro@algarvio.me>
#
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os.path
@@ -30,7 +27,7 @@ def get_resource(filename):
return resource_filename(__package__, os.path.join('data', filename))
-class CustomNotifications(object):
+class CustomNotifications:
def __init__(self, plugin_name=None):
self.custom_notifications = {'email': {}, 'popup': {}, 'blink': {}, 'sound': {}}
diff --git a/deluge/plugins/Notifications/deluge_notifications/core.py b/deluge/plugins/Notifications/deluge_notifications/core.py
index 123f9cf..aa200f9 100644
--- a/deluge/plugins/Notifications/deluge_notifications/core.py
+++ b/deluge/plugins/Notifications/deluge_notifications/core.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2010 Pedro Algarvio <pedro@algarvio.me>
#
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import smtplib
from email.utils import formatdate
@@ -119,7 +116,6 @@ Date: %(date)s
message = '\r\n'.join((headers + message).splitlines())
try:
- # Python 2.6
server = smtplib.SMTP(
self.config['smtp_host'], self.config['smtp_port'], timeout=60
)
@@ -152,7 +148,7 @@ Date: %(date)s
try:
try:
- server.sendmail(self.config['smtp_from'], to_addrs, message)
+ server.sendmail(self.config['smtp_from'], to_addrs, message.encode())
except smtplib.SMTPException as ex:
err_msg = (
_('There was an error sending the notification email: %s') % ex
@@ -176,7 +172,7 @@ Date: %(date)s
def _on_torrent_finished_event(self, torrent_id):
log.debug('Handler for TorrentFinishedEvent called for CORE')
torrent = component.get('TorrentManager')[torrent_id]
- torrent_status = torrent.get_status({})
+ torrent_status = torrent.get_status(['name', 'num_files'])
# Email
subject = _('Finished Torrent "%(name)s"') % torrent_status
message = (
diff --git a/deluge/plugins/Notifications/deluge_notifications/data/config.ui b/deluge/plugins/Notifications/deluge_notifications/data/config.ui
index c16b37a..399cc9e 100644
--- a/deluge/plugins/Notifications/deluge_notifications/data/config.ui
+++ b/deluge/plugins/Notifications/deluge_notifications/data/config.ui
@@ -187,8 +187,6 @@
<object class="GtkEntry" id="smtp_host">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -217,8 +215,6 @@
<property name="can_focus">True</property>
<property name="max_length">5</property>
<property name="width_chars">5</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
<property name="adjustment">adjustment1</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
@@ -246,8 +242,6 @@
<object class="GtkEntry" id="smtp_user">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -273,8 +267,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="visibility">False</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -427,8 +419,6 @@
<object class="GtkEntry" id="smtp_from">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
</object>
<packing>
<property name="left_attach">1</property>
diff --git a/deluge/plugins/Notifications/deluge_notifications/data/config.ui~ b/deluge/plugins/Notifications/deluge_notifications/data/config.ui~
deleted file mode 100644
index f26275b..0000000
--- a/deluge/plugins/Notifications/deluge_notifications/data/config.ui~
+++ /dev/null
@@ -1,643 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.0 -->
-<interface>
- <requires lib="gtk+" version="3.0"/>
- <object class="GtkAdjustment" id="adjustment1">
- <property name="lower">1</property>
- <property name="upper">65535</property>
- <property name="value">25</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
- <object class="GtkWindow" id="window">
- <property name="can_focus">False</property>
- <child>
- <object class="GtkVBox" id="prefs_box">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkViewport" id="viewport1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="resize_mode">queue</property>
- <child>
- <object class="GtkNotebook" id="notebook1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="show_border">False</property>
- <child>
- <object class="GtkVBox" id="vbox2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="valign">start</property>
- <child>
- <object class="GtkFrame" id="frame2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="valign">start</property>
- <property name="margin_left">9</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkAlignment" id="alignment2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="left_padding">12</property>
- <property name="right_padding">10</property>
- <child>
- <object class="GtkVBox" id="vbox1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkCheckButton" id="blink_enabled">
- <property name="label" translatable="yes">Tray icon blinks enabled</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="popup_enabled">
- <property name="label" translatable="yes">Popups enabled</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkCheckButton" id="sound_enabled">
- <property name="label" translatable="yes">Sound enabled</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="halign">start</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="on_sound_enabled_toggled" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkFileChooserButton" id="sound_path">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="create_folders">False</property>
- <signal name="update-preview" handler="on_sound_path_update_preview" swapped="no"/>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="padding">2</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label6">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="margin_top">5</property>
- <property name="xpad">5</property>
- <property name="label" translatable="yes">&lt;b&gt;UI Notifications&lt;/b&gt;</property>
- <property name="use_markup">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkFrame" id="frame3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="valign">start</property>
- <property name="margin_left">10</property>
- <property name="margin_top">7</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkAlignment" id="alignment3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="left_padding">12</property>
- <property name="right_padding">10</property>
- <child>
- <object class="GtkTable" id="prefs_table">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="n_rows">7</property>
- <property name="n_columns">4</property>
- <property name="column_spacing">2</property>
- <property name="row_spacing">2</property>
- <child>
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">Hostname:</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="smtp_host">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Port:</property>
- <property name="justify">right</property>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="smtp_port">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="max_length">5</property>
- <property name="width_chars">5</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
- <property name="adjustment">adjustment1</property>
- <property name="climb_rate">1</property>
- <property name="numeric">True</property>
- </object>
- <packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">Username:</property>
- </object>
- <packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="smtp_user">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">4</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">Password:</property>
- </object>
- <packing>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="smtp_pass">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="visibility">False</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">4</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkFrame" id="frame1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="valign">start</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkAlignment" id="alignment4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="bottom_padding">10</property>
- <child>
- <object class="GtkHBox" id="hbox1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">2</property>
- <child>
- <object class="GtkScrolledWindow" id="scrolledwindow1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="shadow_type">in</property>
- <child>
- <object class="GtkTreeView" id="smtp_recipients">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="headers_visible">False</property>
- <property name="enable_grid_lines">horizontal</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection"/>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkVButtonBox" id="vbuttonbox1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">5</property>
- <property name="layout_style">start</property>
- <child>
- <object class="GtkButton" id="add_button">
- <property name="label">gtk-add</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- <signal name="clicked" handler="on_add_button_clicked" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="delete_button">
- <property name="label">gtk-delete</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- <signal name="clicked" handler="on_delete_button_clicked" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="padding">3</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">&lt;b&gt;Recipients&lt;/b&gt;</property>
- <property name="margin_bottom">3</property>
- <property name="use_markup">True</property>
- <property name="ypad">0</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="right_attach">4</property>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="smtp_tls">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="halign">start</property>
- <property name="draw_indicator">True</property>
- <child>
- <object class="GtkLabel" id="label9">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Server requires TLS/SSL</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">4</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label8">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">From:</property>
- </object>
- <packing>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="smtp_from">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">4</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="smtp_enabled">
- <property name="label" translatable="yes">Enabled</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="on_enabled_toggled" swapped="no"/>
- </object>
- <packing>
- <property name="right_attach">4</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label7">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="xpad">5</property>
- <property name="label" translatable="yes">&lt;b&gt;Email Notifications&lt;/b&gt;</property>
- <property name="use_markup">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- <child type="tab">
- <object class="GtkLabel" id="settings_page_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Settings</property>
- </object>
- <packing>
- <property name="tab_fill">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkVBox" id="vbox5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_left">15</property>
- <property name="margin_right">10</property>
- <property name="margin_bottom">10</property>
- <child>
- <placeholder/>
- </child>
- <child>
- <object class="GtkScrolledWindow" id="scrolledwindow2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <child>
- <object class="GtkTreeView" id="subscriptions_treeview">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="enable_grid_lines">horizontal</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection"/>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label12">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">This configuration does not mean that you'll actually receive notifications for all these events.</property>
- <property name="justify">fill</property>
- <property name="wrap">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="padding">2</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child type="tab">
- <object class="GtkLabel" id="subscriptions_page_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Subscriptions</property>
- </object>
- <packing>
- <property name="position">1</property>
- <property name="tab_fill">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkVBox" id="sounds_page">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_left">15</property>
- <property name="margin_right">10</property>
- <property name="margin_bottom">10</property>
- <child>
- <object class="GtkScrolledWindow" id="scrolledwindow3">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <child>
- <object class="GtkTreeView" id="sounds_treeview">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection"/>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkHButtonBox" id="hbuttonbox1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">10</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="sounds_revert_button">
- <property name="label">gtk-revert-to-saved</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- <signal name="clicked" handler="on_sounds_revert_button_clicked" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="sounds_edit_button">
- <property name="label">gtk-edit</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- <signal name="clicked" handler="on_sounds_edit_button_clicked" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="padding">5</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
- <child type="tab">
- <object class="GtkLabel" id="sounds_page_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Sound Customization</property>
- </object>
- <packing>
- <property name="position">2</property>
- <property name="tab_fill">False</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- </child>
- <child type="titlebar">
- <placeholder/>
- </child>
- </object>
-</interface>
diff --git a/deluge/plugins/Notifications/deluge_notifications/data/notifications.js b/deluge/plugins/Notifications/deluge_notifications/data/notifications.js
index c9fb71f..4b87e55 100644
--- a/deluge/plugins/Notifications/deluge_notifications/data/notifications.js
+++ b/deluge/plugins/Notifications/deluge_notifications/data/notifications.js
@@ -21,7 +21,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
layout: 'fit',
border: false,
- initComponent: function() {
+ initComponent: function () {
Deluge.ux.preferences.NotificationsPage.superclass.initComponent.call(
this
);
@@ -44,7 +44,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
xtype: 'checkbox',
boxLabel: _('Enabled'),
listeners: {
- check: function(object, checked) {
+ check: function (object, checked) {
this.setSmtpDisabled(!checked);
},
scope: this,
@@ -227,11 +227,11 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
fields: [{ name: 'recipient' }],
}),
listeners: {
- afteredit: function(e) {
+ afteredit: function (e) {
e.record.commit();
},
},
- setEmptyText: function(text) {
+ setEmptyText: function (text) {
if (this.viewReady) {
this.getView().emptyText = text;
this.getView().refresh();
@@ -239,7 +239,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
Ext.apply(this.viewConfig, { emptyText: text });
}
},
- loadData: function(data) {
+ loadData: function (data) {
this.getStore().loadData(data);
if (this.viewReady) {
this.getView().updateHeaders();
@@ -259,7 +259,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
},
colModel: new Ext.grid.ColumnModel({
defaults: {
- renderer: function(
+ renderer: function (
value,
meta,
record,
@@ -310,7 +310,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
],
}),
listeners: {
- cellclick: function(grid, rowIndex, colIndex, e) {
+ cellclick: function (grid, rowIndex, colIndex, e) {
var record = grid.getStore().getAt(rowIndex);
var field = grid.getColumnModel().getDataIndex(colIndex);
var value = record.get(field);
@@ -322,18 +322,18 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
}
}
},
- beforeedit: function(e) {
+ beforeedit: function (e) {
if (Ext.isBoolean(e.value)) {
return false;
}
return e.record.get('enabled');
},
- afteredit: function(e) {
+ afteredit: function (e) {
e.record.commit();
},
},
- setEmptyText: function(text) {
+ setEmptyText: function (text) {
if (this.viewReady) {
this.getView().emptyText = text;
this.getView().refresh();
@@ -341,13 +341,13 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
Ext.apply(this.viewConfig, { emptyText: text });
}
},
- setSub: function(eventName) {
+ setSub: function (eventName) {
var store = this.getStore();
var index = store.find('event', eventName);
store.getAt(index).set('email', true);
store.getAt(index).commit();
},
- loadData: function(data) {
+ loadData: function (data) {
this.getStore().loadData(data);
if (this.viewReady) {
this.getView().updateHeaders();
@@ -374,9 +374,9 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
this.on('show', this.updateConfig, this);
},
- updateConfig: function() {
+ updateConfig: function () {
deluge.client.notifications.get_handled_events({
- success: function(events) {
+ success: function (events) {
var data = [];
var keys = Ext.keys(events);
for (var i = 0; i < keys.length; i++) {
@@ -388,7 +388,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
scope: this,
});
deluge.client.notifications.get_config({
- success: function(config) {
+ success: function (config) {
this.chkEnableEmail.setValue(config['smtp_enabled']);
this.setSmtpDisabled(!config['smtp_enabled']);
@@ -420,7 +420,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
});
},
- onApply: function() {
+ onApply: function () {
var config = {};
config['smtp_enabled'] = this.chkEnableEmail.getValue();
@@ -461,11 +461,11 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
deluge.client.notifications.set_config(config);
},
- onOk: function() {
+ onOk: function () {
this.onApply();
},
- onAddClick: function() {
+ onAddClick: function () {
var store = this.recipientsFset.getComponent(0).getStore();
var Recipient = store.recordType;
var i = new Recipient({
@@ -476,7 +476,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
this.recipientsFset.getComponent(0).startEditing(0, 0);
},
- onRemoveClick: function() {
+ onRemoveClick: function () {
var selections = this.recipientsFset
.getComponent(0)
.getSelectionModel()
@@ -488,7 +488,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
store.commitChanges();
},
- setSmtpDisabled: function(disable) {
+ setSmtpDisabled: function (disable) {
this.hBoxHost.setDisabled(disable);
this.hBoxPort.setDisabled(disable);
this.hBoxUser.setDisabled(disable);
@@ -498,7 +498,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
this.recipientsFset.getComponent(0).setDisabled(disable);
},
- onDestroy: function() {
+ onDestroy: function () {
deluge.preferences.un('show', this.updateConfig, this);
Deluge.ux.preferences.NotificationsPage.superclass.onDestroy.call(this);
@@ -508,11 +508,11 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
Deluge.plugins.NotificationsPlugin = Ext.extend(Deluge.Plugin, {
name: 'Notifications',
- onDisable: function() {
+ onDisable: function () {
deluge.preferences.removePage(this.prefsPage);
},
- onEnable: function() {
+ onEnable: function () {
this.prefsPage = deluge.preferences.addPage(
new Deluge.ux.preferences.NotificationsPage()
);
diff --git a/deluge/plugins/Notifications/deluge_notifications/gtkui.py b/deluge/plugins/Notifications/deluge_notifications/gtkui.py
index 816cb36..4dc5ff8 100644
--- a/deluge/plugins/Notifications/deluge_notifications/gtkui.py
+++ b/deluge/plugins/Notifications/deluge_notifications/gtkui.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2010 Pedro Algarvio <pedro@algarvio.me>
#
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from os.path import basename
@@ -42,7 +39,7 @@ except ImportError:
try:
require_version('Notify', '0.7')
- from gi.repository import Notify
+ from gi.repository import GLib, Notify
except (ValueError, ImportError):
POPUP_AVAILABLE = False
else:
@@ -174,15 +171,17 @@ class GtkUiNotifications(CustomNotifications):
if not self.config['popup_enabled']:
return defer.succeed(_('Popup notification is not enabled.'))
if not POPUP_AVAILABLE:
- return defer.fail(_('libnotify is not installed'))
+ err_msg = _('libnotify is not installed')
+ log.warning(err_msg)
+ return defer.fail(ImportError(err_msg))
if Notify.init('Deluge'):
self.note = Notify.Notification.new(title, message, 'deluge-panel')
- self.note.set_hint('desktop-entry', 'deluge')
+ self.note.set_hint('desktop-entry', GLib.Variant.new_string('deluge'))
if not self.note.show():
err_msg = _('Failed to popup notification')
log.warning(err_msg)
- return defer.fail(err_msg)
+ return defer.fail(Exception(err_msg))
return defer.succeed(_('Notification popup shown'))
def __play_sound(self, sound_path=''):
@@ -191,7 +190,7 @@ class GtkUiNotifications(CustomNotifications):
if not SOUND_AVAILABLE:
err_msg = _('pygame is not installed')
log.warning(err_msg)
- return defer.fail(err_msg)
+ return defer.fail(ImportError(err_msg))
pygame.init()
try:
@@ -203,7 +202,7 @@ class GtkUiNotifications(CustomNotifications):
except pygame.error as ex:
err_msg = _('Sound notification failed %s') % ex
log.warning(err_msg)
- return defer.fail(err_msg)
+ return defer.fail(ex)
else:
msg = _('Sound notification Success')
log.info(msg)
diff --git a/deluge/plugins/Notifications/deluge_notifications/test.py b/deluge/plugins/Notifications/deluge_notifications/test.py
index 2e6f975..013cdbf 100644
--- a/deluge/plugins/Notifications/deluge_notifications/test.py
+++ b/deluge/plugins/Notifications/deluge_notifications/test.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# vim: sw=4 ts=4 fenc=utf-8 et
# ==============================================================================
# Copyright © 2009-2010 UfSoft.org - Pedro Algarvio <pedro@algarvio.me>
@@ -6,8 +5,6 @@
# License: BSD - Please view the LICENSE file for additional information.
# ==============================================================================
-from __future__ import unicode_literals
-
import logging
from twisted.internet import task
@@ -70,14 +67,14 @@ class TestEmailNotifications(component.Component):
def custom_email_message_provider(self, *evt_args, **evt_kwargs):
log.debug('Running custom email message provider: %s %s', evt_args, evt_kwargs)
- subject = '%s Email Subject: %s' % (self.events[0].__class__.__name__, self.n)
- message = '%s Email Message: %s' % (self.events[0].__class__.__name__, self.n)
+ subject = f'{self.events[0].__class__.__name__} Email Subject: {self.n}'
+ message = f'{self.events[0].__class__.__name__} Email Message: {self.n}'
return subject, message
def custom_popup_message_provider(self, *evt_args, **evt_kwargs):
log.debug('Running custom popup message provider: %s %s', evt_args, evt_kwargs)
- title = '%s Popup Title: %s' % (self.events[0].__class__.__name__, self.n)
- message = '%s Popup Message: %s' % (self.events[0].__class__.__name__, self.n)
+ title = f'{self.events[0].__class__.__name__} Popup Title: {self.n}'
+ message = f'{self.events[0].__class__.__name__} Popup Message: {self.n}'
return title, message
def custom_blink_message_provider(self, *evt_args, **evt_kwargs):
diff --git a/deluge/plugins/Notifications/deluge_notifications/webui.py b/deluge/plugins/Notifications/deluge_notifications/webui.py
index d3529c4..ad090f5 100644
--- a/deluge/plugins/Notifications/deluge_notifications/webui.py
+++ b/deluge/plugins/Notifications/deluge_notifications/webui.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2010 Pedro Algarvio <pedro@algarvio.me>
#
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge.plugins.pluginbase import WebPluginBase
diff --git a/deluge/plugins/Notifications/setup.py b/deluge/plugins/Notifications/setup.py
index d9a9e42..3d87423 100755
--- a/deluge/plugins/Notifications/setup.py
+++ b/deluge/plugins/Notifications/setup.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2010 Pedro Algarvio <pedro@algarvio.me>
#
@@ -17,7 +16,7 @@ from setuptools import find_packages, setup
__plugin_name__ = 'Notifications'
__author__ = 'Pedro Algarvio'
__author_email__ = 'pedro@algarvio.me'
-__version__ = '0.3'
+__version__ = '0.4'
__url__ = 'http://dev.deluge-torrent.org/'
__license__ = 'GPLv3'
__description__ = 'Plugin which provides notifications to Deluge.'
diff --git a/deluge/plugins/Scheduler/deluge_scheduler/__init__.py b/deluge/plugins/Scheduler/deluge_scheduler/__init__.py
index 6db72b6..87d1584 100644
--- a/deluge/plugins/Scheduler/deluge_scheduler/__init__.py
+++ b/deluge/plugins/Scheduler/deluge_scheduler/__init__.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
#
@@ -11,8 +10,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.plugins.init import PluginInitBase
@@ -21,7 +18,7 @@ class CorePlugin(PluginInitBase):
from .core import Core as _pluginCls
self._plugin_cls = _pluginCls
- super(CorePlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
class GtkUIPlugin(PluginInitBase):
@@ -29,7 +26,7 @@ class GtkUIPlugin(PluginInitBase):
from .gtkui import GtkUI as _pluginCls
self._plugin_cls = _pluginCls
- super(GtkUIPlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
class WebUIPlugin(PluginInitBase):
@@ -37,4 +34,4 @@ class WebUIPlugin(PluginInitBase):
from .webui import WebUI as _pluginCls
self._plugin_cls = _pluginCls
- super(WebUIPlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
diff --git a/deluge/plugins/Scheduler/deluge_scheduler/common.py b/deluge/plugins/Scheduler/deluge_scheduler/common.py
index 4c9db09..eb47f13 100644
--- a/deluge/plugins/Scheduler/deluge_scheduler/common.py
+++ b/deluge/plugins/Scheduler/deluge_scheduler/common.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Basic plugin template created by:
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os.path
from pkg_resources import resource_filename
diff --git a/deluge/plugins/Scheduler/deluge_scheduler/core.py b/deluge/plugins/Scheduler/deluge_scheduler/core.py
index 388e4f0..10798ba 100644
--- a/deluge/plugins/Scheduler/deluge_scheduler/core.py
+++ b/deluge/plugins/Scheduler/deluge_scheduler/core.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
#
@@ -11,8 +10,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import time
diff --git a/deluge/plugins/Scheduler/deluge_scheduler/data/scheduler.js b/deluge/plugins/Scheduler/deluge_scheduler/data/scheduler.js
index 13bec46..f59068c 100644
--- a/deluge/plugins/Scheduler/deluge_scheduler/data/scheduler.js
+++ b/deluge/plugins/Scheduler/deluge_scheduler/data/scheduler.js
@@ -40,7 +40,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
],
daysOfWeek: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
- initComponent: function() {
+ initComponent: function () {
Deluge.ux.ScheduleSelector.superclass.initComponent.call(this);
// ExtJS' radiogroup implementation is very broken for styling.
@@ -57,7 +57,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
});*/
},
- onRender: function(ct, position) {
+ onRender: function (ct, position) {
Deluge.ux.ScheduleSelector.superclass.onRender.call(this, ct, position);
var dom = this.body.dom;
@@ -126,7 +126,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
Ext.each(
this.daysOfWeek,
- function(day) {
+ function (day) {
var cells = [];
var row = createEl(table, 'tr');
var label = createEl(row, 'th');
@@ -175,7 +175,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
);
},
- updateCell: function(cell) {
+ updateCell: function (cell) {
// sanity check
if (cell.currentValue == undefined) return;
@@ -188,29 +188,29 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
}
},
- getCurrentBrushValue: function() {
+ getCurrentBrushValue: function () {
var v = null;
var brushes = Ext.get(this.body.dom).findParent('form').elements[
this.stateBrushName
];
- Ext.each(brushes, function(b) {
+ Ext.each(brushes, function (b) {
if (b.checked) v = b.value;
});
return v;
},
- onCellClick: function(event, cell) {
+ onCellClick: function (event, cell) {
cell.oldValue = cell.currentValue;
this.dragAnchor = null;
},
- onCellMouseDown: function(event, cell) {
+ onCellMouseDown: function (event, cell) {
this.dragAnchor = cell;
},
- onCellMouseUp: function(event, cell) {
+ onCellMouseUp: function (event, cell) {
// if we're dragging...
if (this.dragAnchor) {
// set all those between here and the anchor to the new values
@@ -226,7 +226,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
}
},
- onCellMouseOver: function(event, cell) {
+ onCellMouseOver: function (event, cell) {
// LEFT TOOL TIP
// if it isn't showing and we're dragging, show it.
// otherwise if dragging, leave it alone unless we're dragging to the left.
@@ -295,7 +295,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
// dragged into another day. Abort! Abort!
Ext.each(
this.daysOfWeek,
- function(day) {
+ function (day) {
this.revertCells(day, 0, 23);
},
this
@@ -323,7 +323,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
}
},
- onCellMouseOut: function(event, cell) {
+ onCellMouseOut: function (event, cell) {
if (!this.dragAnchor) this.hideCellLeftTooltip();
// revert state. If new state has been set, old and new will be equal.
@@ -333,7 +333,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
}
},
- previewCells: function(day, fromHour, toHour) {
+ previewCells: function (day, fromHour, toHour) {
var cells = this.scheduleCells[day];
var curBrushValue = this.getCurrentBrushValue();
@@ -348,7 +348,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
}
},
- revertCells: function(day, fromHour, toHour) {
+ revertCells: function (day, fromHour, toHour) {
var cells = this.scheduleCells[day];
if (toHour > cells.length) toHour = cells.length;
@@ -359,7 +359,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
}
},
- confirmCells: function(day, fromHour, toHour) {
+ confirmCells: function (day, fromHour, toHour) {
var cells = this.scheduleCells[day];
if (toHour > cells.length) toHour = cells.length;
@@ -371,7 +371,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
}
},
- showCellLeftTooltip: function(text, cell) {
+ showCellLeftTooltip: function (text, cell) {
var tooltip = this.cellLeftTooltip;
if (!tooltip) {
@@ -400,19 +400,19 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
tooltip.style.visibility = 'visible';
},
- hideCellLeftTooltip: function() {
+ hideCellLeftTooltip: function () {
if (this.cellLeftTooltip) {
this.cellLeftTooltip.style.visibility = 'hidden';
}
},
- isCellLeftTooltipHidden: function() {
+ isCellLeftTooltipHidden: function () {
if (this.cellLeftTooltip)
return this.cellLeftTooltip.style.visibility == 'hidden';
else return true;
},
- showCellRightTooltip: function(text, cell) {
+ showCellRightTooltip: function (text, cell) {
var tooltip = this.cellRightTooltip;
if (!tooltip) {
@@ -441,19 +441,19 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
tooltip.style.visibility = 'visible';
},
- hideCellRightTooltip: function() {
+ hideCellRightTooltip: function () {
if (this.cellRightTooltip) {
this.cellRightTooltip.style.visibility = 'hidden';
}
},
- isCellRightTooltipHidden: function() {
+ isCellRightTooltipHidden: function () {
if (this.cellRightTooltip)
return this.cellRightTooltip.style.visibility == 'hidden';
else return true;
},
- getConfig: function() {
+ getConfig: function () {
var config = [];
for (var i = 0; i < 24; i++) {
@@ -471,7 +471,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
return config;
},
- setConfig: function(config) {
+ setConfig: function (config) {
for (var i = 0; i < 24; i++) {
var hourConfig = config[i];
@@ -496,7 +496,7 @@ Deluge.ux.preferences.SchedulerPage = Ext.extend(Ext.Panel, {
header: false,
layout: 'fit',
- initComponent: function() {
+ initComponent: function () {
Deluge.ux.preferences.SchedulerPage.superclass.initComponent.call(this);
this.form = this.add({
@@ -561,7 +561,7 @@ Deluge.ux.preferences.SchedulerPage = Ext.extend(Ext.Panel, {
this.on('show', this.updateConfig, this);
},
- onRender: function(ct, position) {
+ onRender: function (ct, position) {
Deluge.ux.preferences.SchedulerPage.superclass.onRender.call(
this,
ct,
@@ -572,7 +572,7 @@ Deluge.ux.preferences.SchedulerPage = Ext.extend(Ext.Panel, {
this.form.doLayout();
},
- onApply: function() {
+ onApply: function () {
// build settings object
var config = {};
@@ -586,13 +586,13 @@ Deluge.ux.preferences.SchedulerPage = Ext.extend(Ext.Panel, {
deluge.client.scheduler.set_config(config);
},
- onOk: function() {
+ onOk: function () {
this.onApply();
},
- updateConfig: function() {
+ updateConfig: function () {
deluge.client.scheduler.get_config({
- success: function(config) {
+ success: function (config) {
this.schedule.setConfig(config['button_state']);
this.downloadLimit.setValue(config['low_down']);
this.uploadLimit.setValue(config['low_up']);
@@ -608,11 +608,11 @@ Deluge.ux.preferences.SchedulerPage = Ext.extend(Ext.Panel, {
Deluge.plugins.SchedulerPlugin = Ext.extend(Deluge.Plugin, {
name: 'Scheduler',
- onDisable: function() {
+ onDisable: function () {
deluge.preferences.removePage(this.prefsPage);
},
- onEnable: function() {
+ onEnable: function () {
this.prefsPage = deluge.preferences.addPage(
new Deluge.ux.preferences.SchedulerPage()
);
diff --git a/deluge/plugins/Scheduler/deluge_scheduler/gtkui.py b/deluge/plugins/Scheduler/deluge_scheduler/gtkui.py
index 12f5fb6..16222c8 100644
--- a/deluge/plugins/Scheduler/deluge_scheduler/gtkui.py
+++ b/deluge/plugins/Scheduler/deluge_scheduler/gtkui.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
#
@@ -11,8 +10,6 @@
# See LICENSE for more details.
#
-from __future__ import division, unicode_literals
-
import logging
from gi.repository import Gdk, Gtk
@@ -30,7 +27,7 @@ DAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
class SchedulerSelectWidget(Gtk.DrawingArea):
def __init__(self, hover):
- super(SchedulerSelectWidget, self).__init__()
+ super().__init__()
self.set_events(
Gdk.EventMask.BUTTON_PRESS_MASK
| Gdk.EventMask.BUTTON_RELEASE_MASK
diff --git a/deluge/plugins/Scheduler/deluge_scheduler/webui.py b/deluge/plugins/Scheduler/deluge_scheduler/webui.py
index 518eaa6..4f5418b 100644
--- a/deluge/plugins/Scheduler/deluge_scheduler/webui.py
+++ b/deluge/plugins/Scheduler/deluge_scheduler/webui.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
#
@@ -10,8 +9,6 @@
# the additional special exception to link portions of this program with the OpenSSL library.
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge.plugins.pluginbase import WebPluginBase
diff --git a/deluge/plugins/Scheduler/setup.py b/deluge/plugins/Scheduler/setup.py
index 71b69e9..3ac181d 100644
--- a/deluge/plugins/Scheduler/setup.py
+++ b/deluge/plugins/Scheduler/setup.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
#
diff --git a/deluge/plugins/Stats/deluge_stats/__init__.py b/deluge/plugins/Stats/deluge_stats/__init__.py
index a40379b..ca7b0bb 100644
--- a/deluge/plugins/Stats/deluge_stats/__init__.py
+++ b/deluge/plugins/Stats/deluge_stats/__init__.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
#
@@ -11,8 +10,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.plugins.init import PluginInitBase
@@ -21,7 +18,7 @@ class CorePlugin(PluginInitBase):
from .core import Core as _pluginCls
self._plugin_cls = _pluginCls
- super(CorePlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
class GtkUIPlugin(PluginInitBase):
@@ -29,7 +26,7 @@ class GtkUIPlugin(PluginInitBase):
from .gtkui import GtkUI as _pluginCls
self._plugin_cls = _pluginCls
- super(GtkUIPlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
class WebUIPlugin(PluginInitBase):
@@ -37,4 +34,4 @@ class WebUIPlugin(PluginInitBase):
from .webui import WebUI as _pluginCls
self._plugin_cls = _pluginCls
- super(WebUIPlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
diff --git a/deluge/plugins/Stats/deluge_stats/common.py b/deluge/plugins/Stats/deluge_stats/common.py
index 4c9db09..eb47f13 100644
--- a/deluge/plugins/Stats/deluge_stats/common.py
+++ b/deluge/plugins/Stats/deluge_stats/common.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Basic plugin template created by:
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os.path
from pkg_resources import resource_filename
diff --git a/deluge/plugins/Stats/deluge_stats/core.py b/deluge/plugins/Stats/deluge_stats/core.py
index 635c54d..1be51e6 100644
--- a/deluge/plugins/Stats/deluge_stats/core.py
+++ b/deluge/plugins/Stats/deluge_stats/core.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Ian Martin <ianmartin@cantab.net>
# Copyright (C) 2008 Damien Churchill <damoxc@gmail.com>
@@ -10,8 +9,6 @@
# See LICENSE for more details.
#
-from __future__ import division, unicode_literals
-
import logging
import time
@@ -77,16 +74,34 @@ class Core(CorePluginBase):
self.length = self.config['length']
# self.stats = get_key(self.saved_stats, 'stats') or {}
- self.stats_keys = ['peer.num_peers_half_open', 'dht.dht_node_cache']
- self.add_stats(
+
+ # keys needed from core.get_session_status
+ self.stat_keys = [
'upload_rate',
'download_rate',
- 'dht_nodes',
- 'dht_cache_nodes',
- 'dht_torrents',
- 'num_peers',
- 'num_connections',
- )
+ 'dht.dht_nodes',
+ 'dht.dht_node_cache',
+ 'dht.dht_torrents',
+ 'peer.num_peers_connected',
+ 'peer.num_peers_half_open',
+ ]
+ # collected statistics and functions to get them
+ self.stat_getters = {
+ 'upload_rate': lambda s: s['upload_rate'],
+ 'download_rate': lambda s: s['download_rate'],
+ 'dht_nodes': lambda s: s['dht.dht_nodes'],
+ 'dht_cache_nodes': lambda s: s['dht.dht_node_cache'],
+ 'dht_torrents': lambda s: s['dht.dht_torrents'],
+ 'num_peers': lambda s: s['peer.num_peers_connected'],
+ 'num_connections': lambda s: s['peer.num_peers_connected']
+ + s['peer.num_peers_half_open'],
+ }
+
+ # initialize stats object
+ for key in self.stat_getters.keys():
+ for i in self.intervals:
+ if key not in self.stats[i]:
+ self.stats[i][key] = []
self.update_stats()
@@ -101,33 +116,13 @@ class Core(CorePluginBase):
self.save_timer.stop() if self.save_timer.running else None
self.save_stats()
- def add_stats(self, *stats):
- for stat in stats:
- if stat not in self.stats_keys:
- self.stats_keys.append(stat)
- for i in self.intervals:
- if stat not in self.stats[i]:
- self.stats[i][stat] = []
-
def update_stats(self):
# Get all possible stats!
stats = {}
- for key in self.stats_keys:
- # try all keys we have, very inefficient but saves having to
- # work out where a key comes from...
- try:
- stats.update(self.core.get_session_status([key]))
- except AttributeError:
- pass
- stats['num_connections'] = (
- stats['num_peers'] + stats['peer.num_peers_half_open']
- )
- stats['dht_cache_nodes'] = stats['dht.dht_node_cache']
- stats.update(
- self.core.get_config_values(
- ['max_download', 'max_upload', 'max_num_connections']
- )
- )
+ raw_stats = self.core.get_session_status(self.stat_keys)
+ for name, fn in self.stat_getters.items():
+ stats[name] = fn(raw_stats)
+
# status = self.core.session.status()
# for stat in dir(status):
# if not stat.startswith('_') and stat not in stats:
diff --git a/deluge/plugins/Stats/deluge_stats/data/config.ui~ b/deluge/plugins/Stats/deluge_stats/data/config.ui~
deleted file mode 100644
index 25fc029..0000000
--- a/deluge/plugins/Stats/deluge_stats/data/config.ui~
+++ /dev/null
@@ -1,280 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
- <requires lib="gtk+" version="3.0"/>
- <!-- interface-naming-policy toplevel-contextual -->
- <object class="GtkWindow" id="window1">
- <property name="can_focus">False</property>
- <child>
- <object class="GtkVBox" id="prefs_box">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkFrame" id="frame1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkAlignment" id="alignment4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="left_padding">15</property>
- <child>
- <object class="GtkTable" id="table2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="n_rows">10</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">15</property>
- <child>
- <object class="GtkColorButton" id="bandwidth_graph_download_rate_color">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="color">#000000000000</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_EXPAND</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Download color:</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Upload color:</property>
- </object>
- <packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkColorButton" id="bandwidth_graph_upload_rate_color">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="color">#000000000000</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_EXPAND</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label8">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">&lt;b&gt;Connections Graph&lt;/b&gt;</property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label9">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">&lt;b&gt;Bandwidth Graph&lt;/b&gt;</property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="right_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkColorButton" id="connections_graph_dht_nodes_color">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="color">#000000000000</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="x_options">GTK_EXPAND</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label10">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">DHT nodes:</property>
- </object>
- <packing>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- </packing>
- </child>
- <child>
- <object class="GtkColorButton" id="connections_graph_dht_cache_nodes_color">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="color">#000000000000</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
- <property name="x_options">GTK_EXPAND</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label11">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Cached DHT nodes:</property>
- </object>
- <packing>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label12">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">DHT torrents:</property>
- </object>
- <packing>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label13">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Connections:</property>
- </object>
- <packing>
- <property name="top_attach">7</property>
- <property name="bottom_attach">8</property>
- </packing>
- </child>
- <child>
- <object class="GtkColorButton" id="connections_graph_dht_torrents_color">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="color">#000000000000</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
- <property name="x_options">GTK_EXPAND</property>
- </packing>
- </child>
- <child>
- <object class="GtkColorButton" id="connections_graph_num_connections_color">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="color">#000000000000</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">7</property>
- <property name="bottom_attach">8</property>
- <property name="x_options">GTK_EXPAND</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label16">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">&lt;b&gt;Seeds / Peers&lt;/b&gt;</property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="right_attach">2</property>
- <property name="top_attach">8</property>
- <property name="bottom_attach">9</property>
- </packing>
- </child>
- <child>
- <object class="GtkColorButton" id="seeds_graph_num_peers_color">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="color">#000000000000</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">9</property>
- <property name="bottom_attach">10</property>
- <property name="x_options">GTK_EXPAND</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label17">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Peers:</property>
- </object>
- <packing>
- <property name="top_attach">9</property>
- <property name="bottom_attach">10</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">&lt;b&gt;Graph Colors&lt;/b&gt;</property>
- <property name="use_markup">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
-</interface>
diff --git a/deluge/plugins/Stats/deluge_stats/data/stats.js b/deluge/plugins/Stats/deluge_stats/data/stats.js
index 8f9e3f8..7ba3d27 100644
--- a/deluge/plugins/Stats/deluge_stats/data/stats.js
+++ b/deluge/plugins/Stats/deluge_stats/data/stats.js
@@ -10,7 +10,7 @@
*/
StatsPlugin = Ext.extend(Deluge.Plugin, {
- constructor: function(config) {
+ constructor: function (config) {
config = Ext.apply(
{
name: 'Stats',
@@ -20,8 +20,8 @@ StatsPlugin = Ext.extend(Deluge.Plugin, {
StatsPlugin.superclass.constructor.call(this, config);
},
- onDisable: function() {},
+ onDisable: function () {},
- onEnable: function() {},
+ onEnable: function () {},
});
new StatsPlugin();
diff --git a/deluge/plugins/Stats/deluge_stats/graph.py b/deluge/plugins/Stats/deluge_stats/graph.py
index 847c253..0d3220f 100644
--- a/deluge/plugins/Stats/deluge_stats/graph.py
+++ b/deluge/plugins/Stats/deluge_stats/graph.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Ian Martin <ianmartin@cantab.net>
# Copyright (C) 2008 Damien Churchill <damoxc@gmail.com>
@@ -14,13 +13,15 @@
port of old plugin by markybob.
"""
-from __future__ import division, unicode_literals
-
import logging
import math
import time
-from gi.repository import cairo
+import gi
+
+gi.require_foreign('cairo')
+
+import cairo # isort:skip (gi checks required before import).
log = logging.getLogger(__name__)
@@ -58,7 +59,7 @@ def change_opacity(color, opactiy):
return tuple(color)
-class Graph(object):
+class Graph:
def __init__(self):
self.width = 100
self.height = 100
@@ -174,7 +175,7 @@ class Graph(object):
te = self.ctx.text_extents(text)
return math.ceil(te[4] - te[0])
- y_tick_width = max((space_required(text) for text in y_tick_text))
+ y_tick_width = max(space_required(text) for text in y_tick_text)
top = font_extents[2] / 2
# bounds(left, top, right, bottom)
diff --git a/deluge/plugins/Stats/deluge_stats/gtkui.py b/deluge/plugins/Stats/deluge_stats/gtkui.py
index 75e3015..c088060 100644
--- a/deluge/plugins/Stats/deluge_stats/gtkui.py
+++ b/deluge/plugins/Stats/deluge_stats/gtkui.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Ian Martin <ianmartin@cantab.net>
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import division, unicode_literals
-
import logging
from gi.repository import Gtk
@@ -85,7 +82,7 @@ def text_to_rgba(color):
class GraphsTab(Tab):
def __init__(self, colors):
- super(GraphsTab, self).__init__()
+ super().__init__()
builder = Gtk.Builder()
builder.add_from_file(get_resource('tabs.ui'))
@@ -270,7 +267,7 @@ class GtkUI(Gtk3PluginBase):
for graph, colors in self.config['colors'].items():
gtkconf[graph] = {}
for value, color in colors.items():
- color_btn = self.builder.get_object('%s_%s_color' % (graph, value))
+ color_btn = self.builder.get_object(f'{graph}_{value}_color')
try:
gtkconf[graph][value] = color_btn.get_color().to_string()
except Exception:
@@ -285,7 +282,7 @@ class GtkUI(Gtk3PluginBase):
for graph, colors in self.config['colors'].items():
for value, color in colors.items():
try:
- color_btn = self.builder.get_object('%s_%s_color' % (graph, value))
+ color_btn = self.builder.get_object(f'{graph}_{value}_color')
color_btn.set_rgba(text_to_rgba(color))
except Exception as ex:
log.debug('Unable to set %s %s %s: %s', graph, value, color, ex)
diff --git a/deluge/plugins/Stats/deluge_stats/tests/test_stats.py b/deluge/plugins/Stats/deluge_stats/tests/test_stats.py
index 3b581be..9c66ee1 100644
--- a/deluge/plugins/Stats/deluge_stats/tests/test_stats.py
+++ b/deluge/plugins/Stats/deluge_stats/tests/test_stats.py
@@ -1,19 +1,14 @@
-# -*- coding: utf-8 -*-
#
# 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 __future__ import print_function, unicode_literals
-
import pytest
+import pytest_twisted
from twisted.internet import defer
-from twisted.trial import unittest
import deluge.component as component
from deluge.common import fsize, fspeed
-from deluge.tests import common as tests_common
-from deluge.tests.basetest import BaseTestCase
from deluge.ui.client import client
@@ -26,42 +21,42 @@ def print_totals(totals):
print('down:', fsize(totals['total_download'] - totals['total_payload_download']))
-class StatsTestCase(BaseTestCase):
- def set_up(self):
+@pytest.mark.usefixtures('component')
+class TestStatsPlugin:
+ @pytest_twisted.async_yield_fixture(autouse=True)
+ async def set_up(self):
defer.setDebugging(True)
- tests_common.set_tmp_config_dir()
client.start_standalone()
client.core.enable_plugin('Stats')
- return component.start()
-
- def tear_down(self):
+ await component.start()
+ yield
client.stop_standalone()
- return component.shutdown()
+ await component.shutdown()
@defer.inlineCallbacks
def test_client_totals(self):
plugins = yield client.core.get_available_plugins()
if 'Stats' not in plugins:
- raise unittest.SkipTest('WebUi plugin not available for testing')
+ pytest.skip('Stats plugin not available for testing')
totals = yield client.stats.get_totals()
- self.assertEqual(totals['total_upload'], 0)
- self.assertEqual(totals['total_payload_upload'], 0)
- self.assertEqual(totals['total_payload_download'], 0)
- self.assertEqual(totals['total_download'], 0)
+ assert totals['total_upload'] == 0
+ assert totals['total_payload_upload'] == 0
+ assert totals['total_payload_download'] == 0
+ assert totals['total_download'] == 0
# print_totals(totals)
@defer.inlineCallbacks
def test_session_totals(self):
plugins = yield client.core.get_available_plugins()
if 'Stats' not in plugins:
- raise unittest.SkipTest('WebUi plugin not available for testing')
+ pytest.skip('Stats plugin not available for testing')
totals = yield client.stats.get_session_totals()
- self.assertEqual(totals['total_upload'], 0)
- self.assertEqual(totals['total_payload_upload'], 0)
- self.assertEqual(totals['total_payload_download'], 0)
- self.assertEqual(totals['total_download'], 0)
+ assert totals['total_upload'] == 0
+ assert totals['total_payload_upload'] == 0
+ assert totals['total_payload_download'] == 0
+ assert totals['total_download'] == 0
# print_totals(totals)
@pytest.mark.gtkui
@@ -72,16 +67,17 @@ class StatsTestCase(BaseTestCase):
Not strictly a unit test, but tests if calls do not fail...
"""
- from deluge.ui.gtkui.gtkui import DEFAULT_PREFS
- from deluge.ui.gtkui.preferences import Preferences
- from deluge.ui.gtkui.mainwindow import MainWindow
- from deluge.configmanager import ConfigManager
- from deluge.ui.gtkui.pluginmanager import PluginManager
- from deluge.ui.gtkui.torrentdetails import TorrentDetails
- from deluge.ui.gtkui.torrentview import TorrentView
from deluge_stats import graph, gtkui
- ConfigManager('gtkui.conf', defaults=DEFAULT_PREFS)
+ from deluge.configmanager import ConfigManager
+ from deluge.ui.gtk3.gtkui import DEFAULT_PREFS
+ from deluge.ui.gtk3.mainwindow import MainWindow
+ from deluge.ui.gtk3.pluginmanager import PluginManager
+ from deluge.ui.gtk3.preferences import Preferences
+ from deluge.ui.gtk3.torrentdetails import TorrentDetails
+ from deluge.ui.gtk3.torrentview import TorrentView
+
+ ConfigManager('gtk3ui.conf', defaults=DEFAULT_PREFS)
self.plugins = PluginManager()
MainWindow()
@@ -89,7 +85,7 @@ class StatsTestCase(BaseTestCase):
TorrentDetails()
Preferences()
- class FakeFile(object):
+ class FakeFile:
def __init__(self):
self.data = []
diff --git a/deluge/plugins/Stats/deluge_stats/webui.py b/deluge/plugins/Stats/deluge_stats/webui.py
index 4c11260..f38daeb 100644
--- a/deluge/plugins/Stats/deluge_stats/webui.py
+++ b/deluge/plugins/Stats/deluge_stats/webui.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
#
@@ -11,8 +10,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge.plugins.pluginbase import WebPluginBase
diff --git a/deluge/plugins/Stats/setup.py b/deluge/plugins/Stats/setup.py
index 174c652..0f3e069 100644
--- a/deluge/plugins/Stats/setup.py
+++ b/deluge/plugins/Stats/setup.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Ian Martin <ianmartin@cantab.net>
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
diff --git a/deluge/plugins/Toggle/deluge_toggle/__init__.py b/deluge/plugins/Toggle/deluge_toggle/__init__.py
index e63e4aa..b0332ee 100644
--- a/deluge/plugins/Toggle/deluge_toggle/__init__.py
+++ b/deluge/plugins/Toggle/deluge_toggle/__init__.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 John Garland <johnnybg+deluge@gmail.com>
#
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.plugins.init import PluginInitBase
@@ -22,7 +19,7 @@ class CorePlugin(PluginInitBase):
from .core import Core as _pluginCls
self._plugin_cls = _pluginCls
- super(CorePlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
class GtkUIPlugin(PluginInitBase):
@@ -30,7 +27,7 @@ class GtkUIPlugin(PluginInitBase):
from .gtkui import GtkUI as _pluginCls
self._plugin_cls = _pluginCls
- super(GtkUIPlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
class WebUIPlugin(PluginInitBase):
@@ -38,4 +35,4 @@ class WebUIPlugin(PluginInitBase):
from .webui import WebUI as _pluginCls
self._plugin_cls = _pluginCls
- super(WebUIPlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
diff --git a/deluge/plugins/Toggle/deluge_toggle/common.py b/deluge/plugins/Toggle/deluge_toggle/common.py
index 4c9db09..eb47f13 100644
--- a/deluge/plugins/Toggle/deluge_toggle/common.py
+++ b/deluge/plugins/Toggle/deluge_toggle/common.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Basic plugin template created by:
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os.path
from pkg_resources import resource_filename
diff --git a/deluge/plugins/Toggle/deluge_toggle/core.py b/deluge/plugins/Toggle/deluge_toggle/core.py
index dad52ce..ab4581b 100644
--- a/deluge/plugins/Toggle/deluge_toggle/core.py
+++ b/deluge/plugins/Toggle/deluge_toggle/core.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 John Garland <johnnybg+deluge@gmail.com>
#
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import deluge.component as component
diff --git a/deluge/plugins/Toggle/deluge_toggle/data/toggle.js b/deluge/plugins/Toggle/deluge_toggle/data/toggle.js
index 8e9a045..20fa4f4 100644
--- a/deluge/plugins/Toggle/deluge_toggle/data/toggle.js
+++ b/deluge/plugins/Toggle/deluge_toggle/data/toggle.js
@@ -10,7 +10,7 @@
*/
TogglePlugin = Ext.extend(Deluge.Plugin, {
- constructor: function(config) {
+ constructor: function (config) {
config = Ext.apply(
{
name: 'Toggle',
@@ -20,8 +20,8 @@ TogglePlugin = Ext.extend(Deluge.Plugin, {
TogglePlugin.superclass.constructor.call(this, config);
},
- onDisable: function() {},
+ onDisable: function () {},
- onEnable: function() {},
+ onEnable: function () {},
});
new TogglePlugin();
diff --git a/deluge/plugins/Toggle/deluge_toggle/gtkui.py b/deluge/plugins/Toggle/deluge_toggle/gtkui.py
index c54bca4..bfb90de 100644
--- a/deluge/plugins/Toggle/deluge_toggle/gtkui.py
+++ b/deluge/plugins/Toggle/deluge_toggle/gtkui.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 John Garland <johnnybg+deluge@gmail.com>
#
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import deluge.component as component
diff --git a/deluge/plugins/Toggle/deluge_toggle/webui.py b/deluge/plugins/Toggle/deluge_toggle/webui.py
index 8f0fc8c..d16d29f 100644
--- a/deluge/plugins/Toggle/deluge_toggle/webui.py
+++ b/deluge/plugins/Toggle/deluge_toggle/webui.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 John Garland <johnnybg+deluge@gmail.com>
#
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge.plugins.pluginbase import WebPluginBase
diff --git a/deluge/plugins/Toggle/setup.py b/deluge/plugins/Toggle/setup.py
index acc6e6c..dadd32e 100644
--- a/deluge/plugins/Toggle/setup.py
+++ b/deluge/plugins/Toggle/setup.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 John Garland <johnnybg+deluge@gmail.com>
#
diff --git a/deluge/plugins/WebUi/deluge_webui/__init__.py b/deluge/plugins/WebUi/deluge_webui/__init__.py
index a3d2980..ba978b2 100644
--- a/deluge/plugins/WebUi/deluge_webui/__init__.py
+++ b/deluge/plugins/WebUi/deluge_webui/__init__.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
#
@@ -11,8 +10,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.plugins.init import PluginInitBase
@@ -21,7 +18,7 @@ class CorePlugin(PluginInitBase):
from .core import Core as _pluginCls
self._plugin_cls = _pluginCls
- super(CorePlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
class GtkUIPlugin(PluginInitBase):
@@ -29,7 +26,7 @@ class GtkUIPlugin(PluginInitBase):
from .gtkui import GtkUI as _pluginCls
self._plugin_cls = _pluginCls
- super(GtkUIPlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
class WebUIPlugin(PluginInitBase):
@@ -37,4 +34,4 @@ class WebUIPlugin(PluginInitBase):
from webui import WebUI as _pluginCls
self._plugin_cls = _pluginCls
- super(WebUIPlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
diff --git a/deluge/plugins/WebUi/deluge_webui/common.py b/deluge/plugins/WebUi/deluge_webui/common.py
index 4c9db09..eb47f13 100644
--- a/deluge/plugins/WebUi/deluge_webui/common.py
+++ b/deluge/plugins/WebUi/deluge_webui/common.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Basic plugin template created by:
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os.path
from pkg_resources import resource_filename
diff --git a/deluge/plugins/WebUi/deluge_webui/core.py b/deluge/plugins/WebUi/deluge_webui/core.py
index cc3330f..f18203e 100644
--- a/deluge/plugins/WebUi/deluge_webui/core.py
+++ b/deluge/plugins/WebUi/deluge_webui/core.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
#
@@ -11,8 +10,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from twisted.internet import defer
diff --git a/deluge/plugins/WebUi/deluge_webui/data/config.ui b/deluge/plugins/WebUi/deluge_webui/data/config.ui
index 18647a4..c58edd0 100644
--- a/deluge/plugins/WebUi/deluge_webui/data/config.ui
+++ b/deluge/plugins/WebUi/deluge_webui/data/config.ui
@@ -86,8 +86,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
<property name="adjustment">adjustment1</property>
<property name="numeric">True</property>
</object>
diff --git a/deluge/plugins/WebUi/deluge_webui/data/config.ui~ b/deluge/plugins/WebUi/deluge_webui/data/config.ui~
deleted file mode 100644
index 101f60d..0000000
--- a/deluge/plugins/WebUi/deluge_webui/data/config.ui~
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
- <requires lib="gtk+" version="3.0"/>
- <!-- interface-naming-policy toplevel-contextual -->
- <object class="GtkAdjustment" id="adjustment1">
- <property name="upper">99999</property>
- <property name="value">8112</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
- <object class="GtkWindow" id="window1">
- <property name="can_focus">False</property>
- <child>
- <object class="GtkVBox" id="prefs_box">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkFrame" id="settings_frame">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkAlignment" id="settings_alignment">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="top_padding">10</property>
- <property name="left_padding">12</property>
- <child>
- <object class="GtkVBox" id="settings_vbox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">5</property>
- <child>
- <object class="GtkCheckButton" id="enabled_checkbutton">
- <property name="label" translatable="yes">Enable web interface</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="ssl_checkbutton">
- <property name="label" translatable="yes">Enable SSL</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="port_hbox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">5</property>
- <child>
- <object class="GtkLabel" id="port_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Listening port:</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="port_spinbutton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
- <property name="primary_icon_sensitive">True</property>
- <property name="secondary_icon_sensitive">True</property>
- <property name="adjustment">adjustment1</property>
- <property name="numeric">True</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="settings_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">&lt;b&gt;Settings&lt;/b&gt;</property>
- <property name="use_markup">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
-</interface>
diff --git a/deluge/plugins/WebUi/deluge_webui/gtkui.py b/deluge/plugins/WebUi/deluge_webui/gtkui.py
index ca3a16e..3d19417 100644
--- a/deluge/plugins/WebUi/deluge_webui/gtkui.py
+++ b/deluge/plugins/WebUi/deluge_webui/gtkui.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
#
@@ -11,8 +10,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from gi.repository import Gtk
diff --git a/deluge/plugins/WebUi/deluge_webui/tests/test_plugin_webui.py b/deluge/plugins/WebUi/deluge_webui/tests/test_plugin_webui.py
index 56e1cc0..1badedc 100644
--- a/deluge/plugins/WebUi/deluge_webui/tests/test_plugin_webui.py
+++ b/deluge/plugins/WebUi/deluge_webui/tests/test_plugin_webui.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 bendikro <bro.devel+deluge@gmail.com>
#
@@ -6,44 +5,44 @@
# the additional special exception to link portions of this program with the OpenSSL library.
# See LICENSE for more details.
#
-
-from __future__ import unicode_literals
-
-from twisted.trial import unittest
+import pytest
+import pytest_twisted
import deluge.component as component
from deluge.core.core import Core
from deluge.core.rpcserver import RPCServer
from deluge.tests import common
-from deluge.tests.basetest import BaseTestCase
common.disable_new_release_check()
-class WebUIPluginTestCase(BaseTestCase):
- def set_up(self):
- common.set_tmp_config_dir()
+@pytest.mark.usefixtures('component')
+class TestWebUIPlugin:
+ @pytest_twisted.async_yield_fixture(autouse=True)
+ async def set_up(self, request):
+ self = request.instance
self.rpcserver = RPCServer(listen=False)
self.core = Core()
- return component.start()
+ await component.start()
+
+ yield
- def tear_down(self):
def on_shutdown(result):
del self.rpcserver
del self.core
- return component.shutdown().addCallback(on_shutdown)
+ await component.shutdown().addCallback(on_shutdown)
def test_enable_webui(self):
if 'WebUi' not in self.core.get_available_plugins():
- raise unittest.SkipTest('WebUi plugin not available for testing')
+ pytest.skip('WebUi plugin not available for testing')
d = self.core.enable_plugin('WebUi')
def result_cb(result):
if 'WebUi' not in self.core.get_enabled_plugins():
self.fail('Failed to enable WebUi plugin')
- self.assertTrue(result)
+ assert result
d.addBoth(result_cb)
return d
diff --git a/deluge/plugins/WebUi/setup.py b/deluge/plugins/WebUi/setup.py
index 861a05a..5f2184c 100644
--- a/deluge/plugins/WebUi/setup.py
+++ b/deluge/plugins/WebUi/setup.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
#
diff --git a/deluge/plugins/init.py b/deluge/plugins/init.py
index addeae9..56b3197 100644
--- a/deluge/plugins/init.py
+++ b/deluge/plugins/init.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
#
@@ -10,14 +9,12 @@
"""
This base class is used in plugin's __init__ for the plugin entry points.
"""
-from __future__ import unicode_literals
-
import logging
log = logging.getLogger(__name__)
-class PluginInitBase(object):
+class PluginInitBase:
_plugin_cls = None
def __init__(self, plugin_name):
diff --git a/deluge/plugins/pluginbase.py b/deluge/plugins/pluginbase.py
index e80199d..5dda2f0 100644
--- a/deluge/plugins/pluginbase.py
+++ b/deluge/plugins/pluginbase.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2010 Andrew Resch <andrewresch@gmail.com>
#
@@ -7,8 +6,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import deluge.component as component
@@ -21,7 +18,7 @@ class PluginBase(component.Component):
update_interval = 1
def __init__(self, name):
- super(PluginBase, self).__init__(name, self.update_interval)
+ super().__init__(name, self.update_interval)
def enable(self):
raise NotImplementedError('Need to define an enable method!')
@@ -32,7 +29,7 @@ class PluginBase(component.Component):
class CorePluginBase(PluginBase):
def __init__(self, plugin_name):
- super(CorePluginBase, self).__init__('CorePlugin.' + plugin_name)
+ super().__init__('CorePlugin.' + plugin_name)
# Register RPC methods
component.get('RPCServer').register_object(self, plugin_name.lower())
log.debug('CorePlugin initialized..')
@@ -41,22 +38,22 @@ class CorePluginBase(PluginBase):
component.get('RPCServer').deregister_object(self)
def enable(self):
- super(CorePluginBase, self).enable()
+ super().enable()
def disable(self):
- super(CorePluginBase, self).disable()
+ super().disable()
class Gtk3PluginBase(PluginBase):
def __init__(self, plugin_name):
- super(Gtk3PluginBase, self).__init__('Gtk3Plugin.' + plugin_name)
+ super().__init__('Gtk3Plugin.' + plugin_name)
log.debug('Gtk3Plugin initialized..')
def enable(self):
- super(Gtk3PluginBase, self).enable()
+ super().enable()
def disable(self):
- super(Gtk3PluginBase, self).disable()
+ super().disable()
class WebPluginBase(PluginBase):
@@ -68,7 +65,7 @@ class WebPluginBase(PluginBase):
debug_stylesheets = []
def __init__(self, plugin_name):
- super(WebPluginBase, self).__init__('WebPlugin.' + plugin_name)
+ super().__init__('WebPlugin.' + plugin_name)
# Register JSON rpc methods
component.get('JSON').register_object(self, plugin_name.lower())