8862 Commits

Author SHA1 Message Date
kbdserver
7d896599b8 [GTK] Fix speed appearing in blanks cells
In TorrentView and PeersTabView, when moving the mouse pointer through
rows, the value in download and upload speed columns can be overwritten
by value from previous row cell.

The solution is to disable return by cached condition in function
cell_data_speed.

Discussion: https://github.com/deluge-torrent/deluge/pull/200#issuecomment-424907571

Removed debugging code.

Co-authored-by: Calum Lind <calumlind+deluge@gmail.com>
2018-10-14 10:52:08 +01:00
Calum Lind
55aee2b00f [Common] Fix incorrect path in TorrentInfo
Refactoring for Python 3 did not account for the `self._files` using an
updated info_dict so simplify code by updating in the files for loop.

Added test that TorrentInfo.files returns the correct structure.
2018-10-14 10:51:08 +01:00
Calum Lind
10d39c83cb [WebUI] Fix error escaping translated text
In a previous commit d4023e7dde42 removed a decode for Python 3 but
with translated text returned by gettext encoded on Python 2 the
escape function would raise a UnicodeDecodeError trying to use ascii
to decode.

The fix is to decode the message returned by gettext on Python 2.
2018-10-13 22:57:28 +01:00
Calum Lind
0b2cb7539f Cleanup Tox and CI configs
- Use the apt addon for installing libtorrent package.
- Start the py3 test sooner as it is slow to complete.
- Add if conditions for gtkui test dependencies.
- Remove Appveyor tests that are taken care of by Travis.
2018-10-10 18:50:41 +01:00
Calum Lind
6fdbf0ba5d Update tox and CI for Python 3 2018-10-10 17:57:02 +01:00
Calum Lind
a980f8e959 [WebUI] Allow multiple torrent uploads in Add dialog
Add a new `multiple` field to FileUploadField to allow selecting
multiple files. Include a fallback for if browser does not support
multiple file selection.

Update Add window to upload and parse multiple torrent files at once.
2018-10-10 17:57:02 +01:00
Calum Lind
c90cf301df [WebUI] Use application/json in header 2018-10-10 17:57:02 +01:00
Calum Lind
6f06cd5ebc [WebUI|Py3] Refactor content_type check
Simplify getting content_type from request to prevent str/bytes mixup.
2018-10-10 17:57:02 +01:00
Calum Lind
86de5657ff [WebUI|Py3] Fix and refactor torrent upload 2018-10-10 17:57:02 +01:00
Calum Lind
4a335eeb61 [Tests] json loads Python 3.5 compatible
json.loads in Python 3.6 accepts str or bytes but Python 3.5 is str
only so decode.
2018-10-10 14:41:10 +01:00
Calum Lind
86d582d52a Remove debugging log line 2018-10-10 14:41:10 +01:00
Calum Lind
673b6653a3 [Py3] Fix TorrentInfo info_dict decoding 2018-10-10 14:41:10 +01:00
Calum Lind
41732fe38b [WebUI|Tests] Fix json_api tests for Python3 2018-10-10 14:41:10 +01:00
Calum Lind
5964bcf897 [Tests|Py3] Fix prefetch metdata test 2018-10-10 14:41:10 +01:00
Calum Lind
3ed4a6e834 [WebUI] Fixes for login auth on Python 3
Remove obsolete password check code.
2018-10-10 14:41:10 +01:00
Calum Lind
20fa106b8b Update pre-commit config
The prettier hook was missing a trailing slash so omitting css files.

Add a trailing space fix hook and fix issues.
2018-10-08 14:49:36 +01:00
Calum Lind
654e2af4e5 [WebUI] Fix browser Flash plugin warning
Do not perform flash player version detection using the fix from here:
  https://github.com/georchestra/georchestra/issues/902
2018-10-08 14:47:27 +01:00
Calum Lind
d5dea44689 [WebUI] Update extjs to 3.4.1.1
Better late than never...

