Commit Graph

9454 Commits

Author SHA1 Message Date
Daniel Schadt
b995b9d5da downloads: fix docstrings for new return value 2016-07-13 22:25:23 +02:00
Florian Bruhin
7f8d4fa97a Merge branch 'blyxxyz-master' 2016-07-13 21:26:35 +02:00
Florian Bruhin
da417bff3e Update docs 2016-07-13 21:25:48 +02:00
Florian Bruhin
ff89ae7839 Merge branch 'master' of https://github.com/blyxxyz/qutebrowser into blyxxyz-master 2016-07-13 21:21:37 +02:00
Florian Bruhin
b59a1766c8 Fix long line 2016-07-13 21:19:02 +02:00
Florian Bruhin
a436468026 test requirements: Update hypothesis to 3.4.2
- Test functions defined using @given can now be called from other
  threads
- Attempting to delete a settings property would previously have
  silently done the wrong thing. Now it raises an AttributeError.
- Creating a settings object with a custom database_file parameter was
  silently getting ignored and the default was being used instead. Now
  it’s not.
2016-07-13 20:21:20 +02:00
Florian Bruhin
c9176b7c58 QtWebEngine: Fix 'unset' with run_js_blocking 2016-07-13 18:17:37 +02:00
Florian Bruhin
a7509d5978 Fix lint 2016-07-13 16:01:12 +02:00
Jan Verbeek
13cbdbb8bd Record mode for :repeat-command before executing 2016-07-13 15:24:45 +02:00
Daniel Schadt
029ffe3fc7 tests: add tests for usertypes.DownloadTarget 2016-07-13 14:17:41 +02:00
Florian Bruhin
5b1cca92ab Add run_js_blocking to tab API 2016-07-13 13:47:30 +02:00
Florian Bruhin
4f97b6342d tests: Add a tab fixture in test_tab 2016-07-13 13:47:29 +02:00
Florian Bruhin
558ef290e4 tests: Add a view fixture in test_tab 2016-07-13 13:47:26 +02:00
Florian Bruhin
68f5ed4fa4 tests: Fix FakeWebTabScroller
Pass tab correctly
2016-07-13 13:47:26 +02:00
Florian Bruhin
f5359b67a2 tests: Fix default_config fixture
This wasn't used since the command tests were deactivated. It was broken
during some refactoring and nobody noticed.
2016-07-13 13:43:46 +02:00
Florian Bruhin
c83a8a64dc QtWebEngine: Implement scroll.delta_page 2016-07-13 11:26:53 +02:00
Florian Bruhin
602d10c495 QtWebEngine: Implement scroll.to_point/.delta 2016-07-13 11:21:50 +02:00
Florian Bruhin
b78b89f04f QtWebEngine: Implement :scroll-perc via JS 2016-07-13 10:55:04 +02:00
Florian Bruhin
e0ab70c8cf end2end tests: Don't fail with "STUB:" warnings
We have some things like pos_px stubbed which will fail any test because
of the stub warning - but some tests don't actually need that, it just
happens when e.g. loading something.

So let's not fail tests based on stub warnings, and see how much works
that way.
2016-07-13 10:55:04 +02:00
Florian Bruhin
9c49900f9e QtWebEngine: Add JS logging 2016-07-13 10:55:04 +02:00
Florian Bruhin
e35dfe7aa3 Merge branch 'blyxxyz-style-in-lists' 2016-07-13 07:29:14 +02:00
Florian Bruhin
444bd7244a Merge branch 'style-in-lists' of https://github.com/blyxxyz/qutebrowser into blyxxyz-style-in-lists 2016-07-13 07:28:49 +02:00
Florian Bruhin
4328169274 flake8 requirements: Get rid of ebb-lint
We've had many checks disabled - these are the ones we actually lose:

    L104
    Docstrings must use Napoleon, not reStructuredText fields.

    L205
    __init__.py is not allowed to contain function or class definitions.

    L206
    Implicit relative imports are not allowed.

    L208
    Pokémon exception handling is always a mistake. If the intent is
    really to catch and ignore exceptions, explicitly name which
    exception types to silence.

    L209
    return, del, raise, assert, print (in python 2, without
    print_function) yield, and yield from are statements, not functions,
    and as such, do not require parentheses.

    L210
    Instead of intentionally relying on the side effects of map, filter,
    or a comprehension, write an explicit for loop.

    L211
    Using map or filter with a lambda as the first argument is always
    better written as list comprehension or generator expression. An
    expression is more readable and extensible, and less importantly,
    doesn't incur as much function call overhead.

    L212
    Using @staticmethod is always wrong.

    L301
    Files must end with a trailing newline.

    L303
    noqa is ignored, and as such, # noqa comments should be deleted to
    reduce pointless noise.

However, most of those are also checked by pylint (and the rest I don't
really care about), and ebb-lint increases flake8's runtime a lot
(45s -> almost 2min).
2016-07-13 07:24:10 +02:00
Daniel Schadt
7597221776 fix lint 2016-07-12 22:39:21 +02:00
Daniel Schadt
940b124253 switch set literal to list literal
See PR #1642.

