Commit Graph

8613 Commits

Author SHA1 Message Date
Calum Lind 6233e5c844 [Blocklist] Fix detecting compression type on Py3
The magic number is in bytes so ensure bytes in COMPRESSION_TYPES
2018-11-02 08:47:57 +00:00
Calum Lind a01481b26f [Plugins] Update create script and add GTK3 how-to doc
- Updated create_plugin script to create a GTK3 plugin.
- Added a document for updating a 1.3 plugin to be compatible with
  2.0.
2018-11-02 08:47:57 +00:00
Calum Lind 3d24998577 [Docs] Fix duplicate description warnings 2018-11-02 08:47:57 +00:00
Calum Lind f24e9d152c [Common] Remove oldest archive if too many exist
Prevents the archive folder bloating.
2018-11-02 08:47:57 +00:00
Calum Lind f47089ae7d [Core] Archive corrupt torrent.state on load
If the torrent.state was corrupted then loading would create a new
state with no backup to examine.

The solution is to use the archive function to save a copy of the
torrent.state.

Added a message argument to archive_files so that the error message
with a reason for archiving can be included in the tarball.
2018-11-02 08:47:57 +00:00
Calum Lind d70abd2986 [Plugins] Refactor plugin scan code
Simplify adding entries to the working_set.
Also fixes adding files rather than just dirs to working_set.
2018-11-02 08:47:57 +00:00
Calum Lind 7d998a45f2 Shorten code to declare namespace
This is the recommened way of declaring namespace.

Also remove unneeded unicode_literals import.
2018-11-02 08:47:57 +00:00
Calum Lind 3433a911cc [Plugins] Allow enabling any plugin Python version
Users encounter issues when trying to install plugins with differing
python versions. If the plugin was built with Py2.6 but they are using
Py2.7 the plugin would not load. With the move to Python 3 this could
become more of an issue. The workaround is to let the plugin manager
to try to load the deluge plugin regardless of the python version it
was built with.

This will put the onus on plugin author to keep the plugin code
compatible with more Python versions.
2018-11-02 08:47:57 +00:00
Calum Lind 967606fa0f [Tests] Fix str/bytes issue on Python 3
- argparser does not accept bytes and raised an error with encoded vars.
2018-11-02 08:47:57 +00:00
Calum Lind 97e7d95dd3 Cleanup tox configuration
There were issues with dependencies and tox environments under Python 3
so refactored the tox configuration to be more consistent and clearer.

- Moved travis to default to Python 3 for linting and tests.
- Fixed missing mock for cairo in sphinx config.
- Collated the base deps sections to improve readability.
- Added PYTEST_ADDOPTS env to override pytest verbosity in just tox
  tests as this was a common option being used.
- Renamed env 'testcoverage' to the more concise 'coverage' and moved
  html creation under single env as handy to have this output as well
  as report.
- Cleaned up the isort config for gtk3.
- Added `bad-continuation` to pylint config as conflcts with black
  formatting.
- Fix isort issue with bbfreeze script. This will likely be removed
  in future so just skip sorting it.
2018-11-02 08:47:57 +00:00
Calum Lind 26c28445a5 [GTK3] Fix showing piecesbar 2018-11-02 08:45:40 +00:00
Calum Lind 74a459274c [GTK3] Cleanup widget placement and spacing 2018-11-02 08:45:40 +00:00
Calum Lind bb6e290bf8 [GTK3] Fix UnicodeWarning in row comparison on Python 2 2018-11-02 08:45:40 +00:00
Calum Lind 4a79e1f100 [GTK3] Save ui files with Glade 3.22
To ensure properties are updated this is a simple open and save with the
glade designer. Always a bit messy with the diff but should not
change functionality.
2018-11-02 08:45:40 +00:00
Calum Lind bff93bb162 [Appveyor] Remove PyGTK and disable win32 packaging 2018-11-02 08:45:40 +00:00
Calum Lind bffd091429 Update DEPENDS for GTK3 2018-11-02 08:45:40 +00:00
Calum Lind 70d5931622 [GTK3] Fix column header right-click menu popup
The popup_at_pointer method is only available in GTK >=3.22 so for
compatibility restore using popup method.

