mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-18 08:08:46 +00:00
[Lint] Update pre-commit hook and isort versions
* Fixed black hook requiring Py3.6 to installed locally. Will now assume Py3.6+ in installed. * Added isort traceback in pre-commit flake8 hook fails * Updated versions of Black, Prettier and isort * Keep Flake8 at 3.7.9 due to E402 issue: https://gitlab.com/pycqa/flake8/-/issues/638 * New pyproject config for isort v5 with fixes for Python 2 imports. * Fixed travis config to run Python 3.6 for lint run. Replaced the virtualenv with_system_site_packages config with Travis specific Python config value so lint run doesn't attempt to append with_system_site_packages to Python 3.6 command.
This commit is contained in:
parent
23a48dd01c
commit
610a1bb313
114 changed files with 955 additions and 1034 deletions
|
@ -6,28 +6,29 @@ exclude: >
|
|||
)$
|
||||
repos:
|
||||
- repo: https://github.com/ambv/black
|
||||
rev: 19.10b0
|
||||
rev: 20.8b1
|
||||
hooks:
|
||||
- id: black
|
||||
name: Fmt Black
|
||||
language_version: python3.6
|
||||
- repo: https://github.com/prettier/prettier
|
||||
rev: 1.19.1
|
||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||
rev: v2.2.1
|
||||
hooks:
|
||||
- id: prettier
|
||||
name: Fmt Prettier
|
||||
# Workaround to list modified files only.
|
||||
args: [--list-different]
|
||||
- repo: https://gitlab.com/pycqa/flake8
|
||||
# v3.7.9 due to E402 issue: https://gitlab.com/pycqa/flake8/-/issues/638
|
||||
rev: 3.7.9
|
||||
hooks:
|
||||
- id: flake8
|
||||
name: Chk Flake8
|
||||
additional_dependencies:
|
||||
- flake8-isort==2.7
|
||||
- pep8-naming==0.8.2
|
||||
- flake8-isort==4.0.0
|
||||
- pep8-naming==0.11.1
|
||||
args: [--isort-show-traceback]
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v2.4.0
|
||||
rev: v3.4.0
|
||||
hooks:
|
||||
- id: double-quote-string-fixer
|
||||
name: Fix Double-quotes
|
||||
|
|
23
.travis.yml
23
.travis.yml
|
@ -4,10 +4,8 @@ dist: xenial
|
|||
language: python
|
||||
python:
|
||||
# Travis Xenial Python to support system_site_packages
|
||||
- 3.5
|
||||
- 3.5_with_system_site_packages
|
||||
cache: pip
|
||||
virtualenv:
|
||||
system_site_packages: true
|
||||
|
||||
env:
|
||||
global:
|
||||
|
@ -21,19 +19,20 @@ jobs:
|
|||
include:
|
||||
- name: Unit tests
|
||||
env: TOX_ENV=py3
|
||||
- name: Unit tests - libtorrent 1.2
|
||||
env: TOX_ENV=py3
|
||||
addons:
|
||||
apt:
|
||||
sources: [sourceline: "ppa:libtorrent.org/1.2-daily"]
|
||||
packages: [python3-libtorrent, python3-venv]
|
||||
#~ - name: Unit tests - libtorrent 1.2
|
||||
#~ env: TOX_ENV=py3
|
||||
#~ addons:
|
||||
#~ apt:
|
||||
#~ sources: [sourceline: "ppa:libtorrent.org/1.2-daily"]
|
||||
#~ packages: [python3-libtorrent, python3-venv]
|
||||
- name: Unit tests - Python 2
|
||||
env: TOX_ENV=py27
|
||||
python: 2.7
|
||||
python: 2.7_with_system_site_packages
|
||||
- if: commit_message =~ SECURITY_TEST
|
||||
env: TOX_ENV=security
|
||||
- name: Code linting
|
||||
env: TOX_ENV=lint
|
||||
python: 3.6
|
||||
- name: Docs build
|
||||
env: TOX_ENV=docs
|
||||
- name: GTK unit tests
|
||||
|
@ -73,7 +72,9 @@ install:
|
|||
before_script:
|
||||
- export PYTHONPATH=$PYTHONPATH:$PWD
|
||||
# Verify libtorrent installed and version
|
||||
- python -c "import libtorrent as lt; print(lt.__version__)"
|
||||
- "if [ $TOX_ENV != 'lint' ]; then
|
||||
python -c 'import libtorrent as lt; print(lt.__version__)';
|
||||
fi"
|
||||
# Start xvfb for the GTKUI tests
|
||||
- "if [ $TOX_ENV == 'gtkui' ]; then
|
||||
/sbin/start-stop-daemon --start --quiet --background \
|
||||
|
|
|
@ -43,8 +43,8 @@ try:
|
|||
from urllib.request import pathname2url
|
||||
except ImportError:
|
||||
# PY2 fallback
|
||||
from urlparse import urljoin # pylint: disable=ungrouped-imports
|
||||
from urllib import pathname2url, unquote_plus # pylint: disable=ungrouped-imports
|
||||
from urlparse import urljoin # pylint: disable=ungrouped-imports
|
||||
|
||||
# Windows workaround for HTTPS requests requiring certificate authority bundle.
|
||||
# see: https://twistedmatrix.com/trac/ticket/9209
|
||||
|
@ -1013,9 +1013,9 @@ def decode_bytes(byte_str, encoding='utf8'):
|
|||
if encoding.lower() not in ['utf8', 'utf-8']:
|
||||
encodings.insert(0, lambda: (encoding, 'strict'))
|
||||
|
||||
for l in encodings:
|
||||
for enc in encodings:
|
||||
try:
|
||||
return byte_str.decode(*l())
|
||||
return byte_str.decode(*enc())
|
||||
except UnicodeDecodeError:
|
||||
pass
|
||||
return ''
|
||||
|
@ -1144,6 +1144,7 @@ AUTH_LEVEL_DEFAULT = AUTH_LEVEL_NORMAL
|
|||
|
||||
def create_auth_file():
|
||||
import stat
|
||||
|
||||
import deluge.configmanager
|
||||
|
||||
auth_file = deluge.configmanager.get_config_dir('auth')
|
||||
|
@ -1159,6 +1160,7 @@ def create_auth_file():
|
|||
def create_localclient_account(append=False):
|
||||
import random
|
||||
from hashlib import sha1 as sha
|
||||
|
||||
import deluge.configmanager
|
||||
|
||||
auth_file = deluge.configmanager.get_config_dir('auth')
|
||||
|
@ -1244,8 +1246,7 @@ def set_env_variable(name, value):
|
|||
os.environ[name] = value.encode('utf8')
|
||||
|
||||
if windows_check():
|
||||
from ctypes import windll
|
||||
from ctypes import cdll
|
||||
from ctypes import cdll, windll
|
||||
|
||||
# Update the copy maintained by Windows (so SysInternals Process Explorer sees it)
|
||||
result = windll.kernel32.SetEnvironmentVariableW(name, value)
|
||||
|
@ -1274,7 +1275,7 @@ def unicode_argv():
|
|||
# Versions 2.x of Python don't support Unicode in sys.argv on
|
||||
# Windows, with the underlying Windows API instead replacing multi-byte
|
||||
# characters with '?'.
|
||||
from ctypes import POINTER, byref, cdll, c_int, windll
|
||||
from ctypes import POINTER, byref, c_int, cdll, windll
|
||||
from ctypes.wintypes import LPCWSTR, LPWSTR
|
||||
|
||||
get_cmd_linew = cdll.kernel32.GetCommandLineW
|
||||
|
|
|
@ -204,9 +204,9 @@ class Config(object):
|
|||
global callLater
|
||||
if callLater is None:
|
||||
# Must import here and not at the top or it will throw ReactorAlreadyInstalledError
|
||||
from twisted.internet.reactor import (
|
||||
from twisted.internet.reactor import ( # pylint: disable=redefined-outer-name
|
||||
callLater,
|
||||
) # pylint: disable=redefined-outer-name
|
||||
)
|
||||
# Run the set_function for this key if any
|
||||
try:
|
||||
for func in self.__set_functions[key]:
|
||||
|
@ -304,9 +304,9 @@ class Config(object):
|
|||
global callLater
|
||||
if callLater is None:
|
||||
# Must import here and not at the top or it will throw ReactorAlreadyInstalledError
|
||||
from twisted.internet.reactor import (
|
||||
from twisted.internet.reactor import ( # pylint: disable=redefined-outer-name
|
||||
callLater,
|
||||
) # pylint: disable=redefined-outer-name
|
||||
)
|
||||
|
||||
# We set the save_timer for 5 seconds if not already set
|
||||
if not self._save_timer or not self._save_timer.active():
|
||||
|
|
|
@ -57,10 +57,10 @@ from deluge.event import (
|
|||
from deluge.httpdownloader import download_file
|
||||
|
||||
try:
|
||||
from urllib.request import urlopen, URLError
|
||||
from urllib.request import URLError, urlopen
|
||||
except ImportError:
|
||||
# PY2 fallback
|
||||
from urllib2 import urlopen, URLError
|
||||
from urllib2 import URLError, urlopen
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -200,6 +200,7 @@ class Daemon(object):
|
|||
if rpc not in self.get_method_list():
|
||||
return False
|
||||
|
||||
return self.rpcserver.get_session_auth_level() >= self.rpcserver.get_rpc_auth_level(
|
||||
rpc
|
||||
return (
|
||||
self.rpcserver.get_session_auth_level()
|
||||
>= self.rpcserver.get_rpc_auth_level(rpc)
|
||||
)
|
||||
|
|
|
@ -100,9 +100,7 @@ def tracker_error_filter(torrent_ids, values):
|
|||
|
||||
|
||||
class FilterManager(component.Component):
|
||||
"""FilterManager
|
||||
|
||||
"""
|
||||
"""FilterManager"""
|
||||
|
||||
def __init__(self, core):
|
||||
component.Component.__init__(self, 'FilterManager')
|
||||
|
|
|
@ -190,23 +190,11 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, {
|
|||
|
||||
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();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -324,18 +324,14 @@ 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) {
|
||||
me.accounts.loadData([[user]], false);
|
||||
Ext.getCmp('owner')
|
||||
.setValue(user)
|
||||
.disable(true);
|
||||
Ext.getCmp('owner').setValue(user).disable(true);
|
||||
},
|
||||
scope: this,
|
||||
});
|
||||
|
|
|
@ -275,23 +275,11 @@ Deluge.ux.preferences.ExecutePage = Ext.extend(Ext.Panel, {
|
|||
|
||||
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();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -110,10 +110,7 @@ Deluge.ux.AddLabelWindow = Ext.extend(Ext.Window, {
|
|||
|
||||
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);
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ except ImportError:
|
|||
|
||||
try:
|
||||
require_version('Notify', '0.7')
|
||||
from gi.repository import Notify, GLib
|
||||
from gi.repository import GLib, Notify
|
||||
except (ValueError, ImportError):
|
||||
POPUP_AVAILABLE = False
|
||||
else:
|
||||
|
|
|
@ -72,14 +72,15 @@ 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_stats import graph, gtkui
|
||||
|
||||
from deluge.configmanager import ConfigManager
|
||||
from deluge.ui.gtkui.gtkui import DEFAULT_PREFS
|
||||
from deluge.ui.gtkui.mainwindow import MainWindow
|
||||
from deluge.ui.gtkui.pluginmanager import PluginManager
|
||||
from deluge.ui.gtkui.preferences import Preferences
|
||||
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)
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ try:
|
|||
from urllib.request import url2pathname
|
||||
except ImportError:
|
||||
# PY2 fallback
|
||||
from urlparse import urlparse # pylint: disable=ungrouped-imports
|
||||
from urllib import url2pathname # pylint: disable=ungrouped-imports
|
||||
from urlparse import urlparse # pylint: disable=ungrouped-imports
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
|
|
@ -106,8 +106,8 @@ class Command(BaseCommand):
|
|||
|
||||
elif options.install:
|
||||
import os.path
|
||||
from base64 import b64encode
|
||||
import shutil
|
||||
from base64 import b64encode
|
||||
|
||||
filepath = options.install
|
||||
|
||||
|
|
|
@ -112,9 +112,9 @@ class Console(UI):
|
|||
)
|
||||
# To properly print help message for the console commands ( e.g. deluge-console info -h),
|
||||
# we add a subparser for each command which will trigger the help/usage when given
|
||||
from deluge.ui.console.parser import (
|
||||
from deluge.ui.console.parser import ( # import here because (see top)
|
||||
ConsoleCommandParser,
|
||||
) # import here because (see top)
|
||||
)
|
||||
|
||||
self.console_parser = ConsoleCommandParser(
|
||||
parents=[self.parser],
|
||||
|
|
|
@ -26,9 +26,9 @@ except ImportError:
|
|||
|
||||
try:
|
||||
import signal
|
||||
from fcntl import ioctl
|
||||
import termios
|
||||
import struct
|
||||
import termios
|
||||
from fcntl import ioctl
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
|
|
@ -1061,9 +1061,9 @@ class ComboInput(InputField):
|
|||
# No match, so start at beginning
|
||||
select_in_range(0, selected)
|
||||
|
||||
from deluge.ui.console.widgets.popup import (
|
||||
from deluge.ui.console.widgets.popup import ( # Must import here
|
||||
SelectablePopup,
|
||||
) # Must import here
|
||||
)
|
||||
|
||||
select_popup = SelectablePopup(
|
||||
self.parent,
|
||||
|
|
|
@ -40,9 +40,10 @@ class Gtk(UI):
|
|||
|
||||
def start(self):
|
||||
super(Gtk, self).start()
|
||||
from .gtkui import GtkUI
|
||||
import deluge.common
|
||||
|
||||
from .gtkui import GtkUI
|
||||
|
||||
def run(options):
|
||||
try:
|
||||
gtkui = GtkUI(options)
|
||||
|
|
|
@ -159,8 +159,8 @@ class ErrorDialog(BaseDialog):
|
|||
)
|
||||
|
||||
if traceback:
|
||||
import traceback
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
tb = sys.exc_info()
|
||||
tb = traceback.format_exc(tb[2])
|
||||
|
|
|
@ -75,7 +75,7 @@ set_prgname('deluge')
|
|||
log = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
from setproctitle import setproctitle, getproctitle
|
||||
from setproctitle import getproctitle, setproctitle
|
||||
except ImportError:
|
||||
|
||||
def setproctitle(title):
|
||||
|
|
|
@ -31,8 +31,8 @@ try:
|
|||
from urllib.request import url2pathname
|
||||
except ImportError:
|
||||
# PY2 fallback
|
||||
from urlparse import urlparse # pylint: disable=ungrouped-imports
|
||||
from urllib import url2pathname # pylint: disable=ungrouped-imports
|
||||
from urlparse import urlparse # pylint: disable=ungrouped-imports
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -84,8 +84,8 @@ class IPCInterface(component.Component):
|
|||
if windows_check():
|
||||
# If we're on windows we need to check the global mutex to see if deluge is
|
||||
# already running.
|
||||
import win32event
|
||||
import win32api
|
||||
import win32event
|
||||
import winerror
|
||||
|
||||
self.mutex = win32event.CreateMutex(None, False, 'deluge')
|
||||
|
|
|
@ -627,8 +627,7 @@ class ListView(object):
|
|||
unique=False,
|
||||
default_sort=False,
|
||||
):
|
||||
"""Add a text column to the listview. Only the header name is required.
|
||||
"""
|
||||
"""Add a text column to the listview. Only the header name is required."""
|
||||
render = Gtk.CellRendererText()
|
||||
self.add_column(
|
||||
header,
|
||||
|
|
|
@ -305,8 +305,8 @@ class PeersTab(Tab):
|
|||
peer_ip = peer['ip']
|
||||
else:
|
||||
# This is an IPv6 address
|
||||
import socket
|
||||
import binascii
|
||||
import socket
|
||||
|
||||
# Split out the :port
|
||||
ip = ':'.join(peer['ip'].split(':')[:-1])
|
||||
|
|
|
@ -1180,8 +1180,8 @@ class Preferences(component.Component):
|
|||
chooser.destroy()
|
||||
return
|
||||
|
||||
from base64 import b64encode
|
||||
import shutil
|
||||
from base64 import b64encode
|
||||
|
||||
filename = os.path.split(filepath)[1]
|
||||
shutil.copyfile(filepath, os.path.join(get_config_dir(), 'plugins', filename))
|
||||
|
|
|
@ -112,11 +112,11 @@ class TorrentDetails(component.Component):
|
|||
self.tabs = {}
|
||||
|
||||
# Add the default tabs
|
||||
from .status_tab import StatusTab
|
||||
from .details_tab import DetailsTab
|
||||
from .files_tab import FilesTab
|
||||
from .peers_tab import PeersTab
|
||||
from .options_tab import OptionsTab
|
||||
from .peers_tab import PeersTab
|
||||
from .status_tab import StatusTab
|
||||
from .trackers_tab import TrackersTab
|
||||
|
||||
default_tabs = {
|
||||
|
|
|
@ -60,10 +60,7 @@ Deluge.AddTrackerWindow = Ext.extend(Ext.Window, {
|
|||
},
|
||||
|
||||
onAddClick: function () {
|
||||
var trackers = this.form
|
||||
.getForm()
|
||||
.findField('trackers')
|
||||
.getValue();
|
||||
var trackers = this.form.getForm().findField('trackers').getValue();
|
||||
trackers = trackers.split('\n');
|
||||
|
||||
var cleaned = [];
|
||||
|
@ -78,17 +75,11 @@ Deluge.AddTrackerWindow = Ext.extend(Ext.Window, {
|
|||
);
|
||||
this.fireEvent('add', cleaned);
|
||||
this.hide();
|
||||
this.form
|
||||
.getForm()
|
||||
.findField('trackers')
|
||||
.setValue('');
|
||||
this.form.getForm().findField('trackers').setValue('');
|
||||
},
|
||||
|
||||
onCancelClick: function () {
|
||||
this.form
|
||||
.getForm()
|
||||
.findField('trackers')
|
||||
.setValue('');
|
||||
this.form.getForm().findField('trackers').setValue('');
|
||||
this.hide();
|
||||
},
|
||||
});
|
||||
|
|
|
@ -26,9 +26,7 @@ Ext.state.Manager.setProvider(
|
|||
// configurable parameters
|
||||
Ext.apply(Ext, {
|
||||
escapeHTML: function (text) {
|
||||
text = String(text)
|
||||
.replace('<', '<')
|
||||
.replace('>', '>');
|
||||
text = String(text).replace('<', '<').replace('>', '>');
|
||||
return text.replace('&', '&');
|
||||
},
|
||||
|
||||
|
|
|
@ -83,14 +83,8 @@ Deluge.EditConnectionWindow = Ext.extend(Ext.Window, {
|
|||
show: function (connection) {
|
||||
Deluge.EditConnectionWindow.superclass.show.call(this);
|
||||
|
||||
this.form
|
||||
.getForm()
|
||||
.findField('host')
|
||||
.setValue(connection.get('host'));
|
||||
this.form
|
||||
.getForm()
|
||||
.findField('port')
|
||||
.setValue(connection.get('port'));
|
||||
this.form.getForm().findField('host').setValue(connection.get('host'));
|
||||
this.form.getForm().findField('port').setValue(connection.get('port'));
|
||||
this.form
|
||||
.getForm()
|
||||
.findField('username')
|
||||
|
|
|
@ -54,10 +54,7 @@ Deluge.EditTrackerWindow = Ext.extend(Ext.Window, {
|
|||
Deluge.EditTrackerWindow.superclass.show.call(this);
|
||||
|
||||
this.record = record;
|
||||
this.form
|
||||
.getForm()
|
||||
.findField('tracker')
|
||||
.setValue(record.data['url']);
|
||||
this.form.getForm().findField('tracker').setValue(record.data['url']);
|
||||
},
|
||||
|
||||
onCancelClick: function () {
|
||||
|
@ -65,17 +62,11 @@ Deluge.EditTrackerWindow = Ext.extend(Ext.Window, {
|
|||
},
|
||||
|
||||
onHide: function () {
|
||||
this.form
|
||||
.getForm()
|
||||
.findField('tracker')
|
||||
.setValue('');
|
||||
this.form.getForm().findField('tracker').setValue('');
|
||||
},
|
||||
|
||||
onSaveClick: function () {
|
||||
var url = this.form
|
||||
.getForm()
|
||||
.findField('tracker')
|
||||
.getValue();
|
||||
var url = this.form.getForm().findField('tracker').getValue();
|
||||
this.record.set('url', url);
|
||||
this.record.commit();
|
||||
this.hide();
|
||||
|
|
|
@ -194,18 +194,12 @@ Deluge.EditTrackersWindow = Ext.extend(Ext.Window, {
|
|||
|
||||
onSelect: function (list) {
|
||||
if (list.getSelectionCount()) {
|
||||
this.panel
|
||||
.getBottomToolbar()
|
||||
.items.get(4)
|
||||
.enable();
|
||||
this.panel.getBottomToolbar().items.get(4).enable();
|
||||
}
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
this.panel
|
||||
.getBottomToolbar()
|
||||
.items.get(4)
|
||||
.disable();
|
||||
this.panel.getBottomToolbar().items.get(4).disable();
|
||||
var r = deluge.torrents.getSelected();
|
||||
this.torrentId = r.id;
|
||||
deluge.client.core.get_torrent_status(r.id, ['trackers'], {
|
||||
|
|
|
@ -74,9 +74,6 @@ Deluge.OtherLimitWindow = Ext.extend(Ext.Window, {
|
|||
},
|
||||
|
||||
doFocusField: function () {
|
||||
this.form
|
||||
.getForm()
|
||||
.findField('limit')
|
||||
.focus(true, 10);
|
||||
this.form.getForm().findField('limit').focus(true, 10);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -50,10 +50,7 @@ Ext.ux.form.ToggleField = Ext.extend(Ext.form.Field, {
|
|||
this.panel.add(this.input);
|
||||
this.panel.doLayout();
|
||||
|
||||
this.toggle
|
||||
.getEl()
|
||||
.parent()
|
||||
.setStyle('padding-right', '10px');
|
||||
this.toggle.getEl().parent().setStyle('padding-right', '10px');
|
||||
}
|
||||
Ext.ux.form.ToggleField.superclass.onRender.call(this, ct, position);
|
||||
},
|
||||
|
|
|
@ -6,3 +6,8 @@ requires = [
|
|||
|
||||
[tool.black]
|
||||
skip-string-normalization = true
|
||||
|
||||
[tool.isort]
|
||||
profile = "black"
|
||||
# Python 2 stdlib
|
||||
extra_standard_library = ["urlparse", "HTMLParser", "urllib2"]
|
||||
|
|
|
@ -3,7 +3,7 @@ pytest-twisted
|
|||
pytest-cov
|
||||
mock
|
||||
pre-commit
|
||||
flake8
|
||||
flake8<=3.7.9
|
||||
flake8-quotes
|
||||
flake8-isort
|
||||
pep8-naming
|
||||
|
|
18
setup.cfg
18
setup.cfg
|
@ -24,24 +24,6 @@ includes = glib, gio, cairo, pango, pangocairo, atk, gobject, gtk.keysyms,
|
|||
HTMLParser
|
||||
frameworks = CoreFoundation, Foundation, AppKit
|
||||
|
||||
[isort]
|
||||
known_standard_library = future_builtins
|
||||
known_third_party =
|
||||
# Ignore gtk modules, primarily for tox testing.
|
||||
cairo, gi,
|
||||
# Ignore other module dependencies for pre-commit isort.
|
||||
twisted, OpenSSL, pytest, recommonmark, chardet, pkg_resources, zope, mock,
|
||||
sphinx, rencode, six, mako
|
||||
known_first_party = msgfmt, deluge
|
||||
order_by_type = true
|
||||
not_skip = __init__.py
|
||||
# Black compatible settings
|
||||
multi_line_output=3
|
||||
include_trailing_comma=True
|
||||
force_grid_wrap=0
|
||||
line_length=88
|
||||
use_parentheses=True
|
||||
|
||||
[flake8]
|
||||
max-line-length = 120
|
||||
builtins = _,_n,__request__
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue