Commit Graph

8826 Commits

Author SHA1 Message Date
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
Calum Lind 366b10f07b [GTK3] Fix displaying column popup menu
Right-clicking on column header resulted in this error:

    TypeError: could not convert type EventButton to GdkEvent required for parameter 0

The following fixes and cleans up the issue:
- Move the signal creation to the class, using the __gsignals__ dict.
- Replace `Event` with `object` since we are passing an EventButton as
Gtk3 no longer accepts it as an Event.
- Replace deprecated menu `popup()` with `popup_at_pointer()` which also
fixes a critical gdk error when using `popup()`.
2018-11-02 08:45:39 +00:00
Calum Lind 92a048625a [GTK3] Fix the transient parent for PathChooser
The filechooser dialog was wrongly transient to the main window causing
weird behaviour, namely the main window moving but dialog remaining in
place when attempting to move the child dialog.

The solution is to pass the parent dialog to PathChooser so it can be
properly set the filechooser dialog transient property.

Fixed the Preferences dialog not being set to be modal to main window.
2018-11-02 08:45:39 +00:00
Calum Lind 8199928160 [GTK3] Use a non-CSD filechooser dialog for PathChooser
My personal feeling is that GTK client-side decoration (CSD) putting
main dialog buttons in the titlebar is wrong so create a non-CSD dialog.

There was no simple way of changing GtkFileChooserDialog to play nice
with non-CSD buttons and resulting in these GTK warnings:
    Gtk-WARNING : Content added to the action area of a dialog using header bars

There is an unwanted dialog border with this custom filechooser dialog
with no apparent way to remove them. Would require switching to a
GtkWindow implementation.
2018-11-02 08:45:39 +00:00
hugosenari 545aca9a4c [GTK3] Fix piecesbar Pango methods
Fixes 'Context' object has no attribute 'create_layout'
Fix the gi cairo import warning
2018-11-02 08:45:39 +00:00
hugosenari 9f113eab23 [GTK3] Fix ImportError has no attribute message
Python 3 exception objects now use `msg` but casting with `str()` is
better.
2018-11-02 08:45:39 +00:00
hugosenari bc6bc017cb [GTK3] Fix TextBuffer.get_text() arguments
This fixes an error that it takes exactly 4 arguments (3 given)
2018-11-02 08:45:39 +00:00
hugosenari 535fda90e3 [GTK3] Use core.pause_torrents with list of torrents
Use the new api method.
2018-11-02 08:45:39 +00:00
hugosenari 0ace086de4 [GTK3] Fix About 'MainWindow' object has no attribute 'get_window' 2018-11-02 08:45:39 +00:00
hugosenari bbb1b44a23 [GTK3] Fix piecesbar window attribute error
Fixes the error: object has no attribute window
2018-11-02 08:45:39 +00:00
hugosenari dfed17ac0d [GTK3] Fix import and attribute warnings
Fixes:
- warning import GConf
- Gtk is not defined
- 'ResponseType' has no attribute 'Yes'
- selection.data should be selection.get_data
2018-11-02 08:45:39 +00:00
hugosenari 2f879c33f3 [GTK3] Fix path_combo_chooser warnings
Fixes
 - Please remove the widget from its existing container first
 - object has no attribute 'height'
2018-11-02 08:45:39 +00:00
hugosenari 14b6ba10cf [GTK3] Use decode_bytes from method returns
Python3 PyGObject automatically encodes/decodes strings to and from
methods. This does not happen on Python 2 so for compatibility use
decode_bytes.
2018-11-02 08:45:39 +00:00
hugosenari ae0b072b75 [GTK3] Fix config default_load_path keyerror 2018-11-02 08:45:39 +00:00
hugosenari 250afa6e0b [GTK3][OSX] Restore windowing lookup for quartz 2018-11-02 08:45:39 +00:00
hugosenari b29b6fe69f [GTK3] Restore and update expand_row code 2018-11-02 08:45:39 +00:00
hugosenari f160d6312f [GTK3] Fix piecesbar warnings
Fixes:
- get_style to get_style_context
- use str with gsignals
2018-11-02 08:45:39 +00:00
hugosenari a8d01fd52f [GTK3] Fix GObject deprecation warnings
GObject.idle_add is deprecated using GLib.idle_add instead
GObject.timeout_add is deprecated using GLib.timeout_add instead
GObject.SIGNAL_RUN_LAST is deprecated; use GObject.SignalFlags.RUN_LAST instead
GObject.GError is deprecated; use GLib.GError instead
GObject.timeout_add is deprecated use GLib.timeout_add instead.
ListStore(str, str) using unicode_literals get_value return utf8.
2018-11-02 08:45:39 +00:00
hugosenari 3a5ec4f5f4 [GTK3] Fix Glade ui margins and spacing 2018-11-02 08:45:39 +00:00
hugosenari eebb93d4ee [GTK3] Cleanup Glade UI deprecated widgets and properties
- VBox is Box(vertical);
- HBox is Box;
- HButtonBox is ButtonBox;
- HSeparator is Separator;
- VPaned is Paned(vertical);
- Table is Grid;
- use_action_appearance is purged;
- yalign is purged;
- xalign is purged;
- xoptions are purged;
- yoptions are purged;
- add some align: start;
2018-11-02 08:45:39 +00:00
Calum Lind 01fafd4fe0 [GTK3] Change module structure from ui/gtkui to ui/gtk3
This moves the directory structure so that there is no conflict with the
old gtk2 UI. Also changes the conf and state files being loaded.
2018-11-02 08:45:39 +00:00
Calum Lind ca0db4d1a7 [GTK3] Save ui files with Glade 3 2018-11-02 08:45:39 +00:00
Calum Lind ea72164798 [GTK3] Large rename/modify code for GTK3 2018-11-02 08:45:39 +00:00
Calum Lind e2ba980299 [GTK3] Marked FIXME code changes for GTK3 2018-11-02 08:45:39 +00:00
Calum Lind 98051bdea2 [Docs] Move apidoc command to Sphinx config
The apidoc modules were not being generated on ReadTheDocs because
there is no way to run sphinx-apidoc manually.

