summaryrefslogtreecommitdiffstats
path: root/deluge/plugins/Label/deluge_label
diff options
context:
space:
mode:
Diffstat (limited to 'deluge/plugins/Label/deluge_label')
-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
12 files changed, 54 insertions, 102 deletions
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