Commit Graph

9088 Commits

Author SHA1 Message Date
Calum Lind 9d802b2a91
[Tests] Fix missing __qualname__ for mock callback
test_pop_alerts raised the following error:

    File "/home/runner/work/deluge/deluge/deluge/core/alertmanager.py", line 177, in handle_alerts
        handler=handler.__qualname__,
    File "lib/python3.10/unittest/mock.py", line 645, in __getattr__
        raise AttributeError(name)
    AttributeError: __qualname__

Mocks don't generate dunder methods like `__qualname__` attribute so
we need to manually specify it.
2024-09-06 21:02:50 +01:00
Gregorio Litenstein 8867da94f8
[Console] endwin() not needed when using wrapper
Using it anyway produces a crash because it returns an error if called two times without any intervening updates.

Closes: https://github.com/deluge-torrent/deluge/pull/461
2024-08-26 20:48:38 +01:00
Martin Hertz e1fa8d18ec
[Console] Improve interactive-mode preferences saving
The bottom options for cancel/apply/ok where confusing for end-users as being checkboxes needing spacebar prepended to activate firstly, before return/enter to activate said previous selection, but changed now to omit. Also fixed not showing canceled options as sticking.

Co-authored-by: Calum Lind <calumlind+deluge@gmail.com>
Closes: https://github.com/deluge-torrent/deluge/pull/445
2024-08-26 19:43:11 +01:00
kenstir d5af32802f
[Build] Fix Ubuntu dependency for appindicator
Change name to gir1.2-appindicator3-0.1.  Tested on Ubuntu 22.04.4 LTS
and Ubuntu 20.04.6 LTS.
Replace appindicator3 refs with newer ayatanaappindicator3
Replace broken python-appindicator link with working jammy link.

Closes: https://github.com/deluge-torrent/deluge/pull/459
2024-08-26 19:39:59 +01:00
Calum Lind d1d72b1be8
[UI] Replace deprecated Pillow Image.Antialias with Lanczos
ANTIALIAS was removed in Pillow 10.0.0 so replace with suggested
alternative.

Ref: https://pillow.readthedocs.io/en/stable/releasenotes/10.0.0.html#constants
2024-08-26 19:36:53 +01:00
Calum Lind 776efe4faa
[i18n] Update po files from launchpad 2024-08-24 23:14:49 +01:00
Jacob Siverskog f101f0afdd
[Console] Fix ports typo
incomming -> incoming.

Closes: https://github.com/deluge-torrent/deluge/pull/442
2024-08-24 17:40:12 +01:00
Martin Hertz d98d15422a
[AutoAdd] Fix Windows display scaling breaking WebUI elements
Closes: https://github.com/deluge-torrent/deluge/pull/444
2024-08-24 17:35:31 +01:00
zakary d9e3facbe8
[CI] Update actions to latest version (node 16 deprecation)
Closes: https://github.com/deluge-torrent/deluge/pull/453
2024-08-24 17:33:18 +01:00
Martin Hertz 6ba23a8013
[Packaging] NSIS x64 reg-keys into proper place
Closes: https://github.com/deluge-torrent/deluge/pull/455
2024-08-24 16:13:36 +01:00
Calum Lind af70ff1fdc
[Util] Refactor reset language env vars 2024-08-24 13:52:24 +01:00
DjLegolas 18fa028d2d
[3635][WebUI] fix language change to system default
When setting a language, we set 2 environment variables at run time.
Setting the language back to `System Default`, we don't clean those env
variables.
In the WebUI, the page only reloads, and we still use the env variables
to set the language back to the previous one.
This does not affect GTK.

Closes: https://dev.deluge-torrent.org/ticket/3635
Closes: https://github.com/deluge-torrent/deluge/pull/450
2024-08-24 13:42:13 +01:00
DjLegolas 322faa7a54
[Build] Prevent usage of twisted>=23 on Windows
with newer versions of twisted, a regression was added for the GTK
reactor on Windows.
it effects all versions, including latest (currently 24.3.0).

So will prevent the upgrade on Windows only.

