Commit Graph

8708 Commits

Author SHA1 Message Date
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