http://cdn.sencha.com/ext/commercial/3.4.1.1/release-notes.html
2018-10-08 14:47:27 +01:00
Calum Lind
5743382c65 Remove Pipfile and pipenv
For now using requirements files and tox to setup a dev env so to
prevent confusion or stagnation of Pipfile remove it and pipenv
documentation.
2018-10-08 12:21:00 +01:00
Calum Lind
39f37e6133 [Tests] Remove slimit dependency
The changes to the minify script mean we no longer require slimit.
2018-10-08 12:19:03 +01:00
DjLegolas
0ed3554f95 [WebUI] Copy non-minified JS file if slimit missing
This will remove the setup dependency in "slimit" package.
In case "slimit" is missing, the non-minified JS files will be copied
as is to the build.
"slimit" is marked as a dependency for development process only.
2018-10-08 12:13:21 +01:00
Kirill Romanov
ba6af99b05 [Notifications] Set notification desktop entry hint
Due to Gnome Guidelines https://wiki.gnome.org/Initiatives/GnomeGoals/NotificationSource
2018-10-08 12:11:07 +01:00
Calum Lind
9e29fe4111 [Tests] Lint with pre-commit
- Add lint section to tox.
- Replace flake8 with lint on Travis and remove commented out sections.
- Remove flake8 from appveyor to reduce sequential testing time.
2018-10-05 18:45:37 +01:00
Calum Lind
a8a4fb69c0 [Lint] Exclude js and css from EOF fixer
- When running pre-commit on all files it is picking up minified js and
  css files. Since prettier will format correctly the source files ignore
  them in end-of-file fixer.
- The template files in web docs can be ignored too.
- Removed the unneeded `pre-commit-hooks` dependency as pre-commit
  resolves that itself.
- Include files fixed by pre-commit.
2018-10-05 18:45:37 +01:00
Calum Lind
6cf13d112b [Tests] Remove debug traceback 2018-10-05 13:23:45 +01:00
Calum Lind
6973f96f8c [Tests] Update tox and CI configs
- Add new requirements files to make it easier to install deps.

- Tox changes
  - Update tox to use new requirements files.
  - Tweak heading styles.
  - Add development environment command `devenv`.
  - Remove testenv command as it would run on devenv creation.

- Travis changes
  - Now uses xenial as trusty is very old now.
  - Trial run disabled to speed up tests.
  - Add tox-venv for Python 3 support.
  - Only install testssl if running security tests.

- Appveyor
  - Add tox-venv for Python 3 support.
  - Use requirements file for non-tox.
  - Remove trial run to speed up testing.
2018-10-05 13:23:45 +01:00
Calum Lind
0548bdb655 [Lint] Add pre-commit config
- Added a pre-commit config for code linting and formatting. It will
  auto-format python, javascript, CSS, YAML and markdown files to save
  manually doing so. To install:

      pip install pre-commit
      pre-commit install

- Added a default virtual environment directory to gitignore.
2018-10-05 09:45:42 +01:00
Calum Lind
36606fc448 [Docs] Add markdown support
- Use recommonmark to enable use of markdown files in docs.
- Fix theme not specified
- Remove unused spelling module.
- Cleanup mocking modules in conf so building docs requires only Sphinx.
- Simplify tox section, including use of requirements-docs file. Added
  slimit dependency for sdist-ing deluge package.
2018-10-04 15:53:42 +01:00
Calum Lind
c415b097fe Cleanup outgoing_interface code and help text
- Remove is_ip check as libtorrent does accept IP address for this setting.
  See: https://github.com/arvidn/libtorrent/issues/3087
- Use consistent wording for help text.
2018-10-04 10:51:20 +01:00
Calum Lind
970fad7557 [GTK] Fix column name missing translation markup
With non-English languages this lookup would fail without gettext
translation of the column name.

A better solution is to not use the translatable column title as an
index but this is a quick fix for now.
2018-10-04 10:39:48 +01:00
Calum Lind
358ff74d0e [Lint] Format files with Prettier
Use Prettier to auto-format javascript, CSS and YAML files so that less
manual work is involved and style is consistent across project.
2018-10-03 18:16:09 +01:00
Calum Lind
b1cdc32f73 [Lint] Use Black to auto-format code
The move to using auto-formatter makes it easier to read, submit and
speeds up development time. https://github.com/ambv/black/

Although I would prefer 79 chars, the default line length of 88 chars
used by black suffices. The flake8 line length remains at 120 chars
since black does not touch comments or docstrings and this will require
another round of fixes.

The only black setting that is not standard is the use of double-quotes
for strings so disabled any formatting of these. Note however that
flake8 will still flag usage of double-quotes. I may change my mind on
double vs single quotes but for now leave them.

