Compare commits

...

1453 Commits

Author SHA1 Message Date
Florian Bruhin
9b4d6a8f89 Release v0.8.4 2016-11-06 00:44:24 +01:00
Florian Bruhin
baeb374589 Fix changelog 2016-11-06 00:43:27 +01:00
Florian Bruhin
26cfac60d4 Move config import in keyconf.py 2016-11-06 00:08:40 +01:00
Florian Bruhin
f9d5af3546 Update freeze.py from master 2016-11-05 23:50:16 +01:00
Florian Bruhin
bd7cefddd5 Fix GitHub filename 2016-11-05 23:36:11 +01:00
Florian Bruhin
e925e8a059 Update build_release.py from master 2016-11-05 23:09:47 +01:00
Florian Bruhin
17cdf2eab6 Release v0.8.3 2016-11-05 23:06:56 +01:00
Florian Bruhin
38f7f63689 Update changelog for v0.8.3 2016-11-05 23:02:49 +01:00
Daniel Schadt
3b0e7a07f3 pdfjs: compatibility for v1.6.210
They renamed PDFView to PDFViewerApplication, which we need to account
for in our pdfjs scripts.

Also, it seems like the actual viewer is now only created when the DOM
has been loaded. This means that at the time when our script is
executed, the viewer does not yet exist. Thus we need to delay the open
request too by registering a DOMContentLoaded handler.
2016-11-05 22:41:10 +01:00
arza
5f3922d1d6 Fix sk-keybinding. 2016-11-05 22:20:33 +01:00
Rok Mandeljc
6cd159246c TabWidget: a possible fix for #1693 - grey area under custom tabbar
Attempt to fix the issue #1693 by:
- setting the TabBarStyle to TabWidget in addition to TabBar
- chain up SE_TabWidgetTabBar requests in TabBarStyle.subElementRect
  to the super() rather than self._style, in order to avoid getting
  adwaita-specific rect sizes instead of default ones that are also
  used in rendering.
2016-11-05 22:20:10 +01:00
Michael Hoang
552198ac31 Give error when trying to detach a single tab 2016-11-05 22:19:17 +01:00
Ryan Roden-Corrent
1222394efd Update command completion on setting an alias.
Wire up the config change event to update command completion on
changing aliases, so the new aliases will be included.

Fixes #1814.

Currently we do not have tests at a high enough level to test whether
signals are wired up correctly to update completions.
2016-11-05 22:18:56 +01:00
Ryan Roden-Corrent
a7ff4075de Allow binding to an alias.
Fix #1813: Cannot :bind to alias
2016-11-05 22:17:43 +01:00
Florian Bruhin
a876f4a199 Fix handling of typing.Union with newer Python 3.5 versions 2016-11-05 22:13:03 +01:00
Florian Bruhin
661945c61b Fix :restart deleting the given --basedir 2016-08-16 21:28:18 +02:00
Florian Bruhin
496e5a38fa Add "# pragma: no branch" 2016-08-16 11:55:07 +02:00
Florian Bruhin
a43aa52c81 Fix #1641 for v0.8.x
This is the equivalent of 56515321dd
2016-08-16 11:15:32 +02:00
Daniel Schadt
4abbe50289 tests: fix tests for misc.editor
Due to the change to NamedTemporaryFile, the _filename attribute was
removed. We now have to use _file.name.
2016-08-07 11:21:33 +02:00
Daniel Schadt
363d4f4654 os.unlink -> os.remove
The functions do the same, but remove sounds better.
2016-08-07 11:21:33 +02:00
Daniel Schadt
34e184ebf5 editor: fix external editor on windows
On windows, only one process can open a file in write mode at once. We
didn't close the handle we got (self._oshandle) before _cleanup, which
means that we had the file open the whole time, which means that the
external editor couldn't write back the changes.

This patch closes the file while the external editor is running and only
opens it once the editor is closed. We re-opened the file anyway, so
this shouldn't be a huge change. Additionally, tempfile.NamedTemporaryFile
is used instead of mkstemp, as we don't have to deal with os-level file
handles that way.
2016-08-07 11:21:33 +02:00
Florian Bruhin
17840d06da keyconfig: Validate commands *after* transforming
Otherwise we'd still get an error when e.g. transforming :yank-selected
to :yank selection as :yank-selected got removed.
2016-08-07 11:21:33 +02:00
Florian Bruhin
e9e2adb9a7 Fix crash when doing :<space><enter>
Introduced in #1577.
Fixes #1773.
2016-08-07 11:21:05 +02:00
Florian Bruhin
113675a0b5 Release v0.8.2 2016-08-02 18:33:59 +02:00
Florian Bruhin
c4d8a767f9 Update changelog for 0.8.2 2016-08-02 18:33:36 +02:00
Florian Bruhin
de3867fe95 Bump up filename length limit to 50
The usual limit seems to be 255 bytes, so even when assuming 5-byte
UTF-8 chars for every letter, 50 should be fine.

http://serverfault.com/questions/9546/filename-length-limits-on-linux/9548#9548
2016-08-02 16:17:05 +02:00
Daniel Schadt
6ac3940264 open-download: don't crash on download cancel
Fixes #1728.
2016-08-02 16:17:05 +02:00
Daniel Schadt
5e9eafd5a3 open-download: force encoding for filename
Fixes #1726.
2016-08-02 16:17:05 +02:00
Daniel Schadt
5d4b9e815c open-download: make sure the name is not too long
Fixes #1725.

Make sure that the temporary filename is not too long by restricting the
suggested part to 20 characters.
2016-08-02 16:17:05 +02:00
Daniel Schadt
3eba7fc314 downloads: don't crash on OSError in open-download
Fixes the crash in #1725, but does not provide a solution. The browser
won't crash, but the file won't be downloaded and opened either.
2016-08-02 16:17:05 +02:00
Florian Bruhin
11d7486f97 freeze.py: Copy plugin folders on Windows
This makes HTML5 video work.
Fixes #1068.
2016-08-02 15:56:40 +02:00
Florian Bruhin
8e7a1d3d97 Use HTML content for localstorage test
JS logging is disabled by QtWebKit in private browsing mode
2016-08-02 15:18:58 +02:00
Florian Bruhin
98704c0471 Fix deleting of quickmarks with ctrl-d 2016-08-02 14:58:12 +02:00
Florian Bruhin
c2bf595b79 Don't use QSignalSpy in IPC test
Fixes #1727.

For another testcase in the same file we still need to use it until
pytest-qt has a MultiSignalBlocker.args.
2016-08-02 14:26:11 +02:00
Florian Bruhin
f73f3a2001 Tunnel private-browsing to QtWebKit correctly 2016-08-02 14:24:34 +02:00
Florian Bruhin
afde5bbc79 Fix using a relative path with --basedir 2016-08-02 14:23:38 +02:00
Florian Bruhin
66a76a4504 travis: Remove testing on Ubuntu Wily 2016-08-02 11:20:12 +02:00
Florian Bruhin
feb73f06c5 Fix ;o/;O default bindings 2016-08-02 10:52:45 +02:00
Florian Bruhin
e32fbe9013 QtWebEngine: Fix crash when closing/reopening tabs 2016-08-02 10:52:24 +02:00
Florian Bruhin
776a16bf65 Fix crash when opening http://foo%40bar@baz 2016-08-02 10:51:54 +02:00
Florian Bruhin
225c860452 Fix <input /> test in test_webelem 2016-08-02 10:48:18 +02:00
Florian Bruhin
f982402526 Consider input elements without type for hinting 2016-08-02 10:46:23 +02:00
Florian Bruhin
6a6e7ecb38 travis: Switch bot to #qutebrowser-dev 2016-07-27 13:05:09 +02:00
Florian Bruhin
c94ed93f13 build_release: Fix call_tox with no python on Win 2016-07-27 12:36:43 +02:00
Florian Bruhin
95d1721f01 Release v0.8.1 2016-07-27 12:31:30 +02:00
Florian Bruhin
410be07f54 Hide harfbuzz warning if frozen 2016-07-27 12:15:37 +02:00
Florian Bruhin
01de52c23a Improve error message on OS X without QtWebEngine 2016-07-27 12:13:45 +02:00
Florian Bruhin
a84807ed05 Handle empty command in CommandRunner.parse_all
Sicne we now call self._get_alias there, we also need to make sure it's
not an empty string before that.

Introduced in #1577. Fixes #1690.
2016-07-27 11:23:30 +02:00
Florian Bruhin
2795ae9478 Update build scripts from master 2016-07-26 17:01:08 +02:00
Florian Bruhin
614794a62a link_pyqt: Use PyQt5.QtCore to find PyQt5 path
For some reason on OS X, PyQt5.__file__ does not exist as it's a
namespace package.
2016-07-26 13:59:25 +02:00
Florian Bruhin
b12c984846 Release v0.8.0 2016-07-26 13:30:41 +02:00
Florian Bruhin
3801960c61 tests: Add v0.8.0 to old_configs 2016-07-26 13:30:41 +02:00
Florian Bruhin
07e0ae5584 Un-hide --backend argument 2016-07-26 13:30:41 +02:00
Florian Bruhin
3ccb691e9f tab API: Rename scroll to scroller
The scroll attribute did overwrite QWidget.scroll which is unfortunate.
2016-07-26 13:19:07 +02:00
Florian Bruhin
878fa26247 Use real slots for QtWebKit signals
Otherwise we can get this when immediately quitting:

Traceback (most recent call last):
  File ".../qutebrowser/browser/webkit/webkittab.py", line 580, in <lambda>
    not self._widget.page().error_occurred))
RuntimeError: wrapped C/C++ object of type WebView has been deleted
2016-07-26 12:55:40 +02:00
Florian Bruhin
214641301c Improve test_smoke
There's currently an error on exit which doesn't get caught with
--nowindow and not with ":later 500 quit".

We also need to check the output as there's an additional segfault when
that happens...
2016-07-26 12:51:12 +02:00
Florian Bruhin
7f9af096cd Clean up changelog 2016-07-26 12:34:02 +02:00
Florian Bruhin
99ea20d0d1 Merge branch 'paretje-bash' 2016-07-26 12:14:42 +02:00
Florian Bruhin
9bd48c4277 Merge branch 'bash' of https://github.com/paretje/qutebrowser into paretje-bash 2016-07-26 12:13:15 +02:00
Florian Bruhin
3ea6d4c527 Add KeyConfigStub.get_reverse_bindings_for 2016-07-26 12:06:42 +02:00
Kevin Velghe
0f07198271 Don't pass 2 arguments to shebang
On most platforms (according to shellcheck), you can't pass two
arguments in a shebang. I.e. on Debian you get:
/usr/bin/env: ‘bash -e’: No such file or directory
2016-07-26 11:48:26 +02:00
Florian Bruhin
49977a32c4 Remove unused imports 2016-07-26 11:09:24 +02:00
Florian Bruhin
70d6f90f08 Display key hint for :prompt-download-open
This also splits up _display_question into one method per mode.
2016-07-26 11:08:03 +02:00
Florian Bruhin
d70f3a0417 Merge branch 'Kingdread-open-download' 2016-07-26 10:54:59 +02:00
Florian Bruhin
d5cf8ef894 Update docs 2016-07-26 10:54:45 +02:00
Florian Bruhin
36b0054238 Add keyconf.get_reverse_bindings_for 2016-07-26 10:50:50 +02:00
Florian Bruhin
f4f6a3dac1 Merge branch 'open-download' of https://github.com/Kingdread/qutebrowser into Kingdread-open-download 2016-07-26 10:32:34 +02:00
Florian Bruhin
e4d896401d Merge branch 'mlochbaum-mark-del-no-args' 2016-07-26 08:39:11 +02:00
Florian Bruhin
da64db853e Update docs 2016-07-26 08:36:16 +02:00
Florian Bruhin
dab17b801e Merge branch 'mark-del-no-args' of https://github.com/mlochbaum/qutebrowser into mlochbaum-mark-del-no-args 2016-07-26 08:33:17 +02:00
Florian Bruhin
ded733c674 test requirements: Update CherryPy to 7.1.0
Implement systemd's socket activation mechanism for CherryPy servers,
based on work sponsored by Endless Computers.

Socket Activation allows one to setup a system so that systemd will sit
on a port and start services 'on demand' (a little bit like inetd and
xinetd used to do).
2016-07-25 22:59:28 +02:00
Marshall Lochbaum
028e7239ed Add more number files 2016-07-25 15:37:02 -04:00
Florian Bruhin
2751e57958 Update OS X install instructions
Closes #1656
2016-07-25 19:41:29 +02:00
Florian Bruhin
c618983b3d flake8 requirements: Update flake8-tuple to 0.2.12
flake8>=3.0.0 compatibility
2016-07-25 18:07:41 +02:00
Florian Bruhin
b8ea3d3c39 flake8 requirements: Pin flake8 properly 2016-07-25 18:07:31 +02:00
Florian Bruhin
3efb41f743 flake8 requirements: Filter to flake8 < 3.0 2016-07-25 16:39:30 +02:00
Florian Bruhin
9f45a27a2a test requirements: Update CherryPy to 7.0.0
7.0.0
-----

Removed the long-deprecated backward compatibility for
legacy config keys in the engine. Use the config for the
namespaced-plugins instead:

 - autoreload_on -> autoreload.on
 - autoreload_frequency -> autoreload.frequency
 - autoreload_match -> autoreload.match
 - reload_files -> autoreload.files
 - deadlock_poll_frequency -> timeout_monitor.frequency

6.2.1
-----

Fix KeyError in Bus.publish when signal handlers set in config.
2016-07-25 13:06:32 +02:00
Florian Bruhin
1564563662 Don't enable warnings if log was never inited
Otherwise, anything importing qtutils (which uses ignore_py_warnings
on module level) would enable warnings. This means pylint showed its own
warnings because of qute_pylint.config.
2016-07-25 13:03:58 +02:00
Florian Bruhin
c3f53312af Fix 'is not' string comparison 2016-07-23 19:51:13 +02:00
Florian Bruhin
e887d9a381 Remove useless super-calls 2016-07-23 18:39:27 +02:00
Marshall Lochbaum
3ffb726b98 Merge branch 'master' into mark-del-no-args 2016-07-23 12:12:19 -04:00
Marshall Lochbaum
f52c7f13d3 Update numbers in urlmarks test 2016-07-23 12:05:26 -04:00
Marshall Lochbaum
9eeda62adf Use quickmark-add rather than quickmark-save in test 2016-07-23 12:05:26 -04:00
Marshall Lochbaum
1781d0fba3 Use DoesNotExistError rather than CommandError in get_by_qurl 2016-07-23 12:05:21 -04:00
Marshall Lochbaum
9758b52d91 Assume _current_url is valid (remove try/except) 2016-07-23 12:05:21 -04:00
Marshall Lochbaum
02731743c0 Use qtutils.ensure_valid instead of testing isValid in get_by_qurl 2016-07-23 12:05:11 -04:00
Florian Bruhin
04fdce9058 Close file stream in qute_pylint.modeline 2016-07-23 17:00:05 +02:00
Marshall Lochbaum
cba25d2bbb Remove quickmark_del and bookmark_del from the urlmark classes (use delete instead) 2016-07-23 10:55:57 -04:00
Florian Bruhin
3d4a01ef4c Merge branch 'winged-issue_1033_bookmark_display' 2016-07-23 15:48:41 +02:00
Florian Bruhin
19077c8b47 Update docs 2016-07-23 15:47:31 +02:00
Florian Bruhin
91b754d6ea Merge branch 'issue_1033_bookmark_display' of https://github.com/winged/qutebrowser into winged-issue_1033_bookmark_display 2016-07-23 15:42:33 +02:00
David Vogt
1f320b8686 Various fixes after code review.
* Move documentation changes of bookmark / quickmarks to docstrings, as the
  asciidoc is autogenerated from those
* Fix some whitespaces in the BDD test cases
* Improved docstring in qute_bookmarks handler
2016-07-23 14:50:28 +02:00
Florian Bruhin
02a06732ff Also ignore ImportWarning for pkg_resources import 2016-07-23 14:15:39 +02:00
Florian Bruhin
78fd614237 Merge branch 'ganwell-issue_1670_tests_fail_due_to_SSL_error' 2016-07-23 14:03:08 +02:00
David Vogt
11bf5c8809 Minor cleanups. Whitespace / indentation CSS.
There were some CSS classes that were not used in the bookmarks page.
Also, fixes a small indentation / code alignment issue
2016-07-23 13:06:56 +02:00
Florian Bruhin
d1cc542835 Update authors 2016-07-23 13:05:55 +02:00
Florian Bruhin
40a3e24b05 Ignore warning when importing pkg_resources
On Debian Jessie we get a PendingDeprecationWarning which we now see
since the log is init'ed earlier.
2016-07-23 13:04:53 +02:00
Florian Bruhin
64f208486e Add log.ignore_py_warnings() 2016-07-23 13:04:45 +02:00
Florian Bruhin
36bb5cf285 Merge branch 'issue_1670_tests_fail_due_to_SSL_error' of https://github.com/ganwell/qutebrowser into ganwell-issue_1670_tests_fail_due_to_SSL_error 2016-07-23 12:46:16 +02:00
David Vogt
8bbfcc01be Sort bookmarks / quickmarks by title or name respectively. 2016-07-23 12:32:05 +02:00
David Vogt
12e7b4f244 Extend command documentation regarding bookmarks page
Add links to the qute:bookmarks page in the documentation for `:bookmark-add`
and `:quickmark-add` commands.
2016-07-23 12:27:31 +02:00
David Vogt
85be6565fc Implement feature request #1033: Bookmark display
There is a new page now, qute:bookmarks that will display all bookmarks and
quickmarks. It's still missing a search / filter feature, but you can use
the built-in search / navigation just as easily for now.
2016-07-23 12:09:49 +02:00
Jean-Louis Fuchs
f040fd5a6d Ignore missing SSLv3 messages from Qt 2016-07-23 10:01:56 +00:00
Jean-Louis Fuchs
ef01566621 Initialize qt logging to qutebrowser as early as possible 2016-07-23 09:54:13 +00:00
Florian Bruhin
76eab7617b Remove @pyqtSlot for functions and non-QObjects
Fixes #1669
2016-07-23 11:42:50 +02:00
Marshall Lochbaum
e9660ad676 Fix incorrect number in test 2016-07-21 22:45:36 -04:00
Marshall Lochbaum
ff682606ab Add tests for bookmark-del and quickmark-del with no arguments 2016-07-21 22:34:10 -04:00
Marshall Lochbaum
19949101c6 Make quickmark_del with no argument delete the current page's mark (fixes #1661) 2016-07-21 22:32:04 -04:00
Marshall Lochbaum
83005bc072 Make bookmark_del with no argument delete the current page's mark 2016-07-21 21:14:54 -04:00
Florian Bruhin
63e466f019 Remove @pyqtSlot for some non-QObject classes
Not sure if I got all, but at least I got the ones which fail
immediately on start.

See #1669.
2016-07-21 14:56:12 +02:00
Florian Bruhin
ac2553794c flake8: Ignore all dotfiles 2016-07-21 14:55:50 +02:00
Florian Bruhin
aabee4828e Merge branch 'rcorre-cut_test_clutter' 2016-07-20 16:19:49 +02:00
Florian Bruhin
a1c4e6e2cf Rename shadowed tmpdir variable 2016-07-20 16:13:46 +02:00
Florian Bruhin
5f2dc53d94 tox: Set distshare = {toxworkdir}
This is kind uf unorthodox and the "distshare" setting seems to be
deprecated, but we don't get a ~/.tox this way.

See #1637
2016-07-20 16:02:14 +02:00
Florian Bruhin
c4fb43df58 pylint: Set persistent=n
See #1637
2016-07-20 15:51:57 +02:00
Florian Bruhin
c7eec246d3 Merge branch 'cut_test_clutter' of https://github.com/rcorre/qutebrowser into rcorre-cut_test_clutter 2016-07-20 15:28:58 +02:00
Florian Bruhin
bf06f4a4d7 tests: Use dedicated logger for message mock
The message mock might handle a message during pytest-qt's processEvents
during test setup. If that happens, depending on the fixture order,
pytest-caplog might not be set up first, which is why the
self._caplog.at_level call can fail:

  File "c:\projects\qutebrowser\qutebrowser\misc\guiprocess.py", line 105, in on_finished
    immediately=True)
  File "C:\projects\qutebrowser\tests\helpers\messagemock.py", line 71, in _handle_error
    self._handle(Level.error, *args, **kwargs)
  File "C:\projects\qutebrowser\tests\helpers\messagemock.py", line 65, in _handle
    with self._caplog.at_level(log_level):  # needed so we don't fail
  File "C:\projects\qutebrowser\.tox\py34\lib\site-packages\pytest_catchlog.py", line 232, in at_level
    obj = logger and logging.getLogger(logger) or self.handler
  File "C:\projects\qutebrowser\.tox\py34\lib\site-packages\pytest_catchlog.py", line 186, in handler
    return self._item.catch_log_handler
  AttributeError: 'Function' object has no attribute 'catch_log_handler'

Full stack:

    c:\projects\qutebrowser-git\.tox\py34\lib\site-packages\pytestqt\plugin.py(100)pytest_runtest_setup()
  -> _process_events()
    c:\projects\qutebrowser-git\.tox\py34\lib\site-packages\pytestqt\plugin.py(140)_process_events()
  -> app.processEvents()
    c:\projects\qutebrowser-git\qutebrowser\misc\guiprocess.py(94)on_error()
  -> self._what, msg), immediately=True)
    c:\projects\qutebrowser-git\tests\helpers\messagemock.py(71)_handle_error()
  -> self._handle(Level.error, *args, **kwargs)
    c:\projects\qutebrowser-git\tests\helpers\messagemock.py(65)_handle()
  -> with self._caplog.at_level(log_level):  # needed so we don't fail
    c:\projects\qutebrowser-git\.tox\py34\lib\site-packages\pytest_catchlog.py(235)at_level()
  -> obj = logger and logging.getLogger(logger) or self.handler
  > c:\projects\qutebrowser-git\.tox\py34\lib\site-packages\pytest_catchlog.py(189)handler()->None

This should fix broken AppVeyor builds.

Fixes #1662.
2016-07-20 14:23:09 +02:00
Florian Bruhin
811361dbbe test requirements: Update beautifulsoup4 to 4.5.0
* Beautiful Soup is no longer compatible with Python 2.6. This
  actually happened a few releases ago, but it's now official.

* Beautiful Soup will now work with versions of html5lib greater than
  0.99999999.

* If a search against each individual value of a multi-valued
  attribute fails, the search will be run one final time against the
  complete attribute value considered as a single string. That is, if
  a tag has class="foo bar" and neither "foo" nor "bar" matches, but
  "foo bar" does, the tag is now considered a match.

  This happened in previous versions, but only when the value being
  searched for was a string. Now it also works when that value is
  a regular expression, a list of strings, etc.

* Fixed a bug that deranged the tree when a whitespace element was
  reparented into a tag that contained an identical whitespace
  element.

* Added support for CSS selector values that contain quoted spaces,
  such as tag[style="display: foo"].

* Corrected handling of XML processing instructions.

* Corrected an encoding error that happened when a BeautifulSoup
  object was copied.

* The contents of <textarea> tags will no longer be modified when the
  tree is prettified.

* When a BeautifulSoup object is pickled but its tree builder cannot
  be pickled, its .builder attribute is set to None instead of being
  destroyed. This avoids a performance problem once the object is
  unpickled.

* Specify the file and line number when warning about a
  BeautifulSoup object being instantiated without a parser being
  specified.

* The `limit` argument to `select()` now works correctly, though it's
  not implemented very efficiently.

* Fixed a Python 3 ByteWarning when a URL was passed in as though it
  were markup. Thanks to James Salter for a patch and
  test.

* We don't run the check for a filename passed in as markup if the
  'filename' contains a less-than character; the less-than character
  indicates it's most likely a very small document.
2016-07-20 14:07:01 +02:00
Florian Bruhin
dfbd31f35f Use /usr/bin/env shebang for bash userscripts
See #1665
2016-07-20 11:06:35 +02:00
Florian Bruhin
6130226a23 doc/stacktrace: Add qt5-webengine-debug 2016-07-20 09:40:09 +02:00
Florian Bruhin
d271c31edf pylint requirements: Update pylint to 1.6.4
* Recurse into all the ancestors when checking if an object is an exception

  Since we were going only into the first level, we weren't inferring
  when a class used a metaclass which defined a base Exception class
  for the aforementioned class.
2016-07-19 19:22:25 +02:00
Florian Bruhin
4161f4d6eb test requirements: Update CherryPy to 6.2.0
* Added tool to automatically convert request params based on type
  annotations (primarily in Python 3). For example:

    @cherrypy.tools.params()
    def resource(self, limit: int):
        assert isinstance(limit, int)
2016-07-19 09:36:51 +02:00
Florian Bruhin
70f14329e3 pylint requirements: Update pylint to 1.6.3
* Do not crash when inferring uninferable exception types for docparams
  extension
2016-07-19 09:24:51 +02:00
Ryan Roden-Corrent
48dbf505ce Limit config_tmpdir use in test_configtypes.
Only use the fixture in the test class that tries to access the config
dir (TestFileAndUserStyleSheet) rather than the whole test.
2016-07-18 21:49:37 -04:00
Ryan Roden-Corrent
7b3406a3e4 Use monkeypatch.setenv instead of os.putenv.
This ensures the environment is modified only for the test using the
fixture rather than for the whole test run.
2016-07-18 21:39:35 -04:00
Florian Bruhin
ea8e1f1131 Merge branch 'lahwaacz-#1657' 2016-07-18 14:31:20 +02:00
Florian Bruhin
8a290bf9b2 Add a test for #1657/#1658 2016-07-18 14:31:01 +02:00
Jakub Klinkovský
202883fc03 fix #1657
The _filterstr attribute was not cleaned up properly and persisted
between hintings. In this case, it was set to something representing the
Escape key.
2016-07-17 17:36:35 +02:00
Florian Bruhin
d867a789c2 Re-enable crash reports for QtWebEngine 2016-07-17 14:27:01 +02:00
Ryan Roden-Corrent
7d36847f77 Prevent test_tab from creating user data dir.
This is another case (like test_qt_javascript) that needs redirection
of XDG_DATA_HOME to prevent Qt from creating ~/.share/local/qute_test.
2016-07-17 07:07:05 -04:00
Florian Bruhin
f597b052c6 test requirements: Update CherryPy to 6.1.1
Fix issue where autoreload fails when the host interpreter for CherryPy
was launched using ``python -m``.
2016-07-17 12:00:54 +02:00
Ryan Roden-Corrent
5ae9d985b1 Prevent lingering object from test_config.
Using the config_tmdpir fixture across all tests in this module caused
a lingering LineParser to make test_debug fail.
I still don't know why, but scoping the config_tmpdir fixture to only
the test class that was creating ~/.config/qute_test fixes the issue,
and still prevents creation of a user tempdir.
2016-07-16 06:47:12 -04:00
Ryan Roden-Corrent
f589e44700 Don't write to user datadir in test_qt_javascript.
This was more complicated than the other data/config/cachedir test
fixes, as QtWebEngine was accessing the datadir directly (and bypassing
standdarddir.data).

This means the tmpdir_data stub is not enough, we need to set
XDG_DATA_HOME to redirect access.
2016-07-15 13:46:50 -04:00
Ryan Roden-Corrent
d9b546701e Prevent creation of user dirs on several tests.
Use the config_tempdir and data_tempdir fixtures for several tests that
were creation ~/.config/qute_test or ~/.local/share/qute_test.
2016-07-15 13:46:50 -04:00
Ryan Roden-Corrent
a6695ea1be Prevent test_adblock from creating real config dir.
Don't create ~/.config/qute_test by mocking out standdarddir.config for
all tests in this module.

This adds config_tmpdir to fixtures.py and moves temp_datadir from
test_adblock to fixtures.py as it will be needed more broadly.
2016-07-15 13:46:50 -04:00
Ryan Roden-Corrent
9c9b367887 Completely prevent tests from creating cachedir.
Attempting to fix the test on windows caused it to create the cachedir
again. The call to init(None) was unnecessary.
2016-07-15 13:46:50 -04:00
Ryan Roden-Corrent
cee5d6b97f Use fake_args in test_standarddir. 2016-07-15 13:46:50 -04:00
Ryan Roden-Corrent
34583d1565 Fix standarddir test on Windows.
Was broken by 48a2cad while trying to prevent creation of qute_test in
non-temp locations.
2016-07-15 13:46:50 -04:00
Ryan Roden-Corrent
1f71520bb2 Prevent tests from creating cachedir tag.
Running test_standarddir would pollute the user's home with
`~/.cache/qute_test`.

The `no_cachedir_tag` fixture was supposed to prevent this, but was not
working because [usefixtures does not work on fixtures]
(https://github.com/pytest-dev/pytest/issues/1014).

This fixes the fixture to actually prevent cachedir creation, but
applies it to tests individually (or by class) rather than with autouse
because the cachedir tests cannot pass if it is working.
2016-07-15 13:46:50 -04:00
Ryan Roden-Corrent
daaa5ff5c5 Don't create real config/data dirs from tests.
Running the tests would create ~/.config/qute_test and
~/.local/share/qute_test on the user's machine. The test_standardir
module needed a bit more mocking to prevent it from cluttering the
user's machine.

Two tests that created the data dir were fixed by passing basedir in
args, and one test that created the config dir was fixed by patching
os.makedirs to a noop.
2016-07-15 13:46:50 -04:00
Florian Bruhin
6f65973237 Adjust freeze_tests for cherrypy.wsgiserver merge 2016-07-15 17:05:41 +02:00
Florian Bruhin
701c2fe7d0 appveyor: Don't patch registry
In newer Appveyor images, only a key for Python 3.5 exists here.
2016-07-15 17:05:16 +02:00
Florian Bruhin
d710a98f46 Fix lint 2016-07-15 15:52:48 +02:00
Florian Bruhin
e2c4e6301f QtWebEngine: Implement scroll.at_top() 2016-07-15 14:00:41 +02:00
Florian Bruhin
695864281b QtWebEngine: Implement pixel scroll position in JS 2016-07-15 13:04:44 +02:00
Florian Bruhin
7adc8ab2d6 QtWebEngine: Implement scroll position based on JS 2016-07-15 12:52:27 +02:00
Florian Bruhin
83906d223a Remove unneeded pylint suppression
In the last CherryPy update, cherrypy.wsgiserver got converted to a
single module. While this issue still exists in pylint, we don't get it
here anymore.
2016-07-15 11:09:51 +02:00
Florian Bruhin
321e5319c6 pylint requirements: Update pylint to 1.6.2
* Do not crash when printing the help of options with default regular
  expressions
* More granular versions for deprecated modules.
* Do not crash in docparams when we can't infer the exception types.
2016-07-15 11:06:46 +02:00
Florian Bruhin
d079caafa8 Add possibility to disable spellcheck 2016-07-15 00:07:37 +02:00
Florian Bruhin
a8dc940b73 test/vulture reqs: Update vulture to 0.10
* Detect unused function and method arguments.
* Detect unused *args and **kwargs parameters.
* Change license from GPL to MIT.
2016-07-14 23:17:39 +02:00
Florian Bruhin
675e6eca23 Add old tab.seperator spellings to DELETED_OPTIONS
This was never caught due to the bug in the last commit, but now makes
reading very old configs fail.
2016-07-14 16:59:33 +02:00
Florian Bruhin
7b9d38e438 Fix config values being lost with DELETED_OPTIONS
When an option was deleted, we accidentally stopped reading instead of
ignoring that one option and then resuming.
2016-07-14 16:58:54 +02:00
Florian Bruhin
325846f20a Remove doubled check 2016-07-14 16:33:59 +02:00
Florian Bruhin
2848ab1904 test requirements: Update CherryPy to 6.1.0
* Combined wsgiserver2 and wsgiserver3 modules into a single module,
  `cherrypy.wsgiserver`.
2016-07-14 07:07:00 +02:00
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
Florian Bruhin
995b601222 Update docs 2016-07-12 13:31:21 +02:00
Florian Bruhin
9f6b3973d3 Adjust :print --pdf test title 2016-07-12 13:29:32 +02:00
Florian Bruhin
77035851a3 Sanity check the PDF file for :print --pdf test 2016-07-12 13:28:43 +02:00
Florian Bruhin
fce825f9df Remove redundant "Given a new tmpdir" step
With the (tmpdir) replacement we'll get a temporary directory no matter
what, so this is unnecessary.
2016-07-12 13:22:47 +02:00
Florian Bruhin
cd4eff364a Add printing to tab API
This fixes printing for QtWebKit, and hopefully will make printing to
PDF work with QtWebEngine with Qt >= 5.7
2016-07-12 12:54:11 +02:00
Jan Verbeek
ee4b24a5dc Blacklist leave-mode, use "not in" 2016-07-12 11:03:36 +02:00
Florian Bruhin
7a39021d41 Merge branch 'issues/1630' of https://github.com/jdkaplan/qutebrowser into jdkaplan-issues/1630 2016-07-12 10:07:59 +02:00
Florian Bruhin
37c6d63ddf tests: Ignore "load glyph failed" warnings
See #1637
2016-07-12 09:45:40 +02:00
Jeremy Kaplan
6b2b096f3c Add test for :print --pdf 2016-07-11 20:08:24 -04:00
Jeremy Kaplan
62ae793a24 Generate docs 2016-07-11 20:07:54 -04:00
Jan Verbeek
508c0f21fa Blacklist prompt-accept, remove mode_allowed 2016-07-12 00:23:34 +02:00
Florian Bruhin
d315a3131d Require QtWebEngine with --backend webengine 2016-07-11 22:51:05 +02:00
Florian Bruhin
ed3198db4e Merge branch 'rcorre-taskadd' 2016-07-11 21:15:14 +02:00
Florian Bruhin
31b4f2e383 Update changelog 2016-07-11 21:15:03 +02:00
Florian Bruhin
fc2787dd72 Merge branch 'taskadd' of https://github.com/rcorre/qutebrowser into rcorre-taskadd 2016-07-11 21:14:21 +02:00
Florian Bruhin
cb84cbf730 Merge branch 'ismail-s-add-bookmark-by-url' 2016-07-11 20:55:38 +02:00
Florian Bruhin
fc999f247b Update docs 2016-07-11 20:55:24 +02:00
Florian Bruhin
4f9be56d7d Merge branch 'add-bookmark-by-url' of https://github.com/ismail-s/qutebrowser into ismail-s-add-bookmark-by-url 2016-07-11 20:54:09 +02:00
Florian Bruhin
9f9e41687f Add a (tmpdir) replacement for BDD tests
See #1639
2016-07-11 20:47:37 +02:00
Florian Bruhin
3d4cf1fc92 QtWebEngine: Fix icon access on Qt < 5.7 2016-07-11 18:24:38 +02:00
Florian Bruhin
d91c922b4c Add --qute-bdd-webengine switch for end2end tests 2016-07-11 17:24:03 +02:00
Florian Bruhin
ed5af29ac9 Fix lint 2016-07-11 16:43:06 +02:00
Florian Bruhin
f2c52f96a1 Fix _on_url_changed 2016-07-11 16:33:19 +02:00
Florian Bruhin
8b67d68d4a Move qtutils.ensure_valid in WebView.openurl 2016-07-11 16:32:24 +02:00
Florian Bruhin
e80475ed57 Remove support for showing JS statusbar messages
Closes #1579.
2016-07-11 16:19:44 +02:00
Florian Bruhin
d0aea24568 Remove WebView.linkHovered signal 2016-07-11 16:09:17 +02:00
Florian Bruhin
914f9db8ca Actually connect _on_url_changed slot 2016-07-11 16:05:09 +02:00
Florian Bruhin
f46d6cbe27 Fix url_text, take 3 2016-07-11 15:06:36 +02:00
Florian Bruhin
9b75e661e2 Fix missed url_text substitutions 2016-07-11 14:59:35 +02:00
Florian Bruhin
5d6eedcd49 Move URL/title handling to AbstractTab 2016-07-11 14:36:57 +02:00
Florian Bruhin
a470bfc3f3 Get rid of url_text_changed signal
Instead we simply use url_changed which (similar to Qt's urlChanged)
simply has a QUrl argument.
2016-07-11 14:28:51 +02:00
Florian Bruhin
5cbd540e15 Get rid of WebView.cur_url attribute
The only thing which differs from url() is that it got set immediately
after openurl() was called, which might or might not have improved
something.

Let's see if things still work the same without it.
2016-07-11 14:20:46 +02:00
Florian Bruhin
7e36884cbd Add some debug logging to early QWEW import
See #1640
2016-07-11 13:49:24 +02:00
Florian Bruhin
64dc099d51 pylint: Enable docstyle extension 2016-07-11 13:47:18 +02:00
Florian Bruhin
6a07d231f4 pykint: Add some disable=unused-variable 2016-07-11 13:18:31 +02:00
Florian Bruhin
a64937122d Drop unneeded .keys() 2016-07-11 13:13:16 +02:00
Florian Bruhin
a5d2d3109e pylint: Reenable bad-builtin extension 2016-07-11 13:12:52 +02:00
Florian Bruhin
1d237b0569 pylint: ignore wrong-import-position project-wide
While it's more accurate with isort now, we get a wrong-import-position
for everything in scripts/ where we have to do the sys.path magic first.
2016-07-11 13:00:37 +02:00
Florian Bruhin
63b8d225e8 pylint requirements: pylint 1.6
Closes #1632.

new: mccabe
new: isort
deleted: colorama

astroid 1.4.7
-------------

* Stop saving assignment locals in ExceptHandlers, when the context is a store.

  This fixes a tripping case, where the RHS of a ExceptHandler can be redefined
  by the LHS, leading to a local save. For instance, ``except KeyError, exceptions.IndexError``
  could result in a local save for IndexError as KeyError, resulting in potential unexpected
  inferences. Since we don't lose a lot, this syntax gets prohibited.

pylint 1.6.0
------------

* Added a new extension, `pylint.extensions.mccabe`, for warning
  about complexity in code.

* Deprecate support for --optimize-ast.
* Deprecate support for the HTML output.
* Deprecate support for --output-files.

* Fixed a documentation error for the check_docs extension.

* Made the list of property-defining decorators configurable.

* Fix a bug where the top name of a qualified import was detected as unused variable.

* bad-builtin is now an extension check.

* generated-members support qualified name through regular expressions.

  For instance, one can specify a regular expression as --generated-members=astroid.node_classes.*
  for ignoring every no-member error that is accessed as in `astroid.node_classes.missing.object`.

* Add the ability to ignore files based on regex matching, with the new ``--ignore-patterns``
  option.

  This allows for multiple ignore patterns to be specified. Rather than
  clobber the existing ignore option, we introduced a new one called
  ignore-patterns.

* Added a new error, 'trailing-newlines', which is emitted when a file
  has trailing new lines.

* Add a new option, 'redefining-builtins-modules', for controlling the modules
  which can redefine builtins, such as six.moves and future.builtins.

* 'reimported' is emitted when the same name is imported from different module.

* Add a new recommendation checker, 'consider-iterating-dictionary', which is emitted
  which is emitted when a dictionary is iterated through .keys().

* Use the configparser backport for Python 2

  This fixes a problem we were having with comments inside values, which is fixed
  in Python 3's configparser.

* A new error was added, 'invalid-length-returned', when the `__len__`
  special method returned something else than a non-negative number.

* Switch to using isort internally for wrong-import-order.

* check_docs extension can find constructor parameters in __init__.

* Don't warn about invalid-sequence-index if the indexed object has unknown base
  classes.

* Don't crash when checking, for super-init-not-called, a method defined in an if block.

* Do not emit import-error or no-name-in-module for fallback import blocks by default.

  Until now, we warned with these errors when a fallback import block (a TryExcept block
  that contained imports for Python 2 and 3) was found, but this gets cumbersome when
  trying to write compatible code. As such, we don't check these blocks by default,
  but the analysis can be enforced by using the new ``--analyse-fallback-block`` flag.

pylint 1.6.1
------------

* Use environment markers for supporting conditional dependencies.
2016-07-11 13:00:08 +02:00
Florian Bruhin
216d8c3c13 test requirements: Update hypothesis to 3.4.1
On Windows when running two Hypothesis processes in parallel (e.g. using
pytest-xdist) they could race with each other and one would raise an
exception due to the non-atomic nature of file renaming on Windows and
the fact that you can't rename over an existing file. This is now fixed.
2016-07-11 12:45:47 +02:00
Florian Bruhin
c558a8b4ad Add missing docstring 2016-07-11 12:42:51 +02:00
Florian Bruhin
e9d606a782 Move load_status / SSL errors to AbstractTab 2016-07-11 12:09:41 +02:00
Florian Bruhin
6ae232d8fc Move 'progress' to AbstractTab
This makes load progress work with QtWebEngine.
2016-07-11 11:31:59 +02:00
Florian Bruhin
8567fffdad Merge branch 'qtwebengine' 2016-07-11 10:56:20 +02:00
Florian Bruhin
b4f993e2ab Add an early-import for QtWebEngineWidgets 2016-07-11 09:18:05 +02:00
Florian Bruhin
43c1f62e39 Also skip test_tab on PyQt < 5.6
See #1638
2016-07-11 09:10:11 +02:00
Jeremy Kaplan
a6a030e92f Add :print --pdf flag to skip printing dialog 2016-07-10 21:58:54 -04:00
Florian Bruhin
86f381a3b7 Skip tests using fake_web_tab on PyQt < 5.6
For some weird reason they cause a segfault in QObject::disconnect since
fake_web_tab was converted to a fixture...

See #1638
2016-07-10 21:42:13 +02:00
Florian Bruhin
01b7b27bda Fix lines which are now too long 2016-07-10 17:33:36 +02:00
Florian Bruhin
b791095324 Rename browser.tab module and classes 2016-07-10 17:27:02 +02:00
Florian Bruhin
2649418c0b Fix lint 2016-07-10 17:04:26 +02:00
Florian Bruhin
d2ece6b542 Move Backend enum to usertypes
Otherwise we have a cyclic import
2016-07-10 17:04:26 +02:00
Florian Bruhin
34e39bed4e Add a test for cmd instance with wrong backend 2016-07-10 17:04:25 +02:00
Florian Bruhin
fd8e66136f tests: Add a mode_manager fixture 2016-07-10 17:04:25 +02:00
Florian Bruhin
52e14950f1 tests: Fix messagemock with stack argument 2016-07-10 17:04:25 +02:00
Florian Bruhin
7859df74c4 Add tests for Command.run 2016-07-10 17:04:25 +02:00
Florian Bruhin
b07cca023b Fix Command.run with no arguments 2016-07-10 17:04:25 +02:00
Florian Bruhin
2136d00aa2 tests: Add a fake_args fixture 2016-07-10 17:04:25 +02:00
Florian Bruhin
949172809d Add tab_registry to test_tab 2016-07-10 16:57:02 +02:00
Florian Bruhin
e36123735b Use a fixture for FakeWebTab
We need to make sure qapp and tab_registry are available everywhere the
FakeWebTab class is used.
2016-07-10 16:57:02 +02:00
Florian Bruhin
0ab601aaf3 Make it possible to limit commands to backends 2016-07-10 16:57:02 +02:00
Florian Bruhin
11cd5f8653 Don't register webview in objreg
All places now should use the tab API instead.
2016-07-08 17:21:33 +02:00
Florian Bruhin
67eea1678e Move tab registry from webview to tab 2016-07-08 17:13:18 +02:00
Florian Bruhin
dcf39538a3 Improve objreg error message if no window is given 2016-07-08 17:09:20 +02:00
Ismail S
fd7342b055 Move """ to separate line 2016-07-08 15:58:47 +01:00
Ismail S
394d9d1404 Add more tests for :bookmark-add 2016-07-08 15:54:39 +01:00
Ismail S
5ad66c29e1 Update docstring 2016-07-08 15:38:58 +01:00
Ismail S
babbd0771c Refactor code 2016-07-08 15:33:13 +01:00
Florian Bruhin
7360ea69ba Fix lint 2016-07-08 13:08:31 +02:00
Florian Bruhin
06a6daee34 Add stubs for QtWebEngine 2016-07-08 12:53:48 +02:00
Florian Bruhin
cc11af5e28 Fix lint 2016-07-08 11:21:00 +02:00
Florian Bruhin
b0fa821bc3 pylint: Disable duplicate-code globally
We can't disable it more fine-grained:
https://github.com/PyCQA/pylint/issues/214

I think for the shown duplicate (histroy in webkittab/webenginetab) it
makes no sense to refactor things as a Mixin...
2016-07-08 11:03:27 +02:00
Florian Bruhin
b1fda1b0ef Get rid of tab.run_webaction
As mentioned here:
e4b0b7fffd (r70002693)

It makes no sense to add a backend-specific run_webaction method to
AbstractTab - better to just access _widget directly in this one place
instead of adding something backend-speficic to the API.
2016-07-08 10:42:54 +02:00
Florian Bruhin
55784f9783 Add tab.create() helper function 2016-07-08 10:38:52 +02:00
Florian Bruhin
334f6cda4f tab: Rename modeman to mode_manager
To avoid it being mixed up with the modeman module
2016-07-08 10:38:51 +02:00
Florian Bruhin
7c6dd60f35 Fix test_on_tab_changed in statusbar.url tests
- The invalid URL will now get encoded when using QUrl.
- The check for a None url_text is somewhat pointless as I don't think
  this can ever happen in the real circumstances.
2016-07-08 10:38:51 +02:00
Florian Bruhin
37d20023b3 Remove now unneeded vulture ignore
We're now using __slots__
2016-07-08 10:10:08 +02:00
Florian Bruhin
f9eecaf584 Fix typo 2016-07-08 10:09:49 +02:00
Florian Bruhin
782561462b Use stubs.FakeWebTab to fake tabs
This also fixes the cur_url access.
2016-07-08 10:09:03 +02:00
Florian Bruhin
09f4c2199e Rename widget to tab in some places
This also fixes the cur_url access.
2016-07-08 10:08:44 +02:00
Florian Bruhin
b8086d1d13 mhtml: web_view -> tab rename
Otherwise this sounds like we still have a QWebView.
This also fixes the cur_url access.
2016-07-08 10:08:11 +02:00
Florian Bruhin
2befebaf3a Don't use properties for AbstractTab
Otherwise exceptions in there could be hidden by Python/PyQt.

Some places are not changed yet, as there are also other renames in the
next commits.
2016-07-08 10:05:46 +02:00
Florian Bruhin
ecd399181d Fix AbstractSearch attribute docs 2016-07-08 09:15:28 +02:00
Florian Bruhin
3bb5b5d1c9 Merge branch 'blyxxyz-status-position' 2016-07-08 09:11:29 +02:00
Florian Bruhin
b5c1db6bae Merge branch 'status-position' of https://github.com/blyxxyz/qutebrowser into blyxxyz-status-position 2016-07-08 09:10:26 +02:00
Florian Bruhin
9898b1af37 pylint: Remove -j0
See https://github.com/PyCQA/pylint/issues/987

On my laptop I get about a 3m -> 2m20s speedup, which isn't really worth
the trouble...
2016-07-07 23:22:42 +02:00
Jan Verbeek
a8c55ffe08 Stop downloads bar from pushing away status bar 2016-07-07 23:11:08 +02:00
Ismail S
3b0fb84c47 Allow adding bookmarks by url 2016-07-07 20:16:19 +01:00
Florian Bruhin
e4b0b7fffd Fix lint 2016-07-07 20:12:17 +02:00
Florian Bruhin
70fb9bfd51 Regenerate docs again 2016-07-07 20:08:12 +02:00
Florian Bruhin
dde8ac6844 Use __slots__ for tab.TabData 2016-07-07 19:36:27 +02:00
Florian Bruhin
b999090a51 Hide --backend argument for now 2016-07-07 19:28:00 +02:00
Florian Bruhin
0207f8758b Only disable reports with --backend webengine 2016-07-07 18:32:52 +02:00
Florian Bruhin
2fd01e57e6 Add default value for --backend argument 2016-07-07 18:32:52 +02:00
Florian Bruhin
ee7b4256a9 Fix AbstractTab repr() with no URL available 2016-07-07 18:32:52 +02:00
Florian Bruhin
d9516b9c1d Adjust various comments 2016-07-07 18:32:52 +02:00
Florian Bruhin
3c99436950 Make on_* methods in tab private 2016-07-07 18:32:52 +02:00
Florian Bruhin
868f781f4d Rename zoom._set_default_zoom to zoom.set_default 2016-07-07 18:32:52 +02:00
Florian Bruhin
1c9d0857cb Various cleanups 2016-07-07 18:32:52 +02:00
Florian Bruhin
9421db8869 Update docs for --backend 2016-07-07 18:32:52 +02:00
Florian Bruhin
40f0aa0023 Fix pylint without QtWebEngine available 2016-07-07 18:32:52 +02:00
Florian Bruhin
fea25d715c Add Percentage test with None-value 2016-07-07 18:32:52 +02:00
Florian Bruhin
3fe851ed84 Temporarily remove tab.py from perfect_files
We have things like the mousewheel event handling in there which we
can't easily test just yet.
2016-07-07 18:32:52 +02:00
Florian Bruhin
5420d6d2ae Mark some session tests as xfail
There'll be a refactoring to add a session API to WebTab later anyways,
so no point in fixing this now.

As many tests as possible here should probably also be changed to
end2end ones as there's a lot of mocking going on.
2016-07-07 18:32:52 +02:00
Florian Bruhin
7e3e9618b2 Revert "Adjust QtWebKit _key_press to QtWebEngine one"
This reverts commit f52326c5eea83e58d95afb696480600c6a8a5b7b.

For some reason this causes a lot of segfaults...
2016-07-07 18:32:52 +02:00
Florian Bruhin
e1bad17f2a Split up SessionManager._save_tab_item 2016-07-07 18:32:52 +02:00
Florian Bruhin
b23ddb31c9 Fix lint 2016-07-07 18:32:52 +02:00
Florian Bruhin
be02bfb37d Unify arguments for on_mode_* slots in Caret 2016-07-07 18:32:52 +02:00
Florian Bruhin
df2c50aa60 Add class docstrings for webkittab/webenginetab 2016-07-07 18:32:52 +02:00
Florian Bruhin
de60ad04dc Fix mouse wheel zooming 2016-07-07 18:32:52 +02:00
Florian Bruhin
f72f82fb0c QtWebEngine: Fix userData() call on session saving 2016-07-07 18:32:52 +02:00
Florian Bruhin
b78de501c2 Adjust QtWebKit _key_press to QtWebEngine one 2016-07-07 18:32:52 +02:00
Florian Bruhin
47ce6aff89 Send QtWebEngine fake key events to focus proxy
This fixes simple scrolling with QtWebEngine.
2016-07-07 18:32:52 +02:00
Florian Bruhin
ec053f8007 Simplify TabData implementation
This uses direct attributes instead of self._data which means we can
only override __setattr__, and pylint will better understand what's
happening.
2016-07-07 18:32:52 +02:00
Florian Bruhin
40d28b80bf Fix typo 2016-07-07 18:32:52 +02:00
Florian Bruhin
2bd07937e5 Remove unnecessary TabData.__getattr__ code
__getattribute__ is used in that case; see
https://github.com/PyCQA/pylint/issues/979
2016-07-07 18:32:52 +02:00
Florian Bruhin
09f025628f Use tab.AbstractTab for signals/slots 2016-07-07 18:32:52 +02:00
Florian Bruhin
7444f83dbf Fix importing of QtWebEngine specific code 2016-07-07 18:32:52 +02:00
Florian Bruhin
17466b4f26 Fix some lint 2016-07-07 18:32:52 +02:00
Florian Bruhin
4e5a7a891e tests: Use FakeWebTab for stubbing 2016-07-07 18:32:52 +02:00
Florian Bruhin
5107a87291 Fix test_tab tests 2016-07-07 18:32:52 +02:00
Florian Bruhin
7b37d85150 Pass modeman as argument to AbstractTab 2016-07-07 18:32:52 +02:00
Florian Bruhin
e0cd878606 Fix/tunnel mhtml downloads 2016-07-07 18:32:52 +02:00
Florian Bruhin
0719101b6f Also tunnel :paste-primary 2016-07-07 18:32:52 +02:00
Florian Bruhin
21b282ce29 Get rid of _DummyUserscriptRunner
This simplifies the code a bit and only provides
userscript.run_async (and not the UserscriptRunner class) as entrypoint.
2016-07-07 18:32:52 +02:00
Florian Bruhin
a6307497c0 Rewrite userscripts to work with async dumping 2016-07-07 18:32:52 +02:00
Florian Bruhin
edafa7c99f Tunnel a few features until we have a proper API 2016-07-07 18:32:52 +02:00
Florian Bruhin
3c71337698 Handle OverflowError when scrolling 2016-07-07 18:32:52 +02:00
Florian Bruhin
00b287117a Fix tabs.feature tests 2016-07-07 18:32:52 +02:00
Florian Bruhin
0937a64f1c Fix :inspect 2016-07-07 18:32:52 +02:00
Florian Bruhin
675f95a2e4 Add stubs for on_mode_{entered,left} for WebEngine
This means at least we won't get a crash when using the commandline.
2016-07-07 18:32:52 +02:00
Florian Bruhin
12fc0821c0 Try to implement some QtWebEngine scrolling 2016-07-07 18:32:52 +02:00
Florian Bruhin
9c5143786c Implement scroll.pos_perc for QtWebEngine 2016-07-07 18:32:52 +02:00
Florian Bruhin
a1f4dcd542 Add QWebEngineView subclass 2016-07-07 18:32:52 +02:00
Florian Bruhin
822e193682 Fix :view-source 2016-07-07 18:32:52 +02:00
Florian Bruhin
04ee021bdb Add AbstractTab.set_html 2016-07-07 18:32:52 +02:00
Florian Bruhin
78f425c98b Add AbstractTab.data 2016-07-07 18:32:52 +02:00
Florian Bruhin
70b7314b76 Fix :debug-webaction 2016-07-07 18:32:52 +02:00
Florian Bruhin
deb0a10973 Add AbstractTab.backend attribute 2016-07-07 18:32:52 +02:00
Florian Bruhin
4de48620e3 Fix loading of sessions 2016-07-07 18:32:52 +02:00
Florian Bruhin
a62e2a0c27 Fix :undo 2016-07-07 18:32:52 +02:00
Florian Bruhin
09c3528585 Fix loading of marks
This probably broke when merging from master.
2016-07-07 18:32:52 +02:00
Florian Bruhin
5dfd8d68bf Set focus proxy for AbstractTab
By default, the AbstractTab object got the focus, which means things
like key events passed to it didn't actually get passed through to the
web view, causing these tests to fail:

    tests/end2end/features/test_keyinput_bdd.py::test_forwarding_all_keys
    tests/end2end/features/test_keyinput_bdd.py::test_forwarding_special_keys

Now we make sure the real underlying WebView always gets the keyboard
focus.
2016-07-07 18:32:52 +02:00
Florian Bruhin
3c3043eeae Add tab.clear_ssl_errors()
This fixes :debug-clear-ssl-errors
2016-07-07 18:32:52 +02:00
Florian Bruhin
86f63e1ae6 Add tab.new_tab_requested signal 2016-07-07 18:32:52 +02:00
Florian Bruhin
4d650c8dfd Add tab.caret.follow_selected() 2016-07-07 18:32:52 +02:00
Florian Bruhin
1148184892 Add tab.set_open_target
This fixes :follow-selected
2016-07-07 18:32:52 +02:00
Florian Bruhin
5dd4b2d56a Fix :buffer completion 2016-07-07 18:32:52 +02:00
Florian Bruhin
52efa9f185 Make AbstractHistory.history private 2016-07-07 18:32:52 +02:00
Florian Bruhin
b0ba2125a3 Fix :undo 2016-07-07 18:32:52 +02:00
Florian Bruhin
aebc29337a Move __iter__ to AbstractHistory 2016-07-07 18:32:52 +02:00
Florian Bruhin
59c9ee88e5 Quick fix for createWindow 2016-07-07 18:32:52 +02:00
Florian Bruhin
94b856c565 Make self._widget private in wrappers
While we need to set it from the outside (from AbstractTab) this still
is not considered public API for the rest of the code, so let's make it
private.
2016-07-07 18:32:52 +02:00
Florian Bruhin
0b88c5d413 Re-implement searching for QtWebKit 2016-07-07 18:32:52 +02:00
Florian Bruhin
515d16f137 Move selection()/has_selection() to caret 2016-07-07 18:32:52 +02:00
Florian Bruhin
9f130c6b27 Disable crash reports 2016-07-07 18:32:52 +02:00
Florian Bruhin
5c535213ad Random cleanups 2016-07-07 18:32:52 +02:00
Florian Bruhin
ac4186a0f0 Tunnel :hint and :navigate 2016-07-07 18:32:52 +02:00
Florian Bruhin
5fe2230e1f Fix various scrolling issues 2016-07-07 18:32:52 +02:00
Florian Bruhin
16c397a9d2 Fix various zooming issues 2016-07-07 18:32:52 +02:00
Florian Bruhin
edb65ecf50 Add run_js_eval and get :jseval to run 2016-07-07 18:32:52 +02:00
Florian Bruhin
cd95f94ac8 Disallow None-callback for dump_async 2016-07-07 18:32:52 +02:00
Florian Bruhin
21753bc65f Make AbstractCaret a QObject 2016-07-07 18:32:52 +02:00
Florian Bruhin
e21edd3e18 Implement selection 2016-07-07 18:32:52 +02:00
Florian Bruhin
90614d1fe3 Initial caret browsing support 2016-07-07 18:32:52 +02:00
Florian Bruhin
34d3d2cda6 Full scrolling implementation 2016-07-07 18:32:52 +02:00
Florian Bruhin
56852821e8 Try to fix _back_forward 2016-07-07 18:32:52 +02:00
Florian Bruhin
7319ced0bc Fix history deserializing 2016-07-07 18:32:52 +02:00
Florian Bruhin
67ffa67968 Fix deserialize call 2016-07-07 18:32:52 +02:00
Florian Bruhin
7cbe174f1e Fix set_zoom_factor call 2016-07-07 18:32:52 +02:00
Florian Bruhin
7e607a0cf2 Add icon() 2016-07-07 18:32:52 +02:00
Florian Bruhin
4fea285740 Add win_id attribute 2016-07-07 18:32:52 +02:00
Florian Bruhin
363f3d7ea7 Replace scroll_pos by scroll_pos_px()/_perc() 2016-07-07 18:32:52 +02:00
Florian Bruhin
ed716b2b90 Make session saving work 2016-07-07 18:32:52 +02:00
Florian Bruhin
2d590c581d Make :reload and :stop work 2016-07-07 18:32:52 +02:00
Florian Bruhin
6a42e0c96c Make shutdown work 2016-07-07 18:32:52 +02:00
Florian Bruhin
55753171f1 Make :back/:forward work 2016-07-07 18:32:52 +02:00
Florian Bruhin
3ee58fdea3 Get :debug-dump-page to work 2016-07-07 18:32:52 +02:00
Florian Bruhin
0c1e266073 Use QWebView/QWebEngineView for test_tab 2016-07-07 18:32:52 +02:00
Florian Bruhin
5b9ae8bc85 Initial history implementation 2016-07-07 18:32:52 +02:00
Florian Bruhin
37c3dbbc7d Fix test_tab 2016-07-07 18:32:52 +02:00
Florian Bruhin
d2dd32b979 Fix test_url 2016-07-07 18:32:52 +02:00
Florian Bruhin
8e5a86fb13 Don't require QtWebEngine 2016-07-07 18:32:52 +02:00
Florian Bruhin
bf286f8c74 Fix some tests 2016-07-07 18:32:52 +02:00
Florian Bruhin
115021b8ea Get QtWebEngine to start and work somewhat 2016-07-07 18:32:52 +02:00
Florian Bruhin
b0a391932a Get qutebrowser to run 2016-07-07 18:32:52 +02:00
Florian Bruhin
048f7dcaf5 Refactor signals 2016-07-07 18:32:52 +02:00
Florian Bruhin
4305966f7b Add WrapperLayout/AbstractTab 2016-07-07 18:32:52 +02:00
Florian Bruhin
29ee605c79 Fix version output test on Windows
On Windows we get something like C:\IMPORTPATH instead of /IMPORTPATH
2016-07-07 18:32:13 +02:00
Florian Bruhin
674b316db3 Simplify test_version_output 2016-07-07 09:14:36 +02:00
Florian Bruhin
ade9b17b22 Remove now unused version.GPL_BOILERPLATE 2016-07-07 08:58:02 +02:00
Florian Bruhin
f3979ad908 backers: Add Geir Isene 2016-07-07 07:14:21 +02:00
Florian Bruhin
ebf9bc4e0a Improve version output 2016-07-06 23:47:59 +02:00
Florian Bruhin
a58c3ff0c6 Print some version numbers in travis_install.sh 2016-07-06 22:25:14 +02:00
Florian Bruhin
28ea459c05 Prune .github in MANIFEST.in 2016-07-06 21:21:31 +02:00
Florian Bruhin
89cdef851d Install new node 2016-07-06 17:05:12 +02:00
Florian Bruhin
8d625393ec Merge branch 'munyari-issue_template' 2016-07-06 17:00:14 +02:00
Florian Bruhin
6dbbd894b8 Regenerate authors 2016-07-06 17:00:09 +02:00
Florian Bruhin
2e23ad59dc Merge branch 'issue_template' of https://github.com/munyari/qutebrowser into munyari-issue_template 2016-07-06 16:33:30 +02:00
Panashe M. Fundira
9bd2c60488 Move issue template to .github directory 2016-07-06 10:22:54 -04:00
Panashe M. Fundira
44eefc2c3b Simplify issue template 2016-07-06 10:02:14 -04:00
Ryan Roden-Corrent
06adfc5bff Leverage +LATEST in taskadd userscript.
This is cleaner than parsing the output of `task`.
2016-07-06 08:04:06 -04:00
Florian Bruhin
db1ba9ac88 Merge branch 'blyxxyz-status-position' 2016-07-06 13:59:05 +02:00
Florian Bruhin
7ddbd24c30 Add ui -> status-position to the changelog 2016-07-06 13:58:46 +02:00
Florian Bruhin
53c942a2de Regenerate authors 2016-07-06 13:58:02 +02:00
Florian Bruhin
794a275383 Merge branch 'status-position' of https://github.com/blyxxyz/qutebrowser into blyxxyz-status-position 2016-07-06 13:56:55 +02:00
Florian Bruhin
8ba04b460e Add $QUTE_*_DIR to changelog 2016-07-06 13:56:34 +02:00
Florian Bruhin
ef03a79956 Merge branch 'rcorre-completer_tests' 2016-07-06 13:36:01 +02:00
Florian Bruhin
b429b919b5 Merge branch 'completer_tests' of https://github.com/rcorre/qutebrowser into rcorre-completer_tests 2016-07-06 13:35:13 +02:00
Florian Bruhin
80238ec2ac Merge branch 'blyxxyz-userscript_vars' 2016-07-06 13:26:58 +02:00
Florian Bruhin
e0d5c3d2b1 Regenerate authors 2016-07-06 13:26:44 +02:00
Florian Bruhin
ab123b8c80 Merge branch 'userscript_vars' of https://github.com/blyxxyz/qutebrowser into blyxxyz-userscript_vars 2016-07-06 13:25:16 +02:00
Florian Bruhin
60cc72b5a6 test requirements: Update pytest-cov to 2.3.0
- Add support for specifying output location for html, xml, and annotate
  report.
- Fix bug hiding test failure when cov-fail-under failed.
- For coverage >= 4.0, match the default behaviour of coverage report
  and error if coverage fails to find the source instead of just
  printing a warning.
- Fixed bug occurred when bare --cov parameter was used with xdist.
- Add support for skip_covered and added --cov-report=term-skip-covered
  command line options.
2016-07-06 00:18:13 +02:00
Florian Bruhin
294560ec6d flake8 requirements: Update flake8-tuple to 0.2.11
- fixed: non exists file raise IOError
- fixed: compatibility with older versions of flake8
2016-07-06 00:16:43 +02:00
Florian Bruhin
30131f0ec4 flake8 reqs: Update flake8-tidy-imports to 1.0.2
- Fixed I201 rule to detect banned imports like from x import y.
2016-07-05 08:39:18 +02:00
Florian Bruhin
eb990d4bd5 Revert "flake8 reqs: Remove obsolete comment"
This reverts commit 3a481a2fa5.
2016-07-05 08:35:58 +02:00
Florian Bruhin
70117265d6 Fix some a/an misspellings
Thanks to https://github.com/jwilk/anorack
2016-07-05 08:34:03 +02:00
Ryan Roden-Corrent
6c2c9438a7 More completer unit test cases. 2016-07-04 19:06:00 -04:00
Jan Verbeek
85bd29a7c8 Add status-position documentation 2016-07-04 19:05:44 +02:00
Panashe M. Fundira
efa3cbf04f Add issue template 2016-07-04 12:55:50 -04:00
Ryan Roden-Corrent
4c9417ac6e Use helper method for cmd prompt text testing.
In test_completer, introduce two helper methods to reduce duplicate
code for handling fake cmd prompt text that uses '|' as a placeholder.
2016-07-04 12:31:56 -04:00
Jan Verbeek
965459ab36 Add status-position option
See #1257.
I can't think of a good way to do widget-packing because tabs can be on
the left or right.
2016-07-04 18:21:09 +02:00
Ryan Roden-Corrent
27d635a394 Test selection_changed, not change_completed_part.
For the Completer unit tests:
Although `change_completed_part` looks like a public method, it was
only used internally. Test the externally-used method
`selection_changed` instead.
2016-07-04 08:22:21 -04:00
Jan Verbeek
955478799b Shorten repeat-command description, remove .i, .o
If .i and .o exist there's a delay before . gets accepted.
2016-07-04 13:39:00 +02:00
Ryan Roden-Corrent
a6a8bf9304 Clean up test_completer further.
Based on code review:
- Use qtbot.waitSignal to test a signal firing
- Use pytest.mark.xfail for an expected test failure
- Ensure there are 2 newlines between module-level functions
2016-07-04 07:36:31 -04:00
Ryan Roden-Corrent
68e373df44 Use QLineEdit as a base for FakeStatusbarCommand.
Reduces the amount of mocking and keeps it more true to the original.
2016-07-03 23:06:36 -04:00
Ryan Roden-Corrent
7f690c3f3f More unit test coverage for Completer.
Test completion_item{next,prev} and change_completed_part.
2016-07-03 22:58:09 -04:00
Ryan Roden-Corrent
1ea28890b5 Move completion_item_del to completion widget.
It was implemented as a member of the Completer object, but registered
to the CompletionWidget. This led to the weird scenario where self was
actually a CompletionWidget, even though it was declared in Completer.
2016-07-03 17:35:17 -04:00
Ryan Roden-Corrent
9bfff1c685 Test more cases for completer.update_completion. 2016-07-03 17:18:16 -04:00
Ryan Roden-Corrent
13e8ed53d6 Clean up completer unit test.
Based on code review:

    - import modules, not classes
    - use methods, not lambdas for the mock command prompt class
    - use None rather than Mock for DUMB_SORT
    - autouse two fixtures and remove them from test signatures
2016-07-03 17:18:16 -04:00
Jan Verbeek
8039e7ab74 Move :repeat-command tests 2016-07-03 22:32:07 +02:00
Florian Bruhin
e3c6a0b766 Handle OSError when closing download fileobj 2016-07-03 18:26:21 +02:00
Florian Bruhin
d1f6ae99b5 tests: Skip :spawn with invalid quoting on Windows
For some reason this often causes segfaults lately - let's skip it until
we can investigate what's wrong.

See #1614
2016-07-03 17:32:19 +02:00
Florian Bruhin
9ad76011c7 Regenerate authors 2016-07-03 17:00:22 +02:00
Florian Bruhin
9f464fd283 Merge branch 'Kingdread-expected-error' 2016-07-03 16:59:57 +02:00
Florian Bruhin
f6cd73c784 Merge branch 'expected-error' of https://github.com/Kingdread/qutebrowser into Kingdread-expected-error 2016-07-03 16:58:06 +02:00
Florian Bruhin
3a481a2fa5 flake8 reqs: Remove obsolete comment 2016-07-03 16:09:53 +02:00
Florian Bruhin
dce3e0fb78 flake8 reqs: Update flake8-pep3101 to 0.4
- Rename pep8 to pycodestyle.
- Add support for python 3.5.
- Add flake8 pypi classifier.
- Drop python 3.3 and 3.4 support (only testing it probably works just
  fine).
- Fix travis and coveralls to work properly with python 3.5.
2016-07-03 16:09:16 +02:00
Florian Bruhin
596a3841dd flake8 reqs: Update flake8-future-import tp 0.4.3
- Restore old option name behaviour that an option like min-version in
  the tox.ini is recognized.
2016-07-03 16:06:28 +02:00
Ryan Roden-Corrent
07edcce697 Unit test Completer.update_completion.
Validate update_completion sets the completions widget's model
correctly based on the command text.
2016-07-02 12:25:55 -04:00
Daniel Schadt
ee9d3b6a49 quteprocess: replace Expected with expected 2016-07-02 17:22:40 +02:00
Daniel Schadt
4863df5ac8 quteprocess: also mark expected WARNINGs 2016-07-02 17:19:19 +02:00
Daniel Schadt
e2b521a408 fix lint 2016-07-02 16:51:58 +02:00
Daniel Schadt
bce06d6f43 quteproc: mark expected errors as such
Fixes #1611

This marks errors that are expected by a test with an "(Expected)"
marker and white color (instead of red).

The formatting of the log messages has been deferred to _render_log,
since the .expected attribute is not correctly set right after we read
the message.
2016-07-02 13:59:46 +02:00
Jan Verbeek
67ada03414 Add QUTE_DATA_DIR, QUTE_DOWNLOAD_DIR documentation 2016-07-02 13:20:11 +02:00
Ryan Roden-Corrent
6ce3ad68f8 Add a userscript to integrate with taskwarrior.
The `taskadd` userscript adds a task based on the current title and URL.
It passes additional arguments along to `task`.

For example:
    :spawn --userscript taskadd due:eod pri:H
will add a task with high priority due at the end of the day.
The description will be the current page title and it will be annotated
with the current page url.

If used with hints, the hint text is used as the description.

Unfortunately, there is currently no way to use :hint fill and maintain
the hint text, which limits the ability to provide additional args in
hint mode.
2016-07-01 22:38:25 -04:00
Jan Verbeek
4172e39045 Move :repeat-command tests to scroll.feature 2016-07-02 01:42:47 +02:00
Florian Bruhin
bd506b186b Merge branch 'edi9999-patch-2' 2016-07-01 23:34:18 +02:00
Florian Bruhin
3a73351779 Merge branch 'patch-2' of https://github.com/edi9999/qutebrowser into edi9999-patch-2 2016-07-01 22:53:49 +02:00
Florian Bruhin
e3500e8bdf backes.asciidoc: Add tuxlovesyou 2016-07-01 22:38:40 +02:00
Florian Bruhin
39fee34b91 flake8 reqs: Update flake8-tidy-imports to 1.0.1
- I201 rule that allows you to configure complaining about certain
  modules being imported, e.g. if you are moving from Python 2 to 3 you
  could stop urlparse being imported in favour of
  six.moves.urllib.parse.
2016-07-01 21:58:18 +02:00
Florian Bruhin
b262c34ed9 Fix crowdfunding link in README
Fixes #1615
2016-07-01 21:58:11 +02:00
Jan Verbeek
9678fd1e09 Make argument description more clear + style fix 2016-07-01 19:17:50 +02:00
Jan Verbeek
cc67dba9f1 Add and use $QUTE_DATA_DIR, $QUTE_DOWNLOAD_DIR
Also fix a few small issues in the userscripts like unquoted variables
and trailing whitespace.
2016-07-01 15:53:21 +02:00
Florian Bruhin
274644e83d tests: __tracebackhide__ in quteproc.after_test 2016-07-01 14:44:42 +02:00
Florian Bruhin
2ec820f366 Merge branch 'rcorre-completion_tests' 2016-07-01 14:42:42 +02:00
Florian Bruhin
a3b0e7c1cb Fix indent 2016-07-01 14:38:18 +02:00
Florian Bruhin
b178099f44 Merge branch 'completion_tests' of https://github.com/rcorre/qutebrowser into rcorre-completion_tests 2016-07-01 14:36:32 +02:00
Florian Bruhin
43812b6d2b behaviour -> behavior 2016-07-01 14:20:00 +02:00
Florian Bruhin
f1de4cc0cf Revert "Strip newline char with :edit-url"
This reverts commit ac9fee310d.
2016-07-01 13:52:08 +02:00
Florian Bruhin
ac9fee310d Strip newline char with :edit-url 2016-07-01 13:50:28 +02:00
Florian Bruhin
a6dbdc3e84 Update docs 2016-07-01 13:47:26 +02:00
Florian Bruhin
af37272246 Merge branch 'edit-url' of https://github.com/blyxxyz/qutebrowser into blyxxyz-edit-url 2016-07-01 13:40:00 +02:00
Florian Bruhin
1c2aca5e82 flake8 reqs: Blacklist flake8-future-import 0.4.2
0.4.2 ignores config options for flake8 2.6.2:
https://github.com/xZise/flake8-future-import/issues/8#issuecomment-229921673
2016-07-01 13:18:39 +02:00
Florian Bruhin
aa7282819e Add a 'backers' file for the crowdfunding 2016-07-01 12:38:08 +02:00
Ryan Roden-Corrent
d45acb0388 Eliminate FakeSettingSection/Value.
Don't really need to mock these out for tests as the real classes are
simple enough.
2016-06-30 20:12:44 -04:00
Ryan Roden-Corrent
94ec712ea8 Really clean up Qt view in completion tests.
Missed a spot.
2016-06-30 20:12:04 -04:00
Jan Verbeek
4f32d94f5f Remove obsolete :edit-url with count test 2016-06-30 22:58:05 +02:00
Florian Bruhin
4ae3df62c5 Handle invalid URLs in :jump-mark 2016-06-30 20:59:18 +02:00
Florian Bruhin
b527cf53d2 flake8 requirements: Update flake8-tuple to 0.2.10
pep8 -> pycodestyle
2016-06-30 18:33:58 +02:00
Florian Bruhin
1209d4192f test requirements: Update pytest-repeat to 0.3.0 2016-06-30 17:56:19 +02:00
Jan Verbeek
6fbbc3f123 Only load with :edit-url if the URL was changed, remove count argument 2016-06-30 17:48:06 +02:00
Florian Bruhin
dece5dda78 Add a docstring for pytest_bdd_apply_tag 2016-06-30 17:42:17 +02:00
Florian Bruhin
ead437be82 Don't define pytest_bdd_apply_tag when frozen
This should help with the undefined hook while not requiring to install
the pytest-bdd plugin when frozen.
2016-06-30 17:40:54 +02:00
Florian Bruhin
49d3e9ece8 Revert "Include pytest-bdd with frozen tests"
This reverts commit fcbb5b8bac.

This triggers a RecursionError when frozen...
2016-06-30 17:40:10 +02:00
Florian Bruhin
ce8315b720 Document :hint input and add default binding
See #1607, #1499
2016-06-30 17:33:51 +02:00
Florian Bruhin
fcbb5b8bac Include pytest-bdd with frozen tests
This is needed so the pytest_bdd_apply_hook in conftest is valid - BDD
tests are still skipped when frozen for now.
2016-06-30 16:34:42 +02:00
Florian Bruhin
50c1d85137 Use raw string for regex 2016-06-30 15:46:38 +02:00
Florian Bruhin
eb463ab2d3 Fix pytest-bdd tags 2016-06-30 14:47:55 +02:00
Florian Bruhin
8d9a699b5b test requirements: Update to pytest-bdd 2.17.0
This also allows us to have dynamic pyqt>=5.3.1 etc. tags.
2016-06-30 14:02:30 +02:00
Ryan Roden-Corrent
4178f73ed9 Move utility functions to top of test_completion.
Just a style change.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
849706e310 Clean up Qt view used in completion tests.
Add the view created during the tests to qtot so it gets cleaned up
after the test exits.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
ee59b133c0 Don't bother mocking a history entry.
Use webkit.history.Entry in tests instead of FakeHistoryEntry.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
f50b8bb8e8 Use iter instead of __iter__.
Corrent two places this was used.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
f94ee172c9 Add completion/models/base to perfect_files.
It now has 100% test coverage.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
d6012ad95c Test delete_cur_item more cleanly.
Reduce duplicate code by mocking out a QTreeView around the model and
setting its index.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
9d49f5a57d Test tab completion with multiple tabbed browsers. 2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
b6652ad6bc Test completion quickmark/bookmark deletion.
Validate that quickmarks and bookmarks can be deleted from the url
completion menu.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
409de10fb4 Unit test delete_cur_item for tab completion model. 2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
8321c1a90f Unit test setting value completion 2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
f5b1019d4d Unit test config option completion.
Had to add the `raw` parameter to ConfigStub.get as the setting option
completion model passes this argument explicitly (although the docs say
only raw=True is supported).
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
5255a71bc5 Unit test setting section completion. 2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
d49fa7c4a3 Clean up objreg after test_history.
test_init in test_history was leaving a web-history in the objreg,
which was interfering with the completion tests.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
16f043034f Unit test tab (buffer) completion.
This involved adding a few stubs as well as expanding the FakeWebView.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
610f9b7068 Unit test session completion 2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
baf8d00a20 Unit test url/quickmark/bookmark completion.
This also adds a few more stubs/fakes to mock out the
quickmark-manager, bookmark-manager, and web-history objects.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
b037ec489f Add unit tests for help completion.
Also adds a FakeConfigSection stub for stubbing out configdata.DATA.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
555bdb75b5 Add unit test for CommandCompletionModel.
This establishes a pattern that can probably be used to test any of the
completion models.

See #999.
2016-06-30 07:26:02 -04:00
Florian Bruhin
f6fbb098cc Remove redundant sentence in docstring 2016-06-30 12:40:52 +02:00
Florian Bruhin
080f9f5bc2 Update docs 2016-06-30 12:40:20 +02:00
Florian Bruhin
900ad1ba6d Merge branch 'alias-multi-commands' of https://github.com/mgoral/qutebrowser into mgoral-alias-multi-commands 2016-06-30 12:34:18 +02:00
Florian Bruhin
3c43639cf1 Merge branch 'blyxxyz-scroll' 2016-06-30 12:27:53 +02:00
Florian Bruhin
f10841e003 Update docs 2016-06-30 12:27:43 +02:00
Florian Bruhin
99d921f169 Merge branch 'scroll' of https://github.com/blyxxyz/qutebrowser into blyxxyz-scroll 2016-06-30 12:18:15 +02:00
Florian Bruhin
7b63aea4ad travis: Allow OS X to fail again
I'm tired of trying to keep up with Homebrew packages...
2016-06-30 10:53:58 +02:00
Florian Bruhin
a0a53ad435 Merge branch 'Dietr1ch-fix-dvorak' 2016-06-30 10:02:07 +02:00
Florian Bruhin
3e167f7e2f Regenerate authors 2016-06-30 10:02:02 +02:00
Florian Bruhin
0f34e6b374 Merge branch 'fix-dvorak' of https://github.com/Dietr1ch/qutebrowser into Dietr1ch-fix-dvorak 2016-06-30 10:01:34 +02:00
Florian Bruhin
ad83950410 travis: Install v5.6.1_1-1 bottle
This should fix OS X builds.
2016-06-30 09:54:03 +02:00
Jan Verbeek
2ab1d35a7c Remove useless import and global declaration, add missing whitespace 2016-06-30 03:13:40 +02:00
Jan Verbeek
320b9cac3f Move repeat-command, make it work with multiple modes, improve tests 2016-06-30 02:22:02 +02:00
Florian Bruhin
03fbacd93c requirements: Update vulture to 0.9
* Don't flag attributes as unused if they are used as global variables in
  another module.
* Don't consider "True" and "False" variable names.
* Abort with error message when invoked on .pyc files.

This means we can remove the whitelisted globals in run_vulture.py and
the associated xfailing test.

We also needed to adjust run_vulture.py slightly as the file attribute
got renamed to filename.
2016-06-29 23:44:39 +02:00
Jan Verbeek
64731c2053 Fix confusing indent 2016-06-29 21:23:42 +02:00
Jan Verbeek
f9afa190b1 Handle check for allowed mode better 2016-06-29 20:58:29 +02:00
Jan Verbeek
cc1899ebca Add tests for repeat-command, make compatible with different count methods 2016-06-29 20:29:56 +02:00
Jan Verbeek
980cf5ada1 Documentation, check if config dir exists 2016-06-29 13:39:18 +02:00
Jan Verbeek
3c2c7ecaae Test for scroll with count and argument 2016-06-29 11:47:51 +02:00
Jan Verbeek
5e9fa2b57e Make gg accept count 2016-06-29 00:12:44 +02:00
Florian Bruhin
cd136b7b33 flake8 reqs: Update flake8-copyright to 0.2.0
Add flake8 v3.x compatibility
2016-06-28 20:48:52 +02:00
Florian Bruhin
87496617a4 Hide QtWebKit image format warning
This was hidden for tests in c390c797b2
but should be hidden for normal usage as well.
2016-06-28 20:46:06 +02:00
Jan Verbeek
7c350a29d5 Add $QUTE_CONFIG_DIR for userscripts (#937) 2016-06-27 22:16:25 +02:00
Jan Verbeek
7a6d26ef86 Fix protected-access for last_command (not sure what to do for _modes and _not_modes) 2016-06-27 18:40:47 +02:00
Jan Verbeek
81f25251a5 Fix singleton-comparison 2016-06-27 18:21:35 +02:00
Jan Verbeek
f654013372 Add repeat-command (.) command 2016-06-27 17:38:11 +02:00
Florian Bruhin
72e5bf35e1 flake8 requirements: Update pep8-naming to 0.4.1 2016-06-26 15:13:12 +02:00
Florian Bruhin
eda6fc6e17 flake8 requirements: Update flake8 to 2.6.2
- Update the config files to search for to include setup.cfg and
  tox.ini. This was broken in 2.5.5 when we stopped passing config_file
  to our Style Guide
2016-06-26 00:22:41 +02:00
Dietrich Daroch
bd8c576322 Fix Dvorak hint chars
- Use the whole home row
  - Produce easier chords
    - 2-key chords alternate hands first (f[aoeui][dhtns])
    - This is indeed a poor patch for easier chords as it should work on
      every home-row, but there are not that much homerows around.
2016-06-25 16:34:43 -04:00
Edgar Hipp
81c69421c5 Update test_readline.py 2016-06-24 12:00:53 +02:00
Florian Bruhin
d8a01d84b3 test requirements: Update CherryPy to 6.0.2
* Correct additional typos.
2016-06-24 11:17:03 +02:00
Edgar Hipp
bfeba3cee6 Update readline.py 2016-06-22 17:15:03 +02:00
Edgar Hipp
9e1c7e0117 Update readline.py 2016-06-22 16:30:38 +02:00
Florian Bruhin
2b285740d9 Update flake8 requirements
flake8 2.6.0
------------

- Switch to pycodestyle as all future pep8 releases will use that
  package name
- Allow for Windows users on select versions of Python to use --jobs and
  multiprocessing
- Update bounds on McCabe
- Update bounds on PyFlakes and blacklist known broken versions
- Handle new PyFlakes warning with a new error code: F405

flake8-copyright 0.1.1
----------------------

- Set line & column to 1,1 to avoid a flake8 error
- Support multi-year copyright notices

flake8-docstrings 0.2.8
-----------------------

- Try to import pydocstyle (not pycodestyle) as pep257
- Import either pycodestyle or pep8 to use stdin_get_value. This fixes
  the problem for newer Flake8’s (2.6.0+) and older ones.

pycodestyle 2.0.0
-----------------

Announcements:

- Repository renamed to `pycodestyle`
- Added joint Code of Conduct as member of PyCQA

Changes:

- Added tox test support for Python 3.5 and pypy3
- Added check E275 for whitespace on `from ... import ...` lines
- Added W503 to the list of codes ignored by default ignore list
- Removed use of project level `.pep8` configuration file

Bugs:

- Fixed bug with treating `~` operator as binary
- Identify binary operators as unary

Other changes
-------------

- Unpin mccabe as the flake8 requirement got updated
- Pin pep8 as an older version gets installed otherwise
- DIsable D403 warning (false-positivies)
2016-06-20 07:16:59 +02:00
Florian Bruhin
522b938974 pytest: Remove unnecessary norecursedirs 2016-06-17 11:56:43 +02:00
Florian Bruhin
8eee3f6bce Add a test for zooming in cloned tab 2016-06-15 14:44:01 +02:00
Florian Bruhin
f8301b185e flake8 requirements: Update flake8 to 2.5.5
- Fix setuptools integration when parsing config files
- Don't pass the user's config path as the config_file when creating a
  StyleGuide
2016-06-15 09:02:15 +02:00
Florian Bruhin
b099f64efa flake8 requirements: Update pyparsing to 2.1.5
- Added ParserElement.split() generator method, similar to re.split().
  Includes optional arguments maxsplit (to limit the number of splits),
  and includeSeparators (to include the separating matched text in the
  returned output, default=False).

- Added a new parse action construction helper tokenMap, which will
  apply a function and optional arguments to each element in a
  ParseResults. So this parse action:

      def lowercase_all(tokens):
          return [str(t).lower() for t in tokens]
      OneOrMore(Word(alphas)).setParseAction(lowercase_all)

  can now be written:

      OneOrMore(Word(alphas)).setParseAction(tokenMap(str.lower))

  Also simplifies writing conversion parse actions like:

      integer = Word(nums).setParseAction(lambda t: int(t[0]))

  to just:

      integer = Word(nums).setParseAction(tokenMap(int))

  If additional arguments are necessary, they can be included in the
  call to tokenMap, as in:

      hex_integer = Word(hexnums).setParseAction(tokenMap(int, 16))

- Added more expressions to pyparsing_common:
  . IPv4 and IPv6 addresses (including long, short, and mixed forms
    of IPv6)
  . MAC address
  . ISO8601 date and date time strings (with named fields for year, month, etc.)
  . UUID (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
  . hex integer (returned as int)
  . fraction (integer '/' integer, returned as float)
  . mixed integer (integer '-' fraction, or just fraction, returned as float)
  . stripHTMLTags (parse action to remove tags from HTML source)
  . parse action helpers convertToDate and convertToDatetime to do custom parse
    time conversions of parsed ISO8601 strings

- runTests now returns a two-tuple: success if all tests succeed,
  and an output list of each test and its output lines.

- Added failureTests argument (default=False) to runTests, so that
  tests can be run that are expected failures, and runTests' success
  value will return True only if all tests *fail* as expected. Also,
  parseAll now defaults to True.

- New example numerics.py, shows samples of parsing integer and real
  numbers using locale-dependent formats:

    4.294.967.295,000
    4 294 967 295,000
    4,294,967,295.000
2016-06-14 09:48:14 +02:00
Florian Bruhin
5d4c1653e2 Regenerate authors 2016-06-14 09:36:18 +02:00
Ryan Roden-Corrent
9578a3324e Break two long lines that were failing pylint. 2016-06-13 22:31:21 -04:00
Michał Góral
9b394e4111 Use config_stub instead of monkeypatching config.get() 2016-06-13 19:39:00 +02:00
Florian Bruhin
f43f526c5b Exclude some misc/ stuff from releases 2016-06-13 11:32:27 +02:00
Florian Bruhin
4fccc89d7d Split browser into browser/browser.webkit 2016-06-13 11:18:21 +02:00
Florian Bruhin
f70a75978b Move browser.network.pastebin to misc 2016-06-13 09:48:53 +02:00
Florian Bruhin
77953e73f5 Merge branch 'djfinlay-master' 2016-06-13 09:34:44 +02:00
Florian Bruhin
8121b02f5c Update docs 2016-06-13 09:29:36 +02:00
Florian Bruhin
a83b86085a Merge branch 'master' of https://github.com/djfinlay/qutebrowser into djfinlay-master 2016-06-13 09:27:55 +02:00
Florian Bruhin
bc757b2b8c Use root-relative URLs for website header
Fixes #1265
Fixes #1489
2016-06-13 08:01:59 +02:00
Michał Góral
4b883c089e Fixed linters. 2016-06-12 23:04:14 +02:00
Michał Góral
370c8a8b07 Created tests for reading aliases. 2016-06-12 22:31:10 +02:00
Michał Góral
7ee99ba043 Moved searching for aliases to CommandRunner.parse_all()
This addresses issue with having alias for multiple commands splitted by ';;'.

See: The-Compiler/qutebrowser#956.
2016-06-12 21:09:10 +02:00
Daryl Finlay
f9a1c8b83a Update docs 2016-06-10 23:48:03 +01:00
Daryl Finlay
bf32c544a2 Refactor tab and window title update methods 2016-06-10 23:36:43 +01:00
Florian Bruhin
cfe360b95e travis: Update OS X bottle to Qt 5.6.1 2016-06-10 23:14:57 +02:00
Daryl Finlay
054e9ab439 Add host placeholder to window and tab title formats 2016-06-10 21:59:43 +01:00
Florian Bruhin
5c1401b0a1 Fix some stuff in CONTRIBUTING 2016-06-10 16:29:35 +02:00
Florian Bruhin
acf54c5cbe Release v0.7.0 2016-06-10 15:18:56 +02:00
Florian Bruhin
eb32056c26 Merge branch 'V155-master' 2016-06-10 15:17:51 +02:00
Florian Bruhin
4255c495a7 Merge branch 'master' of https://github.com/V155/qutebrowser into V155-master 2016-06-10 15:15:30 +02:00
Florian Bruhin
a95b8eed9b tests: Add config for v0.7.0 2016-06-10 15:14:22 +02:00
Florian Bruhin
823b7e2900 Update changelog 2016-06-10 14:47:41 +02:00
Florian Bruhin
0b4f4a7f23 Improve manual history test 2016-06-10 14:41:08 +02:00
Florian Bruhin
ff7d6250c6 Improve original URL handling
When setting self._orig_url by hand, sometimes on redirects the wrong
URL was picked up.
2016-06-10 14:41:08 +02:00
Florian Bruhin
66938ed44b Full redirect support for history
When a redirect occurs, the item is saved in history with a -r suffix
now. When opening qutebrowser that's picked up and the item is hidden
from completion.
2016-06-10 14:40:42 +02:00
Florian Bruhin
66aae2e5ce Revert "travis: Reactivate OS X tests"
This reverts commit af798c7450.

Currently installing Qt is broken because 5.6.1 was released
2016-06-10 13:48:17 +02:00
Florian Bruhin
e0acda403f Add an end-to-end test for :history-clear 2016-06-10 13:20:58 +02:00
Florian Bruhin
a0fd096038 Update CONTRIBUTING 2016-06-10 13:11:53 +02:00
Florian Bruhin
0a25bb508a Fix lint 2016-06-10 12:21:48 +02:00
Florian Bruhin
9298fa697b Allow to pass atime to WebHistory.add_url
This makes a lot of tests easier and/or more exact.
2016-06-10 12:12:29 +02:00
Florian Bruhin
7511bc1fe5 tests: 100% coverage for browser.history 2016-06-10 12:01:14 +02:00
Florian Bruhin
14a04f1535 Fix lint 2016-06-09 22:03:35 +02:00
Florian Bruhin
185b4bc18b Add more tests for browser.history 2016-06-09 21:14:04 +02:00
Florian Bruhin
f691439149 Make WebHistory parent optional 2016-06-09 21:14:04 +02:00
Florian Bruhin
1d1c71f919 Strip of trailing spaces for history entries 2016-06-09 21:14:04 +02:00
Florian Bruhin
b8fba0a138 Add some documentation to WebHistory 2016-06-09 21:14:04 +02:00
Florian Bruhin
e9e6da6510 Remove WebHistory.__getitem__ 2016-06-09 21:14:04 +02:00
Florian Bruhin
d3dd6d2f77 Add hypothesis test for history.Entry.from_str 2016-06-09 21:14:04 +02:00
Florian Bruhin
33f01d8375 Fix lint 2016-06-09 21:14:03 +02:00
Florian Bruhin
d5abfa3d0d Check if original URL is valid 2016-06-09 21:14:03 +02:00
Florian Bruhin
9510af9912 Use QUrl with QWebHistory
Now that we have our own history implementation, we get the URLs as QUrl
and not as string - so no point in converting them to string and back.
2016-06-09 21:14:03 +02:00
Florian Bruhin
5f25ce69ec Add some tests for browser.history 2016-06-09 21:14:03 +02:00
Florian Bruhin
6304565a9a Refactor browser.history
- Rename HistoryEntry to Entry
- Move history line parsing from WebHistory.async_read to Entry.from_str
- Improve errors for invalid history lines
- Pass history directory/filename from the outside to WebHistory
- Clear temp history after reading it when async_read is done
2016-06-09 21:14:00 +02:00
Florian Bruhin
446abefba5 Make sure there is no temp history without datadir 2016-06-09 17:44:04 +02:00
Florian Bruhin
789b9c9308 tests: Yield fake_save_manager from fixture 2016-06-09 17:44:04 +02:00
Florian Bruhin
75669dd21b tests: Move fake_save_manager to helper.fixtures 2016-06-09 17:44:04 +02:00
Florian Bruhin
ef2b3cd6d9 tests.helpers: Clean up imports 2016-06-09 17:44:04 +02:00
Florian Bruhin
346e59880e Add a manual test for visited history 2016-06-09 17:44:04 +02:00
Florian Bruhin
34ba44b0a3 Separate WebHistoryInterface from WebHistory 2016-06-09 17:44:04 +02:00
Florian Bruhin
089131c79d Improve error message when clicking invalid link 2016-06-09 17:43:33 +02:00
Florian Bruhin
86632804a9 behaviour -> behavior for consistency 2016-06-09 17:30:14 +02:00
Florian Bruhin
726ae50251 Clean up find-implementation in test_hints_html 2016-06-09 17:16:00 +02:00
Florian Bruhin
dbbc4b72ed Use quteproc.set_setting in test_hints_html 2016-06-09 17:15:34 +02:00
Florian Bruhin
ab8a2f7147 Fix lint 2016-06-09 17:12:23 +02:00
Florian Bruhin
035526848e Add a hints -> find-implementation setting
This makes it possible to switch to an alternative implementation if
there are weird issues like #1568. Some users might also prefer the
slightly better performance over more accurate hints.
2016-06-09 17:00:08 +02:00
Florian Bruhin
2d54c927e3 Fix urlutils tests on Qt 5.6.1
For some reason the behaviour of QHostAddress("31c3").isValid() changed
with Qt 5.6.1: https://bugreports.qt.io/browse/QTBUG-53983

This causes the test to fail because Qt thinks this is a valid IP, so we
think it's a valid URL.
2016-06-09 15:16:49 +02:00
Florian Bruhin
c390c797b2 tests: Ignore QtWebKit image format warning
In "Cancelling a MHTML download (issue 1535)" (downloads.feature) we
load an invalid page as a fake "image". With Qt 5.6.1, we get this
warning then.
2016-06-09 14:48:38 +02:00
Florian Bruhin
9e1d20017c tests: Mark "History with an error" as flaky
For some reason, sometimes on Travis the history file we read is empty.
I have no idea why though, as we successfully wait until ":save saved
history" is logged, and that is working fine.

Let's just mark the test as flaky for now so we can move on.
2016-06-09 11:17:18 +02:00
Florian Bruhin
288744c8d0 Use BDD test for link with spaces issue
Clicking actually works fine without the strip() as _resolve_url is
never called in that case, so we need to do something which actually
needs the URL as well.
2016-06-09 10:50:08 +02:00
Florian Bruhin
10918d2a3a Update docs 2016-06-09 10:50:08 +02:00
Florian Bruhin
281d2a427b Merge branch 'stripurl' of https://github.com/Konubinix/qutebrowser into Konubinix-stripurl 2016-06-09 10:38:35 +02:00
Florian Bruhin
aae205030c Add missing import 2016-06-09 10:29:16 +02:00
Florian Bruhin
d6926f0622 Fix expected data in AppendLineParser test
There were two different issues here:

- `\n` rather than `os.linesep` was used, which caused the "generated"
  file to have less data in it than expected
- A final `os.linesep` (or `\n`) was missing, but that was cancelled out
  by a off-by-one error when slicing, so wasn't an issue until we tried
  with \r\n endings.
2016-06-09 10:26:09 +02:00
Samuel Loury
a69610077e Add a test about a href with spaces around 2016-06-09 08:36:18 +02:00
Samuel Loury
8369140b72 Strip the url before processing it
This won't hurt and will help with some poorly formatted sites
including blank spaces around the url (e.g. the Previous link in a
dashboard make with CDash 2.0.2).
2016-06-09 08:23:53 +02:00
Florian Bruhin
c5c022226f Merge branch 'EliteTK-lowercase-toggle' 2016-06-08 22:40:05 +02:00
Florian Bruhin
5563552c13 Update docs 2016-06-08 22:39:54 +02:00
Florian Bruhin
4fe6935003 Merge branch 'lowercase-toggle' of https://github.com/EliteTK/qutebrowser into EliteTK-lowercase-toggle 2016-06-08 22:39:19 +02:00
Florian Bruhin
01a622bf02 history tests: Sync with :save better 2016-06-08 22:32:39 +02:00
Florian Bruhin
d40e8e1c2f tests: Set auto-save-interval to 0
Otherwise history tests could fail because waiting for
"Saved to *history" waited for a previous line, not the newest one.

It also doesn't make any sense to save stuff anyways.
2016-06-08 21:54:44 +02:00
Tomasz Kramkowski
a98cd9a528 Change relevant tests to work with new toggle behaviour 2016-06-08 19:37:13 +01:00
Tomasz Kramkowski
573c25073d Fix toggle config using capitalised boolean value. 2016-06-08 19:06:00 +01:00
Florian Bruhin
e08c6cb059 Don't save the original URL for redirected pages
See #1345
2016-06-08 17:15:08 +02:00
Florian Bruhin
263b5680c7 Improve :history-clear docstring 2016-06-08 16:49:07 +02:00
Florian Bruhin
483a5f8103 Fix sharing of cookie jars with private browsing
Fixes #1219
2016-06-08 16:35:43 +02:00
Florian Bruhin
530721522a Fix lint 2016-06-08 15:38:52 +02:00
Florian Bruhin
34f7b196b7 Merge branch 'toofar-history-title' 2016-06-08 15:28:10 +02:00
Florian Bruhin
1b2c6d30c5 Fix typo 2016-06-08 15:22:21 +02:00
Florian Bruhin
049510ea8f Update changelog 2016-06-08 15:17:27 +02:00
Florian Bruhin
b6e534f9b8 Add BDD tests for new history code 2016-06-08 15:15:54 +02:00
Florian Bruhin
f17d4388fd Use fully encoded URL for history
Otherwise e.g. spaces are literal spaces instead of %20 and the history
breaks.
2016-06-08 15:15:54 +02:00
Florian Bruhin
8c9bd95123 test webserver: Whitelist some more HTTP statuses
- HTTP 301 for redirect-to
- HTTP 404 for status/404
2016-06-08 15:15:54 +02:00
Florian Bruhin
e1fd9fc408 Also add title to history for redirected URLs 2016-06-08 13:30:40 +02:00
Florian Bruhin
9beb68bb5c Ignore symlinks when recompiling for :restart
Otherwise broken symlinks (*cough* emacs *cough*) cause this to fail
with FileNotFoundError.
2016-06-08 12:56:37 +02:00
Florian Bruhin
79e0aa2418 Merge branch 'history-title' of https://github.com/toofar/qutebrowser into toofar-history-title 2016-06-08 12:53:07 +02:00
Florian Bruhin
a5a4c17b1f Merge branch 'EliteTK-history-clear' 2016-06-08 11:40:00 +02:00
Florian Bruhin
af653e7cce Update docs 2016-06-08 11:33:37 +02:00
Florian Bruhin
a870a2888f Improve LineParser clear tests 2016-06-08 11:33:37 +02:00
Florian Bruhin
44f626134b Use real files for lineparser tests 2016-06-08 11:33:37 +02:00
Florian Bruhin
1d51d63f0c LineParser tests: Clear self._data in _open 2016-06-08 10:36:46 +02:00
Florian Bruhin
c686008325 LineParser: Don't write anything without data 2016-06-08 10:36:30 +02:00
Florian Bruhin
b09fe8dca0 Document LineParserMixin attributes 2016-06-08 10:22:55 +02:00
Florian Bruhin
33bcced4a2 Add a test for AppendLineParser.clear 2016-06-08 10:11:59 +02:00
Florian Bruhin
cca26f0f13 Fix lint 2016-06-08 09:45:05 +02:00
Florian Bruhin
4b78b22b9a Remove unnecessary method
This is already inherited from LineParser
2016-06-08 09:30:18 +02:00
Florian Bruhin
21d53b0265 Merge branch 'history-clear' of https://github.com/EliteTK/qutebrowser into EliteTK-history-clear 2016-06-08 09:28:36 +02:00
Florian Bruhin
bd111c2ab1 Fix lint 2016-06-08 07:16:27 +02:00
Florian Bruhin
016c102e57 Fix lint 2016-06-08 00:05:57 +02:00
Florian Bruhin
278093afae Add requirements-qutebrowser.txt-raw 2016-06-08 00:03:07 +02:00
Florian Bruhin
4bae659fbe Re-add requests to pylint envs
This is needed because there's a script using requests
2016-06-08 00:02:43 +02:00
Florian Bruhin
cfb4ebb312 Add missing replace to requirements-pylint.txt-raw 2016-06-07 23:47:10 +02:00
Florian Bruhin
f6473620c5 Fix recompile_requirements.py without arguments 2016-06-07 23:44:50 +02:00
Florian Bruhin
55da4ffc03 Also generate root requirements 2016-06-07 23:44:22 +02:00
Florian Bruhin
164d7bea4b recompile_requirements: Add replace command 2016-06-07 23:40:00 +02:00
Florian Bruhin
19037e8b75 Remove old .in requirements file 2016-06-07 23:32:35 +02:00
Florian Bruhin
81ccaff9c6 requirements: Update filter for Flask 2016-06-07 23:26:04 +02:00
Florian Bruhin
0819ed36f0 Update requirements README.md 2016-06-07 23:21:50 +02:00
Florian Bruhin
1c6b4da706 Use #@ as chars 2016-06-07 23:21:50 +02:00
Florian Bruhin
6249436bde Rename raw-requirements files
This hopefully means they're not picked up on requires.io.
2016-06-07 23:21:50 +02:00
Florian Bruhin
7571040316 Also ignore MarkupSafe dependency 2016-06-07 23:10:33 +02:00
Florian Bruhin
34a6451806 Add special #! commands to recompile_requirements 2016-06-07 23:08:14 +02:00
Florian Bruhin
136cb19814 reqs: Comment out ignored dependencies 2016-06-07 22:53:17 +02:00
Florian Bruhin
1a26c8c61f Add a script to compile requirement files 2016-06-07 22:45:59 +02:00
Florian Bruhin
1104a731a5 Fix filtering of all hints in number mode
Fixes #1559
2016-06-07 18:34:46 +02:00
Florian Bruhin
9880f5bd5f Handle FileNotFoundError in ipc.listen
Fixes #1530
2016-06-07 16:48:43 +02:00
Florian Bruhin
b972acf20c Merge branch 'hints' 2016-06-07 15:43:25 +02:00
Florian Bruhin
7014219a86 Update docs 2016-06-07 15:43:17 +02:00
Florian Bruhin
299fea830e Simplify some bool conditions 2016-06-07 15:42:59 +02:00
Florian Bruhin
5ddc57566d Refactor HintManager.filter_hints 2016-06-07 15:14:57 +02:00
Florian Bruhin
db0a67766d Ignore hints -> scatter for number hints
See https://github.com/The-Compiler/qutebrowser/issues/308#issuecomment-167091450
2016-06-07 15:13:30 +02:00
Florian Bruhin
20636a2343 Get normal parser via objreg 2016-06-07 14:30:46 +02:00
Florian Bruhin
e906178c7d Add changelog entry for multi-word matching 2016-06-07 14:28:36 +02:00
Jakub Klinkovský
de66b68b75 Fix problems reported by pylint 2016-06-07 14:27:37 +02:00
Jakub Klinkovský
1b32444256 Rename variables for consistency with other code and docstrings
As described in [1], the naming of some variables has become
inconsistent with the original code and even docstrings. This commit
corrects some of these problems, with the following terminology:

 - hint text: informative message (see HINT_TEXTS)
 - hint string: the text displayed on the hint (as instance of str)
 - hint label: the element representing the hint, added to the DOM
 - hint: too abstract, sensibly used only in docstrings to refer to the
   "visual result"

This commit amends b89e0f8803 and
8873aba09f.

[1] https://github.com/The-Compiler/qutebrowser/pull/1178#issuecomment-178795190
2016-06-07 14:27:06 +02:00
Florian Bruhin
ca88b7a1cf Add test for multi-word matching 2016-06-07 14:24:53 +02:00
Jakub Klinkovský
e4d5b550a3 Filter hints using a multi-word matching
(addresses https://github.com/The-Compiler/qutebrowser/issues/674#issuecomment-165101219 )
2016-06-07 14:24:17 +02:00
Florian Bruhin
d3eec49b6e Add automated test for #1186 2016-06-07 14:15:32 +02:00
Florian Bruhin
8ff53fdb7f Add an automated test for #576
This is now testable easily since hints are renumbered
2016-06-07 14:08:25 +02:00
Florian Bruhin
222ab6f75e Add changelog entry for #308 2016-06-07 13:58:22 +02:00
Florian Bruhin
efddd64d56 Add test for #308 2016-06-07 13:52:17 +02:00
Florian Bruhin
7f3991a8ca Set _filterstr in HintManager
This is also fixed in
fd12c7567e

But we need the fix in to make tests run.
2016-06-07 13:23:51 +02:00
Jakub Klinkovský
82da79d05a Renumber hints when filtering in numeric mode
(addresses #308)
2016-06-07 13:07:56 +02:00
Florian Bruhin
457913b2ec Add changelog for #576 2016-06-07 11:59:33 +02:00
Jakub Klinkovský
9d20280573 Save the filter string in HintManager
This allows restoring the filter during rapid hinting in numeric mode (addresses #576)
2016-06-07 11:57:31 +02:00
Florian Bruhin
335c6783ce Add a manual test page for #576 2016-06-07 11:57:01 +02:00
Florian Bruhin
cbc866d86d Add changelog entry for #1186 fix 2016-06-07 11:55:17 +02:00
Florian Bruhin
01c4c1717f Add manual test file for #1186 2016-06-07 11:55:17 +02:00
Jakub Klinkovský
3690ead5e0 Fix backspace handling in numeric hint mode
addresses #1186
2016-06-07 11:37:47 +02:00
Florian Bruhin
802258d70a Add hints -> auto-follow-timeout to CHANGELOG 2016-06-07 11:07:29 +02:00
Florian Bruhin
82d7c33b29 Add tests for hints -> auto-follow-timeout 2016-06-07 11:06:39 +02:00
Jakub Klinkovský
87faafd910 Fixed type of auto-follow-timeout option 2016-06-07 10:30:10 +02:00
Jakub Klinkovský
6e494605dd Add timeout after auto-followed hint 2016-06-07 10:30:08 +02:00
Florian Bruhin
b759f481c4 test requirements: Update decorator to 4.0.10
- Improved the documentation thanks to Tony Goodchild (zearin) who also
  provided a much better CSS than the one I was using.
2016-06-07 08:24:53 +02:00
Florian Bruhin
5004a571c4 test requirements: Update CherryPy to 6.0.1
* Correct typos in ``@cherrypy.expose`` decorators.
2016-06-07 08:24:12 +02:00
Florian Bruhin
bdef8c4e3a Fix lint 2016-06-07 08:23:35 +02:00
Florian Bruhin
e8123bb68a Fix pdfjs version parsing for never versions 2016-06-07 07:42:34 +02:00
Florian Bruhin
64fc1a3277 Revert "test requirements: Add pdbpp"
This reverts commit c43bfffd5c.
It uses setuptools_scm which causes... problems.
2016-06-07 06:21:54 +02:00
Florian Bruhin
9787e54238 Revert "test requirements: Also add pdbpp dependencies"
This reverts commit d77b9bff49.
2016-06-07 06:21:50 +02:00
Florian Bruhin
fd8286d4eb Fix BDD runtest_makereport hook on non-BDD tests 2016-06-06 23:37:26 +02:00
Florian Bruhin
a107c644c6 Merge branch 'lahwaacz-iframe_tests' 2016-06-06 23:32:56 +02:00
Florian Bruhin
6b24d69f5f Regenerate authors 2016-06-06 23:32:48 +02:00
Florian Bruhin
b635d10836 Merge branch 'iframe_tests' of https://github.com/lahwaacz/qutebrowser into lahwaacz-iframe_tests 2016-06-06 23:32:20 +02:00
Florian Bruhin
d77b9bff49 test requirements: Also add pdbpp dependencies 2016-06-06 23:22:28 +02:00
Florian Bruhin
c43bfffd5c test requirements: Add pdbpp
pdb sometimes segfaults for some reason - pdbpp works fine and gives us
nicer debugging.
2016-06-06 23:20:44 +02:00
Florian Bruhin
a9f27e3247 bdd: Turn off colors with --color=no 2016-06-06 23:19:14 +02:00
Florian Bruhin
b0df87842e Show BDD scenario on failed tests
See #1552
2016-06-06 23:09:19 +02:00
Florian Bruhin
ef82076819 Ignore pdbpp ResourceWarning
E       Failed: Logged unexpected errors:
E
E       22:30:18 WARNING  py.warnings pdb:<module>:4 /home/florian/proj/qutebrowser/git/.tox/py35/lib/python3.5/site-packages/_pdbpp_path_hack/pdb.py:4: ResourceWarning: unclosed file <_io.TextIOWrapper name='/home/florian/proj/qutebrowser/git/.tox/py35/lib/python3.5/site-packages/pdb.py' mode='r' encoding='UTF-8'>
E         os.path.dirname(os.path.dirname(__file__)), 'pdb.py')).read(), os.path.join(
2016-06-06 22:37:29 +02:00
Florian Bruhin
d2b1682915 Add #1514 to tests/manual/hints/other.html 2016-06-06 21:24:02 +02:00
Jakub Klinkovský
b1997c1e00 tests: add missing wait in "Scenario: Opening a link with specific target frame in a new tab" 2016-06-06 18:26:04 +02:00
Jakub Klinkovský
199f0aeb76 tests: un-xfail some iframe tests (#1525)
The given reason (clicking an iframe to get a focus) applies to only one
test, the others are either stable or flaky for a different reason.
2016-06-06 17:34:22 +02:00
Florian Bruhin
a5f12430ad pylint reqs: Update pylint/astroid to 1.4.6/1.5.6
pylint:

* config files with BOM markers can now be read.
* epylint.py_run does not crash on big files, using .communicate()
  instead of .wait()

astroid:

* Fix a crash which occurred when the class of a namedtuple could not be
  inferred.
* Functional form of enums support accessing values through __call__.
* Brain tips for the ssl library.
2016-06-06 17:14:59 +02:00
Florian Bruhin
d91f4e13d0 Fix long line 2016-06-06 17:13:56 +02:00
Florian Bruhin
009fbe8213 Clean up CommandRunner.parse 2016-06-06 17:10:29 +02:00
Florian Bruhin
3e22f64a20 Get tab indicator fix from #697 2016-06-06 16:49:29 +02:00
Florian Bruhin
7651b3a9f5 Fix userscript CommandRunner 2016-06-06 16:39:10 +02:00
Florian Bruhin
35c7e2b768 Remove unreachable NeighborList code 2016-06-06 16:21:05 +02:00
Florian Bruhin
57a1847e3a Merge branch 'adamwethington7-modifcation-for-issue-1386' 2016-06-06 16:19:49 +02:00
Florian Bruhin
a38ec6e5a3 Update docs 2016-06-06 16:19:42 +02:00
Florian Bruhin
520572321a Add unittests for partial command parsing 2016-06-06 16:18:49 +02:00
Florian Bruhin
c9d85d3a12 bdd: Add tests for partial commandline matching 2016-06-06 16:10:10 +02:00
Florian Bruhin
2f60073cdf bdd: Allow to run invalid commands via quteproc 2016-06-06 16:10:01 +02:00
Florian Bruhin
4a7a2e61d3 Only do partial matching with main CommandParser 2016-06-06 15:56:56 +02:00
Florian Bruhin
ec869686c2 Get rid of TabbedBrowser.got_cmd
Seems like it's not used anywhere anymore
2016-06-06 15:53:33 +02:00
Florian Bruhin
5b396dab26 Merge branch 'modifcation-for-issue-1386' of https://github.com/adamwethington7/qutebrowser into adamwethington7-modifcation-for-issue-1386 2016-06-06 15:44:56 +02:00
Florian Bruhin
4e86a888c9 Add webelem tests for JS/non-JS rect_on_view 2016-06-06 15:42:30 +02:00
Florian Bruhin
88debe4f5e Fix zoom adjusting in rect_on_view
We now make sure we move the rect without adjusting its size, and then
also adjust the size based on the zoom.
2016-06-06 15:18:53 +02:00
Florian Bruhin
b0e9d2aca5 webelem.rect_on_view: Actually use passed geometry 2016-06-06 13:26:46 +02:00
Florian Bruhin
abfd789f9e Fix zooming with a too big count
Fixes #1118
Supersedes #1140
2016-06-06 13:25:01 +02:00
Florian Bruhin
8d5fdf2833 Remove wrap mode for NeighborList 2016-06-06 13:10:14 +02:00
Florian Bruhin
d50af52d1a Fix webelem.is_visible with zoom 2016-06-06 12:54:24 +02:00
Florian Bruhin
b1914d6414 Merge branch 'lahwaacz-hints_positioning' 2016-06-06 12:12:43 +02:00
Florian Bruhin
45da93ab55 Update manual hint tests 2016-06-06 12:12:23 +02:00
Florian Bruhin
10630e30ab hints: Integrate _get_first_rectangle into webelem 2016-06-06 11:56:15 +02:00
Florian Bruhin
4d04d0a511 Update docs 2016-06-06 10:42:49 +02:00
Florian Bruhin
b262580b22 Fix hint position when zoom is used 2016-06-06 10:41:59 +02:00
Florian Bruhin
0e4dbd646c Merge branch 'hints_positioning' of https://github.com/lahwaacz/qutebrowser into lahwaacz-hints_positioning 2016-06-06 10:22:06 +02:00
Florian Bruhin
7db9b85d31 Add entry for exherbo.org to manual/hints/other 2016-06-06 09:17:25 +02:00
Florian Bruhin
164be08627 Rename shadowed function 2016-06-06 09:06:49 +02:00
Florian Bruhin
23bcc35ebd Add some manual test pages for hints 2016-06-06 09:04:35 +02:00
Florian Bruhin
dce969997a Reorganize tests/html 2016-06-06 08:38:35 +02:00
Florian Bruhin
3cfb430cdf bdd: Add test for spawning an external editor 2016-06-06 08:36:30 +02:00
Florian Bruhin
753036067d test requirements: Update CherryPy to 6.0.0
* Setuptools is now required to build CherryPy. Pure distutils installs
  are no longer supported. This change allows CherryPy to depend on
  other packages and re-use code from them. It's still possible to
  install pre-built CherryPy packages (wheels) using pip without
  Setuptools.
* Back out changes attempting to fix redirects with Unicode URLs, as it
  also had the unintended consequence of causing the 'Location' to be
  ``bytes`` on Python 3.
* ``cherrypy.expose`` now works on classes.
* ``cherrypy.config`` decorator is now used throughout the code
  internally.
2016-06-06 08:25:41 +02:00
Florian Bruhin
2df85e75cb test requirements: Update CherryPy to 5.6.0
* ``@cherrypy.expose`` now will also set the exposed
  attribute on a class.
* Rewrote all tutorials and internal usage to prefer
  the decorator usage of ``expose`` rather than setting
  the attribute explicitly.
* Removed test-specific code from tutorials.
2016-06-05 23:15:29 +02:00
Florian Bruhin
546c172e5e test requirements: Update CherryPy to 5.5.0
* Fix for filenames with semicolons and quote characters in filenames
  found in headers.
* Added decorator for registering tools.
* Use simpler encoding rules for SCRIPT_NAME and PATH_INFO environment
  variables in CherryPy Tree allowing non-latin characters to pass even
  when ``wsgi.version`` is not ``u.0``.
* Ensure that multipart fields are decoded even when cached in a file.
2016-06-05 20:44:04 +02:00
Florian Bruhin
3acd63c900 www: Add links to blog 2016-06-05 13:51:38 +02:00
Florian Bruhin
a5ce25e833 Merge branch 'oniondreams-patch-1' 2016-06-05 13:20:47 +02:00
Florian Bruhin
c9539e7dcc Regenerate authors 2016-06-05 13:20:40 +02:00
oniondreams
2be5e322fd Update INSTALL.asciidoc
Add instruction for getting sound and video to work on Gentoo
2016-06-05 12:21:34 +02:00
Florian Bruhin
4eaa9443db Merge branch 'rcorre-bind_case_fix' 2016-06-04 23:31:44 +02:00
Florian Bruhin
6d86ad7bef Update changelog 2016-06-04 23:31:32 +02:00
Florian Bruhin
9f3c2dfada Merge branch 'bind_case_fix' of https://github.com/rcorre/qutebrowser into rcorre-bind_case_fix 2016-06-04 23:30:50 +02:00
Florian Bruhin
1601b85d16 Merge branch 'rcorre-rapid_normal_hints' 2016-06-04 23:14:37 +02:00
Florian Bruhin
2ac521627e Update changelog 2016-06-04 23:13:13 +02:00
Florian Bruhin
7b852a7bbb Merge branch 'rapid_normal_hints' of https://github.com/rcorre/qutebrowser into rcorre-rapid_normal_hints 2016-06-04 23:11:54 +02:00
Florian Bruhin
5c329c409c Improve error messages in test_hints
See #1542
2016-06-04 23:09:08 +02:00
Florian Bruhin
831c3c0272 Add a README for tests/end2end/data/hints/html
See #1542
2016-06-04 23:08:59 +02:00
Florian Bruhin
dc6113dcfa Make scroll test page a bit wider
See #1542
2016-06-04 22:53:37 +02:00
Ryan Roden-Corrent
68faf2b873 Allow hint --rapid in normal mode.
This was disallowed by an assertion, but has a legitimate use case for
clicking multiple buttons or ticking multiple checkboxes.

Resolves #1541.
2016-06-04 15:32:58 -04:00
Florian Bruhin
41fcf0ed33 Make pytest_rerunfailures work with frozen tests 2016-06-04 17:07:51 +02:00
Ryan Roden-Corrent
9f660a98f2 Default mode='normal' for bind/unbind.
Both set mode=None, then later checked if mode == 'None' and set it to
'normal'.
This reduces the function complexity just enough that pylint will stop
complaining.
2016-06-04 07:39:09 -04:00
Ryan Roden-Corrent
1dc20f4d02 Handle special keystrings case-insensitively.
Load all special keystrings (e.g. <ctrl-a>) into memory as lowercase,
and automatically lowercase any special keystring given to bind/unbind.
This prevents <ctrl-a> and <Ctrl-A> from being treated differently.

Resolves #816.
Also resolves #1544 (dupe).
2016-06-04 07:39:09 -04:00
Florian Bruhin
4054992583 Merge branch 'Kingdread-issue-1535' 2016-06-04 13:15:44 +02:00
Florian Bruhin
53b8ac1a60 Update changelog 2016-06-04 13:15:30 +02:00
Florian Bruhin
163082b3ea Wait until download is started 2016-06-04 13:15:22 +02:00
Daniel Schadt
fd27caf311 tests: remove wait in mhtml cancel test 2016-06-03 16:09:31 +02:00
Daniel Schadt
44b1344467 typo used -> user 2016-06-03 15:52:29 +02:00
Daniel Schadt
c3e7ab52b5 tests: add test for cancelling a mhtml download 2016-06-02 23:07:03 +02:00
Daniel Schadt
1cabae0583 mhtml: don't crash when user cancels a download
Fixes 1535

The browser crashed because both callbacks were called (finished and
error), trying to remove the item twice from the list of downloads.
2016-06-02 21:23:11 +02:00
Florian Bruhin
24db93f3eb test req: Update pytest-mock to 1.1
- From this version onward, pytest-mock is licensed under the MIT
  license.
- Now the plugin also adds introspection information on differing call
  arguments when calling helper methods such as assert_called_once_with.
  The extra introspection information is similar to pytest's and can be
  disabled with the mock_traceback_monkeypatch option.
- mocker.stub() now allows passing in the name for the constructed Mock
  object instead of having to set it using the internal _mock_name
  attribute directly. This is useful for debugging as the name is used
  in the mock's repr string as well as related assertion failure
  messages.
- Monkey patching mock module for friendlier tracebacks is automatically
  disabled with the --tb=native option. The underlying mechanism used to
  suppress traceback entries from mock module does not work with that
  option anyway plus it generates confusing messages on Python 3.5 due
  to exception chaining.
- mock.call is now aliased as mocker.call for convenience.
2016-06-02 11:19:22 +02:00
Florian Bruhin
1b9a0367e7 flake8 req: Update sortedcontainers to 1.5.3 2016-06-02 11:18:49 +02:00
Florian Bruhin
a19bb40b50 requirements: Update codecov to 2.0.5
- fix detecting merge commits on all CI, not just Travis
- Use %20 for encoding spaces [appveyor]
2016-06-02 11:16:52 +02:00
Florian Bruhin
2562d57437 tox: Install requirements in pylint-master env 2016-06-02 09:54:51 +02:00
Florian Bruhin
ce0b50bafd Fix pytest_rerunfailures package name 2016-06-01 13:13:41 +02:00
Florian Bruhin
fd55f9236f Merge branch 'Kingdread-json-logging' 2016-06-01 13:09:53 +02:00
Florian Bruhin
14feffa09e Update docs 2016-06-01 13:08:18 +02:00
Florian Bruhin
fcba6beecf Merge branch 'json-logging' of https://github.com/Kingdread/qutebrowser into Kingdread-json-logging 2016-06-01 13:07:52 +02:00
Florian Bruhin
e6f3a200c8 Include pytest-rerunfailures for frozen tests 2016-06-01 12:39:29 +02:00
Florian Bruhin
97ad808fac Remove unneeded marker definitions from pytest.ini
Those are now defined in pytest core or pytest-rerunfailures
2016-05-31 23:45:12 +02:00
Florian Bruhin
b3c91d4b81 tox: Update pytest to 2.9.2
* skip tests where one parameterize dimension was empty
* Fix Xfail does not work with condition keyword argument.
* Fix win32 path issue when puttinging custom config file with absolute
  path in ``pytest.main("-c your_absolute_path")``.
* Fix maximum recursion depth detection when raised error class is not
  aware of unicode/encoded bytes.
* Fix ``pytest.mark.skip`` mark when used in strict mode.
* Minor improvements and fixes to the documentation.
* Fix ``--fixtures`` to show all fixture definitions as opposed to just
  one per fixture name.
2016-05-31 23:41:24 +02:00
Florian Bruhin
5c02f3655a requirements: Also update mccabe for pylint-master 2016-05-31 07:57:53 +02:00
Florian Bruhin
17f54d0ef7 tox: Use -j0 when invoking pylint
This makes things a bit faster
2016-05-31 00:00:40 +02:00
Florian Bruhin
3a8ab8ea02 flake8: Set min-version for flake8-future-imports 2016-05-30 23:53:46 +02:00
Florian Bruhin
100d284cdd requirements: Update mccabe to 0.5.0
- PyCon 2016 PDX release
- Add support for Flake8 3.0
2016-05-30 23:50:11 +02:00
Florian Bruhin
0c611d4d85 requirements: Update flake8-future-import to 0.4.1
- Do not ignore imports which are present and have been added after the
  minimum version
- Ignore imports which became mandatory with the minimum version
2016-05-30 23:47:35 +02:00
Florian Bruhin
2a49dbe817 Fix handling of cmd.no_cmd_split for docs 2016-05-30 16:42:53 +02:00
Florian Bruhin
3e5994cff6 bdd: Get rid of "I execute the userscript" step
Since we now have a (testdata) substitution this is much easier.
2016-05-30 16:21:32 +02:00
Florian Bruhin
9695828608 Merge branch 'rcorre-hint_spawn_fix' 2016-05-30 16:18:17 +02:00
Florian Bruhin
c17a1be8fd Add a test for flags passed to a command 2016-05-30 16:18:03 +02:00
Florian Bruhin
65817ebb81 Update docs 2016-05-30 16:15:20 +02:00
Florian Bruhin
0aa7ed2eb3 Move userscript to correct place 2016-05-30 16:10:52 +02:00
Florian Bruhin
a39c662633 Merge branch 'hint_spawn_fix' of https://github.com/rcorre/qutebrowser into rcorre-hint_spawn_fix 2016-05-30 16:09:28 +02:00
Daniel Schadt
a6b47a7c09 fix lint 2016-05-30 16:00:10 +02:00
Daniel Schadt
fa2636c2f6 tests: fix timezone issues for test_quteprocess
Depending on the timezone, you may either get 00:00 as time or 01:00,
which is bad for testing on different machines.
2016-05-30 16:00:10 +02:00
Daniel Schadt
5f2d5feb58 message: don't indent the traceback
This shouldn't be needed anymore with json-logging.
2016-05-30 16:00:10 +02:00
Daniel Schadt
65e5a3fe09 quteproc: match message with re.DOTALL
Since they may now contain newlines, we need to get the whole message,
which are otherwise not included in .
2016-05-30 16:00:10 +02:00
Daniel Schadt
f676a599a2 tests: remove leftover lines from writing the code
Those lines are not needed.
2016-05-30 16:00:10 +02:00
Daniel Schadt
484320ac19 quteproc: see lines starting with ' ' as error
Now that json logging is used, multiple lines should be correctly
escaped (and parsed), even in tracebacks, so this check should now be
obsolete.
2016-05-30 16:00:10 +02:00
Daniel Schadt
db240e294e quteproc: delegate LogLine to log.ColoredFormatter 2016-05-30 16:00:10 +02:00
Daniel Schadt
cc7c477e3e tests: add update tests for LogLine with json logs 2016-05-30 16:00:10 +02:00
Daniel Schadt
6a6f396f85 quteproc: set lineno to None if function is None 2016-05-30 16:00:10 +02:00
Daniel Schadt
cea32ea333 log: embed traceback in json object 2016-05-30 16:00:10 +02:00
Daniel Schadt
96b299a1fc quteproc: Nicer output for unexpected errors
Instead of
    LogLine('{"levelname": "ERROR", ...}')
we get
    21:22:34 ERROR    downloads  mhtml ...
2016-05-30 16:00:10 +02:00
Daniel Schadt
b4022b9795 quteproc: fix log_color in log message
This actually uses the escape code, not just the color name.
2016-05-30 16:00:10 +02:00
Daniel Schadt
ae16240d41 quteproc: fix docstring in formatted_str
Autocomplete was faster and inserted .strip() after line
2016-05-30 16:00:10 +02:00
Daniel Schadt
d4a295b22e tests: update test_log with json_logging namespace 2016-05-30 16:00:10 +02:00
Daniel Schadt
cf3930f925 quteproc: except ValueError
There is no json.decoder.JSONDecodeError, it was a lie all along...
2016-05-30 16:00:10 +02:00
Daniel Schadt
49419bc429 tests: update test_invocations for --json-logging 2016-05-30 16:00:10 +02:00
Daniel Schadt
4a59a1f112 log: implement JSON as logging output
Fixes #1501

Enabled via the --json-logging parameter.
2016-05-30 16:00:10 +02:00
Florian Bruhin
9a0fa9068c Stabilize tests using :follow-hint 2016-05-30 14:54:06 +02:00
Florian Bruhin
afb88a9560 requirements: Update flake8-future-import to 0.4.0
- Add two older future imports
- Issue an error when a future import does not exist
- Define which is the oldest Python version to be supported so that
  already mandatory features can be ignored and not yet supported
  features default to forbidden (ignoring the lower error code).
- Use return code of 1 if errors occurred
2016-05-30 12:57:57 +02:00
Florian Bruhin
6741a16957 Stabilize :buffer tests
Fixes #1493
2016-05-30 01:16:44 +02:00
Florian Bruhin
424efec8a9 travis: Use Python 3.5 on Ubuntu Xenial 2016-05-30 00:03:40 +02:00
Florian Bruhin
402e110cab bdd: Delete "Navigating up with root directory"
This test causes various trouble for reasons I don't understand, so
let's get rid of it.
2016-05-29 23:59:28 +02:00
Florian Bruhin
d385206ea0 tests: Set some settings for quteproc
We set ui -> message-timeout to 0 to get better error messages in the
log output and network -> ssl-strict to not hang on unexpected SSL
errors.
2016-05-29 23:40:09 +02:00
Florian Bruhin
6ec6657641 travis: Add a Ubuntu Xenial build environment 2016-05-29 23:26:12 +02:00
Florian Bruhin
3a0a30597e Dockerfile: Install dbus 2016-05-29 23:25:46 +02:00
Florian Bruhin
e3556f8fe0 Add a Ubuntu Xenial Dockerfile 2016-05-29 23:14:54 +02:00
Florian Bruhin
2e4c0c6599 Run dbus-uuidgen in Ubuntu Wily Dockerfile
Otherwise the tests will fail with:

  INVALID: process 975: D-Bus library appears to be incorrectly set up; failed to read machine uuid: UUID file '/etc/machine-id' should contain a hex string of length 32, not length 0, with no other text
  INVALID: See the manual page for dbus-uuidgen to correct this issue.
2016-05-29 23:14:10 +02:00
Florian Bruhin
e8528c2c75 travis: Switch back to autogenerated Docker images
Archlinux updated to PyQt 5.6 in [extra] now, so the autobuilt image
should work fine with Qt 5.6 now.
2016-05-29 23:00:32 +02:00
Florian Bruhin
9efcddf727 Add missing import 2016-05-29 22:47:44 +02:00
Florian Bruhin
08f5cfd366 Fix test_enter_folder on Windows 2016-05-29 22:46:32 +02:00
Florian Bruhin
86be7ad82c Move file_url from utils.jinja to utils.urlutils 2016-05-29 22:44:40 +02:00
Florian Bruhin
070e30658f Fix lint 2016-05-29 22:22:34 +02:00
Florian Bruhin
8e2d315807 Fix pytest_status workaround if .cache is missing 2016-05-29 22:21:35 +02:00
Florian Bruhin
2d9cf5ed3a Handle invalid URLs in wait_for_load_finished_url 2016-05-29 22:16:55 +02:00
Florian Bruhin
af798c7450 travis: Reactivate OS X tests 2016-05-29 22:07:24 +02:00
Florian Bruhin
001670969b tests: Ignore segfaults on pytest exit
In various situations (especially on OS X), pytest segfaults on exit probably
due to Qt/PyQt bugs.

We now have a wrapper script which ignores those segfaults if pytest did run
successfully.
2016-05-29 22:06:24 +02:00
Florian Bruhin
1332258767 Revert "travis_run: Show tox exit status"
This reverts commit 144a37ec06.
We accidentally always exit with status 0 with this...
2016-05-29 20:46:48 +02:00
Florian Bruhin
144a37ec06 travis_run: Show tox exit status 2016-05-29 18:47:58 +02:00
Florian Bruhin
119d76c502 Fix lint 2016-05-29 18:45:09 +02:00
Florian Bruhin
5b84fc93df Do a final userscript command read on cleanup
On OS X, sometimes the userscript exited before the QSocketNotifier was
triggered. By doing a final read when cleaning up we make sure we don't
miss anything.

Fixes #1533.
2016-05-29 18:42:56 +02:00
Florian Bruhin
ca87b9e285 tox: Remove weird minus 2016-05-29 18:28:20 +02:00
Florian Bruhin
e10e9c7df2 bdd: Don't run :spawn -u test on OS X for now
See #1533
2016-05-29 18:25:23 +02:00
Florian Bruhin
a905d46757 bdd: Merge userscripts.feature into spawn.feature 2016-05-29 18:24:34 +02:00
Florian Bruhin
800d069764 requirements: Blacklist Flask 0.11.0
See https://github.com/pallets/flask/issues/1825
2016-05-29 18:20:48 +02:00
Florian Bruhin
64d4c9f83e Clean up end2end test file structure
This renames tests/integration to tests/end2end and moves some files to
tests/end2end/fixtures.
2016-05-29 18:20:00 +02:00
Florian Bruhin
f10754fa77 Remove MarkupSafe pin in requirements-tests.txt
We already have that pinned in requirements.txt
2016-05-29 17:50:13 +02:00
Florian Bruhin
a3a160cb22 tests: Fix race condition in test_enter_folder 2016-05-29 17:48:02 +02:00
Florian Bruhin
867b4a8640 Make quteproc.wait_for_load_finished_url public 2016-05-29 17:47:39 +02:00
Florian Bruhin
e7a6907bc2 tests: Don't run geolocation tests on OS X
We already only run them on CI because they can be kind of
unpredictable, and it seems OS X on Travis hangs when running them too.
2016-05-29 17:35:43 +02:00
Florian Bruhin
7180a6df0b requirements: Update pytest dependency pins
This adds MarkupSafe and removes termcolor and wheel.
2016-05-29 17:34:19 +02:00
Florian Bruhin
d008b2a86c requirements: Pin all pylint dependencies 2016-05-29 17:34:16 +02:00
Florian Bruhin
bceb7cf89e tests: Avoid race conditions for :messages tests
We need to wait until the page is actually loaded before we check the
content.
2016-05-29 17:07:37 +02:00
Florian Bruhin
6f6303e0a6 Use requirements files for tox dependencies
While this makes things a little more complicated and means we'll need to use
`-r` to recreate tox environments, it has several advantages:

- Full support from requires.io (including PRs)
- Workaround for https://bitbucket.org/hpk42/tox/issues/332/ so we can update
  virtualenv/pip
2016-05-29 16:53:54 +02:00
Florian Bruhin
cd7b8c65df Remove OS X specific options from freeze.py 2016-05-29 16:26:21 +02:00
Florian Bruhin
9529d55649 Remove misc/qt_menu.nib
This was needed for cx_Freeze on OS X which we don't use anymore.
2016-05-29 16:24:16 +02:00
Florian Bruhin
d3fe2babd3 tests: Wait until page is loaded by default
When doing quteproc.open_path, by default the test didn't wait until the page
was loaded. This caused unintentional race conditions which e.g. caused
dirbrowser tests to fail on OS X:

https://travis-ci.org/The-Compiler/qutebrowser/jobs/133730001

Now instead we wait by default, unless wait=False is passed to open_path() or
open_url().
2016-05-29 16:14:33 +02:00
Florian Bruhin
9bb425d598 Install Qt5/PyQt5 from custom bottles on OS X
We have a custom build which comes with QtWebKit now.
2016-05-29 15:46:43 +02:00
Florian Bruhin
345768bfc4 Fix requirements installing on Appveyor 2016-05-29 15:28:49 +02:00
Florian Bruhin
a987b714de appveyor: Install pip/tox from requirements files 2016-05-29 15:14:42 +02:00
Florian Bruhin
f4ce199968 ci: Blacklist virtualenv > 15.0.1 2016-05-29 15:09:14 +02:00
Florian Bruhin
f72fc04bb1 Revert "ci: Update virtualenv to 15.0.2"
This reverts commit 3c978aa203.
We need to revert this due to the tox/pip bug with inline comments.
2016-05-29 15:08:43 +02:00
Florian Bruhin
51122a8010 tox: Blacklist Flask 0.11.0 2016-05-29 14:35:48 +02:00
Florian Bruhin
a921ee2a8f Revert "tox: Update Flask to 0.11.0"
This reverts commit 986288c408.
2016-05-29 14:35:37 +02:00
Florian Bruhin
986288c408 tox: Update Flask to 0.11.0
Released on May 29th 2016, codename Absinthe.

- Added support to serializing top-level arrays to
  :func:`flask.jsonify`. This introduces a security risk in ancient
  browsers. See :ref:`json-security` for details.
- Added before_render_template signal.
- Added `**kwargs` to :meth:`flask.Test.test_client` to support passing
  additional keyword arguments to the constructor of
  :attr:`flask.Flask.test_client_class`.
- Added ``SESSION_REFRESH_EACH_REQUEST`` config key that controls the
  set-cookie behavior.  If set to ``True`` a permanent session will be
  refreshed each request and get their lifetime extended, if set to
  ``False`` it will only be modified if the session actually modifies.
  Non permanent sessions are not affected by this and will always
  expire if the browser window closes.
- Made Flask support custom JSON mimetypes for incoming data.
- Added support for returning tuples in the form ``(response, headers)``
  from a view function.
- Added :meth:`flask.Config.from_json`.
- Added :attr:`flask.Flask.config_class`.
- Added :meth:`flask.config.Config.get_namespace`.
- Templates are no longer automatically reloaded outside of debug mode.
  This can be configured with the new ``TEMPLATES_AUTO_RELOAD`` config
  key.
- Added a workaround for a limitation in Python 3.3's namespace loader.
- Added support for explicit root paths when using Python 3.3's
  namespace packages.
- Added :command:`flask` and the ``flask.cli`` module to start the local
  debug server through the click CLI system. This is recommended over
  the old ``flask.run()`` method as it works faster and more reliable
  due to a different design and also replaces ``Flask-Script``.
- Error handlers that match specific classes are now checked first,
  thereby allowing catching exceptions that are subclasses of HTTP
  exceptions (in ``werkzeug.exceptions``).  This makes it possible
  for an extension author to create exceptions that will by default
  result in the HTTP error of their choosing, but may be caught with
  a custom error handler if desired.
- Added :meth:`flask.Config.from_mapping`.
- Flask will now log by default even if debug is disabled. The log
  format is now hardcoded but the default log handling can be disabled
  through the ``LOGGER_HANDLER_POLICY`` configuration key.
- Removed deprecated module functionality.
- Added the ``EXPLAIN_TEMPLATE_LOADING`` config flag which when enabled
  will instruct Flask to explain how it locates templates. This should
  help users debug when the wrong templates are loaded.
- Enforce blueprint handling in the order they were registered for
  template loading.
- Ported test suite to py.test.
- Deprecated ``request.json`` in favour of ``request.get_json()``.
- Add "pretty" and "compressed" separators definitions in jsonify()
  method.
  Reduces JSON response size when JSONIFY_PRETTYPRINT_REGULAR=False by
  removing unnecessary white space included by default after separators.
- JSON responses are now terminated with a newline character, because it
  is a convention that UNIX text files end with a newline and some
  clients don't deal well when this newline is missing. See
  https://github.com/pallets/flask/pull/1262 -- this came up originally
  as a part of https://github.com/kennethreitz/httpbin/issues/168
- The automatically provided ``OPTIONS`` method is now correctly
  disabled if the user registered an overriding rule with the
  lowercase-version ``options``.
- ``flask.json.jsonify`` now supports the ``datetime.date`` type.
- Don't leak exception info of already catched exceptions to context
  teardown handlers.
- Allow custom Jinja environment subclasses.
- ``flask.g`` now has ``pop()`` and ``setdefault`` methods.
- Turn on autoescape for ``flask.templating.render_template_string`` by
  default.
- ``flask.ext`` is now deprecated.
- ``send_from_directory`` now raises BadRequest if the filename is
  invalid on the server OS.
- Added the ``JSONIFY_MIMETYPE`` configuration variable.
- Exceptions during teardown handling will no longer leave bad
  application contexts lingering around.
2016-05-29 14:22:11 +02:00
Florian Bruhin
344569fb5b tox: Update flake8-string-format to 0.2.2
- Do not check simple expressions, except for docstrings, because they
  cannot be accessed anyway.
- Properly assert starred arguments in Python 3.5. Only the last element
  must be a vararg if varargs are present and not the complete list.
- Output correct column offset on Python 3.4.2, as that used the wrong
  offset inside calls.
2016-05-29 14:19:38 +02:00
Florian Bruhin
c9d49177cc tox: Update sortedcontainers to 1.5.2 2016-05-29 14:17:48 +02:00
Florian Bruhin
b97736b117 Revert "Work around flake8-string-format bug"
This reverts commit 6c4beef783.
2016-05-29 14:17:32 +02:00
Florian Bruhin
1e55db0630 Follow the American way(tm) of spelling things 2016-05-29 10:57:41 +02:00
Florian Bruhin
4b97ef88ac Merge branch 'hcraT-empty_uri' 2016-05-29 10:38:45 +02:00
Florian Bruhin
86d320b6a1 Update docs 2016-05-29 10:38:24 +02:00
Florian Bruhin
6caa89a622 Merge branch 'empty_uri' of https://github.com/hcraT/qutebrowser into hcraT-empty_uri 2016-05-29 00:37:12 +02:00
Florian Bruhin
3c978aa203 ci: Update virtualenv to 15.0.2 2016-05-28 23:27:42 +02:00
Florian Bruhin
b065d8efcd pyinstaller: Set NSHighResolutionCapable = True
This means qutebrowser will show up correctly on HiDPI/Retina screens
without being pixelated.
2016-05-28 23:20:00 +02:00
Florian Bruhin
90fa2a50ce pyinstaller: Use qutebrowser/__main__.py
When we use qutebrowser.py, PyInstaller 3.2 gets confused
somehow (because of the name conflict with qutebrowser/ maybe?) and
doesn't do anything when running the bundled app.

With qutebrowser/__main__.py the generated filename is still correct and
it actually works.
2016-05-28 23:18:29 +02:00
Tarcisio Fedrizzi
ec2935fab0 Fixes flake8 error 2016-05-28 17:38:31 +02:00
Florian Bruhin
fc3e1b4ede tox: Update hypothesis to 3.4.0
models() strategies from hypothesis.extra.django will now respect much
more of Django's validations out of the box. Wherever possible
full_clean() should succeed.

In particular:

- The max_length, blank and choices kwargs are now respected.
- Add support for DecimalField.
- If a field includes validators, the list of validators are used to
  filter the field strategy.
2016-05-27 15:40:50 +02:00
Florian Bruhin
1d87eee4d7 Fix starting when sys.stderr is None 2016-05-27 14:48:46 +02:00
Florian Bruhin
afcb018ee2 Fix some spelling mistakes
Found via http://jwilk.net/software/mwic
2016-05-27 12:07:00 +02:00
Florian Bruhin
29aedef420 Fix :debug-console with PyQt 5.6 2016-05-27 00:18:23 +02:00
Florian Bruhin
2fb5de8bd3 test_insert_mode: Always set fake clipboard
Otherwise if we only run a keypress test, the fake clipboard won't be
activated and thus the subsequent :yank-selected would write to the real
clipboard.
2016-05-27 00:12:53 +02:00
Florian Bruhin
6c4beef783 Work around flake8-string-format bug
When using flake8-string-format on Python 3.5 with str.format(*group) it
failed:

  Traceback (most recent call last):
    File "./.venv-flakes/bin/flake8", line 11, in <module>
      sys.exit(main())
    File ".../site-packages/flake8/main.py", line 33, in main
      report = flake8_style.check_files()
    File ".../site-packages/flake8/engine.py", line 181, in check_files
      return self._retry_serial(self._styleguide.check_files, paths=paths)
    File ".../site-packages/flake8/engine.py", line 172, in _retry_serial
      return func(*args, **kwargs)
    File ".../site-packages/pep8.py", line 1842, in check_files
      runner(path)
    File ".../site-packages/flake8/engine.py", line 126, in input_file
      return fchecker.check_all(expected=expected, line_offset=line_offset)
    File ".../site-packages/pep8.py", line 1574, in check_all
      self.check_ast()
    File ".../site-packages/pep8.py", line 1521, in check_ast
      for lineno, offset, text, check in checker.run():
    File ".../site-packages/flake8_string_format.py", line 288, in run
      assert isinstance(call.args, ast.Starred) is bool(has_starargs)
  AssertionError

This works around that issue.
See https://github.com/xZise/flake8-string-format/issues/11
2016-05-26 23:50:58 +02:00
Florian Bruhin
ee848ce09e tox: Update sortedcontainers to 1.5.1 2016-05-26 21:42:34 +02:00
Tarcisio Fedrizzi
a3e6761db6 Fixes pylint error 2016-05-26 18:01:01 +02:00
Tarcisio Fedrizzi
a9e96df5df Adds unit test when force_search is True 2016-05-26 18:01:01 +02:00
Tarcisio Fedrizzi
7da6faa7af Changes fuzzy_url to force search even when paths are passed 2016-05-26 18:01:01 +02:00
Tarcisio Fedrizzi
462f9d7e4c Refators discussed in the review
- refactors what discussed in the review
- adds unit tests for schemas without host and path
2016-05-26 18:01:01 +02:00
Ryan Roden-Corrent
db09cbb960 Implement a feature test for :hint all userscript.
This adds a (testdata) substitution for 'When I run {command}' to allow
providing an absolute path for the userscript.
2016-05-26 07:35:28 -04:00
Florian Bruhin
7c89f0c024 Merge branch 'nginth-singleoptioncrash' 2016-05-26 07:48:49 +02:00
Florian Bruhin
998f025553 Update docs 2016-05-26 07:45:17 +02:00
Florian Bruhin
a589c09f2e Merge branch 'singleoptioncrash' of https://github.com/nginth/qutebrowser into nginth-singleoptioncrash 2016-05-26 07:41:09 +02:00
Florian Bruhin
9d018b8fbd pylint: Disable too-many-return-statements 2016-05-26 07:39:47 +02:00
Nick Ginther
1ea99c5958 add completing single option argument test 2016-05-25 17:52:36 -05:00
Nick Ginther
2065f292ab fix crash on empty parts[] (#1523) 2016-05-25 16:45:06 -05:00
Florian Bruhin
20cfadbda7 Merge branch 'nginth-tabindexfix' 2016-05-25 22:10:59 +02:00
Florian Bruhin
4c0f85564d Update docs 2016-05-25 22:10:45 +02:00
Florian Bruhin
824e662154 Merge branch 'tabindexfix' of https://github.com/nginth/qutebrowser into nginth-tabindexfix 2016-05-25 22:09:01 +02:00
Florian Bruhin
a6abc86456 Merge branch 'rcorre-better_keyhints' 2016-05-25 22:07:23 +02:00
Florian Bruhin
ed6432136f Update docs 2016-05-25 22:06:59 +02:00
Florian Bruhin
c96722f169 Merge branch 'better_keyhints' of https://github.com/rcorre/qutebrowser into rcorre-better_keyhints 2016-05-25 22:04:51 +02:00
Nick Ginther
c70accda22 restructure code 2016-05-25 13:46:31 -05:00
Florian Bruhin
5a82bf3357 Add some more logging for SSL errors 2016-05-25 20:45:54 +02:00
Tarcisio Fedrizzi
73c200fb14 Tweaks the multi-line heuristic to handle scheme-like text
Adds some options to implement a way to treat multiline text that starts
with a scheme-like line as text instead as an URL.
2016-05-25 08:05:57 +02:00
Ryan Roden-Corrent
f58e2d91dc Add a keyhint blacklist.
Replace the setting ui.show-keyhints with ui.keyhint-blacklist, which
is a list of globs for keychains that shouldn't be hinted. This allows
users to prevent showing keyhints for keychains they already know.

keyhint-blacklist='*' is equivalent to show-keyhints=False.

Resolves #1515.
2016-05-24 20:46:39 -04:00
Florian Bruhin
f100eb6e03 Mark iframe hint tests as xfail_norun as a stopgap
See #1525.
2016-05-24 22:23:42 +02:00
Nick Ginther
8c487e9a5f fix tabindex statusbar not updating (#1247) 2016-05-24 15:18:22 -05:00
Florian Bruhin
3bbc950616 Fix lint 2016-05-24 21:53:50 +02:00
Florian Bruhin
f692d34d94 Merge branch 'Yatekii-master' 2016-05-24 21:37:02 +02:00
Florian Bruhin
9ef12a0af8 Regenerate authors 2016-05-24 21:36:47 +02:00
Florian Bruhin
846fe8b943 Add a test for #1484 2016-05-24 21:36:09 +02:00
Florian Bruhin
ea1d8902d5 Add logging for #1484 2016-05-24 21:35:48 +02:00
Florian Bruhin
0fb6e508e6 Merge branch 'master' of https://github.com/Yatekii/qutebrowser into Yatekii-master 2016-05-24 21:32:24 +02:00
Florian Bruhin
ce9324029e tox: Update werkzeug to 0.11.10
- Fixed a bug that occurs when running on Python 2.6 and using a broken
  locale.
- Fixed a crash when running the debugger on Google App Engine.
- Fixed an issue with multipart parsing that could cause memory
  exhaustion.
2016-05-24 15:45:19 +02:00
Florian Bruhin
f5c67785c7 tox: Remove pytest-html
We don't use pytest-html anywhere anymore since switching from the
buildbot to Travis CI.
2016-05-24 15:44:39 +02:00
Florian Bruhin
153e955561 tox: Update pbr to 1.10.0 2016-05-24 15:43:09 +02:00
Florian Bruhin
40601adef0 tox: Update hypothesis to 3.2.0
All tests using @given now fix the global random seed. This removes the
health check for that. If a non-zero seed is required for the final
falsifying example, it will be reported. Otherwise Hypothesis will
assume randomization was not a significant factor for the test and be
silent on the subject. If you use the random_module() strategy this will
continue to work and will always display the seed.
2016-05-24 15:41:55 +02:00
Florian Bruhin
c6cb8e5099 Remove unneeded "# pragma: no branch" comments
Those are not needed anymore with coverage 4.1.
2016-05-24 15:40:50 +02:00
Florian Bruhin
11363b9533 Fix some invalid "# pragma: no cover" comments
We accidentally used "# pragma: no coverage" instead.
2016-05-24 15:40:18 +02:00
Ryan Roden-Corrent
b1aaf0f10f Only show keyhints after a short delay.
If a user knows the keychain and can type it quickly, we shouldn't
annoy them with a popup. Only show the keyhint if the user doesn't
complete their keychain in 500ms.

The isVisible() check in the tests is somewhat invalid now because it
is never immediately visible and I don't want to add a delay to unit
tests. I added a check that text() is not set for one test that was
only checking isVisible().

Addresses part of #1515.
2016-05-23 21:21:03 -04:00
Noah Huesser
299c66b82c Possibly fixed issue: #1484 2016-05-23 11:32:27 +02:00
Jakub Klinkovský
ee8247525e simplify testcase for following a hint inside an iframe 2016-05-22 15:19:00 +02:00
Florian Bruhin
002e5801f1 Improve logging in add_js_bridge 2016-05-22 14:55:53 +02:00
Florian Bruhin
4066696956 tox/requirements: Update coverage to 4.1
Version 4.1 --- 2016-05-21

- The internal attribute Reporter.file_reporters was removed in 4.1b3.
  It should have come has no surprise that there were third-party tools
  out there using that attribute. It has been restored, but with a
  deprecation warning.

Version 4.1b3 --- 2016-05-10

- When running your program, execution can jump from an except X: line
  to some other line when an exception other than X happens. This jump
  is no longer considered a branch when measuring branch coverage.
- When measuring branch coverage, yield statements that were never
  resumed were incorrectly marked as missing. This is now fixed.
- During branch coverage of single-line callables like lambdas and
  generator expressions, coverage.py can now distinguish between them
  never being called, or being called but not completed.
- The HTML report now has a map of the file along the rightmost edge of
  the page, giving an overview of where the missed lines are. Thanks,
  Dmitry Shishov.
- The HTML report now uses different monospaced fonts, favoring Consolas
  over Courier. Along the way not properly handling one-space indents
  was fixed. The index page also has slightly different styling, to try
  to make the clickable detail pages more apparent.
- Missing branches reported with coverage report -m will now say ->exit
  for missed branches to the exit of a function, rather than a negative
  number.
- coverage --help and coverage --version now mention which tracer is
  installed, to help diagnose problems. The docs mention which features
  need the C extension.
- Officially support PyPy 5.1, which required no changes, just updates
  to the docs.
- The Coverage.report function had two parameters with non-None
  defaults, which have been changed. show_missing used to default to
  True, but now defaults to None. If you had been calling
  Coverage.report without specifying show_missing, you'll need to
  explicitly set it to True to keep the same behavior. skip_covered used
  to default to False. It is now None, which doesn't change the
  behavior.
- It's never been possible to pass a namespace module to one of the
  analysis functions, but now at least we raise a more specific error
  message, rather than getting confused.
- The coverage.process_startup function now returns the Coverage
  instance it creates.
- Make a small tweak to how we compare threads, to avoid buggy custom
  comparison code in thread classes.

Version 4.1b2 --- 2016-01-23

- Problems with the new branch measurement in 4.1 beta 1 were fixed:
  - Class docstrings were considered executable. Now they no longer are.
  - yield from and await were considered returns from functions, since
    they could tranfer control to the caller. This produced unhelpful
    "missing branch" reports in a number of circumstances. Now they no
    longer are considered returns.
  - In unusual situations, a missing branch to a negative number was
    reported.
- The XML report now produces correct package names for modules found in
  directories specified with source=.
- coverage report won't produce trailing whitespace.

Version 4.1b1 --- 2016-01-10

- Branch analysis has been rewritten: it used to be based on bytecode,
  but now uses AST analysis. This has changed a number of things:
  - More code paths are now considered runnable, especially in
    try/except structures. This may mean that coverage.py will identify
    more code paths as uncovered. This could either raise or lower your
    overall coverage number.
  - Python 3.5's async and await keywords are properly supported
  - Some long-standing branch coverage bugs were fixed:
    - functions with only a docstring for a body would incorrectly
      report a missing branch on the def line.
    - code in an except block could be incorrectly marked as a missing
      branch.
    - context managers (with statements) in a loop or try block could
      confuse the branch measurement, reporting incorrect partial
      branches.
    - In Python 3.5, an actual partial branch could be marked as
      complete.
- Pragmas to disable coverage measurement can now be used on decorator
  lines, and they will apply to the entire function or class being
  decorated.
- Multiprocessing support is now available on Windows.
- Files with two encoding declarations are properly supported.
- Non-ascii characters in regexes in the configuration file worked in
  3.7, but stopped working in 4.0. Now they work again.
- Form-feed characters would prevent accurate determination of the
  beginning of statements in the rest of the file. This is now fixed.
2016-05-22 14:35:26 +02:00
Ryan Roden-Corrent
648f89ef31 Implement more tests for the hinting.
Validate the hint spawn fix as well as add feature tests for previously
untested hinting behaviors (fill, run, --rapid).

There is still no test for the 'userscript' target as running a
userscript from hint mode during a test does not get the same
redirection as the 'I execute the userscript ...' statement, That is,
it looks in /usr/local/share/qutebrowser/userscripts rather than
tests/integration/data/userscripts.
2016-05-21 07:48:52 -04:00
Ryan Roden-Corrent
87cb5bf6c2 Fix test html link for hints 2016-05-20 22:13:49 -04:00
Ryan Roden-Corrent
f025394e04 Set maxsplit=2 for :hint.
This supports things like :hint all spawn -v echo as '-v echo' will be
passed as a single unit to spawn rather than -v being interpreted as a
flag for :hint.

Resolves #797.

Note that, while `:hint --rapid all spawn -v` echo works,
`:hint all --rapid spawn -v echo` does not (this did not work before
either).
2016-05-20 22:11:58 -04:00
Ryan Roden-Corrent
0300f03ebc Allow passing args to spawn from :hint.
Instead of creating a new guiprocess manually, just pass the args along
to the spawn command so it can accept args like -v.

Addresses part of #797 by allowing `hint -- all spawn -v echo`.
`hint all spawn -v echo` is still not supported.
2016-05-20 22:11:58 -04:00
Jakub Klinkovský
c919fcba35 hints: position according to getClientRects() 2016-05-20 21:26:29 +02:00
Jakub Klinkovský
4c06e34074 hints: change click position to the center of the largest square fitting to the top/left corner of the rectangle 2016-05-20 21:26:29 +02:00
Florian Bruhin
0f8b298fad Merge branch 'lahwaacz-hints_clicking' 2016-05-20 18:11:54 +02:00
Florian Bruhin
4b5788a878 Update docs 2016-05-20 18:08:46 +02:00
Florian Bruhin
a5c08e23b6 Fix path to link.html in new tests 2016-05-20 17:21:05 +02:00
Florian Bruhin
ea1f46d542 Merge branch 'hints_clicking' of https://github.com/lahwaacz/qutebrowser into lahwaacz-hints_clicking 2016-05-20 17:09:16 +02:00
Florian Bruhin
2c42219b23 Don't autofollow hint when unfiltering w/ rapid
When we are in rapid mode with only one link, after following the hint, fire()
called filter_hints(None) to display all hints again. Then filter_hints tried
to follow that link, fire() tried to show all again, etc., leading to a
RecursionError.

Fixes #1513.

A test will be added via #1510.
2016-05-20 16:41:51 +02:00
Florian Bruhin
107934e4e1 bdd: Wait a bit in "No crash should happen" step
If we don't do this, the qutebrowser process will be terminated and exit
before it actually has a chance to crash.

See #1510
2016-05-20 16:03:52 +02:00
Florian Bruhin
7898507775 tox: Update pytest-mock to 1.0.0
Fix AttributeError with mocker.spy when spying on inherited methods
2016-05-20 13:10:48 +02:00
Florian Bruhin
d67bfc8c45 Merge branch 'rcorre-keyhint_fix' 2016-05-20 13:07:47 +02:00
Florian Bruhin
b934f8bc4e Fix lint 2016-05-20 13:07:36 +02:00
Ryan Roden-Corrent
b1440a1804 Implement utils.is_special_key.
The check `key.startswith('<') and key.endswith('>') is repeated many
times in code to check for a special key. Replace all these with a call
to the same function.
2016-05-19 20:48:48 -04:00
Ryan Roden-Corrent
5992b81850 Don't show keyhint if there are no hints.
Currently, the keyhint window is shown even if the keystring matches no
possible bindings. This causes an empty keyhint window to hang around
after entering hinting mode.

Instead, the window is now hidden if no bindings match the current
keystring.

Resolves #1507.
2016-05-19 07:02:23 -04:00
Florian Bruhin
93989c035f Merge branch 'rumpelsepp-master' 2016-05-18 23:55:49 +02:00
Florian Bruhin
01e2fb37a0 Regenerate authors 2016-05-18 23:55:43 +02:00
Florian Bruhin
2b0f780500 Merge branch 'master' of https://github.com/rumpelsepp/qutebrowser into rumpelsepp-master 2016-05-18 23:55:34 +02:00
Stefan Tatschner
2c7dc6ffcc Add invalid url to 'test_set_hover_url_encoded'
This covers the recently introduced code path, in 1c23815 (Fix crash
when hovering over an invalid URL, 2016-05-18) when hovering an
invalid URL.
2016-05-18 22:23:26 +02:00
Florian Bruhin
f02bcf256b Update changelog 2016-05-18 18:49:37 +02:00
Florian Bruhin
9111d1b10f Merge branch 'rcorre-command_binding_completion' 2016-05-18 18:48:56 +02:00
Florian Bruhin
b5f8e7306f Merge branch 'command_binding_completion' of https://github.com/rcorre/qutebrowser into rcorre-command_binding_completion 2016-05-18 18:47:13 +02:00
Florian Bruhin
aef952637d Try to fix broken yelo link in README
See #1497
2016-05-18 18:43:16 +02:00
Stefan Tatschner
1c238152f7 Fix crash when hovering over an invalid URL 2016-05-18 16:20:03 +02:00
Ryan Roden-Corrent
4dd1478d2c Use ', '.join instead of str.join(', ', ...). 2016-05-18 08:55:17 -04:00
Ryan Roden-Corrent
0a0f0feaec Update command completions when keyconf changes.
When a user changes keybindings, update the command completion model so
the new keybindings are shown.
2016-05-18 08:00:21 -04:00
Ryan Roden-Corrent
c050b4973b Show special keys last in command completion.
When showing the currently bound key in the misc column for command
completion, if the command has multiple bindings, show special bindings
(e.g. <ctrl-a>) after non-special bindings.
2016-05-18 07:54:06 -04:00
Ryan Roden-Corrent
06caee41b8 Clean up command_binding_completion.
- Add a space after the comman for multiple binding suggestions.
- Use defaultdict(list) instead of defaultdict(lambda: [])
- Move the pylint comment back to the top of the class
2016-05-18 07:46:27 -04:00
Florian Bruhin
dc975cfac0 Update docs 2016-05-18 08:24:20 +02:00
Florian Bruhin
db0e29ae1d Merge branch 'rcorre-keystring' 2016-05-18 07:38:08 +02:00
Florian Bruhin
213677d30a Update changelog 2016-05-18 07:37:20 +02:00
Florian Bruhin
5b65ec17fd Set Qt.RichText textFormat for KeyHintView 2016-05-18 07:35:56 +02:00
Florian Bruhin
5c8d1656ff Fix path to test_keyhints.py in check_coverage.py
utils -> misc
2016-05-18 07:34:40 +02:00
Florian Bruhin
d0af80fbd5 Merge branch 'keystring' of https://github.com/rcorre/qutebrowser into rcorre-keystring 2016-05-18 07:33:17 +02:00
Florian Bruhin
32c7518124 Merge branch 'Liambeguin-hint_inputs' 2016-05-18 07:31:00 +02:00
Florian Bruhin
9a0083ea65 Regenerate authors 2016-05-18 07:30:54 +02:00
Florian Bruhin
324fcfadb0 Merge branch 'hint_inputs' of https://github.com/Liambeguin/qutebrowser into Liambeguin-hint_inputs 2016-05-18 07:30:46 +02:00
Florian Bruhin
d837e3eb91 Merge branch 'forkbong-pretty-hover-url' 2016-05-18 07:28:39 +02:00
Florian Bruhin
6aed55f09d Update changelog 2016-05-18 07:28:28 +02:00
Florian Bruhin
3a29abc779 Regenerate authors 2016-05-18 07:27:38 +02:00
Florian Bruhin
02cbc2f986 Merge branch 'pretty-hover-url' of https://github.com/forkbong/qutebrowser into forkbong-pretty-hover-url 2016-05-18 07:27:30 +02:00
Florian Bruhin
43518a4624 Merge branch 'timeout_docs' of https://github.com/rcorre/qutebrowser into rcorre-timeout_docs 2016-05-18 07:26:12 +02:00
Florian Bruhin
e4d84b0bfc Simplify argparser.type_check
If the value isn't param.default, it will always be a string or a flag, as
type_conv never gets called when the function is called from Python.
2016-05-18 07:16:17 +02:00
Florian Bruhin
284d4e4b97 Only pass is_bool to Command._param_to_argparse_* 2016-05-18 06:55:27 +02:00
Florian Bruhin
a83bf9c3ee Simplify argparser.type_conv
Since we're not using those functions as argparse callbacks anymore, we
can write a normal function instead of factories, which simplifies
things a lot.
2016-05-18 06:55:27 +02:00
Florian Bruhin
8ba6a0f5a7 Update CONTRIBUTING with cmdutils changes 2016-05-18 06:55:27 +02:00
Florian Bruhin
c0d044447d Add tests for qutebrowser.utils.typing 2016-05-18 06:55:17 +02:00
Florian Bruhin
6ed9b6b13f Make sure typing.Union[str, int] gets handled
str always needs to be the last element checked as otherwise it'd always
win.
2016-05-18 06:55:17 +02:00
Florian Bruhin
a0d0b6464f Use typing.py-like annotations for command args
This means:

- An annotation like (int, str) is now typing.Union[int, str].
- utils.typing got expanded so it acts like the real typing.py, with
  issubclass() working properly with typing.Union and __union_params__
  being set.
- A literal string doesn't exist anymore as annotation, instead
  @cmdutils.argument now has a 'choices' argument which can be used like
  @cmdutils.argument('arg', choices=['val1', 'val2']).
- Argument validating/converting is now entirely handled by
  argparser.type_conv instead of relying on python's argparse, i.e.
  type/choices is now not passed to argparse anymore.
2016-05-18 06:55:17 +02:00
Florian Bruhin
cdcd276a1a Also use @cmdutils.argument for :bind
This was added in master and not updated when this branch was rebased on
master.
2016-05-18 06:55:17 +02:00
Florian Bruhin
3a33bc42a6 Add initial support for the typing module 2016-05-18 06:55:17 +02:00
Florian Bruhin
9694374673 Add test for cmd arg types 2016-05-18 06:55:17 +02:00
Florian Bruhin
bb8d0a8ee4 Fix long lines 2016-05-18 06:55:17 +02:00
Florian Bruhin
c33f0c3512 Use @cmdutils.argument for completions 2016-05-18 06:55:17 +02:00
Florian Bruhin
3ab40bbc23 Clear globals correctly for all cmdutils tests
TestArgument didn't clear the globals as the fixture was inside
TestRegister.

This means test_run_vulture failed in funny ways because run_vulture.py
generated a whitelist containing "<locals>" for commands:

    tests/unit/scripts/test_run_vulture.py:55: in run
        return run_vulture.run([str(e.basename) for e in files])
    scripts/dev/run_vulture.py:146: in run
        vult.scavenge(files + [whitelist_file.name])
    .tox/py35/lib/python3.5/site-packages/vulture.py:107: in scavenge
        self.scan(module_string)
    .tox/py35/lib/python3.5/site-packages/vulture.py:75: in scan
        node = ast.parse(node_string, filename=self.file)
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    source = 'qutebrowser.browser.commands.CommandDispatcher.buffer\nqutebrowser.misc.savemanager.SaveManager.save_command\nqutebro...iidoc.UsageFormatter._get_default_metavar_for_positional\nscripts.dev.src2asciidoc.UsageFormatter._metavar_formatter\n'
    filename = '/tmp/tmp_ein2umn', mode = 'exec'

        def parse(source, filename='<unknown>', mode='exec'):
            """
            Parse the source into an AST node.
            Equivalent to compile(source, filename, mode, PyCF_ONLY_AST).
            """
    >       return compile(source, filename, mode, PyCF_ONLY_AST)
    E         File "/tmp/tmp_ein2umn", line 16
    E           test_cmdutils.TestArgument.test_wrong_order.<locals>.fun
    E                                                       ^
    E       SyntaxError: invalid syntax
2016-05-18 06:55:17 +02:00
Florian Bruhin
1611562271 Get rid of dict annotations 2016-05-18 06:55:17 +02:00
Florian Bruhin
d990032a2e Remove leftovers of 'name' annotation key 2016-05-18 06:55:17 +02:00
Florian Bruhin
77151d394a Use @cmdutils.argument for metavar 2016-05-18 06:55:17 +02:00
Florian Bruhin
c14db202d6 Use @cmdutils.argument to hide arguments 2016-05-18 06:55:17 +02:00
Florian Bruhin
2fc4f408cd Fix src2asciidoc 2016-05-18 06:55:17 +02:00
Florian Bruhin
1d5fc4a140 Update @cmdutils.argument docs 2016-05-18 06:55:17 +02:00
Florian Bruhin
2370793f38 Make win_id/count mutually exclusive for ArgInfo 2016-05-18 06:55:17 +02:00
Florian Bruhin
35135c4b0d Use @cmdutils.argument for win_id/count 2016-05-18 06:55:17 +02:00
Florian Bruhin
04367851c3 Refactor how cmdutils.ArgInfo works
It's now a real class, and some other aspects about how it's handled
were cleaned up as well.
2016-05-18 06:55:17 +02:00
Florian Bruhin
9eeaeb95c3 Make sure @cmdutils.argument after @register fails 2016-05-18 06:55:17 +02:00
Florian Bruhin
3c586f34ff Add a @cmdutils.argument decorator
For now the only available keyword argument is 'flag' which customizes
the flag an argument will get.

See #637.
2016-05-18 06:55:17 +02:00
Florian Bruhin
965a012db7 Name strip_whitespace.sh correctly 2016-05-18 06:54:14 +02:00
Florian Bruhin
ee579b4bc3 Add a script to strip trailing whitespace
Obsoletes #1498
2016-05-18 06:37:26 +02:00
Liam BEGUIN
f689cca101 Added missing All group 2016-05-17 23:57:36 -04:00
Liam BEGUIN
c3dfd62172 broke line to fit properly 2016-05-17 23:39:24 -04:00
Ryan Roden-Corrent
52641e25f5 Show currently bound keys in command completion.
The command completion menu now uses the misc colum to show a
comma-separated list of normal-mode keybindings for each command.
2016-05-17 20:25:09 -04:00
Ryan Roden-Corrent
acdeb0f57c Bump default for partial-timeout to 5000ms.
Give more time to read the keyhint widget.
2016-05-17 20:13:25 -04:00
Ryan Roden-Corrent
e810317057 Restore bottom padding of keyhint widget.
Previously, negative bottom padding was used (probably to compensate
for a trailing <br>). With the table format, this is no longer
necessary and causes the last line to be drawn too low.
2016-05-17 20:10:52 -04:00
Liam BEGUIN
ce0d23bd10 Added tests for the inputs group 2016-05-17 19:58:48 -04:00
Liam BEGUIN
b66d5e1ce9 Fixed indentations 2016-05-17 19:58:27 -04:00
Ryan Roden-Corrent
822d148713 Update key hint tests for new format.
Change the unit tests to expect the new tabular format.
Also generally clean up the tests -- refactor from a class to
module-level functions as there was no need for a class here.
2016-05-17 07:04:53 -04:00
Panagiotis Ktistakis
959f777f92 Assert that hovered link generates a valid QUrl 2016-05-17 10:28:33 +03:00
Jimmy
cd21f6326e Save redirect links that are clicked on to history.
This allows webkit to color links that are clicked on but never rendered as
visited too. It also means if you get redirected from eg http://site.com to
http://site.com/ you have essentially duplicates in your history. This makes
the history completion a bit noisier. I suppose normalising paths before
checking for duplicates might help. Also note that otter has an isTypedIn flag
which might be used for dealing with this.
2016-05-17 17:15:22 +12:00
Jimmy
b48b36a88d fixup! Switch browsing history away from QWebHistoryInterface. 2016-05-17 17:15:22 +12:00
Jimmy
33fbe97863 Switch browsing history away from QWebHistoryInterface.
Now adds a url to browser history once we have connected and got enough data
to start rendering the page. The previous approach saved urls as soon as
navigation was initiated, so upon encountering a redirect the final url wasn't
saved.

Using layout started rather than load finished means that pages whose contents
manage to load minus one troublesome asset will still be saved.
2016-05-17 17:15:22 +12:00
Jimmy
1524f29f71 Add titles to history entry.
Adds a title to the HistoryEntry class and includes it in the serialization
stuff. Not currently set from anywhere.

Not sure if anything more needs to be done to support non-ascii characters.
Everything works fine for me with unicode chars in url and title but
everything in my stack is utf-8.
2016-05-17 17:15:22 +12:00
Liam BEGUIN
531a5071f6 updated inputs-group 2016-05-17 00:38:23 -04:00
Ryan Roden-Corrent
86f95c302d Explain timeout vs partial-timeout better in docs. 2016-05-16 21:40:30 -04:00
Felix Van der Jeugt
acb60a1bf4 align using a table 2016-05-16 07:14:34 -04:00
Liam BEGUIN
3b0354518b Added basic inputs-group to :hint 2016-05-15 22:46:12 -04:00
Ryan Roden-Corrent
3cd252ef82 Clean up html for keyhint text.
The \t was behaving the same as a space and the <b> was doing nothing.
2016-05-15 22:33:53 -04:00
Ryan Roden-Corrent
8eee5def5d Add unit tests for the keyhint widget.
- validate keyhint text for a partial keychain
- ensure special keybindings are not suggested
- ensure it is not visible when disabled
- ensure changes to the suffix color are picked up
2016-05-15 22:20:52 -04:00
Ryan Roden-Corrent
581a521b4d Allow setting mock keybindings for unit tests.
Implement mock_key_config.set_bindings_for to set bindings that will be
retrieved by mock_key_config.get_bindings_for.
This is useful for testing the new keyhint ui.
2016-05-15 22:18:16 -04:00
Ryan Roden-Corrent
d506d7793f Further clean up keyhints.
Don't show special keys in the keyhint window as these currently cannot
be part of keychains.
Use a rounded border on the top-right corner and square on the rest.
2016-05-15 12:32:36 -04:00
Panagiotis Ktistakis
224c877fec Hide passwords in hovering URLs 2016-05-15 19:07:10 +03:00
Florian Bruhin
0c1e82a103 Fix lint 2016-05-15 11:53:58 +02:00
Florian Bruhin
6fc2217b07 Merge branch 'rcorre-messages' 2016-05-15 11:51:20 +02:00
Florian Bruhin
76a755634b Update changelog 2016-05-15 11:51:09 +02:00
Florian Bruhin
9b28d90543 Improve output if :messages is used without errors 2016-05-15 11:50:29 +02:00
Florian Bruhin
b704c911ae Fix running qute:log and qute:plainlog
This failed because dict.get('level') returned None with no level
parameter, and the subsequent [0] raised:

    Traceback (most recent call last):
      File ".../qutebrowser/utils/utils.py", line 624, in wrapper
        return func(*args, **kwargs)
      File ".../qutebrowser/browser/network/networkmanager.py", line 445, in createRequest
        op, req, outgoing_data)
      File ".../qutebrowser/browser/network/qutescheme.py", line 107, in createRequest
        data = handler(self._win_id, request)
      File ".../qutebrowser/browser/network/qutescheme.py", line 189, in qute_log
        level = urllib.parse.parse_qs(request.url().query()).get('level')[0]
    TypeError: 'NoneType' object is not subscriptable
2016-05-15 11:33:30 +02:00
Florian Bruhin
bb31787931 Regenerate docs 2016-05-15 11:21:02 +02:00
Florian Bruhin
e21039094d Merge branch 'messages' of https://github.com/rcorre/qutebrowser into rcorre-messages 2016-05-15 11:20:06 +02:00
Florian Bruhin
8193644a04 Merge branch 'forkbong-set-cmd-text-variables' 2016-05-15 11:09:37 +02:00
Florian Bruhin
a9ab6abafd Document {url} and {url:pretty} for :set-cmd-text 2016-05-15 11:09:16 +02:00
Florian Bruhin
3831dc38f7 Regenerate authors 2016-05-15 11:09:08 +02:00
Florian Bruhin
0888f676f3 Change go/gO/xO/wO bindings to use {url:pretty}
This is now possible with #1494.
See #1483.
2016-05-15 11:06:54 +02:00
Florian Bruhin
b75d1629a8 Merge branch 'set-cmd-text-variables' of https://github.com/forkbong/qutebrowser into forkbong-set-cmd-text-variables 2016-05-15 11:01:58 +02:00
Florian Bruhin
6b4efc1822 Fix log output in crash report
With the changes to get rid of colorlog, we broke this, as e.g. {green}
was an undefined key for the vanilla logging.Formatter used for the
in-RAM log. Now we instead use a ColoredFormatter with colors turned
off.
2016-05-15 10:46:46 +02:00
Florian Bruhin
33236b5314 Make tox -e mkenv work
This is a common typo, so let's just make things work. It does the exact
same thing as tox -e mkvenv.
2016-05-15 09:59:44 +02:00
Ryan Roden-Corrent
231950aa88 Increase default value for input.partial-timeout.
Increase from 500 to 2500.
This allows the user more time to read hints shown in the new keyhint
popup.
2016-05-14 19:30:39 -04:00
Ryan Roden-Corrent
d592a3e764 Clean up keyhint implementation.
From code review:

- escape all strings used in the keyhint html
- read the prefix color each time the hint is shown
- use show/hide instead of setVisible
- clean up pylint/flake8 errors
- use CssColor instead of QssColor for keyhint.fg.suffix
- add some padding to the keyhint popup
2016-05-14 19:30:28 -04:00
Florian Bruhin
a1bac9509b Merge branch 'ismail-s-patch-1' 2016-05-14 23:52:43 +02:00
Florian Bruhin
e476a21876 Regenerate authors 2016-05-14 23:52:36 +02:00
Florian Bruhin
827ad3fb13 Merge branch 'patch-1' of https://github.com/ismail-s/qutebrowser into ismail-s-patch-1 2016-05-14 23:52:22 +02:00
Panagiotis Ktistakis
c88883fcb3 Decode URL in statusbar when hovering over it 2016-05-14 19:52:24 +03:00
Ryan Roden-Corrent
e7ff717d52 Show key hints for all modes, not just normal. 2016-05-14 12:50:26 -04:00
Ryan Roden-Corrent
8406746889 Show possible keychains from current input.
When the current keystring is a partial match for one or more bindings,
show the possible bindings in a small overlay.

The overlay is partially transparent by default, but the background
color is configurable as ui->keystring.bg.
2016-05-14 12:50:26 -04:00
Ryan Roden-Corrent
fcd233a675 Clean up :messages implementation.
- Add log.LOG_LEVELS to map names to levels (instead of using
  logging._levelToName)
- Test that log pages do not contain messages below the requested level
- Use pythons urllib.parse.parse_qs instead of Qt's UrlQuery
- Document tab, bg, window args for :messages
- Clean up style
2016-05-14 12:45:22 -04:00
Panagiotis Ktistakis
9527712daa Add tests for {url:pretty} in :set-cmd-text 2016-05-14 18:44:05 +03:00
Ryan Roden-Corrent
c36f760114 Add bdd test for page not containing plaintext.
You can now use 'the page should not contain the plaintext ...' in a
feature test.
2016-05-14 07:10:58 -04:00
Ryan Roden-Corrent
800c1c3cf8 Add :messages command to show past messages.
This adds a 'level' query parameter to qute://log and qute://plainlog.
For example, qute://log?level=warning will show an html page containing
log entries with severity warning or greater.
If the query is omitted, the original behavior of qute://log is
preserved.

:messages [level] is a command that opens qute://log?level=<level>.
By default, level defaults to 'error' as an easy way to see missed
error messages.
2016-05-14 07:10:58 -04:00
Ismail
d6fede7f1d Change 'commands' to 'keybindings' 2016-05-13 23:32:45 +01:00
Ismail
40c2bc7151 Add more commands to docs 2016-05-13 23:29:04 +01:00
Florian Bruhin
42460c3c04 tox: Update pyparsing to 2.1.4
- Split out the '==' behavior in ParserElement, now implemented
  as the ParserElement.matches() method. Using '==' for string test
  purposes will be removed in a future release.

- Expanded capabilities of runTests(). Will now accept embedded
  comments (default is Python style, leading '#' character, but
  customizable). Comments will be emitted along with the tests and
  test output. Useful during test development, to create a test string
  consisting only of test case description comments separated by
  blank lines, and then fill in the test cases. Will also highlight
  ParseFatalExceptions with "(FATAL)".

- Added a 'pyparsing_common' class containing common/helpful little
  expressions such as integer, float, identifier, etc. I used this
  class as a sort of embedded namespace, to contain these helpers
  without further adding to pyparsing's namespace bloat.

- Minor enhancement to traceParseAction decorator, to retain the
  parse action's name for the trace output.

- Added optional 'fatal' keyword arg to addCondition, to indicate that
  a condition failure should halt parsing immediately.
2016-05-13 21:21:14 +02:00
Florian Bruhin
c64e5c9bd5 Get rid of the colorlog dependency
colorlog was problematic for various reasons:

- Not commonly packaged for Linux distributions
- Calling colorama.init() automatically on import
- Not supporting {foo} log formatting
- Not supporting an easy way to turn colors off

Instead we now do the log coloring by hand, which is simpler and means
everyone will have colored logs.
2016-05-13 21:19:33 +02:00
Panagiotis Ktistakis
bb45392c1b Use the right split function 2016-05-13 19:32:35 +03:00
Ismail
9264bd077a Add basic commands to docs 2016-05-13 17:13:45 +01:00
Panagiotis Ktistakis
ecfa6cfc63 Split arguments using qutebrowser.utils.split 2016-05-13 18:59:24 +03:00
Panagiotis Ktistakis
7488f2a5cb Remove unused imports 2016-05-13 18:58:42 +03:00
Panagiotis Ktistakis
38edb1b16d Properly replace variables in set-cmd-text command
This fixes #123 and allows variables like {url:pretty} to be used with
set-cmd-text
2016-05-13 18:12:53 +03:00
Florian Bruhin
a9a853baf0 Improve message stack output
The output failed the tests as it was parsed as invalid. Indenting helps
with that.

This also simplifies things a bit by having a _log_stack function and
shows the type of stack we're printing.
2016-05-13 08:27:11 +02:00
Florian Bruhin
4a551a6758 Show exception stack when handling cmdexc errors. 2016-05-13 07:43:44 +02:00
Florian Bruhin
b6abada50a Fix lint 2016-05-13 06:42:09 +02:00
Florian Bruhin
a7ece80d34 Merge branch 'pyinstaller' 2016-05-13 06:21:28 +02:00
Florian Bruhin
d507727bb3 tox: Update PyInstaller to 3.2
- Even the “main” script is now byte-compiled
- The manual is on readthedocs.io now
- On installation try to compile the bootloader if there is none for the
  current plattform
- (Unix) Use objcopy to create a valid ELF file
- (Linux): Compile with _FORTIFY_SOURCE
- New, updated and fixed hooks: CherryPy, Cryptography, enchant,
  gi.repository.GdkPixbuf, gst, Lib2to3, PyQt4, PyQt5, PySide, SciPy,
  sphinx, sqlalchemy, traitlets, wx.lib.pubsub
- For windowed mode add isatty() for our dummy NullWriter
- Suppress “Failed to execute script” in case of SystemExit
- Do not apply Upx compressor for bootloader files
- Fix absolute path for lib used via ctypes
- (OSX) Fix binary cache on NFS
- (Windows) Fix message in grab_version
- (Windows) Fix wrong icon paramter in Windows example
- (Windows) Fix win32 unicode handling
- (Windows) Fix unnecessary rebuilds caused by rebuilding winmanifest
- (Cygwin) Fix finding the Python library for Cygwin 64-bit
- (OSX) Fix compilation issue
- (Windows) No longer bundle pefile, use package from for windows
- (Windows) Provide a more robust means of executing a Python script
- AIX fixes.
- Update waf to version 1.8.20
- Fix excludedimports, more predictable order how hooks are applied
- Internal impovements and code clean-up
- Clean-ups fixes and improvements for the test suite
2016-05-13 05:23:19 +02:00
Florian Bruhin
b755d56c02 Rename setup.cfg to .flake8
We only use it to store flake8 config, and it turns out flake8 didn't
actually deprecate .flake8.
2016-05-12 22:58:12 +02:00
Florian Bruhin
aea30e810a Fix lint 2016-05-12 21:11:45 +02:00
Florian Bruhin
af1880fc1d tox: Update pyflakes to 1.2.3 2016-05-12 21:11:14 +02:00
Florian Bruhin
7901d2929a ci: Update pip to 8.1.2
Since virtualenv uses the built-in pip version with VIRTUALENV_DOWNLOAD=no we
need to make sure we keep virtualenv capped, but we can use a newer pip.
2016-05-12 20:32:03 +02:00
Florian Bruhin
b634b051c8 travis: Set VIRTUALENV_DOWNLOAD=no
Things broke because of the virtualenv upgrade in requirements-tox.txt.
virtualenv bundles a "good" pip version (good: doesn't suffer
from #1486). However the virtualenv upgrade caused us to get a new
version which downloads a new pip. Setting VIRTUALENV_DOWNLOAD=no
prevents that from happening.
2016-05-12 20:32:03 +02:00
Florian Bruhin
e70d6d49d9 travis: Separate requirement files
This way we can update pip independently before installing the rest, and
avoid installing codecov (and thus coverage which attempts to build C
extension) where it's not needed.
2016-05-12 20:32:03 +02:00
Florian Bruhin
d4e2b4ebb4 travis: Don't update Python for flake8 env
This was needed because of a bug for which the backfix seems to be
ported to Ubuntu now.
2016-05-12 20:32:03 +02:00
Florian Bruhin
56a2b6778c travis: Install libpython3.4-dev
This is now needed because we use "language: generic" which doesn't come
with that package.
2016-05-12 20:32:03 +02:00
Florian Bruhin
0086fc7851 travis: Use "language: generic"
This means we'll get the most minimal image and can install exactly what
we need.
2016-05-12 20:32:03 +02:00
Florian Bruhin
0632f6886e flake8: Adjust appveyor_install.py path
We have some ignores local to that file, and after renaming the file
they showed up again.

We also remove the C901 ignore (mccabe complexity check) as the script
got simpler.
2016-05-12 20:32:03 +02:00
Florian Bruhin
e13320b398 travis: Use python2 for pip
This means we won't need to install pip via apt-get, and using a
Python 2 tox/pip is fine.
2016-05-12 20:32:03 +02:00
Florian Bruhin
3033f77f99 travis: Use (( in travis_retry
If we use [, the script exits when a condition is false (as we use
set -e).
2016-05-12 20:32:03 +02:00
Florian Bruhin
cdc79339fb travis: Use requirement files for pip
This way we can pin tox/pip versions (which are used in the native
Travis environment) *and* get notified about updates by requires.io.
2016-05-12 20:32:03 +02:00
Florian Bruhin
6558e196b4 Simplify package installation on CI
Having a Python script was a good idea back when we could do almost the
same steps on every CI configuration.

This turned out to grow into a complicated script, so it's easier to
split off things for Linux/OS X into a small shell script (and keep
Python for Windows, as I really don't want to use .bat/.ps).
2016-05-12 20:32:03 +02:00
Florian Bruhin
768ff8b193 tox: update pyparsing to 2.1.3
- _trim_arity fix in 2.1.2 was very version-dependent on Py 3.5.0.
  Now works for Python 2.x, 3.3, 3.4, 3.5.0, and 3.5.1 (and hopefully
  beyond).

This fixes pyparsing/flake8-putyt/flake8 being broken with python 3.4:

    >>> import pyparsing
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File ".../pyparsing.py", line 3478, in <module>
        _escapedPunc = Word( _bslash, r"\[]-*.$+^?()~ ", exact=2 ).setParseAction(lambda s,l,t:t[0][1])
      File ".../pyparsing.py", line 948, in setParseAction
        self.parseAction = list(map(_trim_arity, list(fns)))
      File ".../pyparsing.py", line 808, in _trim_arity
        this_line = extract_stack()[-1]
      File ".../pyparsing.py", line 793, in extract_stack
        return [(frame_summary.filename, frame_summary.lineno)]
    AttributeError: 'tuple' object has no attribute 'filename'

See https://sourceforge.net/p/pyparsing/bugs/95/
2016-05-12 20:32:03 +02:00
Florian Bruhin
37a1d0cb6f Log stacktrace of error messages to debug log 2016-05-12 20:30:07 +02:00
Florian Bruhin
e095f9ded2 tox: Downgrade pyparsing to 2.1.1
It seems pyparsing 2.1.2 is broken with Python 3.4:

    >>> import pyparsing
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File ".../pyparsing.py", line 3478, in <module>
        _escapedPunc = Word( _bslash, r"\[]-*.$+^?()~ ", exact=2 ).setParseAction(lambda s,l,t:t[0][1])
      File ".../pyparsing.py", line 948, in setParseAction
        self.parseAction = list(map(_trim_arity, list(fns)))
      File ".../pyparsing.py", line 808, in _trim_arity
        this_line = extract_stack()[-1]
      File ".../pyparsing.py", line 793, in extract_stack
        return [(frame_summary.filename, frame_summary.lineno)]
    AttributeError: 'tuple' object has no attribute 'filename'

That breaks flake8-putty and thus flake8.
See https://sourceforge.net/p/pyparsing/bugs/95/
2016-05-11 08:15:12 +02:00
Florian Bruhin
3098d1fd8c tox: Hardcode more indirect deps for flake8 env
We added more flake8 checkers but never regenerated those, causing some
updates to happen silently and (probably?) breaking stuff.
2016-05-11 06:34:19 +02:00
Florian Bruhin
7a51387fb3 Move comment in tox.ini
On Travis CI, the flake8 env suddenly started to fail (pip upgrade?):

    Invalid requirement: 'pep257==0.7.0  # still needed by flake8-docstrings but ignored'
    Traceback (most recent call last):
      File "/home/travis/build/The-Compiler/qutebrowser/.tox/flake8/lib/python3.4/site-packages/pip/_vendor/packaging/requirements.py", line 92, in __init__
        req = REQUIREMENT.parseString(requirement_string)
      File "/home/travis/build/The-Compiler/qutebrowser/.tox/flake8/lib/python3.4/site-packages/pip/_vendor/pyparsing.py", line 1172, in parseString
        raise exc
      File "/home/travis/build/The-Compiler/qutebrowser/.tox/flake8/lib/python3.4/site-packages/pip/_vendor/pyparsing.py", line 1162, in parseString
        loc, tokens = self._parse( instring, 0 )
      File "/home/travis/build/The-Compiler/qutebrowser/.tox/flake8/lib/python3.4/site-packages/pip/_vendor/pyparsing.py", line 1028, in _parseNoCache
        loc,tokens = self.parseImpl( instring, preloc, doActions )
      File "/home/travis/build/The-Compiler/qutebrowser/.tox/flake8/lib/python3.4/site-packages/pip/_vendor/pyparsing.py", line 2462, in parseImpl
        loc, exprtokens = e._parse( instring, loc, doActions )
      File "/home/travis/build/The-Compiler/qutebrowser/.tox/flake8/lib/python3.4/site-packages/pip/_vendor/pyparsing.py", line 1032, in _parseNoCache
        loc,tokens = self.parseImpl( instring, preloc, doActions )
      File "/home/travis/build/The-Compiler/qutebrowser/.tox/flake8/lib/python3.4/site-packages/pip/_vendor/pyparsing.py", line 2265, in parseImpl
        raise ParseException(instring, loc, self.errmsg, self)
    pip._vendor.pyparsing.ParseException: Expected stringEnd (at char 15), (line:1, col:16)
    During handling of the above exception, another exception occurred:
    Traceback (most recent call last):
      File "/home/travis/build/The-Compiler/qutebrowser/.tox/flake8/lib/python3.4/site-packages/pip/req/req_install.py", line 78, in __init__
        req = Requirement(req)
      File "/home/travis/build/The-Compiler/qutebrowser/.tox/flake8/lib/python3.4/site-packages/pip/_vendor/packaging/requirements.py", line 96, in __init__
        requirement_string[e.loc:e.loc + 8]))
    pip._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'# still '"

I can't reproduce this locally, but I hope this'll help.
2016-05-11 06:08:48 +02:00
Florian Bruhin
ac41c0ba18 tox: Update CherryPy to 5.4.0
* ``cherrypy.test.webtest.WebCase`` now honors a
  'WEBTEST_INTERACTIVE' environment variable to disable
  interactive tests (still enabled by default). Set to '0'
  or 'false' or 'False' to disable interactive tests.
* Fix AttributeError when listiterator was accessed
  using the ``next`` attribute.
* Removed ``cherrypy.lib.sessions.PostgresqlSession``.
* Fix errors with redirects to Unicode URLs.
2016-05-11 05:16:51 +02:00
Florian Bruhin
181a785ce6 Update changelog
[ci skip]
2016-05-10 23:49:10 +02:00
Florian Bruhin
62d35db16a Merge branch 'rcorre-show_binding2' 2016-05-10 23:48:30 +02:00
Florian Bruhin
cb27dbbfb5 Fix error message check for :bind test 2016-05-10 23:47:16 +02:00
Florian Bruhin
ea243ae022 Renumber keybindings in keyinput.feature
An unique keybinding for each test means we have some level of
isolation and can understand error messages more easily.

As we're >10 now, let's use a leading zero to avoid shadowed
keybindings.
2016-05-10 23:46:02 +02:00
Florian Bruhin
90c42ff2e2 Regenerate docs 2016-05-10 23:39:48 +02:00
Florian Bruhin
24d16dd0a7 Merge branch 'show_binding2' of https://github.com/rcorre/qutebrowser into rcorre-show_binding2 2016-05-10 23:39:32 +02:00
Florian Bruhin
36da07c73b Fix lint 2016-05-10 07:56:54 +02:00
Florian Bruhin
5eff35ba30 cmdutils.register: annotation -> arg for flags
Instead of using a 'flag' key in the annotation dict, we now use a flags
argument to @cmdutils.register which is a {argument: flag} dict.

See #637.
2016-05-10 07:35:41 +02:00
Florian Bruhin
49fb981e7f Add test for completion count in cmdutils.register 2016-05-10 07:12:50 +02:00
Florian Bruhin
9ca5acd546 Add tests for flags with @cmdutils.register 2016-05-10 07:00:10 +02:00
Florian Bruhin
b17ecd1376 Add tests for cmdutils.register/star_args_optional 2016-05-10 06:41:42 +02:00
Florian Bruhin
73fbfb9731 Replace 'nargs' annotation by star_args_optional
Before we used a {'nargs': '*'} annotation for the respective argument
to tell qutebrowser it's optional for the commandline. Now we instead
use a star_args_optional argument for @cmdutils.register as a first step
towards freeing up argument annotations for PEP 484.

See #637.
2016-05-09 22:49:24 +02:00
Florian Bruhin
e4e98c6c23 Delete QTextDocument properly in completion.
The CompletionItemDelegate gets reused by Qt for various items in the
completion. Every time _get_textdoc() was called we created a new
QTextDocument, but since it has a long-living parent set (the delegate)
the old one was never actually garbage collected.

We now explicitly delete the old QTextDocument as it's not needed
anymore by either Qt or Python.

See #1476.
2016-05-09 09:11:14 +02:00
Florian Bruhin
56f1d885f9 Use parens instead of \ to continue line 2016-05-09 07:18:12 +02:00
Florian Bruhin
2c6826f9e0 Merge branch 'phansch-bdd_test_insert_mode' 2016-05-09 07:15:48 +02:00
Florian Bruhin
8f3dda6709 Regenerate authors 2016-05-09 07:15:19 +02:00
Florian Bruhin
a8845be9e6 Merge branch 'bdd_test_insert_mode' of https://github.com/phansch/qutebrowser into phansch-bdd_test_insert_mode 2016-05-09 07:15:10 +02:00
Florian Bruhin
e132c1cc1e Merge branch 'Kingdread-confirm-quit-downloads' 2016-05-09 07:07:59 +02:00
Florian Bruhin
7f99c36ec5 Update changelog 2016-05-09 07:07:46 +02:00
Florian Bruhin
f7dc9b54bd Add a test for #846 2016-05-09 07:06:58 +02:00
Daniel Schadt
1fa50021c1 downloads: use right index for beginInsertRows
len(self.downloads) is already the index of the item in the download
list, this should be used for beginInsertRows(). The +1 is only for the
human readable part.
2016-05-08 23:36:31 +02:00
Daniel Schadt
99182e3e79 downloads: change len() to sum() 2016-05-08 23:36:31 +02:00
Daniel Schadt
643d2cc6dd fix confirm-quit=downloads with finished downloads
Issue #846

.rowCount() returns all downloads, even the finished ones that have not
yet been removed from the list. For confirming the quit event, we should
only consider downloads that are still running.
2016-05-08 23:36:31 +02:00
Florian Bruhin
a23aa1cc47 Fix broken supports_selection() test 2016-05-08 22:39:39 +02:00
Florian Bruhin
89c7b0e7f8 Simplify if-statement 2016-05-08 22:18:14 +02:00
Florian Bruhin
165504c1f2 bdd: Fix clipboard_contains_multiline 2016-05-08 22:09:19 +02:00
Florian Bruhin
59ec5fa947 Show debug instead of warning for #670
The user can't do much about this anyways, and I have no idea what
triggers it, so let's not annoy them about it.
2016-05-08 22:08:08 +02:00
Florian Bruhin
b9b6f357da Add utils.supports_selection() 2016-05-08 22:06:59 +02:00
Florian Bruhin
3e6ac28c66 Fix ;Y on systems not supporting primary selection
Instead we paste clipboard like we already do with some other commands
when primary selection is not supported.

Fixes #1336
2016-05-08 21:59:25 +02:00
Florian Bruhin
4d9a98a11d Paste clipboard with :paste-primary on Windows 2016-05-08 21:18:57 +02:00
Florian Bruhin
ddc1f803c0 Clean up assertion 2016-05-08 20:01:35 +02:00
Florian Bruhin
f49cc4e901 Only keep contain tests 2016-05-08 19:57:59 +02:00
Florian Bruhin
65ed878dcf Update copyright 2016-05-08 19:57:18 +02:00
Florian Bruhin
fdb28e4c71 Add test_sortfilter from #950 2016-05-08 19:56:41 +02:00
Florian Bruhin
55f6ce1c95 Merge branch 'fix-link-pyqt' of https://github.com/Kingdread/qutebrowser into Kingdread-fix-link-pyqt 2016-05-08 19:12:26 +02:00
Florian Bruhin
f306ca9b53 Fix lint 2016-05-08 11:14:42 +02:00
Florian Bruhin
b4272975f2 Revert "Use lists instead of tuples"
This reverts commit eb5bfc1659.
2016-05-08 11:09:47 +02:00
Daniel Schadt
dcb2c7f868 link_pyqt: fix crash with spaces in pypath
This fixes a bug where link_pyqt crashes when the path to the python
interpreter contains a space.
2016-05-08 01:08:36 +02:00
Florian Bruhin
95fa78fce3 Merge branch 'jcorentin-test_adblock' 2016-05-07 23:45:53 +02:00
Florian Bruhin
4403f02ac5 Fix HostBlocker.on_config_changed with no datadir 2016-05-07 23:35:30 +02:00
Florian Bruhin
6d1764e732 Clear blocked hosts on start correctly 2016-05-07 23:31:35 +02:00
Florian Bruhin
b6add69705 Improve exception handling in HostBlocker
In on_config_changed, we now ignore FileNotFoundError as that's a common
occurence and not something worth logging.

In case of other OSError's we now also log the exact error message.
2016-05-07 23:30:32 +02:00
Florian Bruhin
f6544786c1 dict 2016-05-07 22:41:22 +02:00
Florian Bruhin
2d8bde62a5 docstring 2016-05-07 22:39:53 +02:00
Florian Bruhin
9e64e5eab4 Check CommandError exception value 2016-05-07 22:39:09 +02:00
Florian Bruhin
f4f329714d Reformat dicts 2016-05-07 22:38:37 +02:00
Florian Bruhin
1a03388fb5 Fix docstrings 2016-05-07 22:28:06 +02:00
Florian Bruhin
eb5bfc1659 Use lists instead of tuples 2016-05-07 22:12:28 +02:00
Florian Bruhin
ccd0d1621c Regenerate authors 2016-05-07 22:10:19 +02:00
Florian Bruhin
bc8d19f003 Fix typo 2016-05-07 22:09:43 +02:00
Florian Bruhin
2ae8ecff71 Use qapp fixture in all adblock tests 2016-05-07 22:08:55 +02:00
Florian Bruhin
7db6f52fa1 Merge branch 'test_adblock' of https://github.com/jcorentin/qutebrowser into jcorentin-test_adblock 2016-05-07 22:06:43 +02:00
Florian Bruhin
6042aa48ca Merge branch 'haitaka-feature-#1349' 2016-05-07 21:59:38 +02:00
Florian Bruhin
a5cea14a0f Update docs 2016-05-07 21:39:19 +02:00
Florian Bruhin
f90776f75c Add documentation for default_window_icon 2016-05-07 21:37:01 +02:00
Florian Bruhin
2ea76c282e Merge branch 'feature-#1349' of https://github.com/haitaka/qutebrowser into haitaka-feature-#1349 2016-05-07 21:32:05 +02:00
Florian Bruhin
d3d765fb97 tox: Update pyflakes to 1.2.2
- Avoid traceback when exception is del-ed in except
2016-05-06 19:02:59 +02:00
Florian Bruhin
612ef09f97 Merge branch 'Kingdread-download-ssl-crash' 2016-05-06 18:23:24 +02:00
Florian Bruhin
e81c13cf35 Update changelog 2016-05-06 18:23:16 +02:00
Florian Bruhin
be7dd6e045 Merge branch 'download-ssl-crash' of https://github.com/Kingdread/qutebrowser into Kingdread-download-ssl-crash 2016-05-06 18:18:06 +02:00
Daniel Schadt
2918c5cd57 downloads: close fileobject in DownloadItem._die
Otherwise we will get a unclosed resource warning.
2016-05-06 18:01:45 +02:00
Florian Bruhin
16f071c778 tox: Update pyflakes to 1.2.1
1.2.1 (2015-05-05):
  - Fix false RedefinedWhileUnused for submodule imports

1.2.0 (2016-05-03):
  - Warn against reusing exception names after the except: block on Python 3
  - Improve the error messages for imports
2016-05-06 16:24:58 +02:00
Daniel Schadt
dcac832f5e netmanager: fix crash when asking with no tab_id
Issue 1413

This happens when the networkmanager is used by something that has no
tab_id, like the generic DownloadManager. In this case, we should just
skip the webview connection (as it makes no sense) instead of crashing
(which is the last thing we want to do).
2016-05-05 00:34:16 +02:00
Florian Bruhin
d2be8a28ca Also ignore segfaults in paintEvent 2016-05-04 23:06:26 +02:00
Florian Bruhin
2d0604ec08 Remove unused imports 2016-05-04 22:15:47 +02:00
Florian Bruhin
034f8585a6 Disable segfault reports for Qt mainloop crashes 2016-05-04 21:50:44 +02:00
Fritz Reichwald
fb88a7b1ef Change the link description to release page 2016-05-04 21:03:19 +02:00
Florian Bruhin
3f66ea1a10 Stabilize buffer test, attempt 2
"Current tab changed" actually waited for an unrelated earlier event.
2016-05-04 20:56:54 +02:00
Florian Bruhin
7a82c13b27 bdd: Also log already found log messages 2016-05-04 20:54:34 +02:00
Florian Bruhin
0ff5c56d05 Merge branch 'error800-patch-1' 2016-05-04 07:09:43 +02:00
Florian Bruhin
e880497d17 Regenerate authors 2016-05-04 07:09:37 +02:00
Florian Bruhin
0d68ae259d Merge branch 'patch-1' of https://github.com/error800/qutebrowser into error800-patch-1 2016-05-04 07:09:25 +02:00
Florian Bruhin
8912012c7d Merge branch 'rcorre-color_regex' 2016-05-04 07:07:47 +02:00
Florian Bruhin
0efd87af12 Clean up formatting of num 2016-05-04 07:07:24 +02:00
Florian Bruhin
46189977ae Merge branch 'color_regex' of https://github.com/rcorre/qutebrowser into rcorre-color_regex 2016-05-04 07:04:40 +02:00
Florian Bruhin
4a1a87a4db I don't know how to magit 2016-05-04 07:03:46 +02:00
Florian Bruhin
9c09c266a6 tox: Exclude pyflakes 1.2.0 for requirements.io 2016-05-04 07:02:33 +02:00
Ryan Roden-Corrent
b8a593cac5 Show command completions for :bind.
All commands will be offered as completions for the <command> argument
of :bind.

Due to the way completers parse the command line, the following

bind --mode caret j

will throw off completions as 'caret' is treated as a positional arg in
terms of the argument count for completions.
In the above example, completion will be triggered for 'j' and no
completions will be given for the actual command.

bind --mode=caret j will complete correctly, though completions are not
filtered by the given mode.
I attempted an approach to filter the commands based on the mode but it
ended up being messy and flaky.
2016-05-03 23:29:34 -04:00
Ryan Roden-Corrent
2536766cac Run :bind <key> to print the current binding.
The <command> arg is now optional. If omitted, :bind prints the current
binding as a message. If --mode is given, the binding for that mode is
printed.
2016-05-03 23:29:34 -04:00
Ryan Roden-Corrent
98508bdd26 Allow flexible whitespace in color strings.
Allow a variable amount of whitespace for rgb, rgba, hsv, and hsva
strings in the config.
Previously only 'rgb(0, 0, 0)' was allowed. Now things like
'rgb(0,0,0)' are permitted.
The repeated 3-digit segments of the regexes were separated out to
reduce repetition and line length.
2016-05-03 23:15:39 -04:00
Fritz Reichwald
8c0d2f4dcc Add xpm version of the 32x32 png logo 2016-05-03 22:22:58 +02:00
Error 800
68a24b2aa4 Update 9. How do I play Youtube videos with mpv?
Add description of umpv script.
2016-05-03 11:12:20 +02:00
Florian Bruhin
d03659b3da Regenerate docs 2016-05-03 06:51:24 +02:00
Florian Bruhin
a6cd91c386 Turn off WebGL by default
This was mainly turned on because that's Qt's upstream default, but
there's no reason for it to be turned on.
2016-05-03 06:33:08 +02:00
Fritz Reichwald
e56c928703 use asciidoc instead of markdown 2016-05-02 21:38:35 +02:00
Fritz Reichwald
d994694739 Add manual .deb installation instructions 2016-05-02 20:50:03 +02:00
Florian Bruhin
e6ab681a08 Add codecov.yml to MANIFEST.in 2016-05-02 07:14:08 +02:00
Florian Bruhin
35bfcdba8a Add a codecov.yml
This hopefully turns off commit status and comments
2016-05-02 06:52:16 +02:00
Florian Bruhin
e5630e9518 Fix lint 2016-05-01 23:03:27 +02:00
Florian Bruhin
8fb1d568ee tests: Actually log the colored log 2016-05-01 23:01:22 +02:00
Florian Bruhin
3eeacd7e09 Fix userscripts on Windows
If the process emitted error() and then finished(), we already set
self._filepath to None and did other cleanup.

Instead we do the file reading inside _cleanup and call that from
on_process_error and on_process_finished.
2016-05-01 22:47:03 +02:00
Florian Bruhin
43908dba20 Use colored logging for end-to-end tests 2016-05-01 22:45:21 +02:00
Florian Bruhin
0b24916fc7 Add missing attribute 2016-05-01 22:34:04 +02:00
Florian Bruhin
c76746ca32 Refine Logjam cipher blacklisting
- The OS check was wrong
- EDH ciphers are (hopefully) not affected and break e.g. gnupg.org
2016-05-01 22:19:11 +02:00
Florian Bruhin
4e333d61cd Clean up failed userscripts correctly 2016-05-01 22:13:52 +02:00
Florian Bruhin
e3f1949f57 bdd: Fix parsing of logged python warnings 2016-05-01 22:13:31 +02:00
Florian Bruhin
dc1b0920ab tox: Update hypothesis to 3.1.3
- Another charmap problem. In 3.1.2 text/characters would break on
  systems which had /tmp/ mounted on a different partition than the
  Hypothesis storage directory (usually in home). This fixes that.
2016-05-01 17:49:44 +02:00
Florian Bruhin
2875596a1e tox: Update flake8-docstrings to 0.2.6
- Respect pep257’s default ignore list
- Handle AllError and other exceptions from pep257
2016-05-01 17:48:58 +02:00
Florian Bruhin
73d5d24cb4 Fix lint 2016-05-01 17:48:35 +02:00
Florian Bruhin
6bd2591681 Disable all Diffie-Hellman ciphers on Windows 2016-05-01 17:42:20 +02:00
Florian Bruhin
0124354b91 Disable more bad SSL ciphers with old Qt/OpenSSL
See #594
2016-05-01 17:31:00 +02:00
Florian Bruhin
7b575460d5 Fix URL for :quickmark-save test
We never noticed this because CherryPy handled this incorrectly in
versions < 5.3.0
2016-04-30 19:08:36 +02:00
Florian Bruhin
2b890901ae Unskip :stop test on OS X
CherryPy now ignores EPROTOTYPE on OS X with 5.3.0, so we can safely
reenable the test.
2016-04-30 18:43:31 +02:00
Florian Bruhin
c718254e0c tox: Update CherryPy to 5.3.0
* Add support for specifying a certificate authority when serving SSL
  using the built-in SSL support.
* Use ssl.create_default_context when available.
* Catch platform-specific socket errors on OS X.
* Fix parsing of URIs containing ``://`` in the path part.
2016-04-30 18:42:50 +02:00
Florian Bruhin
7a3c0b959d Fix release checklist 2016-04-30 18:40:27 +02:00
Florian Bruhin
b7225924e3 Fix lint 2016-04-30 18:39:26 +02:00
Florian Bruhin
48c7eee6f6 Release v0.6.2 2016-04-30 18:16:43 +02:00
Florian Bruhin
379c6561e5 tox: Update requests everywhere 2016-04-30 17:51:04 +02:00
Florian Bruhin
fe9a27a607 tox: Update hypothesis to 3.1.2
Anything which used a text() or characters() strategy was broken on
Windows and I hadn't updated appveyor to use the new repository location
so I didn't notice. This is now fixed and windows support should work
correctly.
2016-04-30 17:49:38 +02:00
Florian Bruhin
ccdd832cbc tox: Update CherryPy to 5.2.0 2016-04-30 17:49:28 +02:00
Florian Bruhin
43d898aa63 Fix log tests 2016-04-30 17:45:45 +02:00
Florian Bruhin
528e303d6e Add a --force-color argument for logging 2016-04-30 17:01:45 +02:00
Florian Bruhin
48d7185c94 log: Don't use colorama on POSIX 2016-04-30 16:59:59 +02:00
Florian Bruhin
365a6ec3ad Update changelog for v0.6.2 2016-04-30 14:47:05 +02:00
Florian Bruhin
f613835873 tox: Update requests to 2.10.0
- SOCKS proxy support
- Updated bundled urllib3 to 1.15.1.
2016-04-30 14:32:43 +02:00
Florian Bruhin
89caf3f497 Add a test for #1464 2016-04-30 14:29:55 +02:00
Florian Bruhin
1ea516f0b5 Update changelog 2016-04-30 14:11:08 +02:00
Florian Bruhin
e9da3ef8bb Merge branch 'NoctuaNivalis-issue-1393' 2016-04-30 14:10:37 +02:00
Florian Bruhin
580f3ed7dc Remove added blank line 2016-04-30 14:09:14 +02:00
Florian Bruhin
e04bf2b74b Regenerate authors 2016-04-30 14:08:51 +02:00
Florian Bruhin
b5aad7d1b9 Merge branch 'issue-1393' of https://github.com/NoctuaNivalis/qutebrowser into NoctuaNivalis-issue-1393 2016-04-30 14:06:54 +02:00
Florian Bruhin
e06a32ff42 Revert "travis: Switch to autobuilt Docker images"
This reverts commit b2e52408f7.
Turns out only [testing] is on PyQt 5.6, and even with that the testsuite
doesn't seem to load properly...
2016-04-29 23:21:41 +02:00
Florian Bruhin
b2e52408f7 travis: Switch to autobuilt Docker images
Since Archlinux switched to PyQt 5.6, we can now use the autobuilt image
without a handbuilt PyQt. This means we have an up-to-date image with
each build again.
2016-04-29 22:54:00 +02:00
Florian Bruhin
294e0799c2 tox: Update hypothesis to 3.1.1
- Fix concurrency issue when running tests that use text() from multiple
  processes at once
- Improve performance of code using lists with max_size
- Fix install on Python 2 with ancient versions of pip so that it
  installs the enum34 backport
- Remove duplicated __all__ exports from hypothesis.strategies
- Update headers to point to new repository location.
- Allow use of strategies that can’t be used in find() (e.g. choices) in
  stateful testing.
2016-04-29 22:25:50 +02:00
Florian Bruhin
4807746e8f Add @pyqtSlot for qApp.focusChanged slot 2016-04-29 22:25:27 +02:00
Felix Van der Jeugt
86d08f741c shorten page and wait for load finished 2016-04-29 21:56:24 +02:00
Florian Bruhin
2d5ffbfd02 Revert "Handle counts for special keys."
This reverts commit c881730fad.

This is just a temporary solution until we can properly fix this.

See #1464
2016-04-29 14:20:11 +02:00
Florian Bruhin
60f8681b41 Improve name of unused variable 2016-04-28 22:28:12 +02:00
Florian Bruhin
868f7c6ea5 Merge branch 'rcorre-special_key_count' 2016-04-28 22:25:46 +02:00
Florian Bruhin
e374599988 Update changelog 2016-04-28 22:25:39 +02:00
Florian Bruhin
8b227f4ba4 Merge branch 'special_key_count' of https://github.com/rcorre/qutebrowser into rcorre-special_key_count 2016-04-28 22:22:23 +02:00
adam
5eea9d0605 Cleanup for flake8/pylint 2016-04-28 09:20:16 -04:00
Florian Bruhin
c39800675e Merge branch 'toofar-buffer_completion_delete_item-1443' 2016-04-28 07:09:38 +02:00
Florian Bruhin
2f10ab4e9a Clean up coding style 2016-04-28 07:07:49 +02:00
Florian Bruhin
c228bb263b Update docs 2016-04-28 07:05:55 +02:00
Florian Bruhin
15a145cf92 Merge branch 'buffer_completion_delete_item-1443' of https://github.com/toofar/qutebrowser into toofar-buffer_completion_delete_item-1443
Merge conflict in qutebrowser/completion/models/miscmodels.py due to a simple
style fix in the old code.
2016-04-28 07:03:27 +02:00
adam
8fd371d836 Proposed addition for issue #1386 2016-04-27 16:47:36 -04:00
Florian Bruhin
0a76a7584d Update changelog 2016-04-27 21:21:30 +02:00
Florian Bruhin
4384e6f81c Merge branch 'Kingdread-issue-1412' 2016-04-27 21:19:24 +02:00
Florian Bruhin
076b486368 Merge branch 'issue-1412' of https://github.com/Kingdread/qutebrowser into Kingdread-issue-1412 2016-04-27 21:19:04 +02:00
Florian Bruhin
ebfcce172b Stabilize :buffer tests 2016-04-27 21:08:16 +02:00
Florian Bruhin
24cde47881 Merge branch 'marks_invalid_url' of https://github.com/rcorre/qutebrowser into rcorre-marks_invalid_url 2016-04-27 21:00:21 +02:00
Florian Bruhin
2a343cb3a1 Various code style improvements 2016-04-27 20:25:27 +02:00
Ryan Roden-Corrent
88f66874a1 Don't crash when setting mark on invalid url. 2016-04-27 08:10:53 -04:00
Daniel Schadt
e8aa242d10 tests: fix invocation test for --cachedir
--cachedir="" doesn't work because the quotes are not processed (as they
would be by the shell) and the cachedir is set to ./"" (that is a
directory with two double quotes as name). The correct start parameter
is thus --cachedir=, which correctly fails when the fix is reverted.
2016-04-27 13:02:18 +02:00
Daniel Schadt
951cab237f tests: factor out common code in test_invocations 2016-04-27 00:04:03 +02:00
Daniel Schadt
758fb94414 tests: add test for DiskCache with cache_dir=None 2016-04-27 00:04:02 +02:00
Daniel Schadt
c0b372591a tests: add tests for --cachedir="" 2016-04-26 23:26:35 +02:00
Daniel Schadt
dcad81a78f cache: fix crash when cache_dir is None
Issue #1412

When passing --cachedir="" on the command line, standarddir.cache()
returns None, which stands for "deactivate cache" and has to be
properly handled in DiskCache.__init__() (i.e. don't pass it to
os.path.join)
2016-04-26 23:14:55 +02:00
Florian Bruhin
fd20b46b33 Split IPCServer.on_ready_read into two methods 2016-04-26 23:14:03 +02:00
Florian Bruhin
7c3361d8da Stabilize :download-delete test 2016-04-26 22:56:06 +02:00
Felix Van der Jeugt
b7ba3cd53e fix flake and pep remarks 2016-04-26 22:52:29 +02:00
Felix Van der Jeugt
2d71c541c6 allow swapping dict at runtime 2016-04-26 22:52:29 +02:00
Felix Van der Jeugt
fdb630555d make robust against short dicts 2016-04-26 22:52:29 +02:00
Felix Van der Jeugt
ae72841856 read the wait_for code 2016-04-26 22:52:29 +02:00
Felix Van der Jeugt
9633e79d87 why don't I even know my own options 2016-04-26 22:52:29 +02:00
Felix Van der Jeugt
7d9d4937aa initial testing - local tox does not work yet 2016-04-26 22:52:29 +02:00
Felix Van der Jeugt
fe4800b68f prevent words from the dictionary prefixing smart hints 2016-04-26 22:52:29 +02:00
Florian Bruhin
3c8598f691 Work around PyQt 5.6 segfault when using IPC
PyQt 5.6 seems to segfault when emitting None with a signal which is
declared as emitting a string:

https://www.riverbankcomputing.com/pipermail/pyqt/2016-April/037375.html

We now avoid this by using an empty string explicitly instead of None.
2016-04-26 22:30:27 +02:00
Florian Bruhin
48b069e89c Remove @pyqtSlot for on_new_window
This worked fine with Python 3.5 but causes a circular import which is
hard to break with Python 3.4.

The original solution was to do @pyqtSlot(object), but that doesn't work
with PyQt 5.6 anymore...
2016-04-26 22:16:04 +02:00
Florian Bruhin
59c4cdd1c2 Revert "Break up circular import on Python 3.4"
This reverts commit e5be48fcc0.
There are other circular imports as well.
2016-04-26 22:14:59 +02:00
Florian Bruhin
e5be48fcc0 Break up circular import on Python 3.4 2016-04-26 21:44:30 +02:00
Florian Bruhin
37b5f49c85 Fix types in @pyqtSlot decorations
PyQt 5.5 enforces correct type signatures, and there were a lot of
places where we were simply wrong, causing qutebrowser to not start at
all...
2016-04-26 20:34:38 +02:00
Florian Bruhin
da24e43fa5 Remove crowdfunding notes 2016-04-25 22:32:29 +02:00
Florian Bruhin
2604f0841a Update changelog 2016-04-25 19:20:37 +02:00
Florian Bruhin
3b23bfbeea Merge branch 'rcorre-undo_crash' 2016-04-25 19:19:48 +02:00
Florian Bruhin
0e27f1a597 Regenerate authors 2016-04-25 19:19:40 +02:00
Florian Bruhin
32d64b1a9a Merge branch 'undo_crash' of https://github.com/rcorre/qutebrowser into rcorre-undo_crash 2016-04-25 19:19:08 +02:00
Florian Bruhin
dd2a7110e7 Merge branch 'kanikaa1234-develop' 2016-04-25 19:06:04 +02:00
Florian Bruhin
3fa5c8885e Regenerate authors 2016-04-25 19:05:55 +02:00
Florian Bruhin
341dae0b3f Simplify deleting fragment 2016-04-25 19:05:20 +02:00
Florian Bruhin
d6c72c5821 Merge branch 'develop' of https://github.com/kanikaa1234/qutebrowser into kanikaa1234-develop 2016-04-25 19:03:20 +02:00
Florian Bruhin
6349c00c72 Fix crash with :tab-{prev,next,focus} with 0 tabs
When using :tab-prev/:tab-next (or :tab-focus which uses :tab-next
internally) immediately after the last tab, those functions could be
called with 0 tabs open, which caused a ZeroDivisionError when trying to
do % 0.

Fixes #1448.
2016-04-25 18:55:15 +02:00
Florian Bruhin
a5679dff04 tox: Update werkzeug to 0.11.9
- Corrected an issue that caused the debugger not to use the
  machine GUID on POSIX systems.
- Corrected an Unicode error on Python 3 for the debugger's
  PIN usage.
- Corrected the timestamp verification in the pin debug code.
  Without this fix the pin was remebered until too long.
2016-04-25 06:12:12 +02:00
kanikaa1234
22ad416f35 Addressing test 2016-04-24 19:33:31 +05:30
Jimmy
32edd35c7a buffer completion: handle deleting items see issue #1443
Allows to use ctrl+d to close tabs from the buffer completion widget
when they are selected. Respects current tab settings like whether you
can close the last tab in a window.

Had to change the `rebuild()` method to use `setData()` when possible
because the selection was being lost if the whole model was being rebuilt.

Current problems are:

1) When opening a new window while you already the tab completion open on
   one window a category is added for the new window but new rows in
   that category aren't picked up. Interesting if you open a third
   window then close the second window the completion display is now
   correct... I can see that the model is being updated correctly but I
   am not sure why that isn't propagating to the view. Not sure whether
   it is worth looking into (further) either.

2) Bit of duplication of code, it iterates over the window registry
   twice. Could put everything in one loop but then that would be
   dependant on the current behaviour of the `tab_closed` signal being
   called with the relevant `tabbed_browser` still existing but with the
   `shutting_down` flag set.

3) I'm still using just the one `rebuild()` method and removing items from
   the end then calling `setData` on everything rather than having special
   `on_tab/window_closed` methods (or partial functions) that delete the
   actual corresponding item. Because if I did that I would also have to
   special case tab moves etc.
2016-04-23 02:55:53 +12:00
Florian Bruhin
77a9bbb4b4 Fix accidental double-import 2016-04-21 23:12:54 +02:00
Florian Bruhin
39e8ac5159 Merge branch 'rcorre-marks' 2016-04-21 22:55:44 +02:00
Florian Bruhin
0955ed49a7 Update docs 2016-04-21 22:55:36 +02:00
Florian Bruhin
5b34f1b429 Fix ModeManager.leave docstring 2016-04-21 20:12:02 +02:00
Florian Bruhin
e0aa35b05a Fix type in @pyqtSlot for ModeManager.leave
For some reason it worked with str as well, but the signal emits a
KeyMode member.
2016-04-21 20:10:58 +02:00
Florian Bruhin
ef91fa3821 Merge branch 'marks' of https://github.com/rcorre/qutebrowser into rcorre-marks 2016-04-21 20:05:41 +02:00
Florian Bruhin
46a525d0d7 bdd: Improve test IDs for :buffer tests 2016-04-21 19:47:26 +02:00
Florian Bruhin
10fe9cf32d Stabilize test_buffer_two_window_index_present
Fixes #1440
I'm not sure if this was the case, but probably it was.
2016-04-21 19:34:39 +02:00
Ryan Roden-Corrent
399cddf7ac Actually test double-undo. 2016-04-21 08:04:20 -04:00
Ryan Roden-Corrent
ccd04ca548 Don't crash when undoing twice on default page.
Avoid a crash when undoing twice on the default page with last-close set to
default-page.
This was caused by logic to reuse the current tab if it is on the default page
and has no history. The fix is using openurl rather than removeTab/tabopen.
2016-04-21 08:04:20 -04:00
Ryan Roden-Corrent
600b5082a9 Touch up tests and add pyqtSlot for marks.
Small code review changes.
2016-04-20 21:53:12 -04:00
Florian Bruhin
a55952375b bdd: Improve output when comparing sessions
See #1440.
2016-04-21 00:15:37 +02:00
Florian Bruhin
e53c136342 tests: Refactor partial_compare
Functions now return a PartialCompareOutcome to attach an error message instead
of a bool, and the main function got rewritten based on a handler dict.
2016-04-21 00:14:13 +02:00
Florian Bruhin
cd128bec8e bdd: __tracbackhide__ in QuteProcess._wait_for_*
This should improve the output we got here:
https://ci.appveyor.com/project/The-Compiler/qutebrowser/build/master-2404/job/gr7m54km6h6nul04
2016-04-20 22:39:52 +02:00
Florian Bruhin
eeb830e040 travis: Ignore doc changes when building a PR
Fixes #1441
2016-04-20 22:35:02 +02:00
Florian Bruhin
391900cc99 Merge branch 'forkbong-pretty_url' 2016-04-20 22:17:35 +02:00
Florian Bruhin
9ae826295b Update docs 2016-04-20 22:17:27 +02:00
Florian Bruhin
e18b056877 Merge branch 'pretty_url' of https://github.com/forkbong/qutebrowser into forkbong-pretty_url 2016-04-20 22:15:54 +02:00
Florian Bruhin
0277c47ffa Merge branch 'forkbong-pretty_url_2' 2016-04-20 20:59:35 +02:00
Florian Bruhin
c27d4f4407 Update docs 2016-04-20 20:59:27 +02:00
Florian Bruhin
6a6285495a Merge branch 'pretty_url_2' of https://github.com/forkbong/qutebrowser into forkbong-pretty_url_2 2016-04-20 20:56:24 +02:00
Florian Bruhin
3237e36db5 tox: Update hacking to 0.11.0 2016-04-20 20:16:50 +02:00
Panagiotis Ktistakis
1ef2f042cf Mention {url:pretty} in the docs 2016-04-20 19:39:18 +03:00
Florian Bruhin
664a542ff6 requirements: Update colorlog to 2.6.3 2016-04-20 17:51:16 +02:00
Florian Bruhin
a6f496dc2a Merge branch 'blyxxyz-master' 2016-04-20 17:49:31 +02:00
Florian Bruhin
41c7f37618 Regenerate authors 2016-04-20 17:48:51 +02:00
Florian Bruhin
6c6b8e10a6 Merge branch 'master' of https://github.com/blyxxyz/qutebrowser into blyxxyz-master 2016-04-20 17:48:41 +02:00
Panagiotis Ktistakis
8550fb3401 Add tests for {url:pretty} variable 2016-04-20 17:58:14 +03:00
Panagiotis Ktistakis
6c3b0219e7 Style fix 2016-04-20 17:25:26 +03:00
Philipp Hansch
dfc1e5703a Cleanup unused files 2016-04-20 16:23:18 +02:00
Philipp Hansch
376c5c458e Convert insert mode tests to non-bdd tests 2016-04-20 16:19:47 +02:00
Philipp Hansch
ff13921aad Add tests for auto-[leave-]insert-mode 2016-04-20 12:50:33 +02:00
Philipp Hansch
601687ba61 Add insert mode feature tests
Issue-Link: #999
2016-04-20 11:04:53 +02:00
Florian Bruhin
22582773b1 Fix lint 2016-04-20 09:00:01 +02:00
Florian Bruhin
bc815505f1 bdd: Output fewer = chars for summary headers
Otherwise we have line breaks on Travis CI
2016-04-20 07:55:59 +02:00
Florian Bruhin
4520261884 bdd: Make TestProcess.log_summary public
We want to use it from the BDD conftest.py
2016-04-20 07:55:23 +02:00
Florian Bruhin
6cf4cebfd4 bdd: Show messages we're waiting for in the log 2016-04-20 07:49:08 +02:00
Florian Bruhin
a99cb5f6b2 bdd: Improve wait_for_load_finished output 2016-04-20 07:38:32 +02:00
Florian Bruhin
5e91ad6c42 bdd: Shorten InvalidLine exception output 2016-04-20 07:38:32 +02:00
Florian Bruhin
266bc6e8d8 bdd: Don't shorten log if an exception happened 2016-04-20 07:38:32 +02:00
Florian Bruhin
1579f27564 bdd: Add sections to log
See #1418
2016-04-20 07:38:12 +02:00
Ryan Roden-Corrent
c881730fad Handle counts for special keys.
Now 3<ctrl-o> will execute whatever <ctrl-o> is mapped to with count=3.
2016-04-19 23:39:02 -04:00
Ryan Roden-Corrent
0755e163bb Only set the ' mark on normal/current hinting.
Don't set ' for downloading, hovering, or opening a link in a tab.
2016-04-19 21:18:20 -04:00
Ryan Roden-Corrent
268d490e25 Return False when MarkKeyParser gets special key. 2016-04-19 17:30:57 -04:00
Jan Verbeek
3788eeb10b Add a few common generic browser keybindings 2016-04-19 22:24:24 +02:00
kanikaa1234
fae005ab7f :navigate: command and test feature 2016-04-19 20:30:20 +05:30
Panagiotis Ktistakis
c7534bd4a3 Allow {url:pretty} variable in commands 2016-04-19 16:37:05 +03:00
Ryan Roden-Corrent
6466ff919a Don't limit marks to alpha characters. 2016-04-19 08:28:11 -04:00
Ryan Roden-Corrent
ae267c466f Small fixes for marks.
Mark two callbacks with pyqtSlot as appropriate.
Return False instead of raising NotImplementedException to avoid pylint
identifying MarkKeyParser as abstract.
2016-04-19 08:28:02 -04:00
Florian Bruhin
5c97ec1659 Fix HeaderDict lint 2016-04-19 09:50:53 +02:00
Florian Bruhin
6aaea2aa31 Fix HeaderDict with an empty value 2016-04-19 09:43:54 +02:00
Florian Bruhin
4ea6bd40e4 Update docs 2016-04-19 09:40:39 +02:00
Florian Bruhin
e860d8cfea Add a custom-headers setting
Supersedes #1132
Closes #1020.
2016-04-19 06:35:32 +02:00
Florian Bruhin
c5999443a1 Implement a HeaderDict config type
Supersedes #1132.
Fixes #1022.
2016-04-19 06:35:20 +02:00
Ryan Roden-Corrent
c7ee7a9702 Update docs for jump-mark and set-mark 2016-04-18 18:15:11 -04:00
Panagiotis Ktistakis
045b54b94b Add commands to yank pretty decoded URLs
yp and yP, yank to the clipboard and primary selection respectively
2016-04-18 23:11:27 +03:00
Panagiotis Ktistakis
bd6783c7e6 Add --pretty flag to :yank
With --pretty, the URL is yanked in a "pretty form", with most
percent-encoded characters decoded. Partially fixes #1372.
2016-04-18 23:10:53 +03:00
Ryan Roden-Corrent
2b68aaa311 Make set_mark searching tests less flaky.
Replace all the html numbers with a few widely spaced divs to guarantee the
search will move the viewport on almost and reasonable screen size.
2016-04-18 12:30:16 -04:00
Ryan Roden-Corrent
a924144d9a Set ' mark after searching.
Allow jumping back to the previous position after a search jumps you around.
2016-04-17 21:04:08 -04:00
Ryan Roden-Corrent
4b00a17d71 Fix MarkKeyParser crash when changing keyconfig.
Ensure MarkKeyParser implements on_keyconfig_changed, so it doesn't fail when
rebinding a key. It doesn't have keybindings, so the implementation is just
`pass`.

This also fixes a few flake8 style errors.
2016-04-17 21:04:08 -04:00
Ryan Roden-Corrent
be6308534f Store both x and y position for marks.
Previously only stored/used y.
2016-04-17 21:04:08 -04:00
Ryan Roden-Corrent
f4b9573744 Remove cyclic dependency from MarkKeyParser.
Rather than calling modeman.leave directly, modeman hooks into a request_leave
signal that is fired when MarkKeyParser wants to exit mark mode.
2016-04-17 21:04:08 -04:00
Ryan Roden-Corrent
49b2f6e967 Move jump_mark logic to TabbedBrowser.
This simplifies the MarkKeyParser by removing its dependency on the
commandrunner. It also removes the need for a new exception type.
2016-04-17 21:04:08 -04:00
Ryan Roden-Corrent
e684cfa03f Trivial fixes for marks based on code review.
- Fix a docstring copy-paste
- Add own name/copyright date to new file
- Simplify a bdd expression (no need for regex)
- Scroll to a pixel position in a single operation
2016-04-17 21:04:08 -04:00
Ryan Roden-Corrent
540f4af225 Set the ' mark after following a link.
This moves mark storage from CommandDispatcher to TabbedBrowser, so it can also
be accessed by the HintManager.
2016-04-17 21:04:08 -04:00
Ryan Roden-Corrent
dc246772e7 Add integration tests for set-mark and jump-mark. 2016-04-17 21:04:08 -04:00
Ryan Roden-Corrent
c7b830d69d Fix up mistakes caught by pylint. 2016-04-17 21:04:08 -04:00
Ryan Roden-Corrent
84eb30bc9a Marks are local to urls, not tabs.
Rather than binding each set of local marks to a tab, bind them to a
url. Strip the fragment from the url, as two pages that differ only in
fragment are likely the same page.
2016-04-17 21:04:08 -04:00
Ryan Roden-Corrent
4037719a78 Add default bindings for set-mark and jump-mark.
Bind set-mark to ` and jump-mark to '.
2016-04-17 21:04:08 -04:00
Ryan Roden-Corrent
7bfea773db Add set_mark and jump_mark modes.
These modes use a custom handler to pass whatever the next keypress is
to either set_mark or jump_mark.
2016-04-17 21:04:08 -04:00
Ryan Roden-Corrent
9062f5925e Set the ' mark on a jump.
Automatically set the special "'" mark when jumping.
jump-mark "'" will jump to the last position before the previous jump.
A jump could be navigating via a link, jumping to another mark, or
scrolling by percentage (e.g. gg or G).
2016-04-17 21:04:08 -04:00
Ryan Roden-Corrent
ddcae14ba4 Implement set-mark and jump-mark.
set-mark <key> saves your current scroll position as mark <key>.
jump-mark <key> jumps to the position previously set for mark <key>.

If <key> is lowercase, it is local to the current tab. Each tab has its
own set of lowercase marks.

If <key> is uppercase, it is global across tabs, and stores a url and a
scroll position. Jumping to an uppercase mark navigates to that url,
then scrolls to the saved position.

Resolves #310.
2016-04-17 21:04:08 -04:00
Ryan Roden-Corrent
f5bb75a186 Fix docstring in scroll_px. 2016-04-17 21:04:08 -04:00
Jakub Klinkovský
0eab422540 tests: replace paths to data/hints/link.html
an adjustment due to 35ed70cfe0
2016-04-15 23:19:08 +02:00
Jakub Klinkovský
3265601eab Merge remote-tracking branch 'upstream/master' into hints_clicking
* upstream/master: (327 commits)
  Remove unused import
  tox: Update Werkzeug to 0.11.8
  Regenerate authors
  Use __file__ instead of sys.argv[0]
  Regenerate authors
  Make update_3rdparty.py install correctly when run from any directory
  Open command line urls explicitly.
  tox: Update Werkzeug to 0.11.6
  Move qutebrowser.rcc to misc/
  Regenerate resources
  Fix CHANGELOG/link in README
  New qutebrowser logo!
  www: Add releases link
  Release v0.6.1
  release checklist: Clarify how to build on Windows
  Make sure the cheatsheet PNG is included in sdist
  Fix cheatsheet link URL in quickstart
  Mark segfault on exit in test_smoke as xfail
  Add a xfail test for #797
  Add missing file
  ...

Conflicts:
	tests/integration/features/hints.feature
2016-04-15 22:37:47 +02:00
Florian Bruhin
d33fae455d Remove unused import 2016-04-15 19:31:54 +02:00
Florian Bruhin
210374a73d tox: Update Werkzeug to 0.11.8
- fixed a regression on Python 3 for the debugger.
- fixed a problem with the machine GUID detection code on OS X
  on Python 3.
2016-04-15 19:27:28 +02:00
Florian Bruhin
72e0b80ed0 Merge branch 'blyxxyz-master' 2016-04-15 19:12:23 +02:00
Florian Bruhin
98bc1c9f85 Regenerate authors 2016-04-15 19:12:16 +02:00
Florian Bruhin
1f66d74f01 Use __file__ instead of sys.argv[0] 2016-04-15 19:12:10 +02:00
Florian Bruhin
38110146ab Merge branch 'master' of https://github.com/blyxxyz/qutebrowser into blyxxyz-master 2016-04-15 19:10:29 +02:00
Florian Bruhin
800cbb644b Merge branch 'Xitian9-cmdline_explicit' 2016-04-15 19:08:13 +02:00
Florian Bruhin
13a0b0eb75 Regenerate authors 2016-04-15 19:08:06 +02:00
Jan Verbeek
7f9a7a282f Make update_3rdparty.py install correctly when run from any directory 2016-04-15 11:23:52 +02:00
Xitian9
c76d4479ee Open command line urls explicitly. 2016-04-15 18:50:42 +10:00
Alexey Glushko
2645334425 Indent fixing 2016-04-14 17:20:34 +00:00
Florian Bruhin
4368daf0d8 tox: Update Werkzeug to 0.11.6
- werkzeug.serving: Still show the client address on bad requests.
- improved the PIN based protection for the debugger to make it harder to
  brute force via trying cookies.  Please keep in mind that the debugger
  *is not intended for running on production environments*
- increased the pin timeout to a week to make it less annoying for people
  which should decrease the change that users disable the pin check
  entirely.
- werkzeug.serving: Fix broken HTTP_HOST when path starts with double slash.
2016-04-14 18:00:06 +02:00
Florian Bruhin
cd5591040e Move qutebrowser.rcc to misc/ 2016-04-14 17:59:45 +02:00
Florian Bruhin
8dec54f7d9 Regenerate resources 2016-04-14 17:59:28 +02:00
Florian Bruhin
4f84911474 Fix CHANGELOG/link in README 2016-04-14 17:50:03 +02:00
Florian Bruhin
d3e7be1eb0 New qutebrowser logo!
Thanks to http://www.yelostudio.com
2016-04-14 17:44:38 +02:00
haitaka
d61ee2681f set back to the qutebrowser logo in on_load_started 2016-04-14 20:26:00 +06:00
Florian Bruhin
cd575e0587 www: Add releases link 2016-04-13 22:30:03 +02:00
haitaka
de93e6c7ee remove trailing whitespace 2016-04-13 19:15:01 +06:00
haitaka
b10c1b063d Site favicon as window icon when 'tabs-are-windows' is enabled 2016-04-13 19:08:50 +06:00
Florian Bruhin
c690e652dc Release v0.6.1 2016-04-10 21:25:32 +02:00
Florian Bruhin
35c413c9c5 release checklist: Clarify how to build on Windows 2016-04-10 21:21:40 +02:00
Florian Bruhin
230186f229 Make sure the cheatsheet PNG is included in sdist
Fixes #1403
2016-04-10 20:59:29 +02:00
Florian Bruhin
14119b99e3 Fix cheatsheet link URL in quickstart 2016-04-10 20:59:07 +02:00
Florian Bruhin
0776aaf32c Mark segfault on exit in test_smoke as xfail
See #1387.
I know this is... less than optimal, but I can't do anything :-/
2016-04-10 20:52:07 +02:00
Florian Bruhin
6e7aefca00 Add a xfail test for #797 2016-04-10 20:30:26 +02:00
Florian Bruhin
3409559958 Add missing file 2016-04-10 20:28:10 +02:00
Florian Bruhin
6989d4d210 Fix downloading of non-ascii files with LC_ALL=C
Fixes #908.
2016-04-10 20:16:40 +02:00
Florian Bruhin
98f0938d35 Rename test_cmdline_args to test_invocations 2016-04-10 19:56:44 +02:00
Florian Bruhin
1954ebd63c Fix test_last_window_session_none 2016-04-10 18:22:58 +02:00
Florian Bruhin
b3dfa5757e Docker: Install libjs-pdf on Debian/Ubuntu 2016-04-10 18:09:17 +02:00
Florian Bruhin
a33aa524de Don't crash if data is None while saving session
Under some circumstances I can't reproduce (switching/turning off
monitors?) it seems it's possible that SessionManager.save gets called
with last_window=True, without on_last_window_closed being called.

This might be to one of the Qt screen management bugs fixed in Qt 5.6,
which would explain why I can't reproduce it.

Instead of crashing, let's log the error and not save the session.
2016-04-10 17:47:14 +02:00
Florian Bruhin
20f80610be Add some more logging for standarddir 2016-04-10 17:47:04 +02:00
Florian Bruhin
e6334e196c Fix #1414 with a weird workaround 2016-04-10 15:26:02 +02:00
Florian Bruhin
9e8302ed5c Merge branch 'axiom-tab-focus-negative-index' 2016-04-09 21:20:26 +02:00
Florian Bruhin
d01616109e Update docs 2016-04-09 21:20:14 +02:00
Johannes Martinsson
570d8b4abe Make tab-focus count from end with negative index
This makes it possible to jump to the very last tab, as opposed to the
last focused tab, by using -1 as the index. Generally negative indexes
are counted from the end.

Solves issue #1166
2016-04-09 03:40:36 +02:00
kanikaa1234
a2bcf80aae Fixed the tests 2016-04-08 20:51:07 +05:30
kanikaa1234
5c976d724b Fixes #1318 2016-04-08 19:40:45 +05:30
Florian Bruhin
917aaefa5a tox: Update flake8-future-import 2016-04-08 07:49:11 +02:00
Florian Bruhin
579b3e81e4 flake8: Remove unnecessary putty-ignore option 2016-04-08 07:41:40 +02:00
Florian Bruhin
79bb8871ee flake8: Use putty-auto-ignore 2016-04-08 07:39:11 +02:00
Florian Bruhin
f097b2e57f tox: Update flake8-putty to 0.3.2
Fix regex selector matching multiple codes
2016-04-08 07:38:30 +02:00
Florian Bruhin
642dc46ba9 flake8: Add hacking 2016-04-08 07:35:53 +02:00
Florian Bruhin
735db072c6 flake8: Add flake8-future-import 2016-04-08 07:10:15 +02:00
Florian Bruhin
41d52386e8 tox: Add flake8-tuple/flake8-tidy-imports
flake8-tuple: Check code for 1-element tuples
flake8-tidy-imports: A flake8 plugin that helps you write tidier
                     imports.
2016-04-08 07:00:29 +02:00
Florian Bruhin
00873fd000 Fix Proxy configtype test 2016-04-07 21:42:26 +02:00
Florian Bruhin
f5b9e0ab27 Add Tor/HTTP completions for network -> proxy 2016-04-07 21:25:23 +02:00
Florian Bruhin
0e6bada68f build_release: Build docs/update 3rdparty on OS X 2016-04-07 08:53:34 +02:00
Florian Bruhin
3f0429574c Makefile-dmg: Add /Applications link to dmg 2016-04-07 08:53:34 +02:00
Florian Bruhin
3984437484 build_release: Build dmg via Makefile-dmg 2016-04-07 08:53:34 +02:00
Florian Bruhin
03be10b4fe Makefile-dmg: Copy files from subdirs
We don't want a /dist/qutebrowser.app in the dmg, only a /qutebrowser.app.
2016-04-07 08:53:34 +02:00
Florian Bruhin
97cb429b57 Makefile-dmg: Set variables 2016-04-07 08:53:34 +02:00
Florian Bruhin
533b9d22e7 Add fancy-dmg Makefile 2016-04-07 08:53:34 +02:00
Florian Bruhin
362837e98c update_3rdparty: Add fancy-dmg Makefile 2016-04-07 08:53:25 +02:00
Florian Bruhin
ae41a074e8 build_release: Add basic OS X build 2016-04-07 08:53:17 +02:00
Florian Bruhin
bfb4f20510 pyinstaller: Build a single-executable app 2016-04-07 08:53:12 +02:00
Florian Bruhin
460f613fec pyinstaller: Set icon 2016-04-07 08:53:12 +02:00
Florian Bruhin
2f8ce31e1a pyinstaller: Add git-commit-id file 2016-04-07 08:53:12 +02:00
Florian Bruhin
f24a721e55 pyinstaller: Include data files
This makes the following things work:

- Error pages
- Caret mode
- pdfjs
- :help
2016-04-07 08:53:12 +02:00
Florian Bruhin
b505c65873 pyinstaller: Add basic qutebrowser.spec 2016-04-07 08:53:07 +02:00
Florian Bruhin
1bf15a053d tox: Add a pyinstaller env 2016-04-07 08:50:36 +02:00
Florian Bruhin
485af2dde7 tox: Update flake8-putty to 0.3.1
- Allow regex selector to use codes extracted from each line
- Add predefined ignore pattern # flake8: disable=<codes>
- Add environment marker selector (PEP 0496)
- Fix bug when filename selector contained trailing whitespace
- Switched to using tox-travis, and added PyPy 3 testing
2016-04-07 07:12:54 +02:00
Florian Bruhin
dad1e48018 Update Homebrew/OS X install instructions 2016-04-07 07:10:05 +02:00
Florian Bruhin
455e32cc0c tox: Update pytest-rerunfailures to 2.0.0
Drop support for Python 3.2, since supporting it became too much of a
hassle. (Reason: Virtualenv 14+ / PIP 8+ do not support Python 3.2
anymore.)
2016-04-06 18:55:54 +02:00
Florian Bruhin
9698af72e8 Merge branch 'jgkamat-editorconfig' 2016-04-06 18:54:51 +02:00
Florian Bruhin
e49db65e33 Regenerate authors 2016-04-06 18:54:45 +02:00
Florian Bruhin
dac1429fb0 Merge branch 'editorconfig' of https://github.com/jgkamat/qutebrowser into jgkamat-editorconfig 2016-04-06 18:54:33 +02:00
Jay Kamat
fa84aae133 Add basic editorconfig for enforcing style 2016-04-06 02:55:34 -04:00
Florian Bruhin
9ea7716b06 Stop supporting running tests without Xvfb/DISPLAY
This always caused problems and unneeded complexity in the past, and it
also increases Travis CI runtime.

We now require either a DISPLAY during tests or Xvfb being installed.
2016-04-06 08:27:43 +02:00
Florian Bruhin
2aef8913ec travis: Don't install recommended packages via apt
This passes --no-install-recommends both for Dockerfiles and Travis
itself.
2016-04-06 08:22:41 +02:00
Florian Bruhin
2ce2b2ab9f travis: Only modify $PATH as needed
See #1396.
2016-04-06 08:22:41 +02:00
Florian Bruhin
d02d99e53e bdd: Make quteproc.set_setting work with quotes
This hopefully fixes editor BDD tests on Windows as the editor path is
now correctly quoted.
2016-04-06 08:13:43 +02:00
Florian Bruhin
14eb63d9e9 ci/install: Fix updating of pip on Appveyor
Windows can't update pip when using the wrapper-executable.
2016-04-06 07:43:55 +02:00
Florian Bruhin
7141941ece Fix lint 2016-04-06 07:17:13 +02:00
Florian Bruhin
57cb812219 ci/install: Wait 30s before re-calling apt-get
See #1396.
2016-04-06 07:14:21 +02:00
Florian Bruhin
b70975223f travis: Use sudo -H to call pip
pip apparently needs this to make caching work properly?
See #1396.
2016-04-06 07:13:03 +02:00
Florian Bruhin
812c255379 travis: Use pip install -U to install packages 2016-04-06 07:12:21 +02:00
Florian Bruhin
2ad4fa5c8a ci/install: Upgrade pip on Travis/AppVeyor
See #1396
2016-04-06 07:11:57 +02:00
Florian Bruhin
f0b66130d6 Merge branch 'rcorre-edit-url' 2016-04-06 06:52:43 +02:00
Florian Bruhin
86dec02fe8 bdd: Add tests for :edit-url 2016-04-06 06:47:19 +02:00
Florian Bruhin
c4878bb7ed Don't raise cmdexc.CommandError in :open
:open can be called via :edit-url async, so we need to use message.error
by hand there.
2016-04-06 06:46:42 +02:00
Florian Bruhin
776c4c4400 Ensure -t/-b/-w are exclusive in :edit-url
Otherwise those would be passed as-is to :open and an unhandled
cmdexc.CommandError would be raised there.
2016-04-06 06:44:50 +02:00
Florian Bruhin
2f520f3b17 Rename test_editor.py to test_editor_unit.py 2016-04-05 19:49:01 +02:00
Florian Bruhin
9db697452d Remove self._editor in CommandDispatcher
This was needed before there was editor.ExternalEditor as there were
various commands which needed to access the editor object.

Since this is encapsulated in ExternalEditor now, no need to keep a
reference to the object around.
2016-04-05 18:48:58 +02:00
Florian Bruhin
107126c42e Regenerate docs 2016-04-05 18:38:56 +02:00
Florian Bruhin
6b3ee53064 Fix lint 2016-04-05 18:37:50 +02:00
Florian Bruhin
fc92137706 Handle count correctly for :edit-url 2016-04-05 18:37:03 +02:00
Florian Bruhin
d56cdd64db Update changelog 2016-04-05 18:35:47 +02:00
Florian Bruhin
332e045f54 Merge branch 'edit-url' of https://github.com/rcorre/qutebrowser into rcorre-edit-url 2016-04-05 18:28:50 +02:00
Florian Bruhin
537d017ec2 @Kingdread is faster than AppVeyor 2016-04-05 14:11:51 +02:00
Florian Bruhin
0abd16f6e5 tests: Use repr to wait for download question
The tests failed on Windows because a double-slash was printed in the
logs, but the tests expected a single one.
2016-04-05 14:09:25 +02:00
Ryan Roden-Corrent
e0d1e527d0 Fix up edit-url implementation.
Remove spaces around '=' for kwargs, don't set the _editor member.
2016-04-05 07:49:01 -04:00
Florian Bruhin
fb741582ef scripts/dev/ci/install: Retry apt-get if it fails 2016-04-05 12:43:51 +02:00
Florian Bruhin
860853f66f Fix lint 2016-04-05 12:40:46 +02:00
Florian Bruhin
b5c177526c tests: Add some "# pragma: no cover" for downloads 2016-04-05 11:43:35 +02:00
Florian Bruhin
ebee06a9c4 bdd: Add tests for download-path-suggestion 2016-04-05 11:43:35 +02:00
Florian Bruhin
6c1ee07c85 travis: Self-update npm in eslint env 2016-04-05 07:34:57 +02:00
Florian Bruhin
e64987d08c MANIFEST: prune scripts/textbrowser_cpp 2016-04-05 07:11:05 +02:00
Florian Bruhin
b9b2297d64 Add minimal C++ testbrowser 2016-04-05 06:56:57 +02:00
Florian Bruhin
1e740aa78b Update release checklist in CONTRIBUTING 2016-04-05 06:54:24 +02:00
Ryan Roden-Corrent
c8848a2641 Implement edit-url to craft a url with an editor.
The edit-url command opens a url (by default, the current url) in the
user's external editor and navigates to the result when the editor is
closed. This makes it easy to tweak the current url to navigate within
a site.

`edit-url` accepts the same flags as `open` (e.g. -t will open in a new
tab.

One may provide a url as an argument to create a shortcut to
pre-populate part of a url and allow filling in the rest.

There is no default keybinding.

Resolves #1261.
2016-04-04 20:47:42 -04:00
Florian Bruhin
f91935c8e8 freeze: Add pkg_resources._vendor.six
Another package added by pkg_resources and not picked up by cx_Freeze...
2016-04-04 21:31:27 +02:00
Florian Bruhin
1d89ea397a tox: Update setuptools in cxfreeze-windows env
In 43a4a6a3e7 we added
pkg_resources._vendor.pyparsing to the frozen modules - however, older
setuptools (and thus pkg_resources) versions don't have that module yet,
so freezing would fail.
2016-04-04 19:03:13 +02:00
Florian Bruhin
910adaf097 build_release: Don't call update_3rdparty.main
main tries to parse sys.argv which will fail when called from
build_release when e.g. --asciidoc is given.
2016-04-04 18:32:49 +02:00
Jakub Klinkovský
e121bd764f hints: add another iframe test 2016-03-16 21:47:58 +01:00
Jakub Klinkovský
164df521c1 hints: add verifications for iframe tests 2016-03-16 20:59:46 +01:00
Jakub Klinkovský
d4ea62a834 hints: add xfailed tests for hinting inside iframes 2016-02-24 23:15:13 +01:00
Jakub Klinkovský
b1207650b0 hints: translate client rectangles into parent frames 2016-02-24 22:56:06 +01:00
Jakub Klinkovský
d630f966e7 hints: ignore too small rectangles returned by getClientRects()
Apparently we can have a '1px x 1px' rectangle at some zoom levels
and '0px x 0px' at others. We can't reliably click these, so let's
ignore them.
2016-02-23 20:23:11 +01:00
Jakub Klinkovský
891a31a0ca hints: move zoom tests to test_hints_html.py 2016-02-23 18:51:32 +01:00
Jakub Klinkovský
35ed70cfe0 hints: split tests into individual HTML files 2016-02-23 18:19:52 +01:00
Jakub Klinkovský
58d2d92d67 Merge remote-tracking branch 'upstream/master' into hints_clicking
* upstream/master: (22 commits)
  Regenerate authors.
  Only run geolocation tests on CI
  Switch to flake8-docstrings with pydocstyle
  Fix lint
  Move pylint plugins to an installed package.
  Include pytest-xvfb properly in frozen tests
  tests: Handle trailing / in wait_for_load_finished.
  Fix lint.
  tox: Upgrade hypothesis to 3.0.2.
  tests: Add first end-to-end test for hints.
  hints: Log the used hint chars
  bdd: use quteproc.wait_for_load_finished.
  Remove xvfbwrapper from freeze_tests.py.
  Regenerate authors.
  Combine launch/crash time into one section.
  Split long lines.
  Switch to pytest-xvfb. Fixes #1309.
  no ellipsis is inserted in big windows
  Regenerate authors.
  fixes #1308
  ...
2016-02-23 17:40:02 +01:00
Jakub Klinkovský
52a9405f74 hints: fix descriptions of zoom tests 2016-02-21 12:53:03 +01:00
Jakub Klinkovský
1cff16b3b4 hints: fix bug in the correction of coordinates based on zoom level 2016-02-19 21:15:56 +01:00
Jakub Klinkovský
97d2038528 hints: make sure that all hints stay visible in tests 2016-02-16 00:05:58 +01:00
Jakub Klinkovský
9799c30c2b hints: add precision tests for different zoom levels 2016-02-15 23:31:49 +01:00
Jakub Klinkovský
dd594b0eca hints: split getClientRects() into separate method
this will be useful for positioning the hint label
2016-02-15 23:28:52 +01:00
Jakub Klinkovský
239b7497e9 hints: simplify tests and make them more reliable 2016-02-15 20:41:54 +01:00
Jakub Klinkovský
748ec043fb hints: add tests for links known to cause troubles 2016-02-15 19:02:29 +01:00
Jakub Klinkovský
a546933516 hints: use getClientRects() JS method to get the correct click position 2016-02-15 18:17:53 +01:00
Tomasz Kramkowski
399aaa2b70 history: Add clear() method and history-clear command
WebHistory now has a clear() method which is also a command
(history-clear) which clears the qutebrowser history using the new
lineparser clear() method and emits a cleared signal.

The completion model urlmodel connects to the WebHistory.cleared signal
and clears its history category completion list.

I am adding this as a temporary fix before #58 or #1051 get implemented.
2016-01-23 22:36:24 +00:00
Tomasz Kramkowski
6894033f8d lineparser: Add clear() method.
The lineparser clear method, implemented for all lineparser subclasses,
clears the underlying file and also empties any lineparser data
structures.
2016-01-23 22:35:19 +00:00
Corentin Julé
6fd8dc4e57 Correct test_config_change 2016-01-23 16:34:05 +01:00
Corentin Julé
47261dbd30 Code cleanup / Good practices 2016-01-23 16:15:19 +01:00
Corentin Julé
ff8d5370a3 Add ideas for improvement 2015-12-08 10:37:04 +01:00
Corentin Julé
99ede3f551 Improve coverage and code cleanup 2015-12-08 00:52:51 +01:00
Corentin Julé
f8fcd48998 remove now useless tests 2015-12-07 00:11:19 +01:00
Corentin Julé
6be0ff67f7 Replace some tests with a generic host blocking list 2015-12-07 00:09:51 +01:00
Corentin Julé
a24a7790cd Improve code readability 2015-12-06 19:33:35 +01:00
Corentin Julé
8bff518ba4 Refactor and add tests 2015-12-06 15:35:10 +01:00
Corentin Julé
ac3d0b9a4c Comply with pylint 2015-12-06 00:51:44 +01:00
Corentin Julé
1ba634969a Correct QUrl creation 2015-12-06 00:42:33 +01:00
Corentin Julé
472585edd5 Add tests for HostBlocker class 2015-12-06 00:10:56 +01:00
Corentin Julé
9da15ae2f9 Correct is_whitelisted_host test 2015-12-05 12:41:52 +01:00
Corentin Jule
d55e6d7d7e Comply with PEP257 2015-12-05 01:35:20 +01:00
Corentin Jule
d5fc7e0389 Merge upstream/master 2015-12-05 01:29:20 +01:00
Corentin Jule
5e5531f924 Revert "Remove old pull request commits"
This reverts commit 5369fc30bc.

messed with git - revert
2015-12-05 01:21:32 +01:00
Corentin Jule
cc946ba6e6 implementation of config_stub fixture 2015-12-05 01:09:11 +01:00
Corentin Jule
8222a86201 Remove useless test 2015-12-05 00:16:38 +01:00
Corentin Jule
3426dd06f6 Add some docstrings 2015-12-04 21:57:34 +01:00
Corentin Jule
e78f1a7412 Merge remote-tracking branch 'upstream/master' into test_adblock 2015-12-04 13:19:00 +01:00
Corentin Jule
95b200ead9 Pylint code cleanup 2015-12-04 01:52:00 +01:00
Corentin Jule
5369fc30bc Remove old pull request commits 2015-12-03 22:13:50 +01:00
Corentin Jule
8dd0249af9 Code cleanup - Pep8 2015-12-03 22:00:39 +01:00
Corentin Jule
2d850f7106 Add tests for first functions of adblock.py 2015-12-03 21:12:51 +01:00
461 changed files with 22768 additions and 10469 deletions

View File

@@ -11,7 +11,7 @@ environment:
- TESTENV: pylint
install:
- C:\Python27\python -u scripts\dev\ci\install.py
- C:\Python27\python -u scripts\dev\ci\appveyor_install.py
test_script:
- C:\Python34\Scripts\tox -e %TESTENV%

17
.editorconfig Normal file
View File

@@ -0,0 +1,17 @@
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
max_line_length = 79
indent_style = space
indent_size = 4
[*.yml]
indent_size = 2
[*.feature]
max_line_length = 9999

View File

@@ -1,5 +1,5 @@
[flake8]
exclude = .venv,.hypothesis,.git,__pycache__,resources.py
exclude = .*,__pycache__,resources.py
# E128: continuation line under-indented for visual indent
# E226: missing whitespace around arithmetic operator
# E265: Block comment should start with '#'
@@ -8,17 +8,6 @@ exclude = .venv,.hypothesis,.git,__pycache__,resources.py
# E266: too many leading '#' for block comment
# F401: Unused import
# N802: function name should be lowercase
# L101: The __init__ method of classes must not have a docstring
# L102: A docstring was incorrectly formatted.
# L103: A test docstring must not start with any form of the words "test", ...
# L201: Container literals must have a trailing comma
# L202: print is not allowed except for debugging.
# L203: pdb and compatible modules are not allowed except for debugging.
# L204: Implicit string literal concatenation is only allowed if every string
# being concatenated is parenthesize
# L207: pass is only necessary in non-optional suites containing no other
# statements.
# L302: The line was too long.
# P101: format string does contain unindexed parameters
# P102: docstring does contain unindexed parameters
# P103: other string does contain unindexed parameters
@@ -30,27 +19,30 @@ exclude = .venv,.hypothesis,.git,__pycache__,resources.py
# D211: No blank lines allowed before class docstring
# (PEP257 got changed, but let's stick to the old standard)
# D402: First line should not be function's signature (false-positives)
# D403: First word of the first line should be properly capitalized
# (false-positives)
# H101: Use TODO(NAME)
# H201: bare except
# H238: Use new-stule classes
# H301: one import per line
# H306: imports not in alphabetical order
ignore =
E128,E226,E265,E501,E402,E266,
F401,
N802,
L101,L102,L103,L201,L202,L203,L204,L207,L302,
P101,P102,P103,
D102,D103,D104,D105,D209,D211,D402
D102,D103,D104,D105,D209,D211,D402,D403,
H101,H201,H238,H301,H306
min-version = 3.4.0
max-complexity = 12
putty-auto-ignore = True
putty-ignore =
/# pylint: disable=invalid-name/ : +N801,N806
/# pylint: disable=wildcard-import/ : +F403
/# pragma: no mccabe/ : +C901
/# flake8: disable=E131/ : +E131
/# flake8: disable=N803/ : +N803
/# flake8: disable=T002/ : +T002
/# flake8: disable=F841/ : +F841
/# flake8: disable=S001/ : +S001
tests/*/*/test_*.py : +D100,D101,D401
tests/*/test_*.py : +D100,D101,D401
tests/unit/browser/http/test_content_disposition.py : +D400
scripts/dev/ci/install.py : +C901
tests/unit/browser/webkit/http/test_content_disposition.py : +D400
scripts/dev/ci/appveyor_install.py : +FI53
copyright-check = True
copyright-regexp = # Copyright [\d-]+ .*
copyright-min-file-size = 110

4
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,4 @@
Please remember to mention your version info (qutebrowser, Qt, PyQt,
OS/distribution) from the `qute:version` page or `qutebrowser --version`
---

6
.gitignore vendored
View File

@@ -1,4 +1,5 @@
__pycache__
*.py~
*.pyc
*.swp
/build
@@ -30,4 +31,9 @@ __pycache__
/.testmondata
/.hypothesis
/prof
/venv
TODO
/scripts/testbrowser_cpp/Makefile
/scripts/testbrowser_cpp/main.o
/scripts/testbrowser_cpp/testbrowser
/scripts/dev/pylint_checkers/qute_pylint.egg-info

View File

@@ -6,7 +6,10 @@ extension-pkg-whitelist=PyQt5,sip
load-plugins=qute_pylint.config,
qute_pylint.modeline,
qute_pylint.openencoding,
qute_pylint.settrace
qute_pylint.settrace,
pylint.extensions.bad_builtin,
pylint.extensions.docstyle
persistent=n
[MESSAGES CONTROL]
enable=all
@@ -14,6 +17,7 @@ disable=no-self-use,
fixme,
global-statement,
locally-disabled,
locally-enabled,
too-many-ancestors,
too-few-public-methods,
too-many-public-methods,
@@ -31,12 +35,15 @@ disable=no-self-use,
wrong-import-order,
ungrouped-imports,
redefined-variable-type,
suppressed-message
suppressed-message,
too-many-return-statements,
duplicate-code,
wrong-import-position
[BASIC]
function-rgx=[a-z_][a-z0-9_]{2,50}$
const-rgx=[A-Za-z_][A-Za-z0-9_]{0,30}$
method-rgx=[a-z_][A-Za-z0-9_]{2,50}$
method-rgx=[a-z_][A-Za-z0-9_]{1,50}$
attr-rgx=[a-z_][a-z0-9_]{0,30}$
argument-rgx=[a-z_][a-z0-9_]{0,30}$
variable-rgx=[a-z_][a-z0-9_]{0,30}$
@@ -57,10 +64,13 @@ dummy-variables-rgx=_.*
[DESIGN]
max-args=10
[CLASSES]
valid-metaclass-classmethod-first-arg=cls
[TYPECHECK]
# MsgType added as WORKAROUND for
# https://bitbucket.org/logilab/pylint/issues/690/
# UnsetObject because pylint infers any objreg.get(...) as UnsetObject.
ignored-classes=qutebrowser.utils.objreg.UnsetObject,
qutebrowser.browser.webelem.WebElementWrapper,
qutebrowser.browser.webkit.webelem.WebElementWrapper,
scripts.dev.check_coverage.MsgType

View File

@@ -1,17 +1,11 @@
sudo: required
dist: trusty
env:
global:
- PATH=/home/travis/bin:/home/travis/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# Not really, but this is here so we can do stuff by hand.
language: c
language: generic
matrix:
include:
- os: linux
env: TESTENV=py34-cov
- os: linux
env: TESTENV=unittests-nodisp
- os: linux
env: DOCKER=debian-jessie
services: docker
@@ -19,7 +13,7 @@ matrix:
env: DOCKER=archlinux
services: docker
- os: linux
env: DOCKER=ubuntu-wily
env: DOCKER=ubuntu-xenial
services: docker
- os: osx
env: TESTENV=py35
@@ -48,8 +42,12 @@ cache:
- $HOME/.cache/pip
- $HOME/build/The-Compiler/qutebrowser/.cache
before_install:
# We need to do this so we pick up the system-wide python properly
- 'export PATH="/usr/bin:$PATH"'
install:
- python scripts/dev/ci/install.py
- bash scripts/dev/ci/travis_install.sh
script:
- bash scripts/dev/ci/travis_run.sh
@@ -62,8 +60,8 @@ notifications:
- https://buildtimetrend.herokuapp.com/travis
irc:
channels:
- "chat.freenode.net#qutebrowser"
on_success: change
- "chat.freenode.net#qutebrowser-dev"
on_success: always
on_failure: always
skip_join: true
template:

View File

@@ -14,6 +14,228 @@ This project adheres to http://semver.org/[Semantic Versioning].
// `Fixed` for any bug fixes.
// `Security` to invite users to upgrade in case of vulnerabilities.
v0.8.3
------
Fixed
~~~~~
- Fixed crash when doing `:<space><enter>`, another corner-case introduced in v0.8.0
- Fixed `:open-editor` (`<Ctrl-e>`) on Windows
- Fixed crash when setting `general -> auto-save-interval` to a too big value.
- Fixed crash when using hints on Void Linux.
- Fixed compatibility with Python 3.5.2+ on Debian unstable
- Compatibility with pdfjs v1.6.210
- `:bind` can now be used to bind to an alias (binding by editing `keys.conf`
already worked before)
- The command completion now updates correctly when changing aliases
- The tabbar now displays correctly with the Adwaita Qt theme
- The default `sk` keybinding now sets the commandline to `:bind` correctly
- Fixed crash when closing a window without focusing it
v0.8.2
------
Fixed
~~~~~
- Fixed `general -> private-browsing` not being set correctly until a restart
(which caused e.g. local storage to be enabled).
- When hinting input fields (`:t`), also consider input elements without a type.
- Fixed crash when opening an invalid URL with a percent-encoded and a real @ in it
- Fixed default `;o` and `;O` bindings
- Fixed local storage not working (and possible other bugs) when using a
relative path with `--basedir`.
- Fixed crash when deleting a quickmark with Ctrl-D
- Fixed HTML5 video playback on Windows
- Fixed crash when using `:prompt-open-download` with a file with chars not
encodable with the OS' filesystem encoding (e.g. with `LC_ALL=C`)
- Fixed `:prompt-open-download` with a too long filename (> 255 bytes)
- Fixed crash when cancelling a download after doing `:prompt-open-download`
- Fixed crash when writing a download to disk fails with
`:prompt-open-download`.
- Fixed `:restart` deleting the basedir when it was given with `--basedir`.
v0.8.1
------
Fixed
~~~~~
- Fix crash when pressing enter without a command
- Adjust error message to point out QtWebEngine is unsupported with the OS
X .app currently.
- Hide Harfbuzz warning with the OS X .app
v0.8.0
------
Added
~~~~~
- New `:repeat-command` command (mapped to `.`) to repeat the last command.
Note that two former default bundings conflict with that binding, unbinding
them via `:unbind .i` and `:unbind .o` is recommended.
- New `qute:bookmarks` page which displays all bookmarks and quickmarks.
- New `:prompt-open-download` (bound to `Ctrl-X`) which can be used to open a
download directly when getting the filename prompt.
- New `{host}` replacement for tab- and window titles which evaluates
to the current host.
- New default binding `;t` for `:hint input`.
- New variables `$QUTE_CONFIG_DIR`, `$QUTE_DATA_DIR` and
`$QUTE_DOWNLOAD_DIR` available for userscripts.
- New option `ui` -> `status-position` to configure the position of the
status bar (top/bottom).
- New `--pdf <filename>` argument for `:print` WHICH can be used to generate a
PDF without a dialog.
Changed
~~~~~~~
- `:scroll-perc` now prefers a count over the argument given to it, which means
`gg` can be used with a count.
- Aliases can now use `;;` to have an alias which executed multiple commands.
- `:edit-url` now does nothing if the URL isn't changed in the spawned editor.
- `:bookmark-add` can now be passed a URL and title to add that as a bookmark
rather than the current page.
- New `taskadd` userscript to add a taskwarrior task annotated with the
current URL.
- `:bookmark-del` and `:quickmark-del` now delete the current page's URL if none
is given.
Fixed
-----
- Compatibility with PyQt 5.7
- Fixed some configuration values being lost when a config option gets removed
from qutebrowser's code.
- Fix crash when downloading with a full disk
- Using `:jump-mark` (e.g. `''`) when the current URL is invalid doesn't crash
anymore.
Removed
-------
- The ability to display status messages from webpages, as well as the related
`ui -> display-statusbar-messages` setting.
- The `general -> wrap-search` setting as searches now always wrap.
According to a quick straw poll and prior crash logs, almost nobody is using
`wrap-search = false`, and turning off wrapping is not possible with
QtWebEngine.
- `:edit-url` now doesn't accept a count anymore as its behavior was confusing
and it doesn't make much sense to add a count.
v0.7.0
------
Added
~~~~~
- New `:edit-url` command to edit the URL in an external editor.
- New `network -> custom-headers` setting to send custom headers with every request.
- New `{url:pretty}` commandline replacement which gets replaced by the decoded URL.
- New marks to remember a scroll position:
- New `:jump-mark` command to jump to a mark, bound to `'`
- New `:set-mark` command to set a mark, bound to ```(backtick)
- The `'` mark gets set when moving away (hinting link with anchor, searching, etc.) so you can move back with `''`
- New `--force-color` argument to force colored logging even if stdout is not a
terminal
- New `:messages` command to show error messages
- New pop-up showing possible keybinding when the first key of a keychain is
pressed. This can be turned off using `:set ui keyhint-blacklist *`.
- New `hints -> auto-follow-timeout` setting to ignore keypresses after
following a hint when filtering in number mode.
- New `:history-clear` command to clear the entire history
- New `hints -> find-implementation` to select which implementation (JS/Python)
should be used to find hints on a page. The `javascript` implementation is
better, but slower.
- New `inputs` group for `:hint` to hint text input fields.
Changed
~~~~~~~
- qutebrowser got a new (slightly updated) logo
- `:tab-focus` can now take a negative index to focus the nth tab counted from
the right.
- `:yank` can now yank the pretty/decoded URL by adding `--pretty`
- `:navigate` now clears the URL fragment
- `:completion-item-del` (`Ctrl-D`) can now be used in `:buffer` completion to
close a tab
- Various SSL ciphers are now disabled by default. With recent Qt/OpenSSL
versions those already all are disabled, but with older versions they might
not be.
- Show favicons as window icon with `tabs-are-windows` set.
- `:bind <key>` without a command now shows the existing binding
- The optional `colorlog` dependency got removed, as qutebrowser now displays
colored logs without it.
- URLs are now shown decoded when hovering.
- Keybindings are now shown in the command completion
- Improved behavior when pasting multiple lines
- Rapid hints can now also be used for the `normal` hint target, which can be
useful with javascript click handlers or checkboxes which don't actually open
a new page.
- `:zoom-in` or `:zoom-out` (`+`/`-`) with a too large count now zooms to the
smallest/largest zoom instead of doing nothing.
- The commandline now accepts partially typed commands if they're unique.
- Number hints are now kept filtered after following a hint in rapid mode.
- Number hints are now renumbered after filtering
- Number hints can now be filtered with multiple space-separated search terms
- `hints -> scatter` is now ignored for number hints
- Better history implementation which also stores titles.
As a consequence, URLs which redirect to another URL are now added to the
history too, marked with a `-r` suffix to the timestamp field.
Fixed
-----
- Fixed using `:hint links spawn` with flags - you can now use things like the
`-v` argument for `:spawn` or pass flags to the spawned commands.
- Various fixes for hinting corner-cases where following a link didn't work or
the hint was drawn at the wrong position.
- Fixed crash when downloading from a URL with SSL errors
- Close file handles correctly when a download failed
- Fixed crash when using `;Y` (`:hint links yank-primary`) on a system without
primary selection
- Don't display quit confirmation with finished downloads
- Fixed updating the tab index in the statusbar when opening a background tab
- Fixed a crash when entering `:-- ` in the commandline
- Fixed `:debug-console` with PyQt 5.6
- Fixed qutebrowser not starting when `sys.stderr` is `None`
- Fixed crash when cancelling a download which belongs to an MHTML download
- Fixed rebinding of keybindings being case-sensitive
- Fix for tab indicators getting lost when moving tabs
- Fixed handling of backspace in number hinting mode
- Fixed `FileNotFoundError` when starting in some cases on old Qt versions
- Fixed sharing of cookies between tabs when `private-browsing` is enabled
- Toggling values with `:set` now uses lower-case values
- Hints now work with (non-standard) links with spaces around the URL
- Strip off trailing spaces for history entries with no title
v0.6.2
------
Fixed
~~~~~
- Fixed crash when using `:tab-{prev,next,focus}` right after closing the last
tab with `last-close` set to `close`.
- Fixed crash when doing `:undo` in a new instance with `tabs -> last-close` set
to `default-page`.
- Fixed crash when starting with --cachedir=""
- Fixed crash in some circumstances when using dictionary hints
- Fixed various crashes related to PyQt 5.6
v0.6.1
-----
Fixed
~~~~~~
- Fixed broken cheatsheet image which was missing from package
- Fixed occasional crash when switching/disconnecting monitors
- Fixed crash when downloading non-ascii files with a broken locale (`LC_ALL=C`)
- Added workaround for a Qt/PyQt bug which is too weird to describe here
v0.6.0
------
@@ -381,7 +603,7 @@ Fixed
~~~~~
- Scrolling should now work more reliably on some pages where arrow keys worked but `hjkl` didn't.
- Small improvements when checking if an input is an URL or not.
- Small improvements when checking if an input is a URL or not.
- Fixed wrong cursor position when completing the first item in the completion.
- Fixed exception when using search engines with {foo} in their name.
- Fixed a bug where the same title was shown for all tabs on some systems.
@@ -393,7 +615,7 @@ Fixed
- Various fixes for deprecated key bindings and auto-migrations.
- Workaround for qutebrowser not starting when there are NUL-bytes in the history (because of a currently unknown bug).
- Fixed handling of keybindings containing Ctrl/Meta on OS X.
- Fixed crash when downloading an URL without filename (e.g. magnet links) via "Save as...".
- Fixed crash when downloading a URL without filename (e.g. magnet links) via "Save as...".
- Fixed exception when starting qutebrowser with `:set` as argument.
- Fixed horrible completion performance when the `shrink` option was set.
- Sessions now store zoom/scroll-position correctly.
@@ -544,7 +766,7 @@ Fixed
- Scroll completion to top when showing it.
- Handle unencodable file paths in config types correctly.
- Fix for crash when executing a delayed command (because of a shadowed keybinding) and then unfocusing the window.
- Fix for crash when hinting on a page which doesn't have an URL yet.
- Fix for crash when hinting on a page which doesn't have a URL yet.
- Fix exception when using `:set-cmd-text` with an empty argument.
- Add a timeout to pastebin HTTP replies.
- Various other fixes for small/rare bugs.

View File

@@ -158,11 +158,11 @@ Examples:
# run only pytest tests which failed in last run:
tox -e py35 -- --lf
# run only the integration feature tests:
tox -e py35 -- tests/integration/features
# run only the end2end feature tests:
tox -e py35 -- tests/end2end/features
# run everything with undo in the generated name, based on the scenario text
tox -e py35 -- tests/integration/features/test_tabs.py -k undo
tox -e py35 -- tests/end2end/features/test_tabs_bdd.py -k undo
# run coverage test for specific file (updates htmlcov/index.html)
tox -e py35-cov -- tests/unit/browser/test_webelem.py
@@ -174,10 +174,14 @@ Profiling
In the _scripts/_ subfolder there's a `run_profile.py` which profiles the code
and shows a graphical representation of what takes how much time.
It needs https://pypi.python.org/pypi/pyprof2calltree/[pyprof2calltree] and
http://kcachegrind.sourceforge.net/html/Home.html[KCacheGrind]. It uses the
built-in Python https://docs.python.org/3.4/library/profile.html[cProfile]
module.
It uses the built-in Python
https://docs.python.org/3.4/library/profile.html[cProfile] module and can show
the output in four different ways:
* Raw profile file (`--profile-tool=none`)
* https://pypi.python.org/pypi/pyprof2calltree/[pyprof2calltree] and http://kcachegrind.sourceforge.net/html/Home.html[KCacheGrind] (`--profile-tool=kcachegrind`)
* https://jiffyclub.github.io/snakeviz/[SnakeViz] (`--profile-tool=snakeviz`)
* https://github.com/jrfonseca/gprof2dot[gprof2dot] (needs `dot` from http://graphviz.org/[Graphviz] and http://feh.finalrewind.org/[feh])
Debugging
~~~~~~~~~
@@ -212,7 +216,6 @@ Documentation of used Python libraries:
* http://pythonhosted.org/setuptools/[setuptools]
* http://cx-freeze.readthedocs.org/en/latest/overview.html[cx_Freeze]
* https://pypi.python.org/pypi/colorama[colorama]
* https://pypi.python.org/pypi/colorlog[colorlog]
Related RFCs and standards:
@@ -371,7 +374,7 @@ The following logging levels are available for every logger:
[width="75%",cols="25%,75%"]
|=======================================================================
|criticial |Critical issue, qutebrowser can't continue to run.
|critical |Critical issue, qutebrowser can't continue to run.
|error |There was an issue and some kind of operation was abandoned.
|warning |There was an issue but the operation can continue running.
|info |General informational messages.
@@ -417,35 +420,59 @@ The types of the function arguments are inferred based on their default values,
e.g. an argument `foo=True` will be converted to a flag `-f`/`--foo` in
qutebrowser's commandline.
This behavior can be overridden using Python's
http://legacy.python.org/dev/peps/pep-3107/[function annotations]. The
annotation should always be a `dict`, like this:
The type can be overridden using Python's
http://legacy.python.org/dev/peps/pep-3107/[function annotations]:
[source,python]
----
@cmdutils.register(...)
def foo(bar: {'type': int}, baz=True):
def foo(bar: int, baz=True):
...
----
The following keys are supported in the dict:
* `type`: The type this value should have. The value entered by the user is
then automatically checked. Possible values:
Possible values:
- A callable (`int`, `float`, etc.): Gets called to validate/convert the
value.
- A string: The value must match exactly (mainly useful with tuples to get
a choice of values, see below).
- A python enum type: All members of the enum are possible values.
- A tuple of multiple types above: Any of these types are valid values,
e.g. `('foo', 'bar')` or `(int, 'foo')`.
* `flag`: The flag to be used, as 1-char string (default: First char of the
long name).
* `nargs`: Gets passed to argparse, see
https://docs.python.org/dev/library/argparse.html#nargs[its documentation].
- A `typing.Union` of multiple types above: Any of these types are valid
values, e.g. `typing.Union[str, int]`
You can customize how an argument is handled using the `@cmdutils.argument`
decorator *after* `@cmdutils.register`. This can e.g. be used to customize the
flag an argument should get:
[source,python]
----
@cmdutils.register(...)
@cmdutils.argument('bar', flag='c')
def foo(bar):
...
----
For a `str` argument, you can restrict the allowed strings using `choices`:
[source,python]
----
@cmdutils.register(...)
@cmdutils.argument('bar', choices=['val1', 'val2'])
def foo(bar: str):
...
----
For `typing.Union` types, the given `choices` are only checked if other types
(like `int`) don't match.
The following arguments are supported for `@cmdutils.argument`:
- `flag`: Customize the short flag (`-x`) the argument will get.
- `win_id=True`: Mark the argument as special window ID argument
- `count=True`: Mark the argument as special count argument
- `hide=True`: Hide the argument from the documentation
- `completion`: A `usertypes.Completion` member to use as completion.
- `choices`: The allowed string choices for the argument.
The name of an argument will always be the parameter name, with any trailing
underscores stripped.
underscores stripped and underscores replaced by dashes.
[[handling-urls]]
Handling URLs
@@ -568,10 +595,7 @@ Return:
* The layout of a class should be like this:
- docstring
- `__magic__` methods
- properties
- _private methods
- public methods
- `on_*` methods
- other methods
- overrides of Qt methods
Checklists
@@ -593,6 +617,14 @@ workaround.
* Check relevant
https://github.com/The-Compiler/qutebrowser/issues?q=is%3Aopen+is%3Aissue+label%3Aqt[qutebrowser
bugs] and check if they're fixed.
* As soon as Homebrew updated, update the custom OS X bottle:
- Update https://github.com/The-Compiler/homebrew-qt5-webkit/blob/master/Formula/qt5.rb[qt5.rb]
- `brew install --build-from-source --build-bottle --verbose qt5.rb`
- `brew bottle qt5.rb`
- `brew install --build-from-source --build-bottle --verbose pyqt5`
- `brew bottle pyqt5`
- Upload bottles to github
- Adjust `scripts/dev/ci/travis_install.sh`
New PyQt release
~~~~~~~~~~~~~~~~
@@ -606,6 +638,11 @@ qutebrowser release
* Make sure there are no unstaged changes and the tests are green.
* Add newest config to `tests/unit/config/old_configs` and update `test_upgrade_version`
- `python -m qutebrowser --basedir conf :quit`
- `sed '/^#/d' conf/config/qutebrowser.conf > tests/unit/config/old_configs/qutebrowser-v0.x.y.conf`
- `rm -r conf`
- commit
* Adjust `__version_info__` in `qutebrowser/__init__.py`.
* Remove *(unreleased)* from changelog.
* Run tests again
@@ -613,7 +650,6 @@ qutebrowser release
* Commit
* Create annotated git tag (`git tag -s "v0.X.Y" -m "Release v0.X.Y"`)
* If it's a new minor, create git branch `v0.X.x`
* If committing on minor branch, cherry-pick release commit to master.
* `git push origin`; `git push origin v0.X.Y`
* Create release on github
@@ -622,12 +658,16 @@ as closed.
* Run `scripts/dev/build_release.py` on Linux to build an sdist
* Upload to PyPI: `twine upload dist/foo{,.asc}`
* Create Windows packages via `scripts/dev/build_release.py` and upload.
* Create Windows packages via `C:\Python34_x32\python scripts\dev\build_release.py --asciidoc C:\Python27\python C:\asciidoc-8.6.9\asciidoc.py`
* Upload to github
* Upload to qutebrowser.org with checksum/GPG
- On server: `sudo mkdir -p /srv/http/qutebrowser/releases/v0.X.Y/windows`
- `rsync -avPh dist/ tonks:`
- On server: `sudo mv qutebrowser-0.X.Y.tar.gz* /srv/http/qutebrowser/releases/v0.X.Y`
* Update AUR package
- Upload windows release:
- `scp bb-win8:proj/qutebrowser/qutebrowser-0.X.Y-windows.zip .`
- `aunpack qutebrowser-0.X.Y-windows.zip`
- `sudo mv qutebrowser-0.X.Y-windows/* /srv/http/qutebrowser/releases/v0.X.Y/windows`
* Update `qutebrowser-git` PKGBUILD if dependencies/install changed
* Announce to qutebrowser mailinglist

View File

@@ -80,13 +80,27 @@ How do I play Youtube videos with mpv?::
player - optionally even with hinting for links:
+
----
:bind x spawn mpv {url}
:bind ;x hint links spawn mpv {hint-url}
:bind m spawn mpv {url}
:bind M hint links spawn mpv {hint-url}
----
+
Note that you might need an additional package (e.g.
https://www.archlinux.org/packages/community/any/youtube-dl/[youtube-dl] on
Archlinux) to play web videos with mpv.
+
There is a very useful script for mpv, which emulates "unique application"
functionality. This way you can add links to the mpv playlist instead of
playing them all at once.
+
You can find the script here: https://github.com/mpv-player/mpv/blob/master/TOOLS/umpv
+
It also works nicely with rapid hints:
+
----
:bind m spawn umpv {url}
:bind M hint links spawn umpv {hint-url}
:bind ;M hint --rapid links spawn umpv {hint-url}
----
How do I use qutebrowser with mutt?::
Due to a Qt limitation, local files without `.html` extensions are

View File

@@ -10,9 +10,31 @@ qutebrowser should run on these systems:
* Ubuntu Trusty (14.04 LTS) or newer
* Any other distribution based on these (e.g. Linux Mint 17+)
Unfortunately there is no Debian package yet, but installing qutebrowser is
still relatively easy! If you want to help packaging it for Debian, please
https://github.com/The-Compiler/qutebrowser/issues/582[get in touch]!
Unfortunately there is no Debian package in the official repos yet, but installing qutebrowser is
still relatively easy!
You can use packages that are built for every release or build it yourself from git.
Using the packages
~~~~~~~~~~~~~~~~~~
Install the dependencies via apt-get:
----
# apt-get install python3-lxml python-tox python3-pyqt5 python3-pyqt5.qtwebkit python3-sip python3-jinja2 python3-pygments python3-yaml
----
Get the packages from the https://github.com/The-Compiler/qutebrowser/releases[release page]
Install the packages:
----
# dpkg -i python3-pypeg2_*_all.deb
# dpkg -i qutebrowser_*_all.deb
----
Build it from git
~~~~~~~~~~~~~~~~~
Install the dependencies via apt-get:
@@ -121,6 +143,13 @@ Make sure you have `python3_4` in your `PYTHON_TARGETS`
(`/etc/portage/make.conf`) and rebuild your system (`emerge -uDNav @world`) if
necessary.
If video or sound don't seem to work, try installing the gstreamer plugins:
----
# emerge -av gst-plugins-{base,good,bad,ugly,libav}
----
On Void Linux
-------------
@@ -200,21 +229,31 @@ Then <<tox,install qutebrowser via tox>>.
On OS X
-------
*Using qutebrowser with Homebrew on OS X is currently broken, as Homebrew
dropped QtWebKit support with Qt 5.6. I'm working on building a standalone
`.app` for OS X instead, but it'll still take a few days until it's ready.*
The easiest way to install qutebrowser on OS X is to use the prebuilt `.app`
files from the
https://github.com/The-Compiler/qutebrowser/releases[release page].
To install qutebrowser on OS X, you'll want a package manager, e.g.
http://brew.sh/[Homebrew] or https://www.macports.org/[MacPorts]. Also make
sure, you have https://itunes.apple.com/en/app/xcode/id497799835[XCode]
installed to compile PyQt5 in a later step.
Alternatively, you can install the dependencies via a package manager (like
http://brew.sh/[Homebrew] or https://www.macports.org/[MacPorts]) and run
qutebrowser from source.
For Homebrew, a few extra steps are necessary since Homebrew dropped QtWebKit
from Qt 5.6 - however, some users reported this didn't work for them, so using
the `.app` is strongly encouraged.
This installs a Qt 5.5 and symlinks it so PyQt5 will work with it instead of Qt
5.6. This requires that `qt5` is not installed via Homebrew:
----
$ brew install python3 pyqt5
$ brew install python3 d-bus mysql sip xz
$ brew install homebrew/versions/qt55
$ brew install --ignore-dependencies pyqt5
$ ln -s /usr/local/opt/qt55 /usr/local/opt/qt5
$ pip3.5 install qutebrowser
----
if you are using Homebrew. For MacPorts, run:
For MacPorts, run:
----
$ sudo port install python34 py34-jinja2 asciidoc py34-pygments py34-pyqt5

View File

@@ -1,12 +1,13 @@
recursive-include qutebrowser *.py
recursive-include qutebrowser/html *.html
recursive-include qutebrowser/img *.svg *.png
recursive-include qutebrowser/test *.py
recursive-include qutebrowser/javascript *.js
graft qutebrowser/html
graft qutebrowser/3rdparty
graft icons
graft doc/img
graft misc
graft misc/apparmor
graft misc/userscripts
recursive-include scripts *.py
include qutebrowser/utils/testfile
include qutebrowser/git-commit-id
@@ -15,15 +16,21 @@ include qutebrowser.desktop
include requirements.txt
include tox.ini
include qutebrowser.py
include misc/cheatsheet.svg
prune www
prune scripts/dev
prune scripts/testbrowser_cpp
prune .github
exclude scripts/asciidoc2html.py
exclude doc/notes
recursive-exclude doc *.asciidoc
include doc/qutebrowser.1.asciidoc
prune tests
prune qutebrowser/3rdparty
prune misc/requirements
prune misc/docker
exclude .editorconfig
exclude pytest.ini
exclude qutebrowser.rcc
exclude .coveragerc
@@ -33,7 +40,10 @@ exclude .eslintignore
exclude doc/help
exclude .appveyor.yml
exclude .travis.yml
exclude codecov.yml
exclude .pydocstylerc
exclude misc/appveyor_install.py
exclude misc/qutebrowser.spec
exclude .flake8
global-exclude __pycache__ *.pyc *.pyo

View File

@@ -15,6 +15,8 @@ image:https://requires.io/github/The-Compiler/qutebrowser/requirements.svg?branc
image:https://travis-ci.org/The-Compiler/qutebrowser.svg?branch=master["Build Status", link="https://travis-ci.org/The-Compiler/qutebrowser"]
image:https://ci.appveyor.com/api/projects/status/9gmnuip6i1oq7046?svg=true["AppVeyor build status", link="https://ci.appveyor.com/project/The-Compiler/qutebrowser"]
image:https://codecov.io/github/The-Compiler/qutebrowser/coverage.svg?branch=master["coverage badge",link="https://codecov.io/github/The-Compiler/qutebrowser?branch=master"]
link:http://www.qutebrowser.org[website] | link:http://blog.qutebrowser.org[blog] | link:https://github.com/The-Compiler/qutebrowser/releases[releases]
// QUTE_WEB_HIDE_END
qutebrowser is a keyboard-focused browser with a minimal GUI. It's based
@@ -22,12 +24,6 @@ on Python, PyQt5 and QtWebKit and free software, licensed under the GPL.
It was inspired by other browsers/addons like dwb and Vimperator/Pentadactyl.
// QUTE_WEB_HIDE
**qutebrowser is currently running a crowdfunding campaign to add support for
the QtWebEngine backend, which fixes many issues. Please
link:http://igg.me/at/qutebrowser[check it out]!**
// QUTE_WEB_HIDE_END
Screenshots
-----------
@@ -115,11 +111,8 @@ The following libraries are optional and provide a better user experience:
To generate the documentation for the `:help` command, when using the git
repository (rather than a release), http://asciidoc.org/[asciidoc] is needed.
The following libraries are optional and provide colored logging in the
console:
* https://pypi.python.org/pypi/colorlog/[colorlog]
* On Windows: https://pypi.python.org/pypi/colorama/[colorama]
On Windows, https://pypi.python.org/pypi/colorama/[colorama] is needed to
display colored log output.
See link:INSTALL.asciidoc[INSTALL] for directions on how to install qutebrowser
and its dependencies.
@@ -148,81 +141,104 @@ Contributors, sorted by the number of commits in descending order:
// QUTE_AUTHORS_START
* Florian Bruhin
* Daniel Schadt
* Ryan Roden-Corrent
* Antoni Boucher
* Lamar Pavel
* Bruno Oliveira
* Alexander Cogneau
* Martin Tournoij
* Felix Van der Jeugt
* Martin Tournoij
* Jakub Klinkovský
* Raphael Pierzina
* Joel Torstensson
* Jan Verbeek
* Tarcisio Fedrizzi
* Patric Schmitz
* Claude
* Corentin Julé
* meles5
* Tarcisio Fedrizzi
* Philipp Hansch
* Panagiotis Ktistakis
* Artur Shaik
* Nathan Isom
* Thorsten Wißmann
* Philipp Hansch
* Kevin Velghe
* Austin Anderson
* Jimmy
* Marshall Lochbaum
* Alexey "Averrin" Nabrodov
* avk
* ZDarian
* Milan Svoboda
* John ShaggyTwoDope Jenkins
* Jimmy
* Peter Vilim
* Clayton Craft
* Oliver Caldwell
* Jonas Schürmann
* Panagiotis Ktistakis
* Jakub Klinkovský
* skinnay
* error800
* Liam BEGUIN
* skinnay
* Zach-Button
* Tomasz Kramkowski
* Ismail S
* Halfwit
* David Vogt
* rikn00
* kanikaa1234
* haitaka
* Nick Ginther
* Michał Góral
* Michael Ilsaas
* Martin Zimmermann
* Fritz Reichwald
* Brian Jackson
* sbinix
* neeasade
* jnphilipp
* Tobias Patzl
* Stefan Tatschner
* Samuel Loury
* Peter Michely
* Panashe M. Fundira
* Link
* Larry Hynes
* Johannes Altmanninger
* Jeremy Kaplan
* Ismail
* Edgar Hipp
* Daryl Finlay
* adam
* Samir Benmendil
* Ryan Roden-Corrent
* Regina Hug
* Mathias Fussenegger
* Marcelo Santos
* Jean-Louis Fuchs
* Fritz V155 Reichwald
* Franz Fellner
* Corentin Jule
* zwarag
* xd1le
* oniondreams
* issue
* haxwithaxe
* evan
* dylan araps
* Tomasz Kramkowski
* Xitian9
* Tomas Orsava
* Tobias Werth
* Tim Harder
* Thiago Barroso Perrotta
* Stefan Tatschner
* Sorokin Alexei
* Samuel Loury
* Noah Huesser
* Matthias Lisin
* Marcel Schilling
* Johannes Martinsson
* Jean-Christophe Petkovich
* Jay Kamat
* Helen Sherwood-Taylor
* HalosGhost
* Gregor Pohl
* Eivind Uggedal
* Dietrich Daroch
* Daniel Lu
* Arseniy Seroka
* Andy Balaam
@@ -231,7 +247,8 @@ Contributors, sorted by the number of commits in descending order:
The following people have contributed graphics:
* WOFall (icon)
* Jad/link:http://yelostudio.com[yelo] (new icon)
* WOFall (original icon)
* regines (key binding cheatsheet)
Thanks / Similar projects
@@ -276,6 +293,7 @@ problems and helpful hints:
Also, thanks to:
* Everyone contributing to the link:doc/backers.asciidoc[crowdfunding].
* Everyone who had the patience to test qutebrowser before v0.1.
* Everyone triaging/fixing my bugs in the
https://bugreports.qt.io/secure/Dashboard.jspa[Qt bugtracker]

9
codecov.yml Normal file
View File

@@ -0,0 +1,9 @@
status:
project:
enabled: no
patch:
enabled: no
changes:
enabled: no
comment: off

172
doc/backers.asciidoc Normal file
View File

@@ -0,0 +1,172 @@
Crowdfunding backers
====================
Mid-2016, qutebrowser did run a http://igg.me/at/qutebrowser[crowdfunding] for
QtWebEngine support in qutebrowser.
Thanks a lot to the following people who contributed to it:
Gold sponsors
-------------
- Chris Salzberg
- Clayton Craft
- Jean-Louis Fuchs
- Matthias Lisin
- 1 Anonymous
Day sponsors
------------
- Agent 42
- Iggy Jackson
- James B
- Rudi Seitz
- Tim „Das MooL“ Wegener
- amd1212
- gavtroy
- 4 Anonymous
Other sponsors
--------------
- AP M
- Alessandro Balzano
- Allan Nordhøy
- Andor Uhlar
- Andreas Leppert
- Andreas Saga Romsdal
- Andrew Rogers / tuxlovesyou
- André Glüpker
- Arian Sanusi
- Arin Lares
- Assaf Lavie
- Baptiste Wicht
- Benjamin Richter
- Benjamin Schnitzler
- Bernardo Kuri
- Boris Kourtoukov
- Brian Buccola
- Bruno Oliveira
- Bryan Gilbert
- Cassandra Rebecca Ruppen
- Charles Saternos
- Chris H
- Christian Karl
- Christian Lange
- Christian Strasser
- Colin O'Brien
- Corsin Pfister
- Cosmin Popescu
- Daniel Andersson
- David Wilson
- Demure Demeanor
- Doug Stone-Weaver
- Eero Kari
- Enric Morales
- Eric Krohn
- Eskild Hustvedt
- Federico Panico
- Felix Van der Jeugt
- Francis Tseng
- Geir Isene
- George Voronin
- German Correa
- Grady Martin
- Gregor Böhl
- Guilherme Stein
- Hannes Doyle
- Hasan Soydabas
- Ian Scott
- Jacob Boldman
- Jacob Wikmark
- Jan Verbeek
- Jarrod Seccombe
- Joel Bradshaw
- Johannes Martinsson
- Jonas Schürmann
- Josh Medeiros
- José Alberto Orejuela García
- Julie Engel
- Jörg Behrmann
- Jørgen Skancke
- Kevin Velghe
- Konstantin Shmelkov
- Kyle Frazer
- Lukas Gierth
- Mar v Leeuwaarde
- Marek Roszman
- Marius Betz
- Marius Krämer
- Markus Schmidinger
- Martin Gabelmann
- Martin Zimmermann
- Mathias Fußenegger
- Maxime Wack
- Michał Góral
- Nathan Isom
- Nathanael Philipp
- Nils Stål
- Oliver Hope
- Oskar Nyberg
- Pablo Navarro
- Panashe M. Fundira
- Patric Schmitz
- Pete M
- Peter Smith
- Phil Collins
- Philipp Hansch
- Philipp Kuhnz
- Raphael Khaiat
- Raphael Pierzina
- Renan Guilherme
- Rick Losie
- Robert Cross
- Roy Van Ginneken
- Rupus Reinefjord
- Ryan Roden-Corrent
- Samir Benmendil
- Simon Giotta
- Stephen England
- Sverrir H Steindorsson
- Tarcisio Fedrizzi
- Thorsten Wißmann
- Timon Stampfli
- Tjelvar Olsson
- Tomasz Kramkowski
- Tsukiko Tsutsukakushi
- Vasilij Schneidermann
- Vinney Cavallo
- Wesly Grefrath
- Will Ware
- Yousaf Khurshid
- Zach Schultz
- averrin
- ben hengst
- colin
- craigtski47
- dag.robole
- daniel.m.kao
- diepfann3
- eamonn oneil
- esakaforever
- francois47
- glspisso
- gmccoy4242
- gtcee3
- jonathf
- lapinski.maciej
- lauri.hakko
- ljanzen
- mutilx9
- nussgipfel
- oed
- p p
- r.c.bruno.andre
- robert.perce
- sghctoma
- targy
- freelancer
- pupu
- regines
- 37 Anonymous

View File

@@ -8,7 +8,7 @@
|<<adblock-update,adblock-update>>|Update the adblock block lists.
|<<back,back>>|Go back in the history of the current tab.
|<<bind,bind>>|Bind a key to a command.
|<<bookmark-add,bookmark-add>>|Save the current page as a bookmark.
|<<bookmark-add,bookmark-add>>|Save the current page as a bookmark, or a specific url.
|<<bookmark-del,bookmark-del>>|Delete a bookmark.
|<<bookmark-load,bookmark-load>>|Load a bookmark.
|<<buffer,buffer>>|Select tab by index or url/title best match.
@@ -20,15 +20,19 @@
|<<download-open,download-open>>|Open the last/[count]th download.
|<<download-remove,download-remove>>|Remove the last/[count]th download from the list.
|<<download-retry,download-retry>>|Retry the first failed/[count]th download.
|<<edit-url,edit-url>>|Navigate to a url formed in an external editor.
|<<fake-key,fake-key>>|Send a fake keypress or key string to the website or qutebrowser.
|<<forward,forward>>|Go forward in the history of the current tab.
|<<fullscreen,fullscreen>>|Toggle fullscreen mode.
|<<help,help>>|Show help about a command or setting.
|<<hint,hint>>|Start hinting.
|<<history-clear,history-clear>>|Clear all browsing history.
|<<home,home>>|Open main startpage in current tab.
|<<inspector,inspector>>|Toggle the web inspector.
|<<jseval,jseval>>|Evaluate a JavaScript string.
|<<jump-mark,jump-mark>>|Jump to the mark named by `key`.
|<<later,later>>|Execute a command after some time.
|<<messages,messages>>|Show a log of past messages.
|<<navigate,navigate>>|Open typical prev/next links or navigate using the URL path.
|<<open,open>>|Open a URL in the current/[count]th tab.
|<<paste,paste>>|Open a page from the clipboard.
@@ -49,6 +53,7 @@
|<<session-save,session-save>>|Save a session.
|<<set,set>>|Set an option.
|<<set-cmd-text,set-cmd-text>>|Preset the statusbar to some text.
|<<set-mark,set-mark>>|Set a mark at the current scroll position in the current tab.
|<<spawn,spawn>>|Spawn a command in a shell.
|<<stop,stop>>|Stop loading in the current/[count]th tab.
|<<tab-clone,tab-clone>>|Duplicate the current tab.
@@ -91,13 +96,14 @@ How many pages to go back.
[[bind]]
=== bind
Syntax: +:bind [*--mode* 'MODE'] [*--force*] 'key' 'command'+
Syntax: +:bind [*--mode* 'mode'] [*--force*] 'key' ['command']+
Bind a key to a command.
==== positional arguments
* +'key'+: The keychain or special key (inside `<...>`) to bind.
* +'command'+: The command to execute, with optional args.
* +'command'+: The command to execute, with optional args, or not given to print the current binding.
==== optional arguments
* +*-m*+, +*--mode*+: A comma-separated list of modes to bind the key in (default: `normal`).
@@ -110,20 +116,28 @@ Bind a key to a command.
[[bookmark-add]]
=== bookmark-add
Save the current page as a bookmark.
Syntax: +:bookmark-add ['url'] ['title']+
Save the current page as a bookmark, or a specific url.
If no url and title are provided, then save the current page as a bookmark. If a url and title have been provided, then save the given url as a bookmark with the provided title. You can view all saved bookmarks on the link:qute://bookmarks[bookmarks page].
==== positional arguments
* +'url'+: url to save as a bookmark. If None, use url of current page.
* +'title'+: title of the new bookmark.
[[bookmark-del]]
=== bookmark-del
Syntax: +:bookmark-del 'url'+
Syntax: +:bookmark-del ['url']+
Delete a bookmark.
==== positional arguments
* +'url'+: The URL of the bookmark to delete.
* +'url'+: The url of the bookmark to delete. If not given, use the current page's url.
==== note
* This command does not split arguments after the last argument and handles quotes literally.
* With this command, +;;+ is interpreted literally instead of splitting off a second command.
[[bookmark-load]]
=== bookmark-load
@@ -141,7 +155,6 @@ Load a bookmark.
==== note
* This command does not split arguments after the last argument and handles quotes literally.
* With this command, +;;+ is interpreted literally instead of splitting off a second command.
[[buffer]]
=== buffer
@@ -161,7 +174,7 @@ Close the current window.
[[download]]
=== download
Syntax: +:download [*--mhtml*] [*--dest* 'DEST'] ['url'] ['dest-old']+
Syntax: +:download [*--mhtml*] [*--dest* 'dest'] ['url'] ['dest-old']+
Download a given URL, or current page if no URL given.
@@ -223,6 +236,22 @@ Retry the first failed/[count]th download.
==== count
The index of the download to retry.
[[edit-url]]
=== edit-url
Syntax: +:edit-url [*--bg*] [*--tab*] [*--window*] ['url']+
Navigate to a url formed in an external editor.
The editor which should be launched can be configured via the `general -> editor` config option.
==== positional arguments
* +'url'+: URL to edit; defaults to the current page url.
==== optional arguments
* +*-b*+, +*--bg*+: Open in a new background tab.
* +*-t*+, +*--tab*+: Open in a new tab.
* +*-w*+, +*--window*+: Open in a new window.
[[fake-key]]
=== fake-key
Syntax: +:fake-key [*--global*] 'keystring'+
@@ -285,6 +314,7 @@ Start hinting.
- `all`: All clickable elements.
- `links`: Only links.
- `images`: Only images.
- `inputs`: Only input fields.
@@ -331,6 +361,15 @@ Start hinting.
`window`, `run`, `hover`, `userscript` and `spawn`.
==== note
* This command does not split arguments after the last argument and handles quotes literally.
[[history-clear]]
=== history-clear
Clear all browsing history.
Note this only clears the global history (e.g. `~/.local/share/qutebrowser/history` on Linux) but not cookies, the back/forward history of a tab, cache or other persistent data.
[[home]]
=== home
Open main startpage in current tab.
@@ -357,6 +396,15 @@ Evaluate a JavaScript string.
* This command does not split arguments after the last argument and handles quotes literally.
* With this command, +;;+ is interpreted literally instead of splitting off a second command.
[[jump-mark]]
=== jump-mark
Syntax: +:jump-mark 'key'+
Jump to the mark named by `key`.
==== positional arguments
* +'key'+: mark identifier; capital indicates a global mark
[[later]]
=== later
Syntax: +:later 'ms' 'command'+
@@ -371,6 +419,22 @@ Execute a command after some time.
* This command does not split arguments after the last argument and handles quotes literally.
* With this command, +;;+ is interpreted literally instead of splitting off a second command.
[[messages]]
=== messages
Syntax: +:messages [*--plain*] [*--tab*] [*--bg*] [*--window*] ['level']+
Show a log of past messages.
==== positional arguments
* +'level'+: Include messages with `level` or higher severity. Valid values: vdebug, debug, info, warning, error, critical.
==== optional arguments
* +*-p*+, +*--plain*+: Whether to show plaintext (as opposed to html).
* +*-t*+, +*--tab*+: Open in a new tab.
* +*-b*+, +*--bg*+: Open in a background tab.
* +*-w*+, +*--window*+: Open in a new window.
[[navigate]]
=== navigate
Syntax: +:navigate [*--tab*] [*--bg*] [*--window*] 'where'+
@@ -415,7 +479,6 @@ The tab index to open the URL in.
==== note
* This command does not split arguments after the last argument and handles quotes literally.
* With this command, +;;+ is interpreted literally instead of splitting off a second command.
[[paste]]
=== paste
@@ -433,12 +496,13 @@ If the pasted text contains newlines, each line gets opened in its own tab.
[[print]]
=== print
Syntax: +:print [*--preview*]+
Syntax: +:print [*--preview*] [*--pdf* 'file']+
Print the current/[count]th tab.
==== optional arguments
* +*-p*+, +*--preview*+: Show preview instead of printing.
* +*-f*+, +*--pdf*+: The file path to write the PDF to.
==== count
The tab index to print.
@@ -449,22 +513,25 @@ Syntax: +:quickmark-add 'url' 'name'+
Add a new quickmark.
You can view all saved quickmarks on the link:qute://bookmarks[bookmarks page].
==== positional arguments
* +'url'+: The url to add as quickmark.
* +'name'+: The name for the new quickmark.
[[quickmark-del]]
=== quickmark-del
Syntax: +:quickmark-del 'name'+
Syntax: +:quickmark-del ['name']+
Delete a quickmark.
==== positional arguments
* +'name'+: The name of the quickmark to delete.
* +'name'+: The name of the quickmark to delete. If not given, delete the quickmark for the current page (choosing one arbitrarily
if there are more than one).
==== note
* This command does not split arguments after the last argument and handles quotes literally.
* With this command, +;;+ is interpreted literally instead of splitting off a second command.
[[quickmark-load]]
=== quickmark-load
@@ -482,7 +549,6 @@ Load a quickmark.
==== note
* This command does not split arguments after the last argument and handles quotes literally.
* With this command, +;;+ is interpreted literally instead of splitting off a second command.
[[quickmark-save]]
=== quickmark-save
@@ -550,7 +616,6 @@ Search for a text on the current page. With no text, clear results.
==== note
* This command does not split arguments after the last argument and handles quotes literally.
* With this command, +;;+ is interpreted literally instead of splitting off a second command.
[[session-delete]]
=== session-delete
@@ -618,6 +683,8 @@ Syntax: +:set-cmd-text [*--space*] [*--append*] 'text'+
Preset the statusbar to some text.
You can use the `{url}` and `{url:pretty}` variables here which will get replaced by the encoded/decoded URL.
==== positional arguments
* +'text'+: The commandline to set.
@@ -627,7 +694,15 @@ Preset the statusbar to some text.
==== note
* This command does not split arguments after the last argument and handles quotes literally.
* With this command, +;;+ is interpreted literally instead of splitting off a second command.
[[set-mark]]
=== set-mark
Syntax: +:set-mark 'key'+
Set a mark at the current scroll position in the current tab.
==== positional arguments
* +'key'+: mark identifier; capital indicates a global mark
[[spawn]]
=== spawn
@@ -635,7 +710,7 @@ Syntax: +:spawn [*--userscript*] [*--verbose*] [*--detach*] 'cmdline'+
Spawn a command in a shell.
Note the {url} variable which gets replaced by the current URL might be useful here.
Note the `{url}` and `{url:pretty}` variables might be useful here. `{url}` gets replaced by the URL in fully encoded format and `{url:pretty}` uses a "pretty form" with most percent-encoded characters decoded.
==== positional arguments
* +'cmdline'+: The commandline to execute.
@@ -652,7 +727,6 @@ Note the {url} variable which gets replaced by the current URL might be useful h
==== note
* This command does not split arguments after the last argument and handles quotes literally.
* With this command, +;;+ is interpreted literally instead of splitting off a second command.
[[stop]]
=== stop
@@ -699,7 +773,8 @@ Select the tab given as argument/[count].
If neither count nor index are given, it behaves like tab-next.
==== positional arguments
* +'index'+: The tab index to focus, starting with 1. The special value `last` focuses the last focused tab.
* +'index'+: The tab index to focus, starting with 1. The special value `last` focuses the last focused tab. Negative indexes
counts from the end, such that -1 is the last tab.
==== count
@@ -773,7 +848,7 @@ Save open pages and quit.
[[yank]]
=== yank
Syntax: +:yank [*--title*] [*--sel*] [*--domain*]+
Syntax: +:yank [*--title*] [*--sel*] [*--domain*] [*--pretty*]+
Yank the current URL/title to the clipboard or primary selection.
@@ -781,6 +856,7 @@ Yank the current URL/title to the clipboard or primary selection.
* +*-t*+, +*--title*+: Yank the title instead of the URL.
* +*-s*+, +*--sel*+: Use the primary selection instead of the clipboard.
* +*-d*+, +*--domain*+: Yank only the scheme, domain, and port number.
* +*-p*+, +*--pretty*+: Yank the URL in pretty decoded form.
[[yank-selected]]
=== yank-selected
@@ -860,7 +936,9 @@ How many steps to zoom out.
|<<paste-primary,paste-primary>>|Paste the primary selection at cursor position.
|<<prompt-accept,prompt-accept>>|Accept the current prompt.
|<<prompt-no,prompt-no>>|Answer no to a yes/no prompt.
|<<prompt-open-download,prompt-open-download>>|Immediately open a download.
|<<prompt-yes,prompt-yes>>|Answer yes to a yes/no prompt.
|<<repeat-command,repeat-command>>|Repeat the last executed command.
|<<rl-backward-char,rl-backward-char>>|Move back a character.
|<<rl-backward-delete-char,rl-backward-delete-char>>|Delete the character before the cursor.
|<<rl-backward-word,rl-backward-word>>|Move back to the start of the current or previous word.
@@ -1083,10 +1161,21 @@ Accept the current prompt.
=== prompt-no
Answer no to a yes/no prompt.
[[prompt-open-download]]
=== prompt-open-download
Immediately open a download.
[[prompt-yes]]
=== prompt-yes
Answer yes to a yes/no prompt.
[[repeat-command]]
=== repeat-command
Repeat the last executed command.
==== count
Which count to pass the command.
[[rl-backward-char]]
=== rl-backward-char
Move back a character.
@@ -1222,7 +1311,7 @@ Scroll the current tab by 'count * dx/dy' pixels.
==== positional arguments
* +'dx'+: How much to scroll in x-direction.
* +'dy'+: How much to scroll in x-direction.
* +'dy'+: How much to scroll in y-direction.
==== count
multiplier

View File

@@ -5,7 +5,6 @@
|==============
|Setting|Description
|<<general-ignore-case,ignore-case>>|Whether to find text on a page case-insensitively.
|<<general-wrap-search,wrap-search>>|Whether to wrap finding text to the top when arriving at the end.
|<<general-startpage,startpage>>|The default page(s) to open at the start, separated by commas.
|<<general-default-page,default-page>>|The page to open if :open -t/-b/-w is used without URL. Use `about:blank` for a blank page.
|<<general-auto-search,auto-search>>|Whether to start a search when something else than a URL is entered.
@@ -33,10 +32,10 @@
|<<ui-zoom-levels,zoom-levels>>|The available zoom levels, separated by commas.
|<<ui-default-zoom,default-zoom>>|The default zoom level.
|<<ui-downloads-position,downloads-position>>|Where to show the downloaded files.
|<<ui-status-position,status-position>>|The position of the status bar.
|<<ui-message-timeout,message-timeout>>|Time (in ms) to show messages in the statusbar for.
|<<ui-message-unfocused,message-unfocused>>|Whether to show messages in unfocused windows.
|<<ui-confirm-quit,confirm-quit>>|Whether to confirm quitting the application.
|<<ui-display-statusbar-messages,display-statusbar-messages>>|Whether to display javascript statusbar messages.
|<<ui-zoom-text-only,zoom-text-only>>|Whether the zoom factor on a frame applies only to the text or to all content.
|<<ui-frame-flattening,frame-flattening>>|Whether to expand each subframe to its contents.
|<<ui-user-stylesheet,user-stylesheet>>|User stylesheet to use (absolute filename, filename relative to the config directory or CSS string). Will expand environment variables.
@@ -49,6 +48,7 @@
|<<ui-hide-mouse-cursor,hide-mouse-cursor>>|Whether to hide the mouse cursor.
|<<ui-modal-js-dialog,modal-js-dialog>>|Use standard JavaScript modal dialog for alert() and confirm()
|<<ui-hide-wayland-decoration,hide-wayland-decoration>>|Hide the window decoration when using wayland (requires restart)
|<<ui-keyhint-blacklist,keyhint-blacklist>>|Keychains that shouldn't be shown in the keyhint dialog
|==============
.Quick reference for section ``network''
@@ -63,6 +63,7 @@
|<<network-proxy-dns-requests,proxy-dns-requests>>|Whether to send DNS requests over the configured proxy.
|<<network-ssl-strict,ssl-strict>>|Whether to validate SSL handshakes.
|<<network-dns-prefetch,dns-prefetch>>|Whether to try to pre-fetch DNS entries to speed up browsing.
|<<network-custom-headers,custom-headers>>|Set custom headers for qutebrowser HTTP requests.
|==============
.Quick reference for section ``completion''
@@ -177,12 +178,14 @@
|<<hints-mode,mode>>|Mode to use for hints.
|<<hints-chars,chars>>|Chars used for hint strings.
|<<hints-min-chars,min-chars>>|Minimum number of chars used for hint strings.
|<<hints-scatter,scatter>>|Whether to scatter hint key chains (like Vimium) or not (like dwb).
|<<hints-scatter,scatter>>|Whether to scatter hint key chains (like Vimium) or not (like dwb). Ignored for number hints.
|<<hints-uppercase,uppercase>>|Make chars in hint strings uppercase.
|<<hints-dictionary,dictionary>>|The dictionary file to be used by the word hints.
|<<hints-auto-follow,auto-follow>>|Follow a hint immediately when the hint text is completely matched.
|<<hints-auto-follow-timeout,auto-follow-timeout>>|A timeout to inhibit normal-mode key bindings after a successfulauto-follow.
|<<hints-next-regexes,next-regexes>>|A comma-separated list of regexes to use for 'next' links.
|<<hints-prev-regexes,prev-regexes>>|A comma-separated list of regexes to use for 'prev' links.
|<<hints-find-implementation,find-implementation>>|Which implementation to use to find elements to hint.
|==============
.Quick reference for section ``colors''
@@ -252,6 +255,9 @@
|<<colors-downloads.fg.error,downloads.fg.error>>|Foreground color for downloads with errors.
|<<colors-downloads.bg.error,downloads.bg.error>>|Background color for downloads with errors.
|<<colors-webpage.bg,webpage.bg>>|Background color for webpages if unset (or empty to use the theme's color)
|<<colors-keyhint.fg,keyhint.fg>>|Text color for the keyhint widget.
|<<colors-keyhint.fg.suffix,keyhint.fg.suffix>>|Highlight color for keys to complete the current keychain
|<<colors-keyhint.bg,keyhint.bg>>|Background color of the keyhint widget.
|==============
.Quick reference for section ``fonts''
@@ -275,6 +281,7 @@
|<<fonts-web-size-minimum-logical,web-size-minimum-logical>>|The minimum logical font size that is applied when zooming out.
|<<fonts-web-size-default,web-size-default>>|The default font size for regular text.
|<<fonts-web-size-default-fixed,web-size-default-fixed>>|The default font size for fixed-pitch text.
|<<fonts-keyhint,keyhint>>|Font used in the keyhint widget.
|==============
== general
@@ -292,17 +299,6 @@ Valid values:
Default: +pass:[smart]+
[[general-wrap-search]]
=== wrap-search
Whether to wrap finding text to the top when arriving at the end.
Valid values:
* +true+
* +false+
Default: +pass:[true]+
[[general-startpage]]
=== startpage
The default page(s) to open at the start, separated by commas.
@@ -508,6 +504,17 @@ Valid values:
Default: +pass:[top]+
[[ui-status-position]]
=== status-position
The position of the status bar.
Valid values:
* +top+
* +bottom+
Default: +pass:[bottom]+
[[ui-message-timeout]]
=== message-timeout
Time (in ms) to show messages in the statusbar for.
@@ -538,17 +545,6 @@ Valid values:
Default: +pass:[never]+
[[ui-display-statusbar-messages]]
=== display-statusbar-messages
Whether to display javascript statusbar messages.
Valid values:
* +true+
* +false+
Default: +pass:[false]+
[[ui-zoom-text-only]]
=== zoom-text-only
Whether the zoom factor on a frame applies only to the text or to all content.
@@ -629,6 +625,7 @@ The format to use for the window title. The following placeholders are defined:
* `{title_sep}`: The string ` - ` if a title is set, empty otherwise.
* `{id}`: The internal window ID of this window.
* `{scroll_pos}`: The page scroll position.
* `{host}`: The host of the current web page.
Default: +pass:[{perc}{title}{title_sep}qutebrowser]+
@@ -665,6 +662,14 @@ Valid values:
Default: +pass:[false]+
[[ui-keyhint-blacklist]]
=== keyhint-blacklist
Keychains that shouldn't be shown in the keyhint dialog
Globs are supported, so ';*' will blacklist all keychainsstarting with ';'. Use '*' to disable keyhints
Default: empty
== network
Settings related to the network.
@@ -750,6 +755,12 @@ Valid values:
Default: +pass:[true]+
[[network-custom-headers]]
=== custom-headers
Set custom headers for qutebrowser HTTP requests.
Default: empty
== completion
Options related to completion and command history.
@@ -856,13 +867,17 @@ Options related to input modes.
=== timeout
Timeout for ambiguous key bindings.
If the current input forms both a complete match and a partial match, the complete match will be executed after this time.
Default: +pass:[500]+
[[input-partial-timeout]]
=== partial-timeout
Timeout for partially typed key bindings.
Default: +pass:[1000]+
If the current input forms only partial matches, the keystring will be cleared after this time.
Default: +pass:[5000]+
[[input-insert-mode-on-plugins]]
=== insert-mode-on-plugins
@@ -1127,6 +1142,7 @@ The format to use for the tab title. The following placeholders are defined:
* `{index}`: The index of this tab.
* `{id}`: The internal tab ID of this tab.
* `{scroll_pos}`: The page scroll position.
* `{host}`: The host of the current web page.
Default: +pass:[{index}: {title}]+
@@ -1321,7 +1337,7 @@ Valid values:
* +true+
* +false+
Default: +pass:[true]+
Default: +pass:[false]+
[[content-css-regions]]
=== css-regions
@@ -1557,7 +1573,7 @@ Default: +pass:[1]+
[[hints-scatter]]
=== scatter
Whether to scatter hint key chains (like Vimium) or not (like dwb).
Whether to scatter hint key chains (like Vimium) or not (like dwb). Ignored for number hints.
Valid values:
@@ -1594,6 +1610,12 @@ Valid values:
Default: +pass:[true]+
[[hints-auto-follow-timeout]]
=== auto-follow-timeout
A timeout to inhibit normal-mode key bindings after a successfulauto-follow.
Default: +pass:[0]+
[[hints-next-regexes]]
=== next-regexes
A comma-separated list of regexes to use for 'next' links.
@@ -1606,6 +1628,17 @@ A comma-separated list of regexes to use for 'prev' links.
Default: +pass:[\bprev(ious)?\b,\bback\b,\bolder\b,\b[&lt;←≪]\b,\b(&lt;&lt;|«)\b]+
[[hints-find-implementation]]
=== find-implementation
Which implementation to use to find elements to hint.
Valid values:
* +javascript+: Better but slower
* +python+: Slightly worse but faster
Default: +pass:[javascript]+
== searchengines
Definitions of search engines which can be used via the address bar.
The searchengine named `DEFAULT` is used when `general -> auto-search` is true and something else than a URL was entered to be opened. Other search engines can be used by prepending the search engine name to the search term, e.g. `:open google qutebrowser`. The string `{}` will be replaced by the search term, use `{{` and `}}` for literal `{`/`}` signs.
@@ -1621,7 +1654,7 @@ Colors used in the UI.
A value can be in one of the following format:
* `#RGB`/`#RRGGBB`/`#RRRGGGBBB`/`#RRRRGGGGBBBB`
* A SVG color name as specified in http://www.w3.org/TR/SVG/types.html#ColorKeywords[the W3C specification].
* An SVG color name as specified in http://www.w3.org/TR/SVG/types.html#ColorKeywords[the W3C specification].
* transparent (no color)
* `rgb(r, g, b)` / `rgba(r, g, b, a)` (values 0-255 or percentages)
* `hsv(h, s, v)` / `hsva(h, s, v, a)` (values 0-255, hue 0-359)
@@ -2030,6 +2063,24 @@ Background color for webpages if unset (or empty to use the theme's color)
Default: +pass:[white]+
[[colors-keyhint.fg]]
=== keyhint.fg
Text color for the keyhint widget.
Default: +pass:[#FFFFFF]+
[[colors-keyhint.fg.suffix]]
=== keyhint.fg.suffix
Highlight color for keys to complete the current keychain
Default: +pass:[#FFFF00]+
[[colors-keyhint.bg]]
=== keyhint.bg
Background color of the keyhint widget.
Default: +pass:[rgba(0, 0, 0, 80%)]+
== fonts
Fonts used for the UI, with optional style/weight/size.
@@ -2138,3 +2189,9 @@ Default: empty
The default font size for fixed-pitch text.
Default: empty
[[fonts-keyhint]]
=== keyhint
Font used in the keyhint widget.
Default: +pass:[8pt ${_monospace}]+

View File

@@ -5,10 +5,23 @@ The Compiler <mail@qutebrowser.org>
NOTE: This page will only appear on the first start. To view it at a later
time, use the `:help` command.
Basic keybindings to get you started
------------------------------------
* Use the arrow keys or `hjkl` to move around a webpage (vim-like syntax is used in quite a few places)
* To go to a new webpage, press `o`, then type a url, then press Enter (Use `O` to open the url in a new tab). If what you've typed isn't a url, then a search engine will be used instead (DuckDuckGo, by default)
* To switch between tabs, use `J` (next tab) and `K` (previous tab), or press `<Alt-num>`, where `num` is the position of the tab to switch to
* To close the current tab, press `d` (and press `u` to undo closing a tab)
* Use `H` and `L` to go back and forth in the history
* To click on something without using the mouse, press `f` to show the hints, then type the keys next to what you want to click on (if that sounds weird, then just try pressing `f` and see what happens)
* Press `:` to show the commandline
* To search in a page, press `/`, type the phrase to search for, then press Enter. Use `n` and `N` to go back and forth through the matches, and press Esc to stop doing the search.
* To close qutebrowser, press `Alt-F4`, or `:q`, or `:wq` to save the currently open tabs and quit (note that in the settings you can make qutebrowser always save the currently open tabs)
What to do now
--------------
* View the http://qutebrowser.org/img/cheatsheet-big.png[key binding cheatsheet]
* View the link:http://qutebrowser.org/img/cheatsheet-big.png[key binding cheatsheet]
to make yourself familiar with the key bindings: +
image:http://qutebrowser.org/img/cheatsheet-small.png["qutebrowser key binding cheatsheet",link="http://qutebrowser.org/img/cheatsheet-big.png"]
* Run `:adblock-update` to download adblock lists and activate adblocking.

View File

@@ -65,6 +65,9 @@ show it.
*--target* '{auto,tab,tab-bg,tab-silent,tab-bg-silent,window}'::
How URLs should be opened if there is already a qutebrowser instance running.
*--backend* '{webkit,webengine}'::
Which backend to use (webengine backend is EXPERIMENTAL!).
=== debug arguments
*-l* '{critical,error,warning,info,debug,vdebug}', *--loglevel* '{critical,error,warning,info,debug,vdebug}'::
Set loglevel
@@ -78,9 +81,15 @@ show it.
*--debug*::
Turn on debugging options.
*--json-logging*::
Output log lines in JSON format (one object per line).
*--nocolor*::
Turn off colored logging.
*--force-color*::
Force colored logging
*--harfbuzz* '{old,new,system,auto}'::
HarfBuzz engine version to use. Default: auto.

View File

@@ -50,7 +50,7 @@ $ git checkout symbols
$ export DEBUG_CFLAGS='-ggdb3 -fvar-tracking-assignments -Og'
$ export DEBUG_CXXFLAGS='-ggdb3 -fvar-tracking-assignments -Og'
$ cd qt5
$ makepkg -si --pkg qt5-base-debug,qt5-webkit-debug
$ makepkg -si --pkg qt5-base-debug,qt5-webkit-debug,qt5-webengine-debug
$ cd ../pyqt5
$ makepkg -si --pkg pyqt5-common-debug,python-pyqt5-debug
----
@@ -76,7 +76,7 @@ Server = http://qutebrowser.org/qt-debug/$arch
Then install the packages:
----
# pacman -Suy pyqt5-common-debug python-pyqt5-debug qt5-base-debug qt5-webkit-debug
# pacman -Suy pyqt5-common-debug python-pyqt5-debug qt5-base-debug qt5-webkit-debug,qt5-webengine-debug
----
The `-debug` packages conflict with the non-debug variants - it's safe to

View File

@@ -33,6 +33,9 @@ The following environment variables will be set when a userscript is launched:
- `QUTE_FIFO`: The FIFO or file to write commands to.
- `QUTE_HTML`: Path of a file containing the HTML source of the current page.
- `QUTE_TEXT`: Path of a file containing the plaintext of the current page.
- `QUTE_CONFIG_DIR`: Path of the directory containing qutebrowser's configuration.
- `QUTE_DATA_DIR`: Path of the directory containing qutebrowser's data.
- `QUTE_DOWNLOAD_DIR`: Path of the downloads directory.
In `command` mode:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 872 B

After

Width:  |  Height:  |  Size: 945 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

2183
icons/qutebrowser-all.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 128 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 45 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 16 KiB

207
icons/qutebrowser.xpm Normal file
View File

@@ -0,0 +1,207 @@
/* XPM */
static char *qutebrowser[] = {
/* columns rows colors chars-per-pixel */
"32 32 169 2 ",
" c #0A396E",
". c #0B3C72",
"X c #0B4077",
"o c #0C437B",
"O c #134175",
"+ c #15467C",
"@ c #18477B",
"# c #1A497D",
"$ c #0D4B86",
"% c #0F4E8D",
"& c #124A80",
"* c #1F4F83",
"= c #0E518C",
"- c #1F5084",
"; c #11508C",
": c #0F5193",
"> c #115799",
", c #115B9C",
"< c #204F83",
"1 c #245287",
"2 c #2A598C",
"3 c #325E8F",
"4 c #11609F",
"5 c #346496",
"6 c #3B6898",
"7 c #115CA1",
"8 c #115EAC",
"9 c #1263A3",
"0 c #1260AD",
"q c #136BAC",
"w c #136BB2",
"e c #1366BA",
"r c #196BB2",
"t c #157ABB",
"y c #1577BB",
"u c #2E6DB0",
"i c #387FB1",
"p c #456E9A",
"a c #4873A1",
"s c #4375AA",
"d c #507AA6",
"f c #597EA4",
"g c #4D7EB3",
"h c #156FCB",
"j c #167AC5",
"k c #1675CA",
"l c #177BCE",
"z c #1777D8",
"x c #1476E4",
"c c #167BE6",
"v c #167DE8",
"b c #197EEF",
"n c #1A7FF0",
"m c #1A80BE",
"M c #5F87AF",
"N c #5D8BBA",
"B c #5A84B1",
"V c #6C8FB3",
"C c #6F96BE",
"Z c #1886CC",
"A c #1883D7",
"S c #198DD5",
"D c #1987D9",
"F c #198ADC",
"G c #1A96DC",
"H c #3090D9",
"J c #1682E9",
"K c #1983ED",
"L c #1689E9",
"P c #1A8DEE",
"I c #1B95ED",
"U c #1C9EEA",
"Y c #1B97E4",
"T c #1A84F2",
"R c #1A8BF2",
"E c #1C94F4",
"W c #1D9CF5",
"Q c #3388E6",
"! c #3D90E9",
"~ c #228EF3",
"^ c #229FF6",
"/ c #3294F4",
"( c #3D9FF6",
") c #339CF4",
"_ c #1CA2E5",
"` c #1DABEE",
"' c #1DA4F6",
"] c #1EA9F7",
"[ c #1EADF8",
"{ c #1FB4F9",
"} c #1FB9FA",
"| c #20ACF8",
" . c #27A4F6",
".. c #3DA9F6",
"X. c #20B9FA",
"o. c #2EB6F9",
"O. c #458DC9",
"+. c #5C8DC1",
"@. c #5795C6",
"#. c #709DCB",
"$. c #74A8DD",
"%. c #4A97EA",
"&. c #4896EA",
"*. c #559EEA",
"=. c #439AF5",
"-. c #46A3F6",
";. c #5FA9F6",
":. c #5EA6F3",
">. c #47BCF9",
",. c #51B5F8",
"<. c #58BDF8",
"1. c #68ABEF",
"2. c #7DB9E7",
"3. c #63AEF7",
"4. c #6FB1F7",
"5. c #66B9F8",
"6. c #61B2F6",
"7. c #71B4F7",
"8. c #78B7F4",
"9. c #72BFF9",
"0. c #3BC0FA",
"q. c #6FCEFB",
"w. c #6CC5FA",
"e. c #7BCAF9",
"r. c #89A7C3",
"t. c #83A2C1",
"y. c #98B6D3",
"u. c #9DB9D3",
"i. c #89B6E4",
"p. c #83B6E9",
"a. c #81BDF7",
"s. c #83BFF8",
"d. c #9EC4E9",
"f. c #8CC2F9",
"g. c #85CDFB",
"h. c #87C4F9",
"j. c #92C6F9",
"k. c #95CAFA",
"l. c #9CCBFA",
"z. c #89D7FC",
"x. c #91D9FC",
"c. c #9CDEFD",
"v. c #9ED2FB",
"b. c #A7CAEC",
"n. c #B5CEE3",
"m. c #A1CEFA",
"M. c #AED0F0",
"N. c #ACD6FA",
"B. c #A0DFFC",
"V. c #AFD8FC",
"C. c #B5D9FB",
"Z. c #BCDDFC",
"A. c #BFDCF5",
"S. c #ACE3FD",
"D. c #B5E5FE",
"F. c #BBE2FC",
"G. c #CFE5F5",
"H. c #C3E1FC",
"J. c #CAE6FD",
"K. c #CCEBFD",
"L. c #C4EBFE",
"P. c #D6EDFE",
"I. c #DAEEFD",
"U. c #DEF1FE",
"Y. c #D6F2FE",
"T. c #E4F4FE",
"R. c #E9F6FE",
"E. c #EBF8FF",
"W. c None",
/* pixels */
"W.W.W.W.W.W.W.W.W.W.W.c.S.L.Y.E.E.S.X.} W.W.W.W.W.W.W.W.W.W.W.W.",
"W.W.W.W.W.W.W.W.W.D.T.E.E.T.L.D.c.z.} } X.} } W.W.W.W.W.W.W.W.W.",
"W.W.W.W.W.W.W.B.T.T.R.T.R.U.0.X.z.S.} } } } { { X.W.W.W.W.W.W.W.",
"W.W.W.W.W.W.x.x.K.T.T.T.L.P.q.o.{ } } ` _ { { { { { W.W.W.W.W.W.",
"W.W.W.W.W.c.P.D.G.u.r.i 9 Z _ { { G 4 X t { { { { { { W.W.W.W.W.",
"W.W.W.W.K.U.n.f O { = t { { { { [ { { W.W.W.W.",
"W.W.W.F.I.t.. ' t { { [ [ [ [ [ >.W.W.W.",
"W.W.x.P.V ' X t ` [ [ [ [ [ [ o.e.W.W.",
"W.W.J.y. X t S Y Z $ ' . y [ [ [ ] [ [ | Z.J.W.W.",
"W.<.e.& , _ ] ] [ ] U . ' . y [ ' [ ] ] ] w.K.J.g.W.",
"W.' S o ' ' [ ' [ ' ] o ' . y Y 9 = = 9 @.J.J.J.F.W.",
"W.| , j ' ' ' ' ' ' ' o ' . $ p A.J.J.g.",
"' .. G ' ' ' ' ' ' ' o ' . M H.H.h.",
",.2. . W ' W ' ' ' ' W . ' . M.A.x.",
"N.M.. . W W W ' W W W W .w 9 I U 0 #.Z.m.",
" .9.O D W W W W ' W j $ % F W W W .5 d Z.C.",
"W W ; 9 9.h.5...Q % o j W W W W W W O. 3 C.N.",
"E W 7 B b.d.a . w E E W W W E W E A @ C.l.",
"I E l u W E W E W E E E E A . - k.6.",
"P E E 7 m.o E E E E E E E E l . = E P ",
"L E E E > . O s.o E E E E E E E E 7 , E L ",
"W.R E R ) #.5 1 6 N i.2 s.+ E E E E E E R L . k R W.",
"W.L R E -.m.m.m.m.m.m.2 m.@ N m.m.s.( R R % X E J W.",
"W.W.K R ~ a.m.l.l.l.l.2 s.+ < i.l.m.j.h % e K W.W.",
"W.W.J R R / l.l.l.l.k.2 s.+ * 5 + 8 R J W.W.",
"W.W.W.v T R 3.k.k.j.k.2 2 j.& . 8 R v W.W.W.",
"W.W.W.W.J T ~ 7.j.j.j.g +.p.j.s.+. . . : z T v W.W.W.W.",
"W.W.W.W.W.c T T =.f.j.j.s.j.j.j.j.$.g s u e h b T T v W.W.W.W.W.",
"W.W.W.W.W.W.c b n 4.f.f.s.m.s.s.s.j.s.j./ T n T b c W.W.W.W.W.W.",
"W.W.W.W.W.W.W.c x 1.s.s.s.s.s.s.s.s.4.=.n T n c c W.W.W.W.W.W.W.",
"W.W.W.W.W.W.W.W.W.&.*.1.a.s.s.s.s.3.n n v x x W.W.W.W.W.W.W.W.W.",
"W.W.W.W.W.W.W.W.W.W.W.%.%.%.%.*.*.Q x x x W.W.W.W.W.W.W.W.W.W.W."
};

View File

@@ -5,9 +5,18 @@ ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -y update && \
apt-get -y dist-upgrade && \
apt-get -y install python3-pyqt5 python3-pyqt5.qtwebkit python-tox \
python3-sip xvfb git python3-setuptools wget \
herbstluftwm locales
apt-get -y install --no-install-recommends \
python3-pyqt5 \
python3-pyqt5.qtwebkit \
python-tox \
python3-sip \
xvfb \
git \
python3-setuptools \
wget \
herbstluftwm \
locales \
libjs-pdf
RUN echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen && locale-gen
RUN useradd user && mkdir /home/user && chown -R user:users /home/user

View File

@@ -1,13 +1,25 @@
FROM ubuntu:wily
FROM ubuntu:xenial
MAINTAINER Florian Bruhin <me@the-compiler.org>
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -y update && \
apt-get -y dist-upgrade && \
apt-get -y install python3-pyqt5 python3-pyqt5.qtwebkit python-tox \
python3-sip xvfb git python3-setuptools wget \
herbstluftwm language-pack-en
apt-get -y install --no-install-recommends \
python3-pyqt5 \
python3-pyqt5.qtwebkit \
python-tox \
python3-sip \
xvfb \
git \
python3-setuptools \
wget \
herbstluftwm \
language-pack-en \
libjs-pdf \
dbus
RUN dbus-uuidgen --ensure
RUN useradd user && mkdir /home/user && chown -R user:users /home/user
USER user
@@ -22,4 +34,4 @@ CMD Xvfb -screen 0 800x600x24 :0 & \
herbstluftwm & \
git clone /outside qutebrowser.git && \
cd qutebrowser.git && \
tox -e py34
tox -e py35

View File

@@ -1,7 +0,0 @@
These files are copied from Qt's source tree in
src/plugins/platforms/cocoa/qt_menu.nib at revision
b8246f08e49eb672974fd3d3d972a5ff13c1524d.
http://code.qt.io/cgit/qt/qtbase.git/tree/src/plugins/platforms/cocoa/qt_menu.nib
They are needed for cx_Freeze and don't seem to be bundled with Qt anymore.

View File

@@ -1,59 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBClasses</key>
<array>
<dict>
<key>ACTIONS</key>
<dict>
<key>hide</key>
<string>id</string>
<key>hideOtherApplications</key>
<string>id</string>
<key>orderFrontStandardAboutPanel</key>
<string>id</string>
<key>qtDispatcherToQPAMenuItem</key>
<string>id</string>
<key>terminate</key>
<string>id</string>
<key>unhideAllApplications</key>
<string>id</string>
</dict>
<key>CLASS</key>
<string>QCocoaMenuLoader</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>OUTLETS</key>
<dict>
<key>aboutItem</key>
<string>NSMenuItem</string>
<key>aboutQtItem</key>
<string>NSMenuItem</string>
<key>appMenu</key>
<string>NSMenu</string>
<key>hideItem</key>
<string>NSMenuItem</string>
<key>preferencesItem</key>
<string>NSMenuItem</string>
<key>quitItem</key>
<string>NSMenuItem</string>
<key>theMenu</key>
<string>NSMenu</string>
</dict>
<key>SUPERCLASS</key>
<string>NSResponder</string>
</dict>
<dict>
<key>CLASS</key>
<string>FirstResponder</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
<string>NSObject</string>
</dict>
</array>
<key>IBVersion</key>
<string>1</string>
</dict>
</plist>

View File

@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBFramework Version</key>
<string>672</string>
<key>IBOldestOS</key>
<integer>5</integer>
<key>IBOpenObjects</key>
<array>
<integer>57</integer>
</array>
<key>IBSystem Version</key>
<string>9L31a</string>
<key>targetFramework</key>
<string>IBCocoaFramework</string>
</dict>
</plist>

Binary file not shown.

74
misc/qutebrowser.spec Normal file
View File

@@ -0,0 +1,74 @@
# -*- mode: python -*-
import sys
import os
sys.path.insert(0, os.getcwd())
from scripts import setupcommon
block_cipher = None
def get_data_files():
data_files = [
('../qutebrowser/html', 'html'),
('../qutebrowser/img', 'img'),
('../qutebrowser/javascript', 'javascript'),
('../qutebrowser/html/doc', 'html/doc'),
('../qutebrowser/git-commit-id', '')
]
if os.path.exists(os.path.join('qutebrowser', '3rdparty', 'pdfjs')):
data_files.append(('../qutebrowser/3rdparty/pdfjs', '3rdparty/pdfjs'))
else:
print("Warning: excluding pdfjs as it's not present!")
return data_files
setupcommon.write_git_file()
if os.name == 'nt':
icon = 'icons/qutebrowser.ico'
elif sys.platform == 'darwin':
icon = 'icons/qutebrowser.icns'
else:
icon = None
a = Analysis(['../qutebrowser/__main__.py'],
pathex=['misc'],
binaries=None,
datas=get_data_files(),
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='qutebrowser',
icon=icon,
debug=False,
strip=False,
upx=True,
console=False )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='qutebrowser')
app = BUNDLE(coll,
name='qutebrowser.app',
icon=icon,
info_plist={'NSHighResolutionCapable': 'True'},
bundle_identifier=None)

View File

@@ -0,0 +1,20 @@
This directory contains various `requirements` files which are used by `tox` to
have reproducable tests with pinned versions.
The files are generated based on unpinned requirements in `*.txt-raw` files.
Those files can also contain some special commands:
- Add an additional comment to a line: `#@ comment: <package> <comment here>`
- Filter a line for requirements.io: `#@ filter: <package> <filter>`
- Don't include a package in the output: `#@ ignore: <package>` (or multiple packages)
- Replace a part of a frozen package specification with another: `#@ replace <regex> <replacement>`
Some examples:
```
#@ comment: mypkg blah blub
#@ filter: mypkg != 1.0.0
#@ ignore: mypkg, otherpkg
#@ replace: foo bar
```

View File

@@ -0,0 +1,3 @@
# This file is automatically generated by scripts/dev/recompile_requirements.py
check-manifest==0.31

View File

@@ -0,0 +1 @@
check-manifest

View File

@@ -0,0 +1,5 @@
# This file is automatically generated by scripts/dev/recompile_requirements.py
codecov==2.0.5
coverage==4.1
requests==2.10.0

View File

@@ -0,0 +1 @@
codecov

View File

@@ -0,0 +1,3 @@
# This file is automatically generated by scripts/dev/recompile_requirements.py
cx-Freeze==4.3.4

View File

@@ -0,0 +1 @@
cx_Freeze

View File

@@ -0,0 +1,26 @@
# This file is automatically generated by scripts/dev/recompile_requirements.py
flake8==2.6.2 # rq.filter: < 3.0.0
flake8-copyright==0.2.0
flake8-debugger==1.4.0
flake8-deprecated==1.0
flake8-docstrings==0.2.8
flake8-future-import==0.4.3
flake8-mock==0.2
flake8-pep3101==0.4
flake8-putty==0.4.0
flake8-string-format==0.2.2
flake8-tidy-imports==1.0.2
flake8-tuple==0.2.12
hacking==0.11.0
mccabe==0.5.0
packaging==16.7
pbr==1.10.0
pep257==0.7.0 # still needed by flake8-docstrings but ignored
pep8==1.7.0
pep8-naming==0.4.1
pycodestyle==2.0.0
pydocstyle==1.0.0
pyflakes==1.2.3
pyparsing==2.1.5
six==1.10.0

View File

@@ -0,0 +1,23 @@
flake8<3.0.0
flake8-copyright
flake8-debugger
flake8-deprecated
flake8-docstrings
flake8-future-import
flake8-mock
flake8-pep3101
flake8-putty
flake8-string-format
flake8-tidy-imports
flake8-tuple
hacking
pep8-naming
pydocstyle
pyflakes
pep8==1.7.0
#@ comment: pep257 still needed by flake8-docstrings but ignored
# Waiting until hacking/flake8-tuple are updated
#@ filter: flake8 < 3.0.0

View File

@@ -0,0 +1 @@
pip==8.1.2

View File

@@ -0,0 +1,3 @@
# This file is automatically generated by scripts/dev/recompile_requirements.py
PyInstaller==3.2

View File

@@ -0,0 +1 @@
PyInstaller

View File

@@ -0,0 +1,11 @@
# This file is automatically generated by scripts/dev/recompile_requirements.py
-e git+https://github.com/PyCQA/astroid.git#egg=astroid
isort==4.2.5
lazy-object-proxy==1.2.2
mccabe==0.5.0
-e git+https://github.com/PyCQA/pylint.git#egg=pylint
./scripts/dev/pylint_checkers
requests==2.10.0
six==1.10.0
wrapt==1.10.8

View File

@@ -0,0 +1,13 @@
-e git+https://github.com/PyCQA/astroid.git#egg=astroid
-e git+https://github.com/PyCQA/pylint.git#egg=pylint
./scripts/dev/pylint_checkers
requests
# https://github.com/PyCQA/pylint/issues/932
mccabe==0.5.0
# remove @commit-id for scm installs
#@ replace: @.*# #
# fix qute-pylint location
#@ replace: qute-pylint==.* ./scripts/dev/pylint_checkers

View File

@@ -0,0 +1,11 @@
# This file is automatically generated by scripts/dev/recompile_requirements.py
astroid==1.4.7
isort==4.2.5
lazy-object-proxy==1.2.2
mccabe==0.5.0
pylint==1.6.4
./scripts/dev/pylint_checkers
requests==2.10.0
six==1.10.0
wrapt==1.10.8

View File

@@ -0,0 +1,6 @@
pylint
./scripts/dev/pylint_checkers
requests
# fix qute-pylint location
#@ replace: qute-pylint==.* ./scripts/dev/pylint_checkers

View File

@@ -0,0 +1,4 @@
# This file is automatically generated by scripts/dev/recompile_requirements.py
docutils==0.12
pyroma==2.0.2

View File

@@ -0,0 +1 @@
pyroma

View File

@@ -0,0 +1,6 @@
Jinja2
Pygments
pyPEG2
PyYAML
colorama
cssutils

View File

@@ -0,0 +1,32 @@
# This file is automatically generated by scripts/dev/recompile_requirements.py
beautifulsoup4==4.5.0
CherryPy==7.1.0
coverage==4.1
decorator==4.0.10
Flask==0.10.1 # rq.filter: < 0.11.0
glob2==0.4.1
httpbin==0.4.1
hypothesis==3.4.2
itsdangerous==0.24
# Jinja2==2.8
Mako==1.0.4
# MarkupSafe==0.23
parse==1.6.6
parse-type==0.3.4
py==1.4.31
pytest==2.9.2
pytest-bdd==2.17.0
pytest-catchlog==1.2.2
pytest-cov==2.3.0
pytest-faulthandler==1.3.0
pytest-instafail==0.3.0
pytest-mock==1.1
pytest-qt==1.11.0
pytest-repeat==0.3.0
pytest-rerunfailures==2.0.0
pytest-travis-fold==1.2.0
pytest-xvfb==0.2.0
six==1.10.0
vulture==0.10
Werkzeug==0.11.10

View File

@@ -0,0 +1,22 @@
beautifulsoup4
CherryPy
coverage
Flask==0.10.1
httpbin
hypothesis
pytest
pytest-bdd
pytest-catchlog
pytest-cov
pytest-faulthandler
pytest-instafail
pytest-mock
pytest-qt
pytest-repeat
pytest-rerunfailures
pytest-travis-fold
pytest-xvfb
vulture
#@ filter: Flask < 0.11.0
#@ ignore: Jinja2, MarkupSafe

View File

@@ -0,0 +1,6 @@
# This file is automatically generated by scripts/dev/recompile_requirements.py
pluggy==0.3.1
py==1.4.31
tox==2.3.1
virtualenv==15.0.2

View File

@@ -0,0 +1 @@
tox

View File

@@ -0,0 +1,3 @@
# This file is automatically generated by scripts/dev/recompile_requirements.py
vulture==0.10

View File

@@ -0,0 +1 @@
vulture

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2015 Zach-Button <zachrey.button@gmail.com>
#
@@ -39,10 +39,9 @@
[ -z "$QUTE_URL" ] && QUTE_URL='http://google.com'
url=$(echo "$QUTE_URL" | cat - ~/.config/qutebrowser/quickmarks ~/.local/share/qutebrowser/history | dmenu -l 15 -p qutebrowser)
url=$(echo $url | sed -E 's/[^ ]+ +//g' | egrep "https?:" || echo $url)
url=$(echo "$QUTE_URL" | cat - "$QUTE_CONFIG_DIR/quickmarks" "$QUTE_DATA_DIR/history" | dmenu -l 15 -p qutebrowser)
url=$(echo "$url" | sed -E 's/[^ ]+ +//g' | egrep "https?:" || echo "$url")
[ -z "${url// }" ] && exit
echo "open $url" >> "$QUTE_FIFO" || qutebrowser "$url"

View File

@@ -1,4 +1,4 @@
#!/bin/bash -e
#!/usr/bin/env bash
# Both standalone script and qutebrowser userscript that opens a rofi menu with
# all files from the download director and opens the selected file. It works
# both as a userscript and a standalone script that is called from outside of
@@ -18,7 +18,10 @@
# Thorsten Wißmann, 2015 (thorsten` on freenode)
# Any feedback is welcome!
set -e
# open a file from the download directory using rofi
DOWNLOAD_DIR=${DOWNLOAD_DIR:-$QUTE_DOWNLOAD_DIR}
DOWNLOAD_DIR=${DOWNLOAD_DIR:-$HOME/Downloads}
# the name of the rofi command
ROFI_CMD=${ROFI_CMD:-rofi}
@@ -49,7 +52,7 @@ die() {
if ! [ -d "$DOWNLOAD_DIR" ] ; then
die "Download directory »$DOWNLOAD_DIR« not found!"
fi
if ! $(which "${ROFI_CMD}" > /dev/null ) ; then
if ! which "${ROFI_CMD}" > /dev/null ; then
die "Rofi command »${ROFI_CMD}« not found in PATH!"
fi
@@ -109,5 +112,3 @@ fi
msg info "Opening »$file« (of type $filetype) with ${application%.desktop}"
xdg-open "$path" &

View File

@@ -1,4 +1,4 @@
#!/bin/bash -e
#!/usr/bin/env bash
help() {
blink=$'\e[1;31m' reset=$'\e[0m'
cat <<EOF
@@ -22,7 +22,7 @@ Pass backend: (see also passwordstore.org)
must be contained in a later line beginning with "user:", "login:", or
"username:" (configurable by the user_pattern variable).
Behaviour:
Behavior:
It will try to find a username/password entry in the configured backend
(currently only pass) for the current website and will load that pair of
username and password to any form on the current page that has some password
@@ -39,6 +39,7 @@ Configuration:
EOF
}
set -o errexit
set -o pipefail
shopt -s nocasematch # make regexp matching in bash case insensitive
@@ -61,7 +62,7 @@ die() {
}
javascript_escape() {
# print the first argument in a escaped way, such that it can savely
# print the first argument in an escaped way, such that it can safely
# be used within javascripts double quotes
sed "s,[\\\'\"],\\\&,g" <<< "$1"
}
@@ -80,7 +81,7 @@ javascript_escape() {
# between different paths on the same domain.
simplify_url() {
simple_url="${1##*://}" # remove protocoll specification
simple_url="${1##*://}" # remove protocol specification
simple_url="${simple_url%%\?*}" # remove GET parameters
simple_url="${simple_url%%/*}" # remove directory path
simple_url="${simple_url%:*}" # remove port
@@ -89,7 +90,7 @@ simplify_url() {
# no_entries_found() is called if the first query_entries() call did not find
# any matching entries. Multiple implementations are possible:
# The easiest behaviour is to quit:
# The easiest behavior is to quit:
#no_entries_found() {
# if [ 0 -eq "${#files[@]}" ] ; then
# die "No entry found for »$simple_url«"
@@ -106,7 +107,7 @@ simplify_url() {
# fi
# }
# Another beahviour is to drop another level of subdomains until search hits
# Another behavior is to drop another level of subdomains until search hits
# are found:
no_entries_found() {
while [ 0 -eq "${#files[@]}" ] && [ -n "$simple_url" ]; do
@@ -170,7 +171,7 @@ choose_entry_random() {
# dmenu or zenity or even qutebrowser completion in future?) which entry to
# pick
MENU_COMMAND=( head -n 1 )
# whether to show the menu if there is only one entrie in it
# whether to show the menu if there is only one entry in it
menu_if_one_entry=0
choose_entry_menu() {
local nr=${#files[@]}
@@ -245,7 +246,7 @@ pass_backend() {
done < <(find -L "$PREFIX" -iname '*.gpg' -print0)
fi
if ((match_filename)) ; then
# add entries wth matching filepath
# add entries with matching filepath
while read -r passfile ; do
passfile="${passfile#$PREFIX}"
passfile="${passfile#/}"

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2015 Zach-Button <zachrey.button@gmail.com>
#
@@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
#
#
# This script fetches the unprocessed HTML source for a page and opens it in vim.
# :bind gf spawn --userscript qutebrowser_viewsource
#

View File

@@ -7,7 +7,6 @@
# If you would like to set a custom colorscheme/font use these dirs.
# https://github.com/halfwit/dotfiles/blob/master/.config/dmenu/bemenucolors
readonly confdir=${XDG_CONFIG_HOME:-$HOME/.config}
readonly datadir=${XDG_DATA_HOME:-$HOME/.local/share}
readonly optsfile=$confdir/dmenu/bemenucolors
@@ -15,17 +14,17 @@ create_menu() {
# Check quickmarks
while read -r url; do
printf -- '%s\n' "$url"
done < "$confdir"/qutebrowser/quickmarks
done < "$QUTE_CONFIG_DIR"/quickmarks
# Next bookmarks
while read -r url _; do
printf -- '%s\n' "$url"
done < "$confdir"/qutebrowser/bookmarks/urls
done < "$QUTE_CONFIG_DIR"/bookmarks/urls
# Finally history
while read -r _ url; do
printf -- '%s\n' "$url"
done < "$datadir"/qutebrowser/history
done < "$QUTE_DATA_DIR"/history
}
get_selection() {

36
misc/userscripts/taskadd Executable file
View File

@@ -0,0 +1,36 @@
#!/usr/bin/env bash
#
# Behavior:
# Userscript for qutebrowser which adds a task to taskwarrior.
# If run as a command (:spawn --userscript taskadd), it creates a new task
# with the description equal to the current page title and annotates it with
# the current page url. Additional arguments are passed along so you can add
# mods to the task (e.g. priority, due date, tags).
#
# Example:
# :spawn --userscript taskadd due:eod pri:H
#
# To enable passing along extra args, I suggest using a mapping like:
# :bind <somekey> set-cmd-text -s :spawn --userscript taskadd
#
# If run from hint mode, it uses the selected hint text as the description
# and the selected hint url as the annotation.
#
# Ryan Roden-Corrent (rcorre), 2016
# Any feedback is welcome!
#
# For more info on Taskwarrior, see http://taskwarrior.org/
# use either the current page title or the hint text as the task description
[[ $QUTE_MODE == 'hints' ]] && title=$QUTE_SELECTED_TEXT || title=$QUTE_TITLE
# try to add the task and grab the output
msg="$(task add $title $@ 2>&1)"
if [[ $? == 0 ]]; then
# annotate the new task with the url, send the output back to the browser
task +LATEST annotate "$QUTE_URL"
echo "message-info '$msg'" >> $QUTE_FIFO
else
echo "message-error '$msg'" >> $QUTE_FIFO
fi

View File

@@ -1,6 +1,6 @@
#!/bin/bash -e
#!/usr/bin/env bash
#
# Behaviour:
# Behavior:
# Userscript for qutebrowser which views the current web page in mpv using
# sensible mpv-flags. While viewing the page in MPV, all <video>, <embed>,
# and <object> tags in the original page are temporarily removed. Clicking on
@@ -24,6 +24,8 @@
# Thorsten Wißmann, 2015 (thorsten` on freenode)
# Any feedback is welcome!
set -e
if [ -z "$QUTE_FIFO" ] ; then
cat 1>&2 <<EOF
Error: $0 can not be run as a standalone script.

View File

@@ -1,5 +1,4 @@
[pytest]
norecursedirs = .tox .venv
addopts = --strict -rfEw --faulthandler-timeout=70 --instafail
markers =
gui: Tests using the GUI (e.g. spawning widgets)
@@ -11,12 +10,11 @@ markers =
not_frozen: Tests which can't be run if sys.frozen is True.
no_xvfb: Tests which can't be run with Xvfb.
frozen: Tests which can only be run if sys.frozen is True.
integration: Tests which test a bigger portion of code, run without coverage.
skip: Always skipped test.
pyqt531_or_newer: Needs PyQt 5.3.1 or newer.
integration: Tests which test a bigger portion of code
end2end: End to end tests which run qutebrowser as subprocess
xfail_norun: xfail the test with out running it
ci: Tests which should only run on CI.
flaky: Tests which are flaky and should be rerun
flaky_once: Try to rerun this test once if it fails
qt_log_level_fail = WARNING
qt_log_ignore =
^SpellCheck: .*
@@ -37,5 +35,6 @@ qt_log_ignore =
^Geoclue error: Process org\.freedesktop\.Geoclue\.Master exited with status 127
^QObject::connect: Cannot connect \(null\)::stateChanged\(QNetworkSession::State\) to QNetworkReplyHttpImpl::_q_networkSessionStateChanged\(QNetworkSession::State\)
^QXcbClipboard: Cannot transfer data, no data available
^load glyph failed
qt_wait_signal_raising = true
xfail_strict = true

View File

@@ -28,7 +28,7 @@ __copyright__ = "Copyright 2014-2016 Florian Bruhin (The Compiler)"
__license__ = "GPL"
__maintainer__ = __author__
__email__ = "mail@qutebrowser.org"
__version_info__ = (0, 6, 0)
__version_info__ = (0, 8, 4)
__version__ = '.'.join(str(e) for e in __version_info__)
__description__ = "A keyboard-driven, vim-like browser based on PyQt5 and QtWebKit."

View File

@@ -31,7 +31,7 @@ import atexit
import datetime
import tokenize
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWidgets import QApplication, QWidget
from PyQt5.QtWebKit import QWebSettings
from PyQt5.QtGui import QDesktopServices, QPixmap, QIcon, QCursor, QWindow
from PyQt5.QtCore import (pyqtSlot, qInstallMessageHandler, QTimer, QUrl,
@@ -46,8 +46,10 @@ import qutebrowser.resources
from qutebrowser.completion.models import instances as completionmodels
from qutebrowser.commands import cmdutils, runners, cmdexc
from qutebrowser.config import style, config, websettings, configexc
from qutebrowser.browser import urlmarks, cookies, cache, adblock, history
from qutebrowser.browser.network import qutescheme, proxy, networkmanager
from qutebrowser.browser import urlmarks, adblock
from qutebrowser.browser.webkit import cookies, cache, history, downloads
from qutebrowser.browser.webkit.network import (qutescheme, proxy,
networkmanager)
from qutebrowser.mainwindow import mainwindow
from qutebrowser.misc import readline, ipc, savemanager, sessions, crashsignal
from qutebrowser.misc import utilcmds # pylint: disable=unused-import
@@ -62,12 +64,7 @@ qApp = None
def run(args):
"""Initialize everything and run the application."""
if args.version:
print(version.version(short=True))
print()
print()
print(qutebrowser.__copyright__)
print()
print(version.GPL_BOILERPLATE.strip())
print(version.version())
sys.exit(usertypes.Exit.ok)
if args.temp_basedir:
@@ -166,7 +163,7 @@ def _init_icon():
"""Initialize the icon of qutebrowser."""
icon = QIcon()
fallback_icon = QIcon()
for size in (16, 24, 32, 48, 64, 96, 128, 256, 512):
for size in [16, 24, 32, 48, 64, 96, 128, 256, 512]:
filename = ':/icons/qutebrowser-{}x{}.png'.format(size, size)
pixmap = QPixmap(filename)
qtutils.ensure_not_null(pixmap)
@@ -244,12 +241,7 @@ def process_pos_args(args, via_ipc=False, cwd=None, target_arg=None):
cwd: The cwd to use for fuzzy_url.
target_arg: Command line argument received by a running instance via
ipc. If the --target argument was not specified, target_arg
will be an empty string instead of None. This behavior is
caused by the PyQt signal
``got_args = pyqtSignal(list, str, str)``
used in the misc.ipc.IPCServer class. PyQt converts the
None value into a null QString and then back to an empty
python string
will be an empty string.
"""
if via_ipc and not args:
win_id = mainwindow.get_window(via_ipc, force_window=True)
@@ -275,14 +267,17 @@ def process_pos_args(args, via_ipc=False, cwd=None, target_arg=None):
tabbed_browser = objreg.get('tabbed-browser', scope='window',
window=win_id)
log.init.debug("Startup URL {}".format(cmd))
if not cwd: # could also be an empty string due to the PyQt signal
cwd = None
try:
url = urlutils.fuzzy_url(cmd, cwd, relative=True)
except urlutils.InvalidUrlError as e:
message.error('current', "Error in startup argument '{}': "
"{}".format(cmd, e))
else:
background = open_target in ('tab-bg', 'tab-bg-silent')
tabbed_browser.tabopen(url, background=background)
background = open_target in ['tab-bg', 'tab-bg-silent']
tabbed_browser.tabopen(url, background=background,
explicit=True)
def _open_startpage(win_id=None):
@@ -344,24 +339,23 @@ def _save_version():
def on_focus_changed(_old, new):
"""Register currently focused main window in the object registry."""
if new is None:
window = None
else:
window = new.window()
if window is None or not isinstance(window, mainwindow.MainWindow):
if not isinstance(new, QWidget):
log.misc.debug("on_focus_changed called with non-QWidget {!r}".format(
new))
if new is None or not isinstance(new, mainwindow.MainWindow):
try:
objreg.delete('last-focused-main-window')
except KeyError:
pass
qApp.restoreOverrideCursor()
else:
objreg.register('last-focused-main-window', window, update=True)
objreg.register('last-focused-main-window', new.window(), update=True)
_maybe_hide_mouse_cursor()
@pyqtSlot(QUrl)
def open_desktopservices_url(url):
"""Handler to open an URL via QDesktopServices."""
"""Handler to open a URL via QDesktopServices."""
win_id = mainwindow.get_window(via_ipc=True, force_window=False)
tabbed_browser = objreg.get('tabbed-browser', scope='window',
window=win_id)
@@ -427,7 +421,9 @@ def _init_modules(args, crash_handler):
proxy.init()
log.init.debug("Initializing cookies...")
cookie_jar = cookies.CookieJar(qApp)
ram_cookie_jar = cookies.RAMCookieJar(qApp)
objreg.register('cookie-jar', cookie_jar)
objreg.register('ram-cookie-jar', ram_cookie_jar)
log.init.debug("Initializing cache...")
diskcache = cache.DiskCache(standarddir.cache(), parent=qApp)
objreg.register('cache', diskcache)
@@ -440,6 +436,8 @@ def _init_modules(args, crash_handler):
os.environ.pop('QT_WAYLAND_DISABLE_WINDOWDECORATION', None)
_maybe_hide_mouse_cursor()
objreg.get('config').changed.connect(_maybe_hide_mouse_cursor)
temp_downloads = downloads.TempDownloadManager(qApp)
objreg.register('temporary-downloads', temp_downloads)
def _init_late_modules(args):
@@ -478,7 +476,6 @@ class Quitter:
self._shutting_down = False
self._args = args
@pyqtSlot()
def on_last_window_closed(self):
"""Slot which gets invoked when the last window was closed."""
self.shutdown(last_window=True)
@@ -493,12 +490,12 @@ class Quitter:
else:
path = os.path.abspath(os.path.dirname(qutebrowser.__file__))
if not os.path.isdir(path):
# Probably running from an python egg.
# Probably running from a python egg.
return
for dirpath, _dirnames, filenames in os.walk(path):
for fn in filenames:
if os.path.splitext(fn)[1] == '.py':
if os.path.splitext(fn)[1] == '.py' and os.path.isfile(fn):
with tokenize.open(os.path.join(dirpath, fn)) as f:
compile(f.read(), fn, 'exec')
@@ -526,7 +523,7 @@ class Quitter:
cwd = os.path.join(os.path.abspath(os.path.dirname(
qutebrowser.__file__)), '..')
if not os.path.isdir(cwd):
# Probably running from an python egg. Let's fallback to
# Probably running from a python egg. Let's fallback to
# cwd=None and see if that works out.
# See https://github.com/The-Compiler/qutebrowser/issues/323
cwd = None
@@ -554,8 +551,9 @@ class Quitter:
argdict['session'] = session
argdict['override_restore'] = False
# Ensure :restart works with --temp-basedir
argdict['temp_basedir'] = False
argdict['temp_basedir_restarted'] = True
if self._args.temp_basedir:
argdict['temp_basedir'] = False
argdict['temp_basedir_restarted'] = True
# Dump the data
data = json.dumps(argdict)
@@ -713,6 +711,8 @@ class Quitter:
not restart):
atexit.register(shutil.rmtree, self._args.basedir,
ignore_errors=True)
# Delete temp download dir
objreg.get('temporary-downloads').cleanup()
# If we don't kill our custom handler here we might get segfaults
log.destroy.debug("Deactivating message handler...")
qInstallMessageHandler(None)
@@ -723,8 +723,8 @@ class Quitter:
# segfaults.
QTimer.singleShot(0, functools.partial(qApp.exit, status))
@cmdutils.register(instance='quitter', name='wq',
completion=[usertypes.Completion.sessions])
@cmdutils.register(instance='quitter', name='wq')
@cmdutils.argument('name', completion=usertypes.Completion.sessions)
def save_and_quit(self, name=sessions.default):
"""Save open pages and quit.

View File

@@ -1,6 +1,6 @@
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
# Copyright 2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#

View File

@@ -27,7 +27,7 @@ import zipfile
import fnmatch
from qutebrowser.config import config
from qutebrowser.utils import objreg, standarddir, log, message
from qutebrowser.utils import objreg, standarddir, log, message, usertypes
from qutebrowser.commands import cmdutils, cmdexc
@@ -48,7 +48,7 @@ def guess_zip_filename(zf):
def get_fileobj(byte_io):
"""Get an usable file object to read the hosts file from."""
"""Get a usable file object to read the hosts file from."""
byte_io.seek(0) # rewind downloaded file
if zipfile.is_zipfile(byte_io):
byte_io.seek(0) # rewind what zipfile.is_zipfile did
@@ -116,6 +116,7 @@ class HostBlocker:
self._local_hosts_file = None
else:
self._local_hosts_file = os.path.join(data_dir, 'blocked-hosts')
self.on_config_changed()
config_dir = standarddir.config()
if config_dir is None:
@@ -176,7 +177,8 @@ class HostBlocker:
message.info('current',
"Run :adblock-update to get adblock lists.")
@cmdutils.register(instance='host-blocker', win_id='win_id')
@cmdutils.register(instance='host-blocker')
@cmdutils.argument('win_id', win_id=True)
def adblock_update(self, win_id):
"""Update the adblock block lists.
@@ -208,7 +210,8 @@ class HostBlocker:
else:
fobj = io.BytesIO()
fobj.name = 'adblock: ' + url.host()
download = download_manager.get(url, fileobj=fobj,
target = usertypes.FileObjDownloadTarget(fobj)
download = download_manager.get(url, target=target,
auto_remove=True)
self._in_progress.append(download)
download.finished.connect(
@@ -273,11 +276,13 @@ class HostBlocker:
def on_config_changed(self):
"""Update files when the config changed."""
urls = config.get('content', 'host-block-lists')
if urls is None:
if urls is None and self._local_hosts_file is not None:
try:
os.remove(self._local_hosts_file)
except OSError:
log.misc.exception("Failed to delete hosts file.")
except FileNotFoundError:
pass
except OSError as e:
log.misc.exception("Failed to delete hosts file: {}".format(e))
def on_download_finished(self, download):
"""Check if all downloads are finished and if so, trigger reading.

View File

@@ -0,0 +1,641 @@
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# qutebrowser is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Base class for a wrapper over QWebView/QWebEngineView."""
import itertools
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QUrl, QObject, QPoint
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QWidget, QLayout
from qutebrowser.keyinput import modeman
from qutebrowser.config import config
from qutebrowser.utils import utils, objreg, usertypes, message, log, qtutils
tab_id_gen = itertools.count(0)
def create(win_id, parent=None):
"""Get a QtWebKit/QtWebEngine tab object.
Args:
win_id: The window ID where the tab will be shown.
parent: The Qt parent to set.
"""
# Importing modules here so we don't depend on QtWebEngine without the
# argument and to avoid circular imports.
mode_manager = modeman.instance(win_id)
if objreg.get('args').backend == 'webengine':
from qutebrowser.browser.webengine import webenginetab
tab_class = webenginetab.WebEngineTab
else:
from qutebrowser.browser.webkit import webkittab
tab_class = webkittab.WebKitTab
return tab_class(win_id=win_id, mode_manager=mode_manager, parent=parent)
class WebTabError(Exception):
"""Base class for various errors."""
class WrapperLayout(QLayout):
"""A Qt layout which simply wraps a single widget.
This is used so the widget is hidden behind a AbstractTab API and can't
easily be accidentally accessed.
"""
def __init__(self, widget, parent=None):
super().__init__(parent)
self._widget = widget
def addItem(self, _widget):
raise AssertionError("Should never be called!")
def sizeHint(self):
return self._widget.sizeHint()
def itemAt(self, _index): # pragma: no cover
# For some reason this sometimes gets called by Qt.
return None
def takeAt(self, _index):
raise AssertionError("Should never be called!")
def setGeometry(self, rect):
self._widget.setGeometry(rect)
class TabData:
"""A simple namespace with a fixed set of attributes.
Attributes:
keep_icon: Whether the (e.g. cloned) icon should not be cleared on page
load.
inspector: The QWebInspector used for this webview.
viewing_source: Set if we're currently showing a source view.
"""
__slots__ = ['keep_icon', 'viewing_source', 'inspector']
def __init__(self):
self.keep_icon = False
self.viewing_source = False
self.inspector = None
class AbstractPrinting:
"""Attribute of AbstractTab for printing the page."""
def __init__(self):
self._widget = None
def check_pdf_support(self):
raise NotImplementedError
def check_printer_support(self):
raise NotImplementedError
def to_pdf(self, filename):
raise NotImplementedError
def to_printer(self, printer):
raise NotImplementedError
class AbstractSearch(QObject):
"""Attribute of AbstractTab for doing searches.
Attributes:
text: The last thing this view was searched for.
_flags: The flags of the last search (needs to be set by subclasses).
_widget: The underlying WebView widget.
"""
def __init__(self, parent=None):
super().__init__(parent)
self._widget = None
self.text = None
def search(self, text, *, ignore_case=False, reverse=False,
result_cb=None):
"""Find the given text on the page.
Args:
text: The text to search for.
ignore_case: Search case-insensitively. (True/False/'smart')
reverse: Reverse search direction.
result_cb: Called with a bool indicating whether a match was found.
"""
raise NotImplementedError
def clear(self):
"""Clear the current search."""
raise NotImplementedError
def prev_result(self, *, result_cb=None):
"""Go to the previous result of the current search.
Args:
result_cb: Called with a bool indicating whether a match was found.
"""
raise NotImplementedError
def next_result(self, *, result_cb=None):
"""Go to the next result of the current search.
Args:
result_cb: Called with a bool indicating whether a match was found.
"""
raise NotImplementedError
class AbstractZoom(QObject):
"""Attribute of AbstractTab for controlling zoom.
Attributes:
_neighborlist: A NeighborList with the zoom levels.
_default_zoom_changed: Whether the zoom was changed from the default.
"""
def __init__(self, win_id, parent=None):
super().__init__(parent)
self._widget = None
self._win_id = win_id
self._default_zoom_changed = False
self._init_neighborlist()
objreg.get('config').changed.connect(self._on_config_changed)
# # FIXME:qtwebengine is this needed?
# # For some reason, this signal doesn't get disconnected automatically
# # when the WebView is destroyed on older PyQt versions.
# # See https://github.com/The-Compiler/qutebrowser/issues/390
# self.destroyed.connect(functools.partial(
# cfg.changed.disconnect, self.init_neighborlist))
@pyqtSlot(str, str)
def _on_config_changed(self, section, option):
if section == 'ui' and option in ['zoom-levels', 'default-zoom']:
if not self._default_zoom_changed:
factor = float(config.get('ui', 'default-zoom')) / 100
self._set_factor_internal(factor)
self._default_zoom_changed = False
self._init_neighborlist()
def _init_neighborlist(self):
"""Initialize self._neighborlist."""
levels = config.get('ui', 'zoom-levels')
self._neighborlist = usertypes.NeighborList(
levels, mode=usertypes.NeighborList.Modes.edge)
self._neighborlist.fuzzyval = config.get('ui', 'default-zoom')
def offset(self, offset):
"""Increase/Decrease the zoom level by the given offset.
Args:
offset: The offset in the zoom level list.
Return:
The new zoom percentage.
"""
level = self._neighborlist.getitem(offset)
self.set_factor(float(level) / 100, fuzzyval=False)
return level
def set_factor(self, factor, *, fuzzyval=True):
"""Zoom to a given zoom factor.
Args:
factor: The zoom factor as float.
fuzzyval: Whether to set the NeighborLists fuzzyval.
"""
if fuzzyval:
self._neighborlist.fuzzyval = int(factor * 100)
if factor < 0:
raise ValueError("Can't zoom to factor {}!".format(factor))
self._default_zoom_changed = True
self._set_factor_internal(factor)
def factor(self):
raise NotImplementedError
def set_default(self):
default_zoom = config.get('ui', 'default-zoom')
self._set_factor_internal(float(default_zoom) / 100)
@pyqtSlot(QPoint)
def _on_mouse_wheel_zoom(self, delta):
"""Handle zooming via mousewheel requested by the web view."""
divider = config.get('input', 'mouse-zoom-divider')
factor = self.factor() + delta.y() / divider
if factor < 0:
return
perc = int(100 * factor)
message.info(self._win_id, "Zoom level: {}%".format(perc))
self._neighborlist.fuzzyval = perc
self._set_factor_internal(factor)
self._default_zoom_changed = True
class AbstractCaret(QObject):
"""Attribute of AbstractTab for caret browsing."""
def __init__(self, win_id, tab, mode_manager, parent=None):
super().__init__(parent)
self._tab = tab
self._win_id = win_id
self._widget = None
self.selection_enabled = False
mode_manager.entered.connect(self._on_mode_entered)
mode_manager.left.connect(self._on_mode_left)
def _on_mode_entered(self, mode):
raise NotImplementedError
def _on_mode_left(self):
raise NotImplementedError
def move_to_next_line(self, count=1):
raise NotImplementedError
def move_to_prev_line(self, count=1):
raise NotImplementedError
def move_to_next_char(self, count=1):
raise NotImplementedError
def move_to_prev_char(self, count=1):
raise NotImplementedError
def move_to_end_of_word(self, count=1):
raise NotImplementedError
def move_to_next_word(self, count=1):
raise NotImplementedError
def move_to_prev_word(self, count=1):
raise NotImplementedError
def move_to_start_of_line(self):
raise NotImplementedError
def move_to_end_of_line(self):
raise NotImplementedError
def move_to_start_of_next_block(self, count=1):
raise NotImplementedError
def move_to_start_of_prev_block(self, count=1):
raise NotImplementedError
def move_to_end_of_next_block(self, count=1):
raise NotImplementedError
def move_to_end_of_prev_block(self, count=1):
raise NotImplementedError
def move_to_start_of_document(self):
raise NotImplementedError
def move_to_end_of_document(self):
raise NotImplementedError
def toggle_selection(self):
raise NotImplementedError
def drop_selection(self):
raise NotImplementedError
def has_selection(self):
raise NotImplementedError
def selection(self, html=False):
raise NotImplementedError
def follow_selected(self, *, tab=False):
raise NotImplementedError
class AbstractScroller(QObject):
"""Attribute of AbstractTab to manage scroll position."""
perc_changed = pyqtSignal(int, int)
def __init__(self, tab, parent=None):
super().__init__(parent)
self._tab = tab
self._widget = None
def _init_widget(self, widget):
self._widget = widget
def pos_px(self):
raise NotImplementedError
def pos_perc(self):
raise NotImplementedError
def to_perc(self, x=None, y=None):
raise NotImplementedError
def to_point(self, point):
raise NotImplementedError
def delta(self, x=0, y=0):
raise NotImplementedError
def delta_page(self, x=0, y=0):
raise NotImplementedError
def up(self, count=1):
raise NotImplementedError
def down(self, count=1):
raise NotImplementedError
def left(self, count=1):
raise NotImplementedError
def right(self, count=1):
raise NotImplementedError
def top(self):
raise NotImplementedError
def bottom(self):
raise NotImplementedError
def page_up(self, count=1):
raise NotImplementedError
def page_down(self, count=1):
raise NotImplementedError
def at_top(self):
raise NotImplementedError
def at_bottom(self):
raise NotImplementedError
class AbstractHistory:
"""The history attribute of a AbstractTab."""
def __init__(self, tab):
self._tab = tab
self._history = None
def __len__(self):
return len(self._history)
def __iter__(self):
return iter(self._history.items())
def current_idx(self):
raise NotImplementedError
def back(self):
raise NotImplementedError
def forward(self):
raise NotImplementedError
def can_go_back(self):
raise NotImplementedError
def can_go_forward(self):
raise NotImplementedError
def serialize(self):
"""Serialize into an opaque format understood by self.deserialize."""
raise NotImplementedError
def deserialize(self, data):
"""Serialize from a format produced by self.serialize."""
raise NotImplementedError
def load_items(self, items):
"""Deserialize from a list of WebHistoryItems."""
raise NotImplementedError
class AbstractTab(QWidget):
"""A wrapper over the given widget to hide its API and expose another one.
We use this to unify QWebView and QWebEngineView.
Attributes:
history: The AbstractHistory for the current tab.
registry: The ObjectRegistry associated with this tab.
_load_status: loading status of this page
Accessible via load_status() method.
_has_ssl_errors: Whether SSL errors happened.
Needs to be set by subclasses.
for properties, see WebView/WebEngineView docs.
Signals:
See related Qt signals.
new_tab_requested: Emitted when a new tab should be opened with the
given URL.
load_status_changed: The loading status changed
"""
window_close_requested = pyqtSignal()
link_hovered = pyqtSignal(str)
load_started = pyqtSignal()
load_progress = pyqtSignal(int)
load_finished = pyqtSignal(bool)
icon_changed = pyqtSignal(QIcon)
title_changed = pyqtSignal(str)
load_status_changed = pyqtSignal(str)
new_tab_requested = pyqtSignal(QUrl)
url_changed = pyqtSignal(QUrl)
shutting_down = pyqtSignal()
def __init__(self, win_id, parent=None):
self.win_id = win_id
self.tab_id = next(tab_id_gen)
super().__init__(parent)
self.registry = objreg.ObjectRegistry()
tab_registry = objreg.get('tab-registry', scope='window',
window=win_id)
tab_registry[self.tab_id] = self
objreg.register('tab', self, registry=self.registry)
# self.history = AbstractHistory(self)
# self.scroller = AbstractScroller(self, parent=self)
# self.caret = AbstractCaret(win_id=win_id, tab=self, mode_manager=...,
# parent=self)
# self.zoom = AbstractZoom(win_id=win_id)
# self.search = AbstractSearch(parent=self)
# self.printing = AbstractPrinting()
self.data = TabData()
self._layout = None
self._widget = None
self._progress = 0
self._has_ssl_errors = False
self._load_status = usertypes.LoadStatus.none
self.backend = None
def _set_widget(self, widget):
# pylint: disable=protected-access
self._layout = WrapperLayout(widget, self)
self._widget = widget
self.history._history = widget.history()
self.scroller._init_widget(widget)
self.caret._widget = widget
self.zoom._widget = widget
self.search._widget = widget
self.printing._widget = widget
widget.mouse_wheel_zoom.connect(self.zoom._on_mouse_wheel_zoom)
widget.setParent(self)
self.setFocusProxy(widget)
def _set_load_status(self, val):
"""Setter for load_status."""
if not isinstance(val, usertypes.LoadStatus):
raise TypeError("Type {} is no LoadStatus member!".format(val))
log.webview.debug("load status for {}: {}".format(repr(self), val))
self._load_status = val
self.load_status_changed.emit(val.name)
@pyqtSlot(QUrl)
def _on_url_changed(self, url):
"""Update title when URL has changed and no title is available."""
if url.isValid() and not self.title():
self.title_changed.emit(url.toDisplayString())
self.url_changed.emit(url)
@pyqtSlot()
def _on_load_started(self):
self._progress = 0
self._has_ssl_errors = False
self.data.viewing_source = False
self._set_load_status(usertypes.LoadStatus.loading)
self.load_started.emit()
@pyqtSlot(bool)
def _on_load_finished(self, ok):
if ok and not self._has_ssl_errors:
if self.url().scheme() == 'https':
self._set_load_status(usertypes.LoadStatus.success_https)
else:
self._set_load_status(usertypes.LoadStatus.success)
elif ok:
self._set_load_status(usertypes.LoadStatus.warn)
else:
self._set_load_status(usertypes.LoadStatus.error)
self.load_finished.emit(ok)
if not self.title():
self.title_changed.emit(self.url().toDisplayString())
@pyqtSlot(int)
def _on_load_progress(self, perc):
self._progress = perc
self.load_progress.emit(perc)
@pyqtSlot()
def _on_ssl_errors(self):
self._has_ssl_errors = True
def url(self):
raise NotImplementedError
def progress(self):
return self._progress
def load_status(self):
return self._load_status
def _openurl_prepare(self, url):
qtutils.ensure_valid(url)
self.title_changed.emit(url.toDisplayString())
def openurl(self, url):
raise NotImplementedError
def reload(self, *, force=False):
raise NotImplementedError
def stop(self):
raise NotImplementedError
def clear_ssl_errors(self):
raise NotImplementedError
def dump_async(self, callback, *, plain=False):
"""Dump the current page to a file ascync.
The given callback will be called with the result when dumping is
complete.
"""
raise NotImplementedError
def run_js_async(self, code, callback=None):
"""Run javascript async.
The given callback will be called with the result when running JS is
complete.
"""
raise NotImplementedError
def run_js_blocking(self, code):
"""Run javascript and block.
This returns the result to the caller. Its use should be avoided when
possible as it runs a local event loop for QtWebEngine.
"""
raise NotImplementedError
def shutdown(self):
raise NotImplementedError
def title(self):
raise NotImplementedError
def icon(self):
raise NotImplementedError
def set_html(self, html, base_url):
raise NotImplementedError
def __repr__(self):
try:
url = utils.elide(self.url().toDisplayString(QUrl.EncodeUnicode),
100)
except AttributeError:
url = '<AttributeError>'
return utils.get_repr(self, tab_id=self.tab_id, url=url)

File diff suppressed because it is too large Load Diff

View File

@@ -25,7 +25,7 @@ import sip
from PyQt5.QtCore import pyqtSlot, QSize, Qt, QTimer
from PyQt5.QtWidgets import QListView, QSizePolicy, QMenu
from qutebrowser.browser import downloads
from qutebrowser.browser.webkit import downloads
from qutebrowser.config import style
from qutebrowser.utils import qtutils, utils, objreg

View File

@@ -23,7 +23,7 @@ import collections
import functools
import math
import re
import string
from string import ascii_lowercase
from PyQt5.QtCore import (pyqtSignal, pyqtSlot, QObject, QEvent, Qt, QUrl,
QTimer)
@@ -33,10 +33,9 @@ from PyQt5.QtWebKitWidgets import QWebPage
from qutebrowser.config import config
from qutebrowser.keyinput import modeman, modeparsers
from qutebrowser.browser import webelem
from qutebrowser.browser.webkit import webelem
from qutebrowser.commands import userscripts, cmdexc, cmdutils, runners
from qutebrowser.utils import usertypes, log, qtutils, message, objreg, utils
from qutebrowser.misc import guiprocess
ElemTuple = collections.namedtuple('ElemTuple', ['elem', 'label'])
@@ -53,7 +52,6 @@ class WordHintingError(Exception):
"""Exception raised on errors during word hinting."""
@pyqtSlot(usertypes.KeyMode)
def on_mode_entered(mode, win_id):
"""Stop hinting when insert mode was entered."""
if mode == usertypes.KeyMode.insert:
@@ -68,7 +66,9 @@ class HintContext:
frames: The QWebFrames to use.
destroyed_frames: id()'s of QWebFrames which have been destroyed.
(Workaround for https://github.com/The-Compiler/qutebrowser/issues/152)
all_elems: A list of all (elem, label) namedtuples ever created.
elems: A mapping from key strings to (elem, label) namedtuples.
May contain less elements than `all_elems` due to filtering.
baseurl: The URL of the current page.
target: What to do with the opened links.
normal/current/tab/tab_fg/tab_bg/window: Get passed to
@@ -83,10 +83,12 @@ class HintContext:
args: Custom arguments for userscript/spawn
rapid: Whether to do rapid hinting.
mainframe: The main QWebFrame where we started hinting in.
tab: The WebTab object we started hinting in.
group: The group of web elements to hint.
"""
def __init__(self):
self.all_elems = []
self.elems = {}
self.target = None
self.baseurl = None
@@ -96,6 +98,7 @@ class HintContext:
self.destroyed_frames = []
self.args = []
self.mainframe = None
self.tab = None
self.group = None
def get_args(self, urlstr):
@@ -118,6 +121,7 @@ class HintManager(QObject):
_context: The HintContext for the current invocation.
_win_id: The window ID this HintManager is associated with.
_tab_id: The tab ID this HintManager is associated with.
_filterstr: Used to save the filter string for restoring in rapid mode.
Signals:
mouse_event: Mouse event to be posted in the web view.
@@ -154,6 +158,7 @@ class HintManager(QObject):
self._win_id = win_id
self._tab_id = tab_id
self._context = None
self._filterstr = None
self._word_hinter = WordHinter()
mode_manager = objreg.get('mode-manager', scope='window',
window=win_id)
@@ -169,7 +174,7 @@ class HintManager(QObject):
def _cleanup(self):
"""Clean up after hinting."""
for elem in self._context.elems.values():
for elem in self._context.all_elems:
try:
elem.label.removeFromDocument()
except webelem.IsNullError:
@@ -195,6 +200,7 @@ class HintManager(QObject):
window=self._win_id)
message_bridge.maybe_reset_text(text)
self._context = None
self._filterstr = None
def _hint_strings(self, elems):
"""Calculate the hint strings for elems.
@@ -219,7 +225,7 @@ class HintManager(QObject):
else:
chars = config.get('hints', 'chars')
min_chars = config.get('hints', 'min-chars')
if config.get('hints', 'scatter'):
if config.get('hints', 'scatter') and hint_mode != 'number':
return self._hint_scattered(min_chars, chars, elems)
else:
return self._hint_linear(min_chars, chars, elems)
@@ -351,7 +357,7 @@ class HintManager(QObject):
('display', 'inline !important'),
('z-index', '{} !important'.format(int(2 ** 32 / 2 - 1))),
('pointer-events', 'none !important'),
('position', 'absolute !important'),
('position', 'fixed !important'),
('color', config.get('colors', 'hints.fg') + ' !important'),
('background', config.get('colors', 'hints.bg') + ' !important'),
('font', config.get('fonts', 'hints') + ' !important'),
@@ -377,19 +383,16 @@ class HintManager(QObject):
elem: The QWebElement to set the style attributes for.
label: The label QWebElement.
"""
rect = elem.geometry()
no_js = config.get('hints', 'find-implementation') != 'javascript'
rect = elem.rect_on_view(adjust_zoom=False, no_js=no_js)
left = rect.x()
top = rect.y()
zoom = elem.webFrame().zoomFactor()
if not config.get('ui', 'zoom-text-only'):
left /= zoom
top /= zoom
log.hints.vdebug("Drawing label '{!r}' at {}/{} for element '{!r}', "
"zoom level {}".format(label, left, top, elem, zoom))
log.hints.vdebug("Drawing label '{!r}' at {}/{} for element '{!r}' "
"(no_js: {})".format(label, left, top, elem, no_js))
label.setStyleProperty('left', '{}px !important'.format(left))
label.setStyleProperty('top', '{}px !important'.format(top))
def _draw_label(self, elem, text):
def _draw_label(self, elem, string):
"""Draw a hint label over an element.
Args:
@@ -414,7 +417,7 @@ class HintManager(QObject):
label = webelem.WebElementWrapper(parent.lastChild())
label['class'] = 'qutehint'
self._set_style_properties(elem, label)
label.setPlainText(text)
label.setPlainText(string)
return label
def _show_url_error(self):
@@ -441,14 +444,22 @@ class HintManager(QObject):
target_mapping[Target.tab] = usertypes.ClickTarget.tab_bg
else:
target_mapping[Target.tab] = usertypes.ClickTarget.tab
# FIXME Instead of clicking the center, we could have nicer heuristics.
# e.g. parse (-webkit-)border-radius correctly and click text fields at
# the bottom right, and everything else on the top left or so.
# https://github.com/The-Compiler/qutebrowser/issues/70
pos = elem.rect_on_view().center()
# Click the center of the largest square fitting into the top/left
# corner of the rectangle, this will help if part of the <a> element
# is hidden behind other elements
# https://github.com/The-Compiler/qutebrowser/issues/1005
rect = elem.rect_on_view()
if rect.width() > rect.height():
rect.setWidth(rect.height())
else:
rect.setHeight(rect.width())
pos = rect.center()
action = "Hovering" if context.target == Target.hover else "Clicking"
log.hints.debug("{} on '{}' at {}/{}".format(
action, elem, pos.x(), pos.y()))
log.hints.debug("{} on '{}' at position {}".format(
action, elem.debug_text(), pos))
self.start_hinting.emit(target_mapping[context.target])
if context.target in [Target.tab, Target.tab_fg, Target.tab_bg,
Target.window]:
@@ -466,6 +477,13 @@ class HintManager(QObject):
QMouseEvent(QEvent.MouseButtonRelease, pos, Qt.LeftButton,
Qt.NoButton, modifiers),
]
if context.target in [Target.normal, Target.current]:
# Set the pre-jump mark ', so we can jump back here after following
tabbed_browser = objreg.get('tabbed-browser', scope='window',
window=self._win_id)
tabbed_browser.set_mark("'")
if context.target == Target.current:
elem.remove_blank_target()
for evt in events:
@@ -483,7 +501,9 @@ class HintManager(QObject):
url: The URL to open as a QUrl.
context: The HintContext to use.
"""
sel = context.target == Target.yank_primary
sel = (context.target == Target.yank_primary and
utils.supports_selection())
urlstr = url.toString(QUrl.FullyEncoded | QUrl.RemovePassword)
utils.set_clipboard(urlstr, selection=sel)
@@ -551,7 +571,6 @@ class HintManager(QObject):
"""
cmd = context.args[0]
args = context.args[1:]
frame = context.mainframe
env = {
'QUTE_MODE': 'hints',
'QUTE_SELECTED_TEXT': str(elem),
@@ -560,8 +579,12 @@ class HintManager(QObject):
url = self._resolve_url(elem, context.baseurl)
if url is not None:
env['QUTE_URL'] = url.toString(QUrl.FullyEncoded)
env.update(userscripts.store_source(frame))
userscripts.run(cmd, *args, win_id=self._win_id, env=env)
try:
userscripts.run_async(context.tab, cmd, *args, win_id=self._win_id,
env=env)
except userscripts.UnsupportedError as e:
message.error(self._win_id, str(e), immediately=True)
def _spawn(self, url, context):
"""Spawn a simple command from a hint.
@@ -572,9 +595,8 @@ class HintManager(QObject):
"""
urlstr = url.toString(QUrl.FullyEncoded | QUrl.RemovePassword)
args = context.get_args(urlstr)
cmd, *args = args
proc = guiprocess.GUIProcess(self._win_id, what='command', parent=self)
proc.start(cmd, args)
commandrunner = runners.CommandRunner(self._win_id)
commandrunner.run_safely('spawn ' + ' '.join(args))
def _resolve_url(self, elem, baseurl):
"""Resolve a URL and check if we want to keep it.
@@ -586,9 +608,9 @@ class HintManager(QObject):
Return:
A QUrl with the absolute URL, or None.
"""
for attr in ('href', 'src'):
for attr in ['href', 'src']:
if attr in elem:
text = elem[attr]
text = elem[attr].strip()
break
else:
return None
@@ -604,8 +626,7 @@ class HintManager(QObject):
def _find_prevnext(self, frame, prev=False):
"""Find a prev/next element in frame."""
# First check for <link rel="prev(ious)|next">
elems = frame.findAllElements(
webelem.SELECTORS[webelem.Group.links])
elems = frame.findAllElements(webelem.SELECTORS[webelem.Group.links])
rel_values = ('prev', 'previous') if prev else ('next')
for e in elems:
e = webelem.WebElementWrapper(e)
@@ -656,8 +677,8 @@ class HintManager(QObject):
"""
if not isinstance(target, Target):
raise TypeError("Target {} is no Target member!".format(target))
if target in (Target.userscript, Target.spawn, Target.run,
Target.fill):
if target in [Target.userscript, Target.spawn, Target.run,
Target.fill]:
if not args:
raise cmdexc.CommandError(
"'args' is required with target userscript/spawn/run/"
@@ -681,15 +702,27 @@ class HintManager(QObject):
elems = [e for e in elems if filterfunc(e)]
if not elems:
raise cmdexc.CommandError("No elements found.")
hints = self._hint_strings(elems)
log.hints.debug("hints: {}".format(', '.join(hints)))
for e, hint in zip(elems, hints):
label = self._draw_label(e, hint)
self._context.elems[hint] = ElemTuple(e, label)
strings = self._hint_strings(elems)
log.hints.debug("hints: {}".format(', '.join(strings)))
for e, string in zip(elems, strings):
label = self._draw_label(e, string)
elem = ElemTuple(e, label)
self._context.all_elems.append(elem)
self._context.elems[string] = elem
keyparsers = objreg.get('keyparsers', scope='window',
window=self._win_id)
keyparser = keyparsers[usertypes.KeyMode.hint]
keyparser.update_bindings(hints)
keyparser.update_bindings(strings)
def _filter_matches(self, filterstr, elemstr):
"""Return True if `filterstr` matches `elemstr`."""
# Empty string and None always match
if not filterstr:
return True
filterstr = filterstr.casefold()
elemstr = elemstr.casefold()
# Do multi-word matching
return all(word in elemstr for word in filterstr.split())
def follow_prevnext(self, frame, baseurl, prev=False, tab=False,
background=False, window=False):
@@ -724,14 +757,16 @@ class HintManager(QObject):
window=self._win_id)
tabbed_browser.tabopen(url, background=background)
else:
webview = objreg.get('webview', scope='tab', window=self._win_id,
tab=self._tab_id)
webview.openurl(url)
tab = objreg.get('tab', scope='tab', window=self._win_id,
tab=self._tab_id)
tab.openurl(url)
@cmdutils.register(instance='hintmanager', scope='tab', name='hint',
win_id='win_id')
star_args_optional=True, maxsplit=2,
backend=usertypes.Backend.QtWebKit)
@cmdutils.argument('win_id', win_id=True)
def start(self, rapid=False, group=webelem.Group.all, target=Target.normal,
*args: {'nargs': '*'}, win_id):
*args, win_id):
"""Start hinting.
Args:
@@ -743,6 +778,7 @@ class HintManager(QObject):
- `all`: All clickable elements.
- `links`: Only links.
- `images`: Only images.
- `inputs`: Only input fields.
target: What to do with the selected element.
@@ -781,10 +817,12 @@ class HintManager(QObject):
"""
tabbed_browser = objreg.get('tabbed-browser', scope='window',
window=self._win_id)
widget = tabbed_browser.currentWidget()
if widget is None:
tab = tabbed_browser.currentWidget()
if tab is None:
raise cmdexc.CommandError("No WebView available yet!")
mainframe = widget.page().mainFrame()
# FIXME:qtwebengine have a proper API for this
page = tab._widget.page() # pylint: disable=protected-access
mainframe = page.mainFrame()
if mainframe is None:
raise cmdexc.CommandError("No frame focused!")
mode_manager = objreg.get('mode-manager', scope='window',
@@ -795,7 +833,7 @@ class HintManager(QObject):
if rapid:
if target in [Target.tab_bg, Target.window, Target.run,
Target.hover, Target.userscript, Target.spawn,
Target.download]:
Target.download, Target.normal, Target.current]:
pass
elif (target == Target.tab and
config.get('tabs', 'background-tabs')):
@@ -807,6 +845,7 @@ class HintManager(QObject):
self._check_args(target, *args)
self._context = HintContext()
self._context.tab = tab
self._context.target = target
self._context.rapid = rapid
try:
@@ -833,53 +872,115 @@ class HintManager(QObject):
def handle_partial_key(self, keystr):
"""Handle a new partial keypress."""
log.hints.debug("Handling new keystring: '{}'".format(keystr))
for (text, elems) in self._context.elems.items():
for string, elem in self._context.elems.items():
try:
if text.startswith(keystr):
matched = text[:len(keystr)]
rest = text[len(keystr):]
if string.startswith(keystr):
matched = string[:len(keystr)]
rest = string[len(keystr):]
match_color = config.get('colors', 'hints.fg.match')
elems.label.setInnerXml(
elem.label.setInnerXml(
'<font color="{}">{}</font>{}'.format(
match_color, matched, rest))
if self._is_hidden(elems.label):
if self._is_hidden(elem.label):
# hidden element which matches again -> show it
self._show_elem(elems.label)
self._show_elem(elem.label)
else:
# element doesn't match anymore -> hide it
self._hide_elem(elems.label)
self._hide_elem(elem.label)
except webelem.IsNullError:
pass
def _filter_number_hints(self):
"""Apply filters for numbered hints and renumber them.
Return:
Elements which are still visible
"""
# renumber filtered hints
elems = []
for e in self._context.all_elems:
try:
if not self._is_hidden(e.label):
elems.append(e)
except webelem.IsNullError:
pass
if not elems:
# Whoops, filtered all hints
modeman.leave(self._win_id, usertypes.KeyMode.hint,
'all filtered')
return {}
strings = self._hint_strings(elems)
self._context.elems = {}
for elem, string in zip(elems, strings):
elem.label.setInnerXml(string)
self._context.elems[string] = elem
keyparsers = objreg.get('keyparsers', scope='window',
window=self._win_id)
keyparser = keyparsers[usertypes.KeyMode.hint]
keyparser.update_bindings(strings, preserve_filter=True)
return self._context.elems
def _filter_non_number_hints(self):
"""Apply filters for letter/word hints.
Return:
Elements which are still visible
"""
visible = {}
for string, elem in self._context.elems.items():
try:
if not self._is_hidden(elem.label):
visible[string] = elem
except webelem.IsNullError:
pass
if not visible:
# Whoops, filtered all hints
modeman.leave(self._win_id, usertypes.KeyMode.hint,
'all filtered')
return visible
def filter_hints(self, filterstr):
"""Filter displayed hints according to a text.
Args:
filterstr: The string to filter with, or None to show all.
filterstr: The string to filter with, or None to use the filter
from previous call (saved in `self._filterstr`). If
`filterstr` is an empty string or if both `filterstr`
and `self._filterstr` are None, all hints are shown.
"""
for elems in self._context.elems.values():
if filterstr is None:
filterstr = self._filterstr
else:
self._filterstr = filterstr
for elem in self._context.all_elems:
try:
if (filterstr is None or
filterstr.casefold() in str(elems.elem).casefold()):
if self._is_hidden(elems.label):
if self._filter_matches(filterstr, str(elem.elem)):
if self._is_hidden(elem.label):
# hidden element which matches again -> show it
self._show_elem(elems.label)
self._show_elem(elem.label)
else:
# element doesn't match anymore -> hide it
self._hide_elem(elems.label)
self._hide_elem(elem.label)
except webelem.IsNullError:
pass
visible = {}
for k, e in self._context.elems.items():
try:
if not self._is_hidden(e.label):
visible[k] = e
except webelem.IsNullError:
pass
if not visible:
# Whoops, filtered all hints
modeman.leave(self._win_id, usertypes.KeyMode.hint, 'all filtered')
elif len(visible) == 1 and config.get('hints', 'auto-follow'):
if config.get('hints', 'mode') == 'number':
visible = self._filter_number_hints()
else:
visible = self._filter_non_number_hints()
if (len(visible) == 1 and
config.get('hints', 'auto-follow') and
filterstr is not None):
# apply auto-follow-timeout
timeout = config.get('hints', 'auto-follow-timeout')
keyparsers = objreg.get('keyparsers', scope='window',
window=self._win_id)
normal_parser = keyparsers[usertypes.KeyMode.normal]
normal_parser.set_inhibited_timeout(timeout)
# unpacking gets us the first (and only) key in the dict.
self.fire(*visible)
@@ -917,30 +1018,31 @@ class HintManager(QObject):
}
elem = self._context.elems[keystr].elem
if elem.webFrame() is None:
message.error(self._win_id, "This element has no webframe.",
message.error(self._win_id,
"This element has no webframe.",
immediately=True)
return
if self._context.target in elem_handlers:
handler = functools.partial(
elem_handlers[self._context.target], elem, self._context)
handler = functools.partial(elem_handlers[self._context.target],
elem, self._context)
elif self._context.target in url_handlers:
url = self._resolve_url(elem, self._context.baseurl)
if url is None:
self._show_url_error()
return
handler = functools.partial(
url_handlers[self._context.target], url, self._context)
handler = functools.partial(url_handlers[self._context.target],
url, self._context)
else:
raise ValueError("No suitable handler found!")
if not self._context.rapid:
modeman.maybe_leave(self._win_id, usertypes.KeyMode.hint,
'followed')
else:
# Show all hints again
# Reset filtering
self.filter_hints(None)
# Undo keystring highlighting
for (text, elems) in self._context.elems.items():
elems.label.setInnerXml(text)
for string, elem in self._context.elems.items():
elem.label.setInnerXml(string)
handler()
@cmdutils.register(instance='hintmanager', scope='tab', hide=True,
@@ -964,13 +1066,13 @@ class HintManager(QObject):
def on_contents_size_changed(self, _size):
"""Reposition hints if contents size changed."""
log.hints.debug("Contents size changed...!")
for elems in self._context.elems.values():
for e in self._context.all_elems:
try:
if elems.elem.webFrame() is None:
if e.elem.webFrame() is None:
# This sometimes happens for some reason...
elems.label.removeFromDocument()
e.label.removeFromDocument()
continue
self._set_style_position(elems.elem, elems.label)
self._set_style_position(e.elem, e.label)
except webelem.IsNullError:
pass
@@ -997,14 +1099,17 @@ class WordHinter:
def __init__(self):
# will be initialized on first use.
self.words = set()
self.dictionary = None
def ensure_initialized(self):
"""Generate the used words if yet uninialized."""
if not self.words:
dictionary = config.get("hints", "dictionary")
"""Generate the used words if yet uninitialized."""
dictionary = config.get("hints", "dictionary")
if not self.words or self.dictionary != dictionary:
self.words.clear()
self.dictionary = dictionary
try:
with open(dictionary, encoding="UTF-8") as wordfile:
alphabet = set(string.ascii_lowercase)
alphabet = set(ascii_lowercase)
hints = set()
lines = (line.rstrip().lower() for line in wordfile)
for word in lines:
@@ -1034,13 +1139,11 @@ class WordHinter:
"text": str,
}
extractable_attrs = collections.defaultdict(
list, {
"IMG": ["alt", "title", "src"],
"A": ["title", "href", "text"],
"INPUT": ["name"]
}
)
extractable_attrs = collections.defaultdict(list, {
"IMG": ["alt", "title", "src"],
"A": ["title", "href", "text"],
"INPUT": ["name"]
})
return (attr_extractors[attr](elem)
for attr in extractable_attrs[elem.tagName()]
@@ -1058,15 +1161,19 @@ class WordHinter:
yield candidate[match.start():match.end()].lower()
def any_prefix(self, hint, existing):
return any(hint.startswith(e) or e.startswith(hint)
for e in existing)
return any(hint.startswith(e) or e.startswith(hint) for e in existing)
def new_hint_for(self, elem, existing):
def filter_prefixes(self, hints, existing):
return (h for h in hints if not self.any_prefix(h, existing))
def new_hint_for(self, elem, existing, fallback):
"""Return a hint for elem, not conflicting with the existing."""
new = self.tag_words_to_hints(self.extract_tag_words(elem))
no_prefixes = (h for h in new if not self.any_prefix(h, existing))
new_no_prefixes = self.filter_prefixes(new, existing)
fallback_no_prefixes = self.filter_prefixes(fallback, existing)
# either the first good, or None
return next(no_prefixes, None)
return (next(new_no_prefixes, None) or
next(fallback_no_prefixes, None))
def hint(self, elems):
"""Produce hint labels based on the html tags.
@@ -1086,7 +1193,9 @@ class WordHinter:
used_hints = set()
words = iter(self.words)
for elem in elems:
hint = self.new_hint_for(elem, used_hints) or next(words)
hint = self.new_hint_for(elem, used_hints, words)
if not hint:
raise WordHintingError("Not enough words in the dictionary.")
used_hints.add(hint)
hints.append(hint)
return hints

View File

@@ -1,211 +0,0 @@
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# qutebrowser is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Simple history which gets written to disk."""
import time
import collections
from PyQt5.QtCore import pyqtSignal, QUrl
from PyQt5.QtWebKit import QWebHistoryInterface
from qutebrowser.utils import utils, objreg, standarddir, log
from qutebrowser.config import config
from qutebrowser.misc import lineparser
class HistoryEntry:
"""A single entry in the web history.
Attributes:
atime: The time the page was accessed.
url: The URL which was accessed as QUrl.
url_string: The URL which was accessed as string.
"""
def __init__(self, atime, url):
self.atime = float(atime)
self.url = QUrl(url)
self.url_string = url
def __repr__(self):
return utils.get_repr(self, constructor=True, atime=self.atime,
url=self.url.toDisplayString())
def __str__(self):
return '{} {}'.format(int(self.atime), self.url_string)
class WebHistory(QWebHistoryInterface):
"""A QWebHistoryInterface which supports being written to disk.
Attributes:
_lineparser: The AppendLineParser used to save the history.
_history_dict: An OrderedDict of URLs read from the on-disk history.
_new_history: A list of HistoryEntry items of the current session.
_saved_count: How many HistoryEntries have been written to disk.
_initial_read_started: Whether async_read was called.
_initial_read_done: Whether async_read has completed.
_temp_history: OrderedDict of temporary history entries before
async_read was called.
Signals:
add_completion_item: Emitted before a new HistoryEntry is added.
arg: The new HistoryEntry.
item_added: Emitted after a new HistoryEntry is added.
arg: The new HistoryEntry.
"""
add_completion_item = pyqtSignal(HistoryEntry)
item_added = pyqtSignal(HistoryEntry)
async_read_done = pyqtSignal()
def __init__(self, parent=None):
super().__init__(parent)
self._initial_read_started = False
self._initial_read_done = False
self._lineparser = lineparser.AppendLineParser(
standarddir.data(), 'history', parent=self)
self._history_dict = collections.OrderedDict()
self._temp_history = collections.OrderedDict()
self._new_history = []
self._saved_count = 0
objreg.get('save-manager').add_saveable(
'history', self.save, self.item_added)
def __repr__(self):
return utils.get_repr(self, length=len(self))
def __getitem__(self, key):
return self._new_history[key]
def __iter__(self):
return iter(self._history_dict.values())
def __len__(self):
return len(self._history_dict)
def async_read(self):
"""Read the initial history."""
if self._initial_read_started:
log.init.debug("Ignoring async_read() because reading is started.")
return
self._initial_read_started = True
if standarddir.data() is None:
self._initial_read_done = True
self.async_read_done.emit()
return
with self._lineparser.open():
for line in self._lineparser:
yield
data = line.rstrip().split(maxsplit=1)
if not data:
# empty line
continue
elif len(data) != 2:
# other malformed line
log.init.warning("Invalid history entry {!r}!".format(
line))
continue
atime, url = data
if atime.startswith('\0'):
log.init.warning(
"Removing NUL bytes from entry {!r} - see "
"https://github.com/The-Compiler/qutebrowser/issues/"
"670".format(data))
atime = atime.lstrip('\0')
# This de-duplicates history entries; only the latest
# entry for each URL is kept. If you want to keep
# information about previous hits change the items in
# old_urls to be lists or change HistoryEntry to have a
# list of atimes.
entry = HistoryEntry(atime, url)
self._add_entry(entry)
self._initial_read_done = True
self.async_read_done.emit()
for url, entry in self._temp_history.items():
self._new_history.append(entry)
self._add_entry(entry)
self.add_completion_item.emit(entry)
def _add_entry(self, entry, target=None):
"""Add an entry to self._history_dict or another given OrderedDict."""
if target is None:
target = self._history_dict
target[entry.url_string] = entry
target.move_to_end(entry.url_string)
def get_recent(self):
"""Get the most recent history entries."""
old = self._lineparser.get_recent()
return old + [str(e) for e in self._new_history]
def save(self):
"""Save the history to disk."""
new = (str(e) for e in self._new_history[self._saved_count:])
self._lineparser.new_data = new
self._lineparser.save()
self._saved_count = len(self._new_history)
def addHistoryEntry(self, url_string):
"""Called by WebKit when an URL should be added to the history.
Args:
url_string: An url as string to add to the history.
"""
if not url_string:
return
if config.get('general', 'private-browsing'):
return
entry = HistoryEntry(time.time(), url_string)
if self._initial_read_done:
self.add_completion_item.emit(entry)
self._new_history.append(entry)
self._add_entry(entry)
self.item_added.emit(entry)
else:
self._add_entry(entry, target=self._temp_history)
def historyContains(self, url_string):
"""Called by WebKit to determine if an URL is contained in the history.
Args:
url_string: The URL (as string) to check for.
Return:
True if the url is in the history, False otherwise.
"""
return url_string in self._history_dict
def init(parent=None):
"""Initialize the web history.
Args:
parent: The parent to use for WebHistory.
"""
history = WebHistory(parent)
objreg.register('web-history', history)
QWebHistoryInterface.setDefaultInterface(history)

View File

@@ -23,7 +23,7 @@ import os
from PyQt5.QtCore import QUrl
from qutebrowser.browser import webelem
from qutebrowser.browser.webkit import webelem
from qutebrowser.utils import utils
@@ -51,9 +51,8 @@ def generate_pdfjs_page(url):
"""
viewer = get_pdfjs_res('web/viewer.html').decode('utf-8')
script = _generate_pdfjs_script(url)
html_page = viewer.replace(
'</body>', '</body><script>{}</script>'.format(script)
)
html_page = viewer.replace('</body>',
'</body><script>{}</script>'.format(script))
return html_page
@@ -64,13 +63,15 @@ def _generate_pdfjs_script(url):
url: The url of the pdf page as QUrl.
"""
return (
'PDFJS.verbosity = PDFJS.VERBOSITY_LEVELS.info;\n'
'PDFView.open("{url}");\n'
'document.addEventListener("DOMContentLoaded", function() {{\n'
' PDFJS.verbosity = PDFJS.VERBOSITY_LEVELS.info;\n'
' (window.PDFView || window.PDFViewerApplication).open("{url}");\n'
'}});\n'
).format(url=webelem.javascript_escape(url.toString(QUrl.FullyEncoded)))
def fix_urls(asset):
"""Take a html page and replace each relative URL with an absolute.
"""Take an html page and replace each relative URL with an absolute.
This is specialized for pdf.js files and not a general purpose function.

View File

@@ -40,8 +40,7 @@ class SignalFilter(QObject):
BLACKLIST: List of signal names which should not be logged.
"""
BLACKLIST = ['cur_scroll_perc_changed', 'cur_progress',
'cur_statusbar_message', 'cur_link_hovered']
BLACKLIST = ['cur_scroll_perc_changed', 'cur_progress', 'cur_link_hovered']
def __init__(self, win_id, parent=None):
super().__init__(parent)

View File

@@ -32,8 +32,9 @@ import collections
from PyQt5.QtCore import pyqtSignal, QUrl, QObject
from qutebrowser.utils import message, usertypes, urlutils, standarddir, objreg
from qutebrowser.commands import cmdexc, cmdutils
from qutebrowser.utils import (message, usertypes, qtutils, urlutils,
standarddir, objreg)
from qutebrowser.commands import cmdutils
from qutebrowser.misc import lineparser
@@ -154,8 +155,7 @@ class QuickmarkManager(UrlMarkManager):
try:
key, url = line.rsplit(maxsplit=1)
except ValueError:
message.error('current', "Invalid quickmark '{}'".format(
line))
message.error('current', "Invalid quickmark '{}'".format(line))
else:
self.marks[key] = url
@@ -174,10 +174,14 @@ class QuickmarkManager(UrlMarkManager):
win_id, "Add quickmark:", usertypes.PromptMode.text,
functools.partial(self.quickmark_add, win_id, urlstr))
@cmdutils.register(instance='quickmark-manager', win_id='win_id')
@cmdutils.register(instance='quickmark-manager')
@cmdutils.argument('win_id', win_id=True)
def quickmark_add(self, win_id, url, name):
"""Add a new quickmark.
You can view all saved quickmarks on the
link:qute://bookmarks[bookmarks page].
Args:
win_id: The window ID to display the errors in.
url: The url to add as quickmark.
@@ -204,18 +208,22 @@ class QuickmarkManager(UrlMarkManager):
else:
set_mark()
@cmdutils.register(instance='quickmark-manager', maxsplit=0,
completion=[usertypes.Completion.quickmark_by_name])
def quickmark_del(self, name):
"""Delete a quickmark.
def get_by_qurl(self, url):
"""Look up a quickmark by QUrl, returning its name.
Args:
name: The name of the quickmark to delete.
Takes O(n) time, where n is the number of quickmarks.
Use a name instead where possible.
"""
qtutils.ensure_valid(url)
urlstr = url.toString(QUrl.RemovePassword | QUrl.FullyEncoded)
try:
self.delete(name)
except KeyError:
raise cmdexc.CommandError("Quickmark '{}' not found!".format(name))
index = list(self.marks.values()).index(urlstr)
key = list(self.marks.keys())[index]
except ValueError:
raise DoesNotExistError(
"Quickmark for '{}' not found!".format(urlstr))
return key
def get(self, name):
"""Get the URL of the quickmark named name as a QUrl."""
@@ -283,16 +291,3 @@ class BookmarkManager(UrlMarkManager):
self.marks[urlstr] = title
self.changed.emit()
self.added.emit(title, urlstr)
@cmdutils.register(instance='bookmark-manager', maxsplit=0,
completion=[usertypes.Completion.bookmark_by_url])
def bookmark_del(self, url):
"""Delete a bookmark.
Args:
url: The URL of the bookmark to delete.
"""
try:
self.delete(url)
except KeyError:
raise cmdexc.CommandError("Bookmark '{}' not found!".format(url))

View File

@@ -0,0 +1,20 @@
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# qutebrowser is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Classes related to the browser widgets for QtWebEngine."""

View File

@@ -0,0 +1,431 @@
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# qutebrowser is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
# FIXME:qtwebengine remove this once the stubs are gone
# pylint: disable=unused-variable
"""Wrapper over a QWebEngineView."""
from PyQt5.QtCore import pyqtSlot, Qt, QEvent, QPoint
from PyQt5.QtGui import QKeyEvent, QIcon
from PyQt5.QtWidgets import QApplication
# pylint: disable=no-name-in-module,import-error,useless-suppression
from PyQt5.QtWebEngineWidgets import QWebEnginePage
# pylint: enable=no-name-in-module,import-error,useless-suppression
from qutebrowser.browser import browsertab
from qutebrowser.browser.webengine import webview
from qutebrowser.utils import usertypes, qtutils, log, utils
class WebEnginePrinting(browsertab.AbstractPrinting):
"""QtWebEngine implementations related to printing."""
def check_pdf_support(self):
if not hasattr(self._widget.page(), 'printToPdf'):
raise browsertab.WebTabError(
"Printing to PDF is unsupported with QtWebEngine on Qt > 5.7")
def check_printer_support(self):
raise browsertab.WebTabError(
"Printing is unsupported with QtWebEngine")
def to_pdf(self, filename):
self._widget.page().printToPdf(filename)
def to_printer(self, printer):
# Should never be called
assert False
class WebEngineSearch(browsertab.AbstractSearch):
"""QtWebEngine implementations related to searching on the page."""
def __init__(self, parent=None):
super().__init__(parent)
self._flags = QWebEnginePage.FindFlags(0)
def _find(self, text, flags, cb=None):
"""Call findText on the widget with optional callback."""
if cb is None:
self._widget.findText(text, flags)
else:
self._widget.findText(text, flags, cb)
def search(self, text, *, ignore_case=False, reverse=False,
result_cb=None):
flags = QWebEnginePage.FindFlags(0)
if ignore_case == 'smart':
if not text.islower():
flags |= QWebEnginePage.FindCaseSensitively
elif not ignore_case:
flags |= QWebEnginePage.FindCaseSensitively
if reverse:
flags |= QWebEnginePage.FindBackward
self.text = text
self._flags = flags
self._find(text, flags, result_cb)
def clear(self):
self._widget.findText('')
def prev_result(self, *, result_cb=None):
# The int() here makes sure we get a copy of the flags.
flags = QWebEnginePage.FindFlags(int(self._flags))
if flags & QWebEnginePage.FindBackward:
flags &= ~QWebEnginePage.FindBackward
else:
flags |= QWebEnginePage.FindBackward
self._find(self.text, self._flags, result_cb)
def next_result(self, *, result_cb=None):
self._find(self.text, self._flags, result_cb)
class WebEngineCaret(browsertab.AbstractCaret):
"""QtWebEngine implementations related to moving the cursor/selection."""
@pyqtSlot(usertypes.KeyMode)
def _on_mode_entered(self, mode):
log.stub()
@pyqtSlot(usertypes.KeyMode)
def _on_mode_left(self):
log.stub()
def move_to_next_line(self, count=1):
log.stub()
def move_to_prev_line(self, count=1):
log.stub()
def move_to_next_char(self, count=1):
log.stub()
def move_to_prev_char(self, count=1):
log.stub()
def move_to_end_of_word(self, count=1):
log.stub()
def move_to_next_word(self, count=1):
log.stub()
def move_to_prev_word(self, count=1):
log.stub()
def move_to_start_of_line(self):
log.stub()
def move_to_end_of_line(self):
log.stub()
def move_to_start_of_next_block(self, count=1):
log.stub()
def move_to_start_of_prev_block(self, count=1):
log.stub()
def move_to_end_of_next_block(self, count=1):
log.stub()
def move_to_end_of_prev_block(self, count=1):
log.stub()
def move_to_start_of_document(self):
log.stub()
def move_to_end_of_document(self):
log.stub()
def toggle_selection(self):
log.stub()
def drop_selection(self):
log.stub()
def has_selection(self):
return self._widget.hasSelection()
def selection(self, html=False):
if html:
raise NotImplementedError
return self._widget.selectedText()
def follow_selected(self, *, tab=False):
log.stub()
class WebEngineScroller(browsertab.AbstractScroller):
"""QtWebEngine implementations related to scrolling."""
def __init__(self, tab, parent=None):
super().__init__(tab, parent)
self._pos_perc = (None, None)
self._pos_px = QPoint()
def _init_widget(self, widget):
super()._init_widget(widget)
page = widget.page()
try:
page.scrollPositionChanged.connect(
self._on_scroll_pos_changed)
except AttributeError:
log.stub('scrollPositionChanged, on Qt < 5.7')
self._on_scroll_pos_changed()
def _key_press(self, key, count=1):
# FIXME:qtwebengine Abort scrolling if the minimum/maximum was reached.
press_evt = QKeyEvent(QEvent.KeyPress, key, Qt.NoModifier, 0, 0, 0)
release_evt = QKeyEvent(QEvent.KeyRelease, key, Qt.NoModifier, 0, 0, 0)
recipient = self._widget.focusProxy()
for _ in range(count):
# If we get a segfault here, we might want to try sendEvent
# instead.
QApplication.postEvent(recipient, press_evt)
QApplication.postEvent(recipient, release_evt)
@pyqtSlot()
def _on_scroll_pos_changed(self):
"""Update the scroll position attributes when it changed."""
def update_scroll_pos(jsret):
"""Callback after getting scroll position via JS."""
if jsret is None:
# This can happen when the callback would get called after
# shutting down a tab
return
assert isinstance(jsret, dict), jsret
self._pos_perc = (jsret['perc']['x'], jsret['perc']['y'])
self._pos_px = QPoint(jsret['px']['x'], jsret['px']['y'])
self.perc_changed.emit(*self._pos_perc)
js_code = """
{scroll_js}
scroll_pos();
""".format(scroll_js=utils.read_file('javascript/scroll.js'))
self._tab.run_js_async(js_code, update_scroll_pos)
def pos_px(self):
return self._pos_px
def pos_perc(self):
return self._pos_perc
def to_perc(self, x=None, y=None):
js_code = """
{scroll_js}
scroll_to_perc({x}, {y});
""".format(scroll_js=utils.read_file('javascript/scroll.js'),
x='undefined' if x is None else x,
y='undefined' if y is None else y)
self._tab.run_js_async(js_code)
def to_point(self, point):
self._tab.run_js_async("window.scroll({x}, {y});".format(
x=point.x(), y=point.y()))
def delta(self, x=0, y=0):
self._tab.run_js_async("window.scrollBy({x}, {y});".format(x=x, y=y))
def delta_page(self, x=0, y=0):
js_code = """
{scroll_js}
scroll_delta_page({x}, {y});
""".format(scroll_js=utils.read_file('javascript/scroll.js'), x=x, y=y)
self._tab.run_js_async(js_code)
def up(self, count=1):
self._key_press(Qt.Key_Up, count)
def down(self, count=1):
self._key_press(Qt.Key_Down, count)
def left(self, count=1):
self._key_press(Qt.Key_Left, count)
def right(self, count=1):
self._key_press(Qt.Key_Right, count)
def top(self):
self._key_press(Qt.Key_Home)
def bottom(self):
self._key_press(Qt.Key_End)
def page_up(self, count=1):
self._key_press(Qt.Key_PageUp, count)
def page_down(self, count=1):
self._key_press(Qt.Key_PageDown, count)
def at_top(self):
return self.pos_px().y() == 0
def at_bottom(self):
log.stub()
class WebEngineHistory(browsertab.AbstractHistory):
"""QtWebEngine implementations related to page history."""
def current_idx(self):
return self._history.currentItemIndex()
def back(self):
self._history.back()
def forward(self):
self._history.forward()
def can_go_back(self):
return self._history.canGoBack()
def can_go_forward(self):
return self._history.canGoForward()
def serialize(self):
return qtutils.serialize(self._history)
def deserialize(self, data):
return qtutils.deserialize(data, self._history)
def load_items(self, items):
log.stub()
class WebEngineZoom(browsertab.AbstractZoom):
"""QtWebEngine implementations related to zooming."""
def _set_factor_internal(self, factor):
self._widget.setZoomFactor(factor)
def factor(self):
return self._widget.zoomFactor()
class WebEngineTab(browsertab.AbstractTab):
"""A QtWebEngine tab in the browser."""
def __init__(self, win_id, mode_manager, parent=None):
super().__init__(win_id)
widget = webview.WebEngineView()
self.history = WebEngineHistory(self)
self.scroller = WebEngineScroller(self, parent=self)
self.caret = WebEngineCaret(win_id=win_id, mode_manager=mode_manager,
tab=self, parent=self)
self.zoom = WebEngineZoom(win_id=win_id, parent=self)
self.search = WebEngineSearch(parent=self)
self.printing = WebEnginePrinting()
self._set_widget(widget)
self._connect_signals()
self.backend = usertypes.Backend.QtWebEngine
def openurl(self, url):
self._openurl_prepare(url)
self._widget.load(url)
def url(self):
return self._widget.url()
def dump_async(self, callback, *, plain=False):
if plain:
self._widget.page().toPlainText(callback)
else:
self._widget.page().toHtml(callback)
def run_js_async(self, code, callback=None):
if callback is None:
self._widget.page().runJavaScript(code)
else:
self._widget.page().runJavaScript(code, callback)
def run_js_blocking(self, code):
unset = object()
loop = qtutils.EventLoop()
js_ret = unset
def js_cb(val):
"""Handle return value from JS and stop blocking."""
nonlocal js_ret
js_ret = val
loop.quit()
self.run_js_async(code, js_cb)
loop.exec_() # blocks until loop.quit() in js_cb
assert js_ret is not unset
return js_ret
def shutdown(self):
log.stub()
def reload(self, *, force=False):
if force:
action = QWebEnginePage.ReloadAndBypassCache
else:
action = QWebEnginePage.Reload
self._widget.triggerPageAction(action)
def stop(self):
self._widget.stop()
def title(self):
return self._widget.title()
def icon(self):
try:
return self._widget.icon()
except AttributeError:
log.stub('on Qt < 5.7')
return QIcon()
def set_html(self, html, base_url):
# FIXME:qtwebengine
# check this and raise an exception if too big:
# Warning: The content will be percent encoded before being sent to the
# renderer via IPC. This may increase its size. The maximum size of the
# percent encoded content is 2 megabytes minus 30 bytes.
self._widget.setHtml(html, base_url)
def clear_ssl_errors(self):
log.stub()
def _connect_signals(self):
view = self._widget
page = view.page()
page.windowCloseRequested.connect(self.window_close_requested)
page.linkHovered.connect(self.link_hovered)
page.loadProgress.connect(self._on_load_progress)
page.loadStarted.connect(self._on_load_started)
view.titleChanged.connect(self.title_changed)
view.urlChanged.connect(self._on_url_changed)
page.loadFinished.connect(self._on_load_finished)
page.certificate_error.connect(self._on_ssl_errors)
try:
view.iconChanged.connect(self.icon_changed)
except AttributeError:
log.stub('iconChanged, on Qt < 5.7')

View File

@@ -0,0 +1,79 @@
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# qutebrowser is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""The main browser widget for QtWebEngine."""
from PyQt5.QtCore import pyqtSignal, Qt, QPoint
# pylint: disable=no-name-in-module,import-error,useless-suppression
from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEnginePage
# pylint: enable=no-name-in-module,import-error,useless-suppression
from qutebrowser.config import config
from qutebrowser.utils import log
class WebEngineView(QWebEngineView):
"""Custom QWebEngineView subclass with qutebrowser-specific features."""
mouse_wheel_zoom = pyqtSignal(QPoint)
def __init__(self, parent=None):
super().__init__(parent)
self.setPage(WebEnginePage(self))
def wheelEvent(self, e):
"""Zoom on Ctrl-Mousewheel.
Args:
e: The QWheelEvent.
"""
if e.modifiers() & Qt.ControlModifier:
e.accept()
self.mouse_wheel_zoom.emit(e.angleDelta())
else:
super().wheelEvent(e)
class WebEnginePage(QWebEnginePage):
"""Custom QWebEnginePage subclass with qutebrowser-specific features."""
certificate_error = pyqtSignal()
def certificateError(self, error):
self.certificate_error.emit()
return super().certificateError(error)
def javaScriptConsoleMessage(self, level, msg, line, source):
"""Log javascript messages to qutebrowser's log."""
# FIXME:qtwebengine maybe unify this in the tab api somehow?
setting = config.get('general', 'log-javascript-console')
if setting == 'none':
return
level_to_logger = {
QWebEnginePage.InfoMessageLevel: log.js.info,
QWebEnginePage.WarningMessageLevel: log.js.warning,
QWebEnginePage.ErrorMessageLevel: log.js.error,
}
logstring = "[{}:{}] {}".format(source, line, msg)
logger = level_to_logger[level]
logger(logstring)

View File

@@ -0,0 +1,20 @@
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# qutebrowser is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Classes related to the browser widgets for QtWebKit."""

View File

@@ -32,16 +32,23 @@ class DiskCache(QNetworkDiskCache):
"""Disk cache which sets correct cache dir and size.
If the cache is deactivated via the command line argument --cachedir="",
both attributes _cache_dir and _http_cache_dir are set to None.
Attributes:
_activated: Whether the cache should be used.
_cache_dir: The base directory for cache files (standarddir.cache())
_http_cache_dir: the HTTP subfolder in _cache_dir.
_cache_dir: The base directory for cache files (standarddir.cache()) or
None.
_http_cache_dir: the HTTP subfolder in _cache_dir or None.
"""
def __init__(self, cache_dir, parent=None):
super().__init__(parent)
self._cache_dir = cache_dir
self._http_cache_dir = os.path.join(cache_dir, 'http')
if cache_dir is None:
self._http_cache_dir = None
else:
self._http_cache_dir = os.path.join(cache_dir, 'http')
self._maybe_activate()
objreg.get('config').changed.connect(self.on_config_changed)
@@ -65,7 +72,7 @@ class DiskCache(QNetworkDiskCache):
"""Update cache size/activated if the config was changed."""
if (section, option) == ('storage', 'cache-size'):
self.setMaximumCacheSize(config.get('storage', 'cache-size'))
elif (section, option) == ('general', # pragma: no branch
elif (section, option) == ('general', # pragma: no branch
'private-browsing'):
self._maybe_activate()

View File

@@ -37,9 +37,6 @@ class RAMCookieJar(QNetworkCookieJar):
changed = pyqtSignal()
def __init__(self, parent=None):
super().__init__(parent)
def __repr__(self):
return utils.get_repr(self, count=len(self.allCookies()))

View File

@@ -25,6 +25,7 @@ import sys
import os.path
import shutil
import functools
import tempfile
import collections
import sip
@@ -39,8 +40,8 @@ from qutebrowser.config import config
from qutebrowser.commands import cmdexc, cmdutils
from qutebrowser.utils import (message, usertypes, log, utils, urlutils,
objreg, standarddir, qtutils)
from qutebrowser.browser import http
from qutebrowser.browser.network import networkmanager
from qutebrowser.browser.webkit import http
from qutebrowser.browser.webkit.network import networkmanager
ModelRole = usertypes.enum('ModelRole', ['item'], start=Qt.UserRole,
@@ -49,10 +50,7 @@ ModelRole = usertypes.enum('ModelRole', ['item'], start=Qt.UserRole,
RetryInfo = collections.namedtuple('RetryInfo', ['request', 'manager'])
DownloadPath = collections.namedtuple('DownloadPath', ['filename',
'question'])
DownloadPath = collections.namedtuple('DownloadPath', ['filename', 'question'])
# Remember the last used directory
last_used_directory = None
@@ -90,7 +88,7 @@ def path_suggestion(filename):
return filename
elif suggestion == 'both':
return os.path.join(download_dir(), filename)
else:
else: # pragma: no cover
raise ValueError("Invalid suggestion value {}!".format(suggestion))
@@ -104,6 +102,11 @@ def create_full_filename(basename, filename):
Return:
The full absolute path, or None if filename creation was not possible.
"""
# Remove chars which can't be encoded in the filename encoding.
# See https://github.com/The-Compiler/qutebrowser/issues/427
encoding = sys.getfilesystemencoding()
filename = utils.force_encoding(filename, encoding)
basename = utils.force_encoding(basename, encoding)
if os.path.isabs(filename) and os.path.isdir(filename):
# We got an absolute directory from the user, so we save it under
# the default filename in that directory.
@@ -143,8 +146,7 @@ def ask_for_filename(suggested_filename, win_id, *, parent=None,
return DownloadPath(filename=download_dir(), question=None)
encoding = sys.getfilesystemencoding()
suggested_filename = utils.force_encoding(suggested_filename,
encoding)
suggested_filename = utils.force_encoding(suggested_filename, encoding)
q = usertypes.Question(parent)
q.text = "Save file to:"
@@ -226,7 +228,7 @@ class DownloadItemStats(QObject):
else:
return remaining_bytes / avg
@pyqtSlot(int, int)
@pyqtSlot('qint64', 'qint64')
def on_download_progress(self, bytes_done, bytes_total):
"""Update local variables when the download progress changed.
@@ -279,6 +281,7 @@ class DownloadItem(QObject):
_read_timer: A Timer which reads the QNetworkReply into self._buffer
periodically.
_win_id: The window ID the DownloadItem runs in.
_dead: Whether the Download has _die()'d.
Signals:
data_changed: The downloads metadata changed.
@@ -327,6 +330,7 @@ class DownloadItem(QObject):
self.init_reply(reply)
self._win_id = win_id
self.raw_headers = {}
self._dead = False
def __repr__(self):
return utils.get_repr(self, basename=self.basename)
@@ -344,7 +348,7 @@ class DownloadItem(QObject):
errmsg = ""
else:
errmsg = " - {}".format(self.error_msg)
if all(e is None for e in (perc, remaining, self.stats.total)):
if all(e is None for e in [perc, remaining, self.stats.total]):
return ('{index}: {name} [{speed:>10}|{down}]{errmsg}'.format(
index=self.index, name=self.basename, speed=speed,
down=down, errmsg=errmsg))
@@ -394,6 +398,21 @@ class DownloadItem(QObject):
def _die(self, msg):
"""Abort the download and emit an error."""
assert not self.successful
# Prevent actions if calling _die() twice. This might happen if the
# error handler correctly connects, and the error occurs in init_reply
# between reply.error.connect and the reply.error() check. In this
# case, the connected error handlers will be called twice, once via the
# direct error.emit() and once here in _die(). The stacks look like
# this then:
# <networkmanager error.emit> -> on_reply_error -> _die ->
# self.error.emit()
# and
# [init_reply -> <single shot timer> ->] <lambda in init_reply> ->
# self.error.emit()
# which may lead to duplicate error messages (and failing tests)
if self._dead:
return
self._dead = True
self._read_timer.stop()
self.reply.downloadProgress.disconnect()
self.reply.finished.disconnect()
@@ -411,6 +430,11 @@ class DownloadItem(QObject):
self.reply = None
self.done = True
self.data_changed.emit()
if self.fileobj is not None:
try:
self.fileobj.close()
except OSError:
log.downloads.exception("Error while closing file object")
def init_reply(self, reply):
"""Set a new reply and connect its signals.
@@ -435,7 +459,7 @@ class DownloadItem(QObject):
# Here no signals are connected to the DownloadItem yet, so we use a
# singleShot QTimer to emit them after they are connected.
if reply.error() != QNetworkReply.NoError:
QTimer.singleShot(0, lambda: self.error.emit(reply.errorString()))
QTimer.singleShot(0, lambda: self._die(reply.errorString()))
def get_status_color(self, position):
"""Choose an appropriate color for presenting the download's status.
@@ -445,7 +469,7 @@ class DownloadItem(QObject):
"""
# pylint: disable=bad-config-call
# WORKAROUND for https://bitbucket.org/logilab/astroid/issue/104/
assert position in ("fg", "bg")
assert position in ["fg", "bg"]
start = config.get('colors', 'downloads.{}.start'.format(position))
stop = config.get('colors', 'downloads.{}.stop'.format(position))
system = config.get('colors', 'downloads.{}.system'.format(position))
@@ -456,8 +480,8 @@ class DownloadItem(QObject):
elif self.stats.percentage() is None:
return start
else:
return utils.interpolate_color(
start, stop, self.stats.percentage(), system)
return utils.interpolate_color(start, stop,
self.stats.percentage(), system)
@pyqtSlot()
def cancel(self, remove_data=True):
@@ -507,7 +531,13 @@ class DownloadItem(QObject):
def open_file(self):
"""Open the downloaded file."""
assert self.successful
url = QUrl.fromLocalFile(self._filename)
filename = self._filename
if filename is None:
filename = getattr(self.fileobj, 'name', None)
if filename is None:
log.downloads.error("No filename to open the download!")
return
url = QUrl.fromLocalFile(filename)
QDesktopServices.openUrl(url)
def set_filename(self, filename):
@@ -518,15 +548,11 @@ class DownloadItem(QObject):
None: special value to stop the download.
"""
global last_used_directory
if self.fileobj is not None:
if self.fileobj is not None: # pragma: no cover
raise ValueError("fileobj was already set! filename: {}, "
"existing: {}, fileobj {}".format(
filename, self._filename, self.fileobj))
filename = os.path.expanduser(filename)
# Remove chars which can't be encoded in the filename encoding.
# See https://github.com/The-Compiler/qutebrowser/issues/427
encoding = sys.getfilesystemencoding()
filename = utils.force_encoding(filename, encoding)
self._filename = create_full_filename(self.basename, filename)
if self._filename is None:
# We only got a filename (without directory) or a relative path
@@ -535,7 +561,7 @@ class DownloadItem(QObject):
self._filename = create_full_filename(
self.basename, os.path.join(download_dir(), filename))
# At this point, we have a misconfigured XDG_DOWNLOAd_DIR, as
# At this point, we have a misconfigured XDG_DOWNLOAD_DIR, as
# download_dir() + filename is still no absolute path.
# The config value is checked for "absoluteness", but
# ~/.config/user-dirs.dirs may be misconfigured and a non-absolute path
@@ -561,8 +587,8 @@ class DownloadItem(QObject):
txt = self._filename + " already exists. Overwrite?"
self._ask_confirm_question(txt)
# FIFO, device node, etc. Make sure we want to do this
elif (os.path.exists(self._filename) and not
os.path.isdir(self._filename)):
elif (os.path.exists(self._filename) and
not os.path.isdir(self._filename)):
txt = (self._filename + " already exists and is a special file. "
"Write to this?")
self._ask_confirm_question(txt)
@@ -575,7 +601,7 @@ class DownloadItem(QObject):
Args:
fileobj: A file-like object.
"""
if self.fileobj is not None:
if self.fileobj is not None: # pragma: no cover
raise ValueError("fileobj was already set! Old: {}, new: "
"{}".format(self.fileobj, fileobj))
self.fileobj = fileobj
@@ -649,7 +675,7 @@ class DownloadItem(QObject):
except OSError as e:
self._die(e.strerror)
@pyqtSlot(int)
@pyqtSlot('QNetworkReply::NetworkError')
def on_reply_error(self, code):
"""Handle QNetworkReply errors."""
if code == QNetworkReply.OperationCanceledError:
@@ -676,7 +702,7 @@ class DownloadItem(QObject):
self.raw_headers[bytes(key)] = bytes(value)
def _handle_redirect(self):
"""Handle a HTTP redirect.
"""Handle an HTTP redirect.
Return:
True if the download was redirected, False otherwise.
@@ -736,6 +762,9 @@ class DownloadManager(QAbstractListModel):
def _postprocess_question(self, q):
"""Postprocess a Question object that is asked."""
q.destroyed.connect(functools.partial(self.questions.remove, q))
# We set the mode here so that other code that uses ask_for_filename
# doesn't need to handle the special download mode.
q.mode = usertypes.PromptMode.download
self.questions.append(q)
@pyqtSlot()
@@ -755,10 +784,7 @@ class DownloadManager(QAbstractListModel):
**kwargs: passed to get_request().
Return:
If the download could start immediately, (fileobj/filename given),
the created DownloadItem.
If not, None.
The created DownloadItem.
"""
if not url.isValid():
urlutils.invalid_url_error(self._win_id, url, "start download")
@@ -766,27 +792,17 @@ class DownloadManager(QAbstractListModel):
req = QNetworkRequest(url)
return self.get_request(req, **kwargs)
def get_request(self, request, *, fileobj=None, filename=None,
prompt_download_directory=None, **kwargs):
def get_request(self, request, *, target=None, **kwargs):
"""Start a download with a QNetworkRequest.
Args:
request: The QNetworkRequest to download.
fileobj: The file object to write the answer to.
filename: A path to write the data to.
prompt_download_directory: Whether to prompt for the download dir
or automatically download. If None, the
config is used.
target: Where to save the download as usertypes.DownloadTarget.
**kwargs: Passed to fetch_request.
Return:
If the download could start immediately, (fileobj/filename given),
the created DownloadItem.
If not, None.
The created DownloadItem.
"""
if fileobj is not None and filename is not None:
raise TypeError("Only one of fileobj/filename may be given!")
# WORKAROUND for Qt corrupting data loaded from cache:
# https://bugreports.qt.io/browse/QTBUG-42757
request.setAttribute(QNetworkRequest.CacheLoadControlAttribute,
@@ -814,27 +830,10 @@ class DownloadManager(QAbstractListModel):
if suggested_fn is None:
suggested_fn = 'qutebrowser-download'
# We won't need a question if a filename or fileobj is already given
if fileobj is None and filename is None:
filename, q = ask_for_filename(
suggested_fn, self._win_id, parent=self,
prompt_download_directory=prompt_download_directory
)
if fileobj is not None or filename is not None:
return self.fetch_request(request,
fileobj=fileobj,
filename=filename,
suggested_filename=suggested_fn,
**kwargs)
q.answered.connect(
lambda fn: self.fetch_request(request,
filename=fn,
suggested_filename=suggested_fn,
**kwargs))
self._postprocess_question(q)
q.ask()
return None
return self.fetch_request(request,
target=target,
suggested_filename=suggested_fn,
**kwargs)
def fetch_request(self, request, *, page=None, **kwargs):
"""Download a QNetworkRequest to disk.
@@ -855,27 +854,25 @@ class DownloadManager(QAbstractListModel):
return self.fetch(reply, **kwargs)
@pyqtSlot('QNetworkReply')
def fetch(self, reply, *, fileobj=None, filename=None, auto_remove=False,
def fetch(self, reply, *, target=None, auto_remove=False,
suggested_filename=None, prompt_download_directory=None):
"""Download a QNetworkReply to disk.
Args:
reply: The QNetworkReply to download.
fileobj: The file object to write the answer to.
filename: A path to write the data to.
target: Where to save the download as usertypes.DownloadTarget.
auto_remove: Whether to remove the download even if
ui -> remove-finished-downloads is set to -1.
Return:
The created DownloadItem.
"""
if fileobj is not None and filename is not None:
raise TypeError("Only one of fileobj/filename may be given!")
if not suggested_filename:
if filename is not None:
suggested_filename = os.path.basename(filename)
elif fileobj is not None and getattr(fileobj, 'name', None):
suggested_filename = fileobj.name
if isinstance(target, usertypes.FileDownloadTarget):
suggested_filename = os.path.basename(target.filename)
elif (isinstance(target, usertypes.FileObjDownloadTarget) and
getattr(target.fileobj, 'name', None)):
suggested_filename = target.fileobj.name
else:
_, suggested_filename = http.parse_content_disposition(reply)
log.downloads.debug("fetch: {} -> {}".format(reply.url(),
@@ -898,8 +895,8 @@ class DownloadManager(QAbstractListModel):
download.redirected.connect(
functools.partial(self.on_redirect, download))
download.basename = suggested_filename
idx = len(self.downloads) + 1
download.index = idx
idx = len(self.downloads)
download.index = idx + 1 # "Human readable" index
self.beginInsertRows(QModelIndex(), idx, idx)
self.downloads.append(download)
self.endInsertRows()
@@ -907,13 +904,8 @@ class DownloadManager(QAbstractListModel):
if not self._update_timer.isActive():
self._update_timer.start()
if fileobj is not None:
download.set_fileobj(fileobj)
download.autoclose = False
return download
if filename is not None:
download.set_filename(filename)
if target is not None:
self._set_download_target(download, suggested_filename, target)
return download
# Neither filename nor fileobj were given, prepare a question
@@ -924,12 +916,15 @@ class DownloadManager(QAbstractListModel):
# User doesn't want to be asked, so just use the download_dir
if filename is not None:
download.set_filename(filename)
target = usertypes.FileDownloadTarget(filename)
self._set_download_target(download, suggested_filename, target)
return download
# Ask the user for a filename
self._postprocess_question(q)
q.answered.connect(download.set_filename)
q.answered.connect(
functools.partial(self._set_download_target, download,
suggested_filename))
q.cancelled.connect(download.cancel)
download.cancelled.connect(q.abort)
download.error.connect(q.abort)
@@ -937,6 +932,43 @@ class DownloadManager(QAbstractListModel):
return download
def _set_download_target(self, download, suggested_filename, target):
"""Set the target for a given download.
Args:
download: The download to set the filename for.
suggested_filename: The suggested filename.
target: The usertypes.DownloadTarget for this download.
"""
if isinstance(target, usertypes.FileObjDownloadTarget):
download.set_fileobj(target.fileobj)
download.autoclose = False
elif isinstance(target, usertypes.FileDownloadTarget):
download.set_filename(target.filename)
elif isinstance(target, usertypes.OpenFileDownloadTarget):
tmp_manager = objreg.get('temporary-downloads')
try:
fobj = tmp_manager.get_tmpfile(suggested_filename)
except OSError as exc:
msg = "Download error: {}".format(exc)
message.error(self._win_id, msg)
download.cancel()
return
download.finished.connect(
functools.partial(self._open_download, download))
download.autoclose = True
download.set_fileobj(fobj)
else:
log.downloads.error("Unknown download target: {}".format(target))
def _open_download(self, download):
"""Open the given download but only if it was successful."""
if download.successful:
download.open_file()
else:
log.downloads.debug("{} finished but not successful, not opening!"
.format(download))
def raise_no_download(self, count):
"""Raise an exception that the download doesn't exist.
@@ -947,8 +979,8 @@ class DownloadManager(QAbstractListModel):
raise cmdexc.CommandError("There's no download!")
raise cmdexc.CommandError("There's no download {}!".format(count))
@cmdutils.register(instance='download-manager', scope='window',
count='count')
@cmdutils.register(instance='download-manager', scope='window')
@cmdutils.argument('count', count=True)
def download_cancel(self, all_=False, count=0):
"""Cancel the last/[count]th download.
@@ -974,8 +1006,8 @@ class DownloadManager(QAbstractListModel):
.format(count))
download.cancel()
@cmdutils.register(instance='download-manager', scope='window',
count='count')
@cmdutils.register(instance='download-manager', scope='window')
@cmdutils.argument('count', count=True)
def download_delete(self, count=0):
"""Delete the last/[count]th download from disk.
@@ -992,9 +1024,10 @@ class DownloadManager(QAbstractListModel):
raise cmdexc.CommandError("Download {} is not done!".format(count))
download.delete()
self.remove_item(download)
log.downloads.debug("deleted download {}".format(download))
@cmdutils.register(instance='download-manager', scope='window',
count='count')
@cmdutils.register(instance='download-manager', scope='window')
@cmdutils.argument('count', count=True)
def download_open(self, count=0):
"""Open the last/[count]th download.
@@ -1011,8 +1044,8 @@ class DownloadManager(QAbstractListModel):
raise cmdexc.CommandError("Download {} is not done!".format(count))
download.open_file()
@cmdutils.register(instance='download-manager', scope='window',
count='count')
@cmdutils.register(instance='download-manager', scope='window')
@cmdutils.argument('count', count=True)
def download_retry(self, count=0):
"""Retry the first failed/[count]th download.
@@ -1038,7 +1071,7 @@ class DownloadManager(QAbstractListModel):
@pyqtSlot(QNetworkRequest, QNetworkReply)
def on_redirect(self, download, request, reply):
"""Handle a HTTP redirect of a download.
"""Handle an HTTP redirect of a download.
Args:
download: The old DownloadItem.
@@ -1097,8 +1130,8 @@ class DownloadManager(QAbstractListModel):
finished_items = [d for d in self.downloads if d.done]
self.remove_items(finished_items)
@cmdutils.register(instance='download-manager', scope='window',
count='count')
@cmdutils.register(instance='download-manager', scope='window')
@cmdutils.argument('count', count=True)
def download_remove(self, all_=False, count=0):
"""Remove the last/[count]th download from the list.
@@ -1228,7 +1261,8 @@ class DownloadManager(QAbstractListModel):
def flags(self, _index):
"""Override flags so items aren't selectable.
The default would be Qt.ItemIsEnabled | Qt.ItemIsSelectable."""
The default would be Qt.ItemIsEnabled | Qt.ItemIsSelectable.
"""
return Qt.ItemIsEnabled | Qt.ItemNeverHasChildren
def rowCount(self, parent=QModelIndex()):
@@ -1237,3 +1271,72 @@ class DownloadManager(QAbstractListModel):
# We don't have children
return 0
return len(self.downloads)
def running_downloads(self):
"""Return the amount of still running downloads.
Return:
The number of unfinished downloads.
"""
return sum(1 for download in self.downloads if not download.done)
class TempDownloadManager(QObject):
"""Manager to handle temporary download files.
The downloads are downloaded to a temporary location and then openened with
the system standard application. The temporary files are deleted when
qutebrowser is shutdown.
Attributes:
files: A list of NamedTemporaryFiles of downloaded items.
"""
def __init__(self, parent=None):
super().__init__(parent)
self.files = []
self._tmpdir = None
def cleanup(self):
"""Clean up any temporary files."""
if self._tmpdir is not None:
self._tmpdir.cleanup()
self._tmpdir = None
def _get_tmpdir(self):
"""Return the temporary directory that is used for downloads.
The directory is created lazily on first access.
Return:
The tempfile.TemporaryDirectory that is used.
"""
if self._tmpdir is None:
self._tmpdir = tempfile.TemporaryDirectory(
prefix='qutebrowser-downloads-')
return self._tmpdir
def get_tmpfile(self, suggested_name):
"""Return a temporary file in the temporary downloads directory.
The files are kept as long as qutebrowser is running and automatically
cleaned up at program exit.
Args:
suggested_name: str of the "suggested"/original filename. Used as a
suffix, so any file extenions are preserved.
Return:
A tempfile.NamedTemporaryFile that should be used to save the file.
"""
tmpdir = self._get_tmpdir()
encoding = sys.getfilesystemencoding()
suggested_name = utils.force_encoding(suggested_name, encoding)
# Make sure that the filename is not too long
if len(suggested_name) > 50:
suggested_name = suggested_name[:25] + '...' + suggested_name[-25:]
fobj = tempfile.NamedTemporaryFile(dir=tmpdir.name, delete=False,
suffix=suggested_name)
self.files.append(fobj)
return fobj

View File

@@ -0,0 +1,326 @@
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# qutebrowser is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Simple history which gets written to disk."""
import time
import collections
from PyQt5.QtCore import pyqtSignal, QUrl, QObject
from PyQt5.QtWebKit import QWebHistoryInterface
from qutebrowser.commands import cmdutils
from qutebrowser.utils import utils, objreg, standarddir, log, qtutils
from qutebrowser.config import config
from qutebrowser.misc import lineparser
class Entry:
"""A single entry in the web history.
Attributes:
atime: The time the page was accessed.
url: The URL which was accessed as QUrl.
redirect: If True, don't save this entry to disk
"""
def __init__(self, atime, url, title, redirect=False):
self.atime = float(atime)
self.url = url
self.title = title
self.redirect = redirect
qtutils.ensure_valid(url)
def __repr__(self):
return utils.get_repr(self, constructor=True, atime=self.atime,
url=self.url_str(), title=self.title,
redirect=self.redirect)
def __str__(self):
atime = str(int(self.atime))
if self.redirect:
atime += '-r' # redirect flag
elems = [atime, self.url_str()]
if self.title:
elems.append(self.title)
return ' '.join(elems)
def __eq__(self, other):
return (self.atime == other.atime and
self.title == other.title and
self.url == other.url and
self.redirect == other.redirect)
def url_str(self):
"""Get the URL as a lossless string."""
return self.url.toString(QUrl.FullyEncoded | QUrl.RemovePassword)
@classmethod
def from_str(cls, line):
"""Parse a history line like '12345 http://example.com title'."""
data = line.split(maxsplit=2)
if len(data) == 2:
atime, url = data
title = ""
elif len(data) == 3:
atime, url, title = data
else:
raise ValueError("2 or 3 fields expected")
url = QUrl(url)
if not url.isValid():
raise ValueError("Invalid URL: {}".format(url.errorString()))
if atime.startswith('\0'):
log.init.debug(
"Removing NUL bytes from entry {!r} - see "
"https://github.com/The-Compiler/qutebrowser/issues/"
"670".format(data))
atime = atime.lstrip('\0')
if '-' in atime:
atime, flags = atime.split('-')
else:
flags = ''
if not set(flags).issubset('r'):
raise ValueError("Invalid flags {!r}".format(flags))
redirect = 'r' in flags
return cls(atime, url, title, redirect=redirect)
class WebHistoryInterface(QWebHistoryInterface):
"""Glue code between WebHistory and Qt's QWebHistoryInterface.
Attributes:
_history: The WebHistory object.
"""
def __init__(self, webhistory, parent=None):
super().__init__(parent)
self._history = webhistory
def addHistoryEntry(self, url_string):
"""Required for a QWebHistoryInterface impl, obsoleted by add_url."""
pass
def historyContains(self, url_string):
"""Called by WebKit to determine if a URL is contained in the history.
Args:
url_string: The URL (as string) to check for.
Return:
True if the url is in the history, False otherwise.
"""
return url_string in self._history.history_dict
class WebHistory(QObject):
"""The global history of visited pages.
This is a little more complex as you'd expect so the history can be read
from disk async while new history is already arriving.
self.history_dict is the main place where the history is stored, in an
OrderedDict (sorted by time) of URL strings mapped to Entry objects.
While reading from disk is still ongoing, the history is saved in
self._temp_history instead, and then appended to self.history_dict once
that's fully populated.
All history which is new in this session (rather than read from disk from a
previous browsing session) is also stored in self._new_history.
self._saved_count tracks how many of those entries were already written to
disk, so we can always append to the existing data.
Attributes:
history_dict: An OrderedDict of URLs read from the on-disk history.
_hist_dir: The directory to store the history in
_lineparser: The AppendLineParser used to save the history.
_new_history: A list of Entry items of the current session.
_saved_count: How many HistoryEntries have been written to disk.
_initial_read_started: Whether async_read was called.
_initial_read_done: Whether async_read has completed.
_temp_history: OrderedDict of temporary history entries before
async_read was called.
Signals:
add_completion_item: Emitted before a new Entry is added.
Used to sync with the completion.
arg: The new Entry.
item_added: Emitted after a new Entry is added.
Used to tell the savemanager that the history is dirty.
arg: The new Entry.
cleared: Emitted after the history is cleared.
"""
add_completion_item = pyqtSignal(Entry)
item_added = pyqtSignal(Entry)
cleared = pyqtSignal()
async_read_done = pyqtSignal()
def __init__(self, hist_dir, hist_name, parent=None):
super().__init__(parent)
self._initial_read_started = False
self._initial_read_done = False
self._hist_dir = hist_dir
self._lineparser = lineparser.AppendLineParser(hist_dir, hist_name,
parent=self)
self.history_dict = collections.OrderedDict()
self._temp_history = collections.OrderedDict()
self._new_history = []
self._saved_count = 0
objreg.get('save-manager').add_saveable(
'history', self.save, self.item_added)
def __repr__(self):
return utils.get_repr(self, length=len(self))
def __iter__(self):
return iter(self.history_dict.values())
def __len__(self):
return len(self.history_dict)
def async_read(self):
"""Read the initial history."""
if self._initial_read_started:
log.init.debug("Ignoring async_read() because reading is started.")
return
self._initial_read_started = True
if self._hist_dir is None:
self._initial_read_done = True
self.async_read_done.emit()
assert not self._temp_history
return
with self._lineparser.open():
for line in self._lineparser:
yield
line = line.rstrip()
if not line:
continue
try:
entry = Entry.from_str(line)
except ValueError as e:
log.init.warning("Invalid history entry {!r}: {}!".format(
line, e))
continue
# This de-duplicates history entries; only the latest
# entry for each URL is kept. If you want to keep
# information about previous hits change the items in
# old_urls to be lists or change Entry to have a
# list of atimes.
self._add_entry(entry)
self._initial_read_done = True
self.async_read_done.emit()
for entry in self._temp_history.values():
self._add_entry(entry)
self._new_history.append(entry)
if not entry.redirect:
self.add_completion_item.emit(entry)
self._temp_history.clear()
def _add_entry(self, entry, target=None):
"""Add an entry to self.history_dict or another given OrderedDict."""
if target is None:
target = self.history_dict
url_str = entry.url_str()
target[url_str] = entry
target.move_to_end(url_str)
def get_recent(self):
"""Get the most recent history entries."""
old = self._lineparser.get_recent()
return old + [str(e) for e in self._new_history]
def save(self):
"""Save the history to disk."""
new = (str(e) for e in self._new_history[self._saved_count:])
self._lineparser.new_data = new
self._lineparser.save()
self._saved_count = len(self._new_history)
@cmdutils.register(name='history-clear', instance='web-history')
def clear(self):
"""Clear all browsing history.
Note this only clears the global history
(e.g. `~/.local/share/qutebrowser/history` on Linux) but not cookies,
the back/forward history of a tab, cache or other persistent data.
"""
self._lineparser.clear()
self.history_dict.clear()
self._temp_history.clear()
self._new_history.clear()
self._saved_count = 0
self.cleared.emit()
def add_url(self, url, title="", *, redirect=False, atime=None):
"""Called by WebKit when a URL should be added to the history.
Args:
url: A url (as QUrl) to add to the history.
redirect: Whether the entry was redirected to another URL
(hidden in completion)
atime: Override the atime used to add the entry
"""
if config.get('general', 'private-browsing'):
return
if not url.isValid():
log.misc.warning("Ignoring invalid URL being added to history")
return
if atime is None:
atime = time.time()
entry = Entry(atime, url, title, redirect=redirect)
if self._initial_read_done:
self._add_entry(entry)
self._new_history.append(entry)
self.item_added.emit(entry)
if not entry.redirect:
self.add_completion_item.emit(entry)
else:
self._add_entry(entry, target=self._temp_history)
def init(parent=None):
"""Initialize the web history.
Args:
parent: The parent to use for WebHistory.
"""
history = WebHistory(hist_dir=standarddir.data(), hist_name='history',
parent=parent)
objreg.register('web-history', history)
interface = WebHistoryInterface(history, parent=history)
QWebHistoryInterface.setDefaultInterface(interface)

View File

@@ -23,7 +23,7 @@
import os.path
from qutebrowser.utils import log
from qutebrowser.browser import rfc6266
from qutebrowser.browser.webkit import rfc6266
from PyQt5.QtNetwork import QNetworkRequest

View File

@@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Utils for writing a MHTML file."""
"""Utils for writing an MHTML file."""
import functools
import io
@@ -34,7 +34,7 @@ import email.message
from PyQt5.QtCore import QUrl
from qutebrowser.browser import webelem, downloads
from qutebrowser.browser.webkit import webelem, downloads
from qutebrowser.utils import log, objreg, message, usertypes, utils, urlutils
try:
@@ -83,7 +83,7 @@ def _get_css_imports_cssutils(data, inline=False):
Args:
data: The content of the stylesheet to scan as string.
inline: True if the argument is a inline HTML style attribute.
inline: True if the argument is an inline HTML style attribute.
"""
# We don't care about invalid CSS data, this will only litter the log
# output with CSS errors
@@ -112,7 +112,7 @@ def _get_css_imports(data, inline=False):
Args:
data: The content of the stylesheet to scan as string.
inline: True if the argument is a inline HTML style attribute.
inline: True if the argument is an inline HTML style attribute.
"""
if cssutils is None:
return _get_css_imports_regex(data)
@@ -149,7 +149,7 @@ E_QUOPRI = email.encoders.encode_quopri
class MHTMLWriter:
"""A class for outputting multiple files to a MHTML document.
"""A class for outputting multiple files to an MHTML document.
Attributes:
root_content: The root content as bytes.
@@ -222,7 +222,7 @@ class _Downloader:
"""A class to download whole websites.
Attributes:
web_view: The QWebView which contains the website that will be saved.
tab: The AbstractTab which contains the website that will be saved.
dest: Destination filename.
writer: The MHTMLWriter object which is used to save the page.
loaded_urls: A set of QUrls of finished asset downloads.
@@ -233,15 +233,15 @@ class _Downloader:
_win_id: The window this downloader belongs to.
"""
def __init__(self, web_view, dest):
self.web_view = web_view
def __init__(self, tab, dest):
self.tab = tab
self.dest = dest
self.writer = None
self.loaded_urls = {web_view.url()}
self.loaded_urls = {tab.url()}
self.pending_downloads = set()
self._finished_file = False
self._used = False
self._win_id = web_view.win_id
self._win_id = tab.win_id
def run(self):
"""Download and save the page.
@@ -252,8 +252,11 @@ class _Downloader:
if self._used:
raise ValueError("Downloader already used")
self._used = True
web_url = self.web_view.url()
web_frame = self.web_view.page().mainFrame()
web_url = self.tab.url()
# FIXME:qtwebengine have a proper API for this
page = self.tab._widget.page() # pylint: disable=protected-access
web_frame = page.mainFrame()
self.writer = MHTMLWriter(
web_frame.toHtml().encode('utf-8'),
@@ -316,7 +319,7 @@ class _Downloader:
Args:
url: The file to download as QUrl.
"""
if url.scheme() not in {'http', 'https'}:
if url.scheme() not in ['http', 'https']:
return
# Prevent loading an asset twice
if url in self.loaded_urls:
@@ -340,15 +343,13 @@ class _Downloader:
download_manager = objreg.get('download-manager', scope='window',
window=self._win_id)
item = download_manager.get(url, fileobj=_NoCloseBytesIO(),
target = usertypes.FileObjDownloadTarget(_NoCloseBytesIO())
item = download_manager.get(url, target=target,
auto_remove=True)
self.pending_downloads.add((url, item))
item.finished.connect(
functools.partial(self._finished, url, item))
item.error.connect(
functools.partial(self._error, url, item))
item.cancelled.connect(
functools.partial(self._error, url, item))
item.finished.connect(functools.partial(self._finished, url, item))
item.error.connect(functools.partial(self._error, url, item))
item.cancelled.connect(functools.partial(self._cancelled, url, item))
def _finished(self, url, item):
"""Callback when a single asset is downloaded.
@@ -404,7 +405,7 @@ class _Downloader:
"""Callback when a download error occurred.
Args:
url: The orignal url of the asset as QUrl.
url: The original url of the asset as QUrl.
item: The DownloadItem given by the DownloadManager.
"""
try:
@@ -421,6 +422,20 @@ class _Downloader:
return
self._finish_file()
def _cancelled(self, url, item):
"""Callback when a download is cancelled by the user.
Args:
url: The original url of the asset as QUrl.
item: The DownloadItem given by the DownloadManager.
"""
# This callback is called before _finished, so there's no need to
# remove the item or close the fileobject.
log.downloads.debug("MHTML download cancelled by user: {}".format(url))
# Write an empty file instead
item.fileobj.seek(0)
item.fileobj.truncate()
def _finish_file(self):
"""Save the file to the filename given in __init__."""
if self._finished_file:
@@ -468,28 +483,28 @@ class _NoCloseBytesIO(io.BytesIO):
super().close()
def _start_download(dest, web_view):
"""Start downloading the current page and all assets to a MHTML file.
def _start_download(dest, tab):
"""Start downloading the current page and all assets to an MHTML file.
This will overwrite dest if it already exists.
Args:
dest: The filename where the resulting file should be saved.
web_view: Specify the webview whose page should be loaded.
tab: Specify the tab whose page should be loaded.
"""
loader = _Downloader(web_view, dest)
loader = _Downloader(tab, dest)
loader.run()
def start_download_checked(dest, web_view):
def start_download_checked(dest, tab):
"""First check if dest is already a file, then start the download.
Args:
dest: The filename where the resulting file should be saved.
web_view: Specify the webview whose page should be loaded.
tab: Specify the tab whose page should be loaded.
"""
# The default name is 'page title.mht'
title = web_view.title()
title = tab.title()
default_name = utils.sanitize_filename(title + '.mht')
# Remove characters which cannot be expressed in the file system encoding
@@ -513,12 +528,12 @@ def start_download_checked(dest, web_view):
# saving the file anyway.
if not os.path.isdir(os.path.dirname(path)):
folder = os.path.dirname(path)
message.error(web_view.win_id,
message.error(tab.win_id,
"Directory {} does not exist.".format(folder))
return
if not os.path.isfile(path):
_start_download(path, web_view=web_view)
_start_download(path, tab=tab)
return
q = usertypes.Question()
@@ -526,7 +541,7 @@ def start_download_checked(dest, web_view):
q.text = "{} exists. Overwrite?".format(path)
q.completed.connect(q.deleteLater)
q.answered_yes.connect(functools.partial(
_start_download, path, web_view=web_view))
_start_download, path, tab=tab))
message_bridge = objreg.get('message-bridge', scope='window',
window=web_view.win_id)
window=tab.win_id)
message_bridge.ask(q, blocking=False)

Some files were not shown because too many files have changed in this diff Show More