Issue: https://dev.deluge-torrent.org/ticket/3634
Related: https://github.com/twisted/twisted/issues/11987
Closes: https://github.com/deluge-torrent/deluge/pull/448
2024-08-24 11:34:16 +01:00
Calum Lind 785ad00d2b
[WebUI] Fix gettext _ imports 2024-08-24 09:23:22 +01:00
Calum Lind 1e5f248fb8
[WebUI] Fix error stopping daemon in connection manager
The wrong number of arguments was being parsed from get_host_info.
2024-08-24 09:23:22 +01:00
Calum Lind 80985c02da
[CI] Disable failing alertmanager test on Windows
The test_pause_not_pop_alert test passes on Linux but is consistently failing
in CI pipeline for Windows:

    AssertionError: Expected 'mock' to not have been called. Called 1 times.
    Calls: [call.deferred.cancel(),
    call(LtAlertMock(type=1, name='mock_alert1', message='Alert 1'))].

Disabling the test until it can be resolved.
2024-08-19 16:30:12 +01:00
Calum Lind 7660e2e5ca
Add deluge.pot to repo for new translation app
Attempting to move to weblate but need deluge.pot in the repo
2024-07-15 08:39:31 +01:00
Calum Lind 7f3f7f69ee
[GtkUI] Reword preferences to prefer dark theme
The GTK option for dark theme only provides a preference to use the dark
theme, there is not a similar option for light theme so the settings
should only refer to 'prefer dark theme' and whether it's on or off.
2024-02-19 17:50:37 +00:00
Calum Lind 5dd7aa5321
[WebUI] Refactor changing theme
Simplify searching for themes and ensure theme is ordered last.

Ideally themes would be set client-side but seems to be quite tricky to
accomplish with ExtJS.
2024-02-19 17:50:32 +00:00
DjLegolas ee97864086
[GtkUI] Add a way to change themes
Currently, the only way to change the themes is by manually set a value
in the command line or set it as env variable.

Closes: https://dev.deluge-torrent.org/ticket/3536
Closes: https://github.com/deluge-torrent/deluge/pull/392
2024-02-19 17:49:04 +00:00
DjLegolas 848d668af9
[WebUI] Add a way to change themes
Currently, the only way to change the themes is by manually set a value
in the `web.conf` file itself.

Closes: https://dev.deluge-torrent.org/ticket/3536
2024-02-19 15:54:57 +00:00
Chris Ross d9ef65d745
[WebUI] Fix tracker icon to fit within tracker column rows
For me at least, Safari on Mac OS X, the tracker icon significantly
overflows in the Tracker column of the torrent list. (It does show the
correct size in the Trackers filter, though. Different CSS.)

This change causes it to constrain down to the height of the column and
display correctly.

Closes: https://github.com/deluge-torrent/deluge/pull/440
2024-01-21 15:20:24 +00:00
freddy2659 7f70d6c6ff
[WebUI] Fix progress divide by 0 error with empty dir
If a dir exists with no contents then the following error occurred:

```
Traceback (most recent call last):
  ...
  File "/usr/lib/python3.10/site-packages/deluge/ui/web/json_api.py", line 608, in _on_got_files
    dirinfo['progress'] = sum(progresses) / dirinfo['size'] * 100
builtins.ZeroDivisionError: float division by zero
```

Closes: https://github.com/deluge-torrent/deluge/pull/439
2024-01-21 15:18:29 +00:00
Calum Lind b7450b5082
[Docs] Bump sphinx version requirements
There are still warnings that need to be resolved but the build is
passing.
2024-01-21 15:10:47 +00:00
Calum Lind 7046824115
[Alerts] Fix alert handler segfault on lt.pop_alerts
We cannot handle an alert after calling lt.pop_alerts for a subsequent
time since the alert objects are invalidated and with cause a segfault.

To resolve this issue add a timeout to the handler calls and wait in the
alert thread for either the handlers to be called or eventually be
cancelled before getting more alerts.

This is still not an ideal solution and might leave to backlog of alerts
but this is better than crashing the application. Perhaps the timeout
could be tweaked to be shorter for certain alert types such as stats.

Related: https://github.com/arvidn/libtorrent/issues/6437
2024-01-21 14:16:22 +00:00
Calum Lind fa8d19335e
[GTK3] Fix changing torrent ownership
The change ownership menu item was broken due to Gtk deprecation
changes in commit #bcaaeac.