Moved the running of sphinx-apidoc into conf.py.

Added zope.interface minimum version to fix Readthedocs warning.
2018-11-02 00:21:50 +00:00
Calum Lind 20431cc771 [Docs] Fix build errors getting Deluge version
The use of pkg_resource.require caused an unwanted requirements lookup
that errored out the sphinx build when no dependencies are installed.

This is fixed by switching to pkg_resources.get_distribution.

Also changed the tox docs env to not install Deluge as the setup.py
now contains install_requires which is unwanted.
2018-11-01 23:18:05 +00:00
Calum Lind 82ecf8a416 [Docs] Reorganise and add sections from wiki
- Change the layout and contents of docs to be better organised and
  follow ideas from: https://www.divio.com/blog/documentation/
- Use markdown for non-technical documents to speed up writing.
- Added new sections and imported documents from Trac wiki.

Build fixes:

- Added a patch to fix recommonmark 0.4 and doc referencing:
    https://github.com/rtfd/recommonmark/issues/93
- Set docs build in tox to Py2.7 since there are problems with autodoc
  mocking multiple inheritance on Python 3 resulting in metaclass errors.
- Supressed warning about `modules.rst` not in the toctree by creating
  a static `modules.rst` with `:orphan:` file directive and add to git.
  Also skip creating this toc file with sphinx-apidoc in setup and tox.
- Simplified finding exported RPC and JSON API methods by adding an
  autodoc custom class directive. Removed unneeded __rpcapi.py.
2018-11-01 17:38:10 +00:00
Calum Lind 9dcd90056d [Lint] Fix flake8 warnings
- Use six to silence flake8 undefined Python 2 names on Python 3.
- Fix W605 invalid escape sequence.
- Cleanup unused exception variables.
2018-10-25 15:14:19 +01:00
Calum Lind e2c7716ce2 [#1903|UI] Add super seeding option to interfaces
- Fix applying the setting to libtorrent, passing the value without
  modification so it decide when to enable it.
- Enable super_seeding option when adding torrents to core.
- Update UIs with option in tabs and add dialogs.
2018-10-25 15:14:07 +01:00
Calum Lind e6c61c3f8c [Core] Fix potential renaming unicode folders issue
- Found an issue while fixing `get_name` where `handle.rename_file`
  would raise a UnicodeDecodeError with non-ascii on Python 2. The
  fix is to catch this and pass unicode string to method instead.

- Add a test `test_rename_unicode` to verify no errors are generated.
- Updated test to use core.session instead of creating another one.
2018-10-22 21:58:06 +01:00
Calum Lind b834e33568 [#3204|Core] Fix unicode get_name unicode error
The recent change to torrent.get_name does not handle non-ascii paths
on Python 2.

- Add a decode_bytes to resolve the issue.
- Add tests.
- Refactor to reduce nesting.
2018-10-22 21:58:05 +01:00
Calum Lind 9ab2a50097 [Console] Refactor single letter variables
- Replace usage of `s` for variable names to make it easier to read the code.
- Remove unneeded and unused encoding parameter from parse_color_string
  It should not be encoded by this function, only on output.
2018-10-22 16:05:55 +01:00
Calum Lind 1838403e3b [#3199|Console] Fix UnicodeEncodeError in addstr
The following error was encountered by user:

   ...deluge/ui/console/modes/basemode.py, line 290, in add_string
       screen.addstr(row, col, string, color)
   UnicodeEncodeError: 'ascii' codec can't encode character...

The `add_str` method is defaulting to using the Python 2 ascii
encoding with a unicode string so use the encoding passed to the
function.
2018-10-22 16:00:12 +01:00
Calum Lind 9e7c9fc1d3 [AutoAdd] Fix packaging autoadd_options data files
There was a warning about missing javascript file in the package and
found the `data/autoadd_options` subdir was not being included.

Bump version
2018-10-21 16:05:01 +01:00
DjLegolas 9264cb749e [WebUI][#2009] Add About window
- Add an About window to see version details like GTKUI.
- The author and license text were left out as unnecessary.
- Added a daemon get_version method since daemon version was not
  available through the json-api.
- Fix LookupResource to ensure path exists when rendering.
2018-10-21 15:43:29 +01:00
Phil Hudson c01679de1f [Config] Prevent symlinked config files being overwritten
If a user keeps the deluge config file under source control and symlinks
to the config files in deluge config dir then when deluge saves config
files it will replace the symlink with actual file.

Using realpath will resolve these symlinks and file will be updated in
the correct location.

Use a temporary file for new config new before moving it to the
resolved location.

Co-authored-by: Calum Lind <calumlind+deluge@gmail.com>
2018-10-21 14:08:30 +01:00
Calum Lind 3645feb486 [GTK] Fixup translation strings
- Use named placeholders to allow translators to change text order.
- Refactor fpcnt to use format() and markup strings properly.

- Remove gettext.js creatation from generate_pot script since this step
  is now always done at build-time.
2018-10-21 13:51:30 +01:00
Calum Lind d85f665091 Fix large ETA overflow C int
The following error was encountered in GTK3 which is a result of trying
to cast a very large ETA value to C int and raising an Overlflow error.

   <type 'exceptions.OverflowError'>: 3072227291 not in range -2147483648 to 2147483647

The solution is to limit the ETA to 1 year and represent any values over
that as -1 which the UIs can display as infinity.
2018-10-19 17:30:27 +01:00