😗🎶
2016-07-12 22:31:43 +02:00
Jan Verbeek
0cd39ae4ff Change sets to lists 2016-07-12 22:21:05 +02:00
Jan Verbeek
bbc46d28ff Use lists instead of tuples for comparing
Per one of the diff comments on #1597:
> I used to use a tuple for constant things, but nowadays I'd actually
> prefer a list as a tuple is something more heterogeneous (i.e. it
> makes sense to have a `(x, y)` point as a tuple, but a list of points
> would be a list).
> At some point I should probably change it to a list everywhere 😉
2016-07-12 22:05:32 +02:00
Florian Bruhin
46bdfa2932 Regenerate docs 2016-07-12 18:45:14 +02:00
Florian Bruhin
e5cab11979 Escape backslashes in end2end test commands
Let's hope this fixes stuff on Windows where \ is used as path
separator...
2016-07-12 17:52:05 +02:00
Florian Bruhin
1c86669628 Fix test_config.py
We used wrap-search to test interpolations there, but that's gone now.
2016-07-12 17:31:32 +02:00
Florian Bruhin
40455b2692 Always set FindWrapsAroundDocument in WebKitSearch
We accidentally set it to never wrap with the wrap-search option
removal, but we want to *always* wrap.
2016-07-12 17:28:59 +02:00
Florian Bruhin
54c00deb5b Remove checking of 'wrap' in WebEngineSearch
wrap functionality was removed, so no point in doing this here.
2016-07-12 17:28:28 +02:00
Daniel Schadt
a088f238e5 usertypes: remove Frankenstein's enum
This approach is not as weird in Python and still works.

DownloadTarget.OpenDownload has been renamed to OpenFileDownloadTarget,
since OpenDownloadDownloadTarget didn't look as nice.
2016-07-12 17:10:36 +02:00
Daniel Schadt
ed5fb4de4a downloads: make get_tmpdir private 2016-07-12 17:06:40 +02:00
Daniel Schadt
17175ec3d4 mhtml: remove duplicated usertypes import 2016-07-12 17:06:40 +02:00
Daniel Schadt
05c09a1476 tests: fix test_adblock for new download manager 2016-07-12 17:06:40 +02:00
Daniel Schadt
d42d980dda downloads: introduce target= param for .get/.fetch
This parameter replaces the filename and fileobj parameters. This makes
it easier to add more download targets, since only one may be "chosen".
With the OPEN_DOWNLOAD special case added, handling of filename got a
bit ugly, since it may be either None, OPEN_DOWNLOAD or a str with the
file path, and we had to make sure only one target was chosen.

With the new target enum, this handling can be simplified and we
automatically get the guarantee that only one target is chosen.
2016-07-12 17:06:40 +02:00
Daniel Schadt
16e1f8eac9 downloads: fix docstring for .get()
An earlier commit removed the prompt_download_directory parameter, it is
now passed via **kwargs and should thus be removed from the docstring.
2016-07-12 16:52:01 +02:00
Daniel Schadt
220203dd9c spellchecker: mark "occurs" as correct
See http://www.thefreedictionary.com/occur
2016-07-12 16:52:01 +02:00
Daniel Schadt
203dad0004 fix lint 2016-07-12 16:52:01 +02:00
Daniel Schadt
8795f89c88 tests: fix tests for downloads bdd test
The test was failing because of two reasons:

First, the old code had filename questions in DownloadManager.get and
DownloadManager.fetch which were almost identical, thus the part in
DownloadManager.get was removed in an earlier commit. All filename
asking is now done by DownloadManager.fetch. The good part is code
deduplication, the bad part is slightly modified behavior: The new code
doesn't wait for a filename to start the download, instead it tries to
fill the buffer immediately. This made the test fail because qute:// has
no registered handler, so in order for the test to pass now, the "no
crash" part is not enough, we also need to expect the "No handler"
error.

Secondly, and a rather rare (race) condition was the handling of errors
in the DownloadItem. If an error occured after the registration of
self.on_reply_error as error handler and before the check
    reply.error() != QNetworkReply.NoError
at the end of the function, the error signal would be emitted twice:
Once by _die() (called by on_reply_error), and once by the init_reply
function directly (in the last if block). This lead to duplicated error
messages. This is also explained in a comment in the file (with small
"stack traces").
2016-07-12 16:52:01 +02:00
Daniel Schadt
7608805c9a tests: adjust tests for new download mode
Now the prompt is shown with PromptMode.download instead of
PromptMode.text, which we need to change in the tests.
2016-07-12 16:52:01 +02:00
Daniel Schadt
b130c2a284 keybindings: add default for prompt-open-download 2016-07-12 16:52:01 +02:00
Daniel Schadt
81b2688c70 downloads: use global TempDownloadManager
This way, all temporary downloads will end up in the same directory and
everything is cleaned up at program exit, not when the corresponding
window is closed.
2016-07-12 16:52:01 +02:00
Daniel Schadt
c060f9e5c2 allow downloads to be openened directly
The file is saved in a temporary directory, which is cleaned up when the
window is closed.
2016-07-12 16:52:01 +02:00
Jan Verbeek
cafe7181c7 Blacklist command-accept, hide repeat-command
prompt-accept was blacklisted instead of command-accept.
2016-07-12 16:48:33 +02:00
Florian Bruhin
64b32ec87d Remove general -> wrap-search 2016-07-12 16:47:57 +02:00
Florian Bruhin
f0da508c21 Move searching out of WebView subclass
This also makes it work for QtWebEngine.
It also seems to fix #1050 though I'm not 100% sure why.
2016-07-12 16:29:50 +02:00
Florian Bruhin
038f803180 flake8 requirements: Update flake8-putty to 0.4.0
- Microsoft Windows filename selector fixes, with Appveyor CI testing
- Allow multiple codes to be disabled by per-line comments
- Allow comment after each rule line
- Prevent use with flake8 v3
- Support both pep8 and pycodestyle in test suite
2016-07-12 14:16:04 +02:00
Florian Bruhin
6de8f85e04 Merge branch 'jdkaplan-issues/1630' 2016-07-12 13:31:36 +02:00