Fixed by correctly setting the RadioMenuItem group

Refactored to simplify the code
Removed dead or unneeded code

Fixes: https://dev.deluge-torrent.org/ticket/3610
2023-12-02 21:20:22 +00:00
Calum Lind 0c1a02dcb5
[Core] Remove usage of deprecated torrent status.paused
Noticed mismatch with current lt docs and found usage of deprecated
status.paused.

The actual check here is not required we should just attempt to pause
the torrent.

Issue: https://dev.deluge-torrent.org/ticket/3499
2023-12-02 21:20:11 +00:00
Calum Lind 810751d72a
[Tests] Refactor parse_human_size test 2023-11-30 19:03:40 +00:00
Calum Lind 7199805c89
[Common] Fix order of size_units for parse_human_size
The previous commit changed the order of the size
2023-11-27 16:52:03 +00:00
Arkadiusz Bulski 29cf72577f
[Common] Add extra size units suffixes for user input
Minor updates to docstrings

Closes: https://github.com/deluge-torrent/deluge/pull/437
2023-11-27 15:58:19 +00:00
Calum Lind 42accef295
[Tests] Fix unhandled ProcessTerminated trying to kill daemon in clean
The GitHub CI tests on Linux were failing due to ProcessTerminated

>       await daemon.kill()
E       twisted.internet.error.ProcessTerminated: A process has ended with a probable error condition: process ended by signal 6.

Added a try..except in daemon as a quick solution but might need to
investigate the ProcessOutputHandler.kill method.
2023-11-27 15:48:24 +00:00
Calum Lind 54d6f50231
[Core] Refactor Alertmanager to retry unhandled alerts
We are currently creating a copy of each alert to avoid segfaults when
the next pop_alerts invalidates the lt alert objects we are holding
for handler callbacks.

However these alert copies are not deep enough since need to also
resolve the alert object methods e.g. message() therefore it is still
possible to result in lt segfaults.

The workaround is to check for any handlers not called, give them some
more time and eventually discard if still not handled.

Ref: https://github.com/arvidn/libtorrent/issues/6437
2023-11-27 15:17:44 +00:00
DjLegolas b5f8c5af2d
[Core] Call wait_for_alert in a thread
This spawns a thread in alertmanager to call wait_for_alert in a thread.
This reduces latency to deluge responding to events.
And removes all `hasattr` checks in Component

Closes: https://github.com/deluge-torrent/deluge/pull/221
2023-11-27 15:00:56 +00:00
Calum Lind c7dc60571e
[CI] Fix windows packaging build
With recent update to pyinstaller 6.0 the libraries are now placed in an
`_internal` folder within the bundle. This has resulted in the failure
to create copies of libssl.

However after examining the new _internal dir it appears that the x64
lib are now created so this step is no longer required.
2023-11-24 20:50:15 +00:00
DjLegolas 1989d0de73
[UI][Common] Add daemon version check
For new UI features to be added, one should make sure the backend daemon
is supported and add fallback in case it doesn't.
Here we add the ability to get the daemon version from the `Client`
class and also check the version against a desired version.

Closes: https://github.com/deluge-torrent/deluge/pull/427
2023-11-20 12:36:52 +00:00
Radu Carpa 1751d62df9
[Core] Support creating v2 torrents
Add support for v2 torrents in create_torrent, but keep the old
default of only adding the v1 metadata.

Unify the single-file and directory cases to avoid code
duplication.

V2 torrents require files to be piece-aligned. The same for
hybrid v1/v2 ones. To handle both cases of piece-aligned and
non-aligned files, always read the files in piece-aligned
chunks. Re-slice the buffer if needed (for v1-only multi-file
torrents).

Also, had to adapt to progress event. It now depends on the
number of bytes hashed rather than the number of pieces. To
avoid sending and excessive amount of event when handling a
directory with many small files, add a mechanism to limit
event period at 1 per piece_length.

