summaryrefslogtreecommitdiffstats
path: root/deluge/plugins/Execute
diff options
context:
space:
mode:
Diffstat (limited to 'deluge/plugins/Execute')
-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
9 files changed, 34 insertions, 254 deletions
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>
#