With key shortcuts set in the glade files it is not easy to change
the shortcuts on macOS.
Add AccelPaths to each MenuItem to allow adding or modifying accelerator
in codes. Uses the recommended format `<Deluge-MainWindow>/MenuName`
Update menubar code to use new functionality, taking advantage of
accelerator_parse to specify accelerators as strings instead of Gdk
flags.
A future idea would be to use `Gtk.AccelMap.load` to have shortcuts
loaded from user config.
Co-authored-by: Gregorio Litenstein <g.litenstein@gmail.com>
Simplify the code for setting the base path, both via headers and
config. Replaced putchild since it is not recommended for dynamic
paths and overriding getChildWithDefault provides a proper solution.
This also fixes recursive base path problem with previous code where
appending base paths to URL would still return Deluge web e.g.
http://localhost:8112/deluge/deluge/deluge
Removed getChild override by consolidating empty path conditional to
getChildWithDefault. This simplifies and combines the returning of
TopLevel resource for root path or base path.
Added workaround for test logfile error with forwardslash in filename
Error in test_rename_unicode:
TypeError: object MagicMock can't be used in 'await' expression
Fixed by using AsyncMock that can be awaited.
Added backport asyncmock for Python 3.7
The component fixture was warning about existing registered components since
the standalone client was setup before the componentregistry test was performed.
The problem is due to fixture ordering with the setup fixture running
first since it was marked with autouse followed by component fixture.
* Fixed warning by moving component fixture as a dependency of the set_up fixture
* Cleaned up unneeded code
* Added try..except to catch CorePluginBase KeyError deregistering
RPCServer since component fixture already removed it.
* Ignore test-specific Twisted readBody warnings
The input is being passed as `str` instead of `int`, so added a
conversion only if the string is indeed a decimal number.
In addition, closing the add host popup after adding it.
Closes: https://dev.deluge-torrent.org/ticket/3538
When in console, and adding a new host with an invalid port number, the
console starts printing many exceptions regarding the value.
Therefor, we will make sure that the port value is between 0 and 65535.
Improve readability
Move imports available on Windows out of try..except.
For future reference in Python 3.11 termios now has window size methods
but the added complexity of handling older Python versions is not worth
it.
https://docs.python.org/3/library/termios.html#termios.tcgetwinsize
When adding a new torrent, there is a problem changing the path on
Windows machines, due to the difference between the way the files are
being read from the torrent and how we handle them in addtorrentdialog.
This effects both changing and showing the files in the UI.
Now, all path seperator is being considered and converted to slash '/'.
Closes: https://dev.deluge-torrent.org/ticket/3541
Closes: https://github.com/deluge-torrent/deluge/pull/395
Update to latest version of isort to fix install error:
RuntimeError: The Poetry configuration is invalid:
- [extras.pipfile_deprecated_finder.2] 'pip-shims<=0.3.4' does not match '^[a-zA-Z-_.0-9]+$'
Also update the Linting CI to latest version
GitHub pytest runner stalling with the following error:
[Errno 2] No such file or directory: '/opt/hostedtoolcache/Python/3.10.8/x64/lib/python3.10/site-packages/deluge/plugins'
This is related to the editable install of Deluge via pip
pip install -e .
and the custom resource_filename in deluge.common is the source of the
problem where a DistInfoDistribution returns a different path to
EggInfoDistribution.
Working egg-info install
>>> pkg_resources.get_distribution('Deluge')
deluge 2.1.1.dev8 (/home/user/deluge)
>>> type(pkg_resources.get_distribution('Deluge'))
<class 'pkg_resources.EggInfoDistribution'>
>>> pkg_resources.resource_filename('deluge', 'plugins')
'/home/user/deluge/deluge/plugins'
This can identified by the `deluge.egg-info` directory in source
directory.
Broken dist-info install
>>> pkg_resources.get_distribution('Deluge')
deluge 2.1.1.dev8 (/opt/hostedtoolcache/Python/3.10.8/x64/lib/python3.10/site-packages)
>>> type(pkg_resources.get_distribution('Deluge'))
<class 'pkg_resources.DistInfoDistribution'>
>>> pkg_resources.resource_filename('deluge', 'plugins')
'/home/user/deluge/deluge/plugins'
This can be worked around by setting an env var that enables legacy mode
but long-term need to replace the custom resource_filename and replace
usage of pkg_resources.
https://setuptools.pypa.io/en/latest/userguide/development_mode.html#legacy-behaviorhttps://setuptools.pypa.io/en/latest/pkg_resources.html
The enchant package was renamed for version 2 to enchant-2 and original
enchant package removed in Ubuntu 22.04 so docs workflow failed
Fixed by using latest package and specifying ubuntu version to avoid
unexpected failures in future.
Magnets with trackers specified with tr.x param were not being unquoted
so unusable raw tracker string was being set.
Fixed by unquoting tracker and adding test
See-also: https://dev.deluge-torrent.org/ticket/2716
The changes to remove deprecated lt methods didn't account for magnet
trackers so magnets are missing trackers when added.
Previously the addition of trackers was handled by libtorrent when a url
was passed in add_torrent_params. The url parameter is deprecated so
instead we need to add both the info_hash and trackers.
Trac: https://dev.deluge-torrent.org/ticket/3530
A recent dependency change caused the tests running on GitHub Actions
under Python 3.10.5 on Windows to fail when starting pytest run:
...
INTERNALERROR> File "<frozen importlib._bootstrap>", line 123, in acquire
INTERNALERROR> KeyError: xxxx
The cause seems to have been a newer version of chardet package released
recently.
* Fixed by pinning chardet to v4
* Also pin Windows version to 2019 to match packaging workflow
See-also: https://github.com/deluge-torrent/deluge/actions/runs/2578427588
Issue: https://github.com/chardet/chardet/issues/265
Fix rendering issues in ReadTheDocs by specifying latest version of
sphinx-rtd-theme. Normally not an issue to install this latest
dependency from doc/requirement.txt but RTD installs in the env an older
version (<0.5) before running requirements file install
thus sphinx-rtd-theme is not upgraded unless a version is specified.
See-also: https://github.com/readthedocs/sphinx_rtd_theme/issues/1115
Pin Pyinstaller to latest v4.x until issue of aborting upon missing typelibs for various unbuilt gst-modules can be properly investigated and resolved. Specific error for one of the modules being:
`36738 INFO: Loading module hook 'hook-gi.repository.Gst.py' from 'C:\\hostedtoolcache\\windows\\Python\\3.9.13\\x64\\lib\\site-packages\\PyInstaller\\hooks'...
Traceback (most recent call last):
File "<string>", line 7, in <module>
gi.repository.GLib.GError: g-irepository-error-quark: Typelib file for namespace 'Gst', version '1.0' not found (0)
36870 ERROR: gi repository 'GIRepository 2.0' not found. Please make sure corresponding package is installed.
Traceback (most recent call last):
File "<string>", line 4, in <module>
File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\gi\__init__.py", line 139, in require_version
raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gst not available`
Added `--no-index` to ensure pip doesn't install from Pypi
Closes: https://github.com/deluge-torrent/deluge/pull/386
smtplib.SMTP.sendmail expects 'msg' in string of ascii chars or bytes,
where the former gets encoded to bytes through ascii codec, hence
raising said error, but now fixed by encoding to bytes ourself through
utf-8
Closes: https://github.com/deluge-torrent/deluge/pull/383
Just trying to clean up some of the more complicated callback logic.
Notable changes:
* The test was awaiting a DeferredList. By default that will eat
exceptions and just add them to the result list (including test
assertion exceptions.) Added fireOnOneErrback=True to make sure that
wasn't happening. * Moved the logic for multiple calls to await the
same response into torrentmanager from core, so no matter where the
prefetch is called from it will wait for the original call.
* Implemented the multiple calls with an explicit queue of waiting
callbacks, rather than a callback callback chain. * Moved to one inline
async function rather than split into a main and callback after alert
function.
* Added some more type hints to the stuff I changed.
Adjusted test since we are using prefetch as an async function now
we have to schedule the alert to come after we start awaiting the
prefetch call.
Closes: https://github.com/deluge-torrent/deluge/pull/368