Right-clicking on column headers popped-up torrent menu so only show
this menu when in torrentview.
2018-11-02 08:45:39 +00:00
Calum Lind ce49cde49d [GTK3] Fix cmp sorting on Python 3 2018-11-02 08:45:39 +00:00
Calum Lind a3bd2e547a [UI] Use Pillow for .ico icons
Pillow added the code in Win32IconImagePlugin to v2.1 (in 2013) so we can remove it.
Refactored the tracker_icons code to reflect this change.
2018-11-02 08:45:39 +00:00
Calum Lind 64710ad226 [GTK3] Disconnect after editing host in connection manager 2018-11-02 08:45:39 +00:00
Calum Lind cd6bad0e35 [UI] Fix passing bytes config path to subprocess on Python 3
The % substitution was causing the bytes prefix to become part of the
string and created a `b'/` prefixed config directory. Ensure the config
arg is byte prefixed too.
2018-11-02 08:45:39 +00:00
Calum Lind 1310645f55 [GTK3] Translate daemon status in connection manager
- Added a tooltip to show text status which also required translation
  so created a new liststore column for the translated text to ensure
  status is parsed correctly.
- Forced the status to lowercase to avoid translation issues and
  simplify comparisons.
2018-11-02 08:45:39 +00:00
Calum Lind e6a7119595 [GTK3] Replace stock icon and text usage 2018-11-02 08:45:39 +00:00
Calum Lind 0b39b529dd [PY3] Fix tray password encoding issue
The tray password need to be in bytes but GTK on Py3 returns unicode.

Use decode_bytes and then encode to ensure Py2/3 compatibility.
2018-11-02 08:45:39 +00:00
Calum Lind 1d0e40c66b fix move_completed sensitivity 2018-11-02 08:45:39 +00:00
Calum Lind bcc89c73dd [GTK3] Fix statusbar clicking issues 2018-11-02 08:45:39 +00:00
kbdserver a6b47e18c9 Fix package_data namespace in setup.py 2018-11-02 08:45:39 +00:00
Calum Lind 5183c92543 [GTK3] Migrate to AppIndicator3
Replace the old appindicator imports with AppIndicator3.

- Only few changes required due to Enum renaming.
- Updated the preference import to include require_version and set a bool.
- The password preference needs to be encoded for hashlib on Python3 but
also need to keep Python 2 support so attempt decode then encode.
2018-11-02 08:45:39 +00:00
Calum Lind 7c1c3f62d1 [Tests] Ensure GTKUI tests are skipped upon import errors
Need to catch any issues with importing GTK modules to ensure
GTKUI tests are skipped in non-GTK environments.
2018-11-02 08:45:39 +00:00
Calum Lind 729f062ea1 [GTK3] Fix RadioMenuItem group error
Fixes a difference from GTK2->3 where the group can no longer be passed
as a RadioMenuItem so use get_group method to set group.
2018-11-02 08:45:39 +00:00
kbdserver d879ee06a3 [Notifications] Migrate to GTK3
- Switch from pynotify to gi libnotify binding.
  - Ideally would drop libnotify for [GNotification] but requires more
    work with the desktop file needing renamed to DNS format.
    e.g. `org.deluge-torrent.deluge`

[GNotification]: https://developer.gnome.org/GNotification/

Co-authored-by: Calum Lind calumlind+deluge@gmail.com
2018-11-02 08:45:39 +00:00
kbdserver ed1b2a50fa [Scheduler] Migrate plugin code to GTK3
- Added new svg icons for cleaner look.
- Use widget get_allocated_width and get_allocated_height instead of window size.
- Tweaked margins to fix spacing issues.
- Removed yellow background from 'slow settings' and applied only to label.