A new pyproject.toml file has been created for black configuration.
2018-10-03 15:21:53 +01:00
Calum Lind
bcca07443c [Common] Fix config missing value assignment 2018-09-30 14:58:11 +01:00
Calum Lind
67d9c2efb4 [Core] Fix saving listen_interface as None
A mistake in refactoring meant that listen_interface was reset to None
on shutdown.
2018-09-30 14:58:03 +01:00
Calum Lind
34b0fdff1d [Core] Retain magnet details when loading state
It is useful to keep the magnet uri even with the torrent_info. When
adding the torrent magnet details are only used if torrent_info is not
available.
2018-09-28 15:01:34 +01:00
Calum Lind
f93e5e60b5 [Core] Refactor session status code
Simplify the methods by initialising the session_status dict using
libtorrent session_stats_metrics and rate keys.

Instead of first looking for deprecated keys use exception then lookup.

Added a few more tests.
2018-09-28 15:01:34 +01:00
Calum Lind
d8b1e2701c [#3080] Fix torrent reappearing on restart
If a magnet is added to new Deluge state, then deleted, it will reappear
on restart.

The problem results from torrents requiring both state and torrent file
but magnet only rely on the state file and the save_state code not
saving if the torrent list is empty. So torrents won't be loaded as
their torrent files have been deleted but magnets details remain in
state file and are loaded again on restart.

The fix is to always save the state file even if the state is empty.
2018-09-27 10:56:58 +01:00
Calum Lind
abf4c345f0 [#2398|GTK] Update prefetching magnet metadata in AddTorrent dialog
The new code automatically attemps to fetch magnet file details from
core while displaying a 'waiting' message.
2018-09-26 14:18:52 +01:00
Calum Lind
a09334e116 [GTK] Refactor AddTorrent dialog update config scoping
- Fix a potential scoping issue with callback function by moving to
class method and adding requried parameters.
- Remove unneeded return statements and variable.
2018-09-26 14:18:52 +01:00
Calum Lind
57ad9a25da [GTK] Fix AddTorrent dialog title count
Use the treemodel signals to keep the torrent count in the dialog
title correct.
2018-09-26 14:18:52 +01:00
Calum Lind
5a2990ff90 [Core] Handle already prefetching magnet metadata 2018-09-26 14:18:52 +01:00
Calum Lind
759a618f74 [Core] Tweaks to prefetch metadata method
- Disable the magnet from being auto_managed so it starts immediately.
- Reduce the default timeout to 30secs.
- Use the generic tempfile dir.
- Move callback method to be class method
2018-09-26 14:18:52 +01:00
Calum Lind
23f1cfc926 [Core] Assign magnet arg if magnet URI in filename
A magnet that prefetched the metadata is added as a normal torrent but
with the filename set to the magnet URI. So we need to assign the URI to
magnet arg and set filename to None before creating Torrent object.

Updated the is_magnet function to prevent AttributeError with None type.
2018-09-26 14:18:52 +01:00
Calum Lind
57ea5ef5da [GTK] Set default file priority to 4 in add dialog 2018-09-26 14:18:52 +01:00
Calum Lind
944dc1659f [Core] Fix UI file priorities out-of-sync with libtorrent
The file priorities were not updating correctly in the UI and it was
found that in lt 1.1 file priorities are now updated asynchonously so we
cannot get the values immediately. So only update the options
file_priorities if they are empty.
2018-09-26 14:18:52 +01:00
Calum Lind
2dc157578e [GTK] Refactor torrent_liststore appending in AddTorrentDialog
The add_from_torrent and add_from_magnet shared common code so refactor
into methods for reuse.
2018-09-26 11:08:30 +01:00
Calum Lind
8a59216061 [#2398|GTKUI] Fetch magnet files details in Add Dialog 2018-09-26 11:08:30 +01:00
Calum Lind
cc1807cf97 Fix travis docs failing with Sphinx 1.8.0
Sphinx pinned to 1.7

See sphinx-doc/sphinx#5417
2018-09-14 16:09:20 +01:00
Calum Lind
63b7f6d382 [Tests] Add pytest-twisted to tox deps 2018-09-14 16:06:06 +01:00
Calum Lind
5c4cbf58c5 [Tests] Fix UnicodeWarning for gzipped file comparison 2018-09-14 16:06:06 +01:00