Closes: https://github.com/deluge-torrent/deluge/pull/430
2023-11-20 10:05:39 +00:00
Radu Carpa 4088e13905
[Core] Make create_torrent return a deferred
This allows to create a torrent file on the remote server
and get its content in one call.
2023-11-20 10:05:33 +00:00
Radu Carpa b63699c6de
[Core] Don't always write create_torrent metafile to disk
If target=None and add_to_session is True, the torrent will be
directly added to the session without writing the torrent file
to disk. This will allow to programmatically control deluge via
RPC without creating .torrent files all over the place.

Also, make most create_torrent parameters optional.
2023-11-20 10:05:33 +00:00
Calum Lind 8dba0efa85
[Lint] Fixup files 2023-11-19 23:14:44 +00:00
Calum Lind b2005ecd78
[Tests] Fix console tests stalling by pinning pytest to 7.4.2
Tests were stalling in deluge_ui_entry with pytest 7.4.3 likely due to
changes in the way it handles stderr but it is not clean the extact
issue.

For now we will pin the pytest version and look to fix the issue later.

Reference: https://docs.pytest.org/en/stable/changelog.html#pytest-7-4-3-2023-10-24
2023-11-19 23:14:44 +00:00
Calum Lind 39b99182ba
[UI] Further compress Deluge icons 2023-11-19 19:15:29 +00:00
Calum Lind 66eaea0059
[Scripts] Replace icon bash script with python version
Preferable to be working with Python scripts for easier development.

This is direct port of the original bash script with the slight
modification to also use pngquant to reduce file size further.
2023-11-19 19:15:29 +00:00
Calum Lind 5aa4d07816
[Stats] Fix creating test artifacts in tmp not pwd 2023-11-19 19:15:28 +00:00
Calum Lind f3d7b1ffe8
[UI] Minor improvements to create_deluge_pngs
Change the default compression tool to oxipng since it produces smaller
files faster than zopfli.

Add the ECT tool as an option to get maximum compression but is quite
slow to complete.
2023-11-19 19:15:28 +00:00
Anthony Ryan d8f9fe4acf
[UI] Losslessly compress PNG images
Using Efficient-Compression-Tool, we managed to reduge image sizes by
Saved 9.45KB out of 241.88KB (3.9065%) without changing visual appearence.

It's a small improvement, but we get something for nothing and that's nice.

    ect -keep --allfilters-b --pal_sort=120 -30060 -recurse --mt-file ./

Closes: https://github.com/deluge-torrent/deluge/pull/405
2023-11-19 19:15:17 +00:00
Calum Lind f43b605b80
[i18n] Update translations from launchpad 2023-11-13 12:10:39 +00:00
Sébastien Luttringer 1dbb18b80a
Fix tweaking logging levels
When you set a config directory path (-c) on the command line, and only when,
a file named logging.conf is read to set fine grained log levels.
This allows to have per module/plugin log levels.

A simple logging.conf could be:
-<8 -------------------
deluge:info
deluge.plugin.foo:debug
-----------------------

The file is parsed and the log levels are set in the deluge.log.tweak_logging_levels.
This function set the appropriate logger to the desired level.
Despite the log level is changed, log levels less than ERROR are still not
logged.

The reason is that the log level check is done twice, in the logging.Logger class
and in the logging.Handler class.

The fix is to not set the logging level in the Handler in deluge.log.setup_logger
and let only the logging.Logger check the level.

Closes: https://github.com/deluge-torrent/deluge/pull/428
2023-09-18 20:04:14 +01:00
Myrmecophaga tridactyla 21470799d0
i18n: Fix language word
Closes: https://github.com/deluge-torrent/deluge/pull/429
2023-09-18 20:02:39 +01:00
Calum Lind e24081a17e
[CI] Bump Pyinstaller version for Windows packaging
Pyinstaller was pinned due to problems with v5 but these should now be
resolved with latest version.

Bump Twisted to latest minor version

Closes: https://github.com/deluge-torrent/deluge/pull/435
2023-09-18 19:56:31 +01:00
Calum Lind 6c9b058d81
[CI/CD] Fix Pillow packaging build errors
Pillow have dropped 32-bit wheels from v10 onwards so force install of
older v9 wheels since we don't want to build from src.

Refs: https://github.com/python-pillow/Pillow/issues/6941#issuecomment-1604058002
2023-09-18 14:55:53 +01:00