Co-authored-by: Calum Lind <calumlind+deluge@gmail.com>
2018-11-02 08:45:39 +00:00
Calum Lind c51e01ac46 [GTK3] Migrate plugins to GTK3
Add a new Gtk3PluginBase to prevent problems with Gtk2 plugins.
2018-11-02 08:45:39 +00:00
kbdserver 4df5bd05ec [GTK3] Replace stock icons for named icons 2018-11-02 08:45:39 +00:00
Calum Lind cf4012bb60 [GTK3] Fix and remove FIXME comments
- Several of the FIXME comments seem to be outdated so removed.
- The status_icon comment was resolved by fixing the arguments supplied to
tray_menu.popup().
- The TreePath no longer returns a tuple so cast path to int.
- Fix an error with Pixbuf signature.
2018-11-02 08:45:39 +00:00
Calum Lind bbcebe1306 [Tests] Fix use get_iter_first for treestore 2018-11-02 08:45:39 +00:00
Calum Lind bcaaeac852 [GTK3] Use explicitly named functions for creating menuitems
See https://wiki.gnome.org/Projects/PyGObject/InitializerDeprecations
2018-11-02 08:45:39 +00:00
Calum Lind 4111f94597 [GTK3] Fix GError required attr id for GtkTreeSelection 2018-11-02 08:45:39 +00:00
Calum Lind dd7cc31918 [GTK3] Fix catching Wnck not available 2018-11-02 08:45:39 +00:00
Calum Lind d8d094cab6 [Travis] Fix missing pygi gtk3 packages 2018-11-02 08:45:39 +00:00
Calum Lind dc6e93541b [Docs] Fix mocking external modules
With move to GTK3 needed to update the mocking of external modules.

There is a new autodoc option `autodoc_mock_imports` so use this instead
of the custom mock class.

There are some build warnings output using autodoc mock:

    TypeError: unsupported operand type(s) for |: '_MockObject' and '_MockObject'

Will resolve these later as the build passes.
2018-11-02 08:45:39 +00:00
Calum Lind f6ffb940ab [Tests] Update tests for GTK3 new paths 2018-11-02 08:45:39 +00:00
Calum Lind 6fbb1bb370 [GTK3] Fix ui_entry tests for gtk3 2018-11-02 08:45:39 +00:00
Calum Lind 8285b226eb [GTK3] Fix Python 3 issues
In Python 3 builtin next function instead of the next method.

Unpickling with translated strings in state file causes ascii decode
error so ensure UTF-8 encoding is specified.
2018-11-02 08:45:39 +00:00
Calum Lind 194129c027 [GTK3] Fix create torrent dialog warning
The ui liststore had an extra blank value causing a GTK value type
warning.

Also set the default value displayed to be 128 KiB.
2018-11-02 08:45:39 +00:00
Calum Lind 7d5a429466 [GTK3] Fix column lookup not i18n-ised 2018-11-02 08:45:39 +00:00
Calum Lind ac5db1b262 [GTK3] Fix gettext translation code
Add translation setup for Gtk.Builder ui files.

Refactor and cleanup up the translations_util:
- Remove old gtk.glade code.
- Add macos libintl support.
- Remove unneeded setup_translations parameters.
2018-11-02 08:45:39 +00:00
Calum Lind a2857a318d [GTK3] Remove unneeded code in path chooser
Not sure the reason for the added introspection code but originated in
GTK3 changes so remove as path chooser doesn't appear to need it.
2018-11-02 08:45:39 +00:00
Calum Lind 13e1fa355d [GTK3] Fix path chooser warnings and errors 2018-11-02 08:45:39 +00:00
Calum Lind 2e88fa1dfc [GTK3] Remove listview orphaned code
Not sure why/where this originated from but seems to serve no purpose so
removing it.
2018-11-02 08:45:39 +00:00