Various spelling fixes.

This commit is contained in:
Florian Bruhin 2015-03-31 20:49:29 +02:00
parent eb3b0b960f
commit 8ebac8d38c
72 changed files with 212 additions and 211 deletions

View File

@ -278,7 +278,7 @@ There are currently these object registries, also called 'scopes':
`cookie-jar`, etc.) `cookie-jar`, etc.)
* The `tab` scope with objects which are per-tab (`hintmanager`, `webview`, * The `tab` scope with objects which are per-tab (`hintmanager`, `webview`,
etc.). Passing this scope to `objreg.get()` selects the object in the currently etc.). Passing this scope to `objreg.get()` selects the object in the currently
focused tab by default. A tab can be explicitely selected by passing focused tab by default. A tab can be explicitly selected by passing
+tab=_tab-id_, window=_win-id_+ to it. +tab=_tab-id_, window=_win-id_+ to it.
A new object can be registered by using A new object can be registered by using
@ -373,7 +373,7 @@ 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 e.g. an argument `foo=True` will be converted to a flag `-f`/`--foo` in
qutebrowser's commandline. qutebrowser's commandline.
This behaviour can be overridden using Python's This behavior can be overridden using Python's
http://legacy.python.org/dev/peps/pep-3107/[function annotations]. The http://legacy.python.org/dev/peps/pep-3107/[function annotations]. The
annotation should always be a `dict`, like this: annotation should always be a `dict`, like this:
@ -447,7 +447,7 @@ This option controls Valgrind's detection of self-modifying code. If no
checking is done, if a program executes some code, then overwrites it with new checking is done, if a program executes some code, then overwrites it with new
code, and executes the new code, Valgrind will continue to execute the code, and executes the new code, Valgrind will continue to execute the
translations it made for the old code. This will likely lead to incorrect translations it made for the old code. This will likely lead to incorrect
behaviour and/or crashes. behavior and/or crashes.
... ...

View File

@ -43,8 +43,8 @@ Documentation
In addition to the topics mentioned in this README, the following documents are In addition to the topics mentioned in this README, the following documents are
available: available:
* A http://qutebrowser.org/img/cheatsheet-big.png[keybinding cheatsheet]: + * A http://qutebrowser.org/img/cheatsheet-big.png[key binding cheatsheet]: +
image:http://qutebrowser.org/img/cheatsheet-small.png["qutebrowser keybinding cheatsheet",link="http://qutebrowser.org/img/cheatsheet-big.png"] image:http://qutebrowser.org/img/cheatsheet-small.png["qutebrowser key binding cheatsheet",link="http://qutebrowser.org/img/cheatsheet-big.png"]
* link:doc/quickstart.asciidoc[Quick start guide] * link:doc/quickstart.asciidoc[Quick start guide]
* link:doc/FAQ.asciidoc[Frequently asked questions] * link:doc/FAQ.asciidoc[Frequently asked questions]
* link:CONTRIBUTING.asciidoc[Contributing to qutebrowser] * link:CONTRIBUTING.asciidoc[Contributing to qutebrowser]
@ -164,7 +164,7 @@ Contributors, sorted by the number of commits in descending order:
The following people have contributed graphics: The following people have contributed graphics:
* WOFall (icon) * WOFall (icon)
* regines (keybinding cheatsheet) * regines (key binding cheatsheet)
Thanks / Similiar projects Thanks / Similiar projects
-------------------------- --------------------------

View File

@ -9,7 +9,7 @@ What is qutebrowser based on?::
+ +
The concept of it is largely inspired by http://portix.bitbucket.org/dwb/[dwb] The concept of it is largely inspired by http://portix.bitbucket.org/dwb/[dwb]
and http://www.vimperator.org/vimperator[Vimperator]. Many actions and and http://www.vimperator.org/vimperator[Vimperator]. Many actions and
keybindings are similar to dwb. key bindings are similar to dwb.
Why another browser?:: Why another browser?::
It might be hard to believe, but I didn't find any browser which I was It might be hard to believe, but I didn't find any browser which I was
@ -76,7 +76,7 @@ Is there an adblocker?::
for v0.1 if at all. for v0.1 if at all.
How do I play Youtube videos with mpv?:: How do I play Youtube videos with mpv?::
You can easily add a keybinding to play youtube videos inside a real video You can easily add a key binding to play youtube videos inside a real video
player - optionally even with hinting for links: player - optionally even with hinting for links:
+ +
---- ----

View File

@ -503,7 +503,7 @@ Close the current/[count]th tab.
==== optional arguments ==== optional arguments
* +*-l*+, +*--left*+: Force selecting the tab to the left of the current tab. * +*-l*+, +*--left*+: Force selecting the tab to the left of the current tab.
* +*-r*+, +*--right*+: Force selecting the tab to the right of the current tab. * +*-r*+, +*--right*+: Force selecting the tab to the right of the current tab.
* +*-o*+, +*--opposite*+: Force selecting the tab in the oppsite direction of what's configured in 'tabs->select-on-remove'. * +*-o*+, +*--opposite*+: Force selecting the tab in the opposite direction of what's configured in 'tabs->select-on-remove'.
==== count ==== count

View File

@ -74,8 +74,8 @@
[options="header",width="75%",cols="25%,75%"] [options="header",width="75%",cols="25%,75%"]
|============== |==============
|Setting|Description |Setting|Description
|<<input-timeout,timeout>>|Timeout for ambiguous keybindings. |<<input-timeout,timeout>>|Timeout for ambiguous key bindings.
|<<input-partial-timeout,partial-timeout>>|Timeout for partially typed keybindings. |<<input-partial-timeout,partial-timeout>>|Timeout for partially typed key bindings.
|<<input-insert-mode-on-plugins,insert-mode-on-plugins>>|Whether to switch to insert mode when clicking flash and other plugins. |<<input-insert-mode-on-plugins,insert-mode-on-plugins>>|Whether to switch to insert mode when clicking flash and other plugins.
|<<input-auto-leave-insert-mode,auto-leave-insert-mode>>|Whether to leave insert mode if a non-editable element is clicked. |<<input-auto-leave-insert-mode,auto-leave-insert-mode>>|Whether to leave insert mode if a non-editable element is clicked.
|<<input-auto-insert-mode,auto-insert-mode>>|Whether to automatically enter insert mode if an editable element is focused after page load. |<<input-auto-insert-mode,auto-insert-mode>>|Whether to automatically enter insert mode if an editable element is focused after page load.
@ -93,7 +93,7 @@
|<<tabs-background-tabs,background-tabs>>|Whether to open new tabs (middleclick/ctrl+click) in background. |<<tabs-background-tabs,background-tabs>>|Whether to open new tabs (middleclick/ctrl+click) in background.
|<<tabs-select-on-remove,select-on-remove>>|Which tab to select when the focused tab is removed. |<<tabs-select-on-remove,select-on-remove>>|Which tab to select when the focused tab is removed.
|<<tabs-new-tab-position,new-tab-position>>|How new tabs are positioned. |<<tabs-new-tab-position,new-tab-position>>|How new tabs are positioned.
|<<tabs-new-tab-position-explicit,new-tab-position-explicit>>|How new tabs opened explicitely are positioned. |<<tabs-new-tab-position-explicit,new-tab-position-explicit>>|How new tabs opened explicitly are positioned.
|<<tabs-last-close,last-close>>|Behaviour when the last tab is closed. |<<tabs-last-close,last-close>>|Behaviour when the last tab is closed.
|<<tabs-hide-auto,hide-auto>>|Hide the tabbar if only one tab is open. |<<tabs-hide-auto,hide-auto>>|Hide the tabbar if only one tab is open.
|<<tabs-hide-always,hide-always>>|Always hide the tabbar. |<<tabs-hide-always,hide-always>>|Always hide the tabbar.
@ -697,13 +697,13 @@ Options related to input modes.
[[input-timeout]] [[input-timeout]]
=== timeout === timeout
Timeout for ambiguous keybindings. Timeout for ambiguous key bindings.
Default: +pass:[500]+ Default: +pass:[500]+
[[input-partial-timeout]] [[input-partial-timeout]]
=== partial-timeout === partial-timeout
Timeout for partially typed keybindings. Timeout for partially typed key bindings.
Default: +pass:[1000]+ Default: +pass:[1000]+
@ -834,7 +834,7 @@ Default: +pass:[right]+
[[tabs-new-tab-position-explicit]] [[tabs-new-tab-position-explicit]]
=== new-tab-position-explicit === new-tab-position-explicit
How new tabs opened explicitely are positioned. How new tabs opened explicitly are positioned.
Valid values: Valid values:
@ -1208,7 +1208,7 @@ Whether to accept cookies.
Valid values: Valid values:
* +default+: Default QtWebKit behaviour. * +default+: Default QtWebKit behavior.
* +never+: Don't accept cookies at all. * +never+: Don't accept cookies at all.
Default: +pass:[default]+ Default: +pass:[default]+

View File

@ -8,9 +8,9 @@ time, use the `:help` command.
What to do now What to do now
-------------- --------------
* View the http://qutebrowser.org/img/cheatsheet-big.png[keybinding cheatsheet] * View the http://qutebrowser.org/img/cheatsheet-big.png[key binding cheatsheet]
to make yourself familiar with the keybindings: + to make yourself familiar with the key bindings: +
image:http://qutebrowser.org/img/cheatsheet-small.png["qutebrowser keybinding cheatsheet",link="http://qutebrowser.org/img/cheatsheet-big.png"] image:http://qutebrowser.org/img/cheatsheet-small.png["qutebrowser key binding cheatsheet",link="http://qutebrowser.org/img/cheatsheet-big.png"]
* If you just cloned the repository, you'll need to run * If you just cloned the repository, you'll need to run
`scripts/asciidoc2html.py` to generate the documentation. `scripts/asciidoc2html.py` to generate the documentation.
* Go to the link:qute://settings[settings page] to set up qutebrowser the way you want it. * Go to the link:qute://settings[settings page] to set up qutebrowser the way you want it.

View File

@ -106,7 +106,7 @@ It was inspired by other browsers/addons like dwb and Vimperator/Pentadactyl.
- '~/.config/qutebrowser/qutebrowser.conf': Main config file. - '~/.config/qutebrowser/qutebrowser.conf': Main config file.
- '~/.config/qutebrowser/quickmarks': Saved quickmarks. - '~/.config/qutebrowser/quickmarks': Saved quickmarks.
- '~/.config/qutebrowser/keys.conf': Defined keybindings. - '~/.config/qutebrowser/keys.conf': Defined key bindings.
- '~/.local/share/qutebrowser/': Various state information. - '~/.local/share/qutebrowser/': Various state information.
- '~/.cache/qutebrowser/': Temporary data. - '~/.cache/qutebrowser/': Temporary data.

View File

@ -3,14 +3,14 @@ Writing qutebrowser userscripts
The Compiler <mail@qutebrowser.org> The Compiler <mail@qutebrowser.org>
qutebrowser is extensible by writing userscripts which can be called via the qutebrowser is extensible by writing userscripts which can be called via the
`:spawn --userscript` command, or via a keybinding. `:spawn --userscript` command, or via a key binding.
These userscripts are similiar to the (non-javascript) dwb userscripts. They These userscripts are similiar to the (non-javascript) dwb userscripts. They
can be written in any language which can read environment variables and write can be written in any language which can read environment variables and write
to a FIFO. to a FIFO.
Note for simple things such as opening the current page with another browser or Note for simple things such as opening the current page with another browser or
mpv, a simple keybinding to something like `:spawn mpv {url}` should suffice. mpv, a simple key binding to something like `:spawn mpv {url}` should suffice.
Also note userscripts need to have the executable bit set (`chmod +x`) for Also note userscripts need to have the executable bit set (`chmod +x`) for
qutebrowser to run them. qutebrowser to run them.
@ -21,7 +21,7 @@ Getting information
The following environment variables will be set when an userscript is launched: The following environment variables will be set when an userscript is launched:
- `QUTE_MODE`: Either `hints` (started via hints) or `command` (started via - `QUTE_MODE`: Either `hints` (started via hints) or `command` (started via
command or keybinding). command or key binding).
- `QUTE_USER_AGENT`: The currently set user agent. - `QUTE_USER_AGENT`: The currently set user agent.
- `QUTE_FIFO`: The FIFO or file to write commands to. - `QUTE_FIFO`: The FIFO or file to write commands to.

View File

@ -734,7 +734,7 @@ class Application(QApplication):
@cmdutils.register(instance='app', maxsplit=0, debug=True) @cmdutils.register(instance='app', maxsplit=0, debug=True)
def debug_pyeval(self, s): def debug_pyeval(self, s):
"""Evaluate a python string and display the results as a webpage. """Evaluate a python string and display the results as a web page.
// //
@ -847,8 +847,8 @@ class Application(QApplication):
deferrer = True deferrer = True
if deferrer: if deferrer:
# If shutdown was called while we were asking a question, we're in # If shutdown was called while we were asking a question, we're in
# a still sub-eventloop (which gets quitted now) and not in the # a still sub-eventloop (which gets quit now) and not in the main
# main one. # one.
# This means we need to defer the real shutdown to when we're back # This means we need to defer the real shutdown to when we're back
# in the real main event loop, or we'll get a segfault. # in the real main event loop, or we'll get a segfault.
log.destroy.debug("Deferring real shutdown because question was " log.destroy.debug("Deferring real shutdown because question was "
@ -898,7 +898,7 @@ class Application(QApplication):
qInstallMessageHandler(None) qInstallMessageHandler(None)
# Now we can hopefully quit without segfaults # Now we can hopefully quit without segfaults
log.destroy.debug("Deferring QApplication::exit...") log.destroy.debug("Deferring QApplication::exit...")
# We use a singleshot timer to exit here to minimize the likelyhood of # We use a singleshot timer to exit here to minimize the likelihood of
# segfaults. # segfaults.
QTimer.singleShot(0, functools.partial(self.exit, status)) QTimer.singleShot(0, functools.partial(self.exit, status))

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>. # along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Functions related to adblocking.""" """Functions related to ad blocking."""
import io import io
import os.path import os.path

View File

@ -227,7 +227,7 @@ class CommandDispatcher:
Args: Args:
left: Force selecting the tab to the left of the current tab. left: Force selecting the tab to the left of the current tab.
right: Force selecting the tab to the right of the current tab. right: Force selecting the tab to the right of the current tab.
opposite: Force selecting the tab in the oppsite direction of opposite: Force selecting the tab in the opposite direction of
what's configured in 'tabs->select-on-remove'. what's configured in 'tabs->select-on-remove'.
Return: Return:
@ -259,7 +259,7 @@ class CommandDispatcher:
Args: Args:
left: Force selecting the tab to the left of the current tab. left: Force selecting the tab to the left of the current tab.
right: Force selecting the tab to the right of the current tab. right: Force selecting the tab to the right of the current tab.
opposite: Force selecting the tab in the oppsite direction of opposite: Force selecting the tab in the opposite direction of
what's configured in 'tabs->select-on-remove'. what's configured in 'tabs->select-on-remove'.
count: The tab index to close, or None count: The tab index to close, or None
""" """

View File

@ -185,7 +185,7 @@ class DownloadItem(QObject):
done: Whether the download is finished. done: Whether the download is finished.
stats: A DownloadItemStats object. stats: A DownloadItemStats object.
index: The index of the download in the view. index: The index of the download in the view.
successful: Whether the download has completed sucessfully. successful: Whether the download has completed successfully.
error_msg: The current error message, or None error_msg: The current error message, or None
autoclose: Whether to close the associated file if the download is autoclose: Whether to close the associated file if the download is
done. done.
@ -204,7 +204,7 @@ class DownloadItem(QObject):
data_changed: The downloads metadata changed. data_changed: The downloads metadata changed.
finished: The download was finished. finished: The download was finished.
cancelled: The download was cancelled. cancelled: The download was cancelled.
error: An error with the download occured. error: An error with the download occurred.
arg: The error message as string. arg: The error message as string.
redirected: Signal emitted when a download was redirected. redirected: Signal emitted when a download was redirected.
arg 0: The new QNetworkRequest. arg 0: The new QNetworkRequest.

View File

@ -123,7 +123,7 @@ class DownloadView(QListView):
Return: Return:
A list of either: A list of either:
- (QAction, callable) tuples. - (QAction, callable) tuples.
- (None, None) for a seperator - (None, None) for a separator
""" """
actions = [] actions = []
if item is None: if item is None:

View File

@ -62,7 +62,7 @@ class HintContext:
frames: The QWebFrames to use. frames: The QWebFrames to use.
destroyed_frames: id()'s of QWebFrames which have been destroyed. destroyed_frames: id()'s of QWebFrames which have been destroyed.
(Workaround for https://github.com/The-Compiler/qutebrowser/issues/152) (Workaround for https://github.com/The-Compiler/qutebrowser/issues/152)
elems: A mapping from keystrings to (elem, label) namedtuples. elems: A mapping from key strings to (elem, label) namedtuples.
baseurl: The URL of the current page. baseurl: The URL of the current page.
target: What to do with the opened links. target: What to do with the opened links.
normal/tab/tab_bg/window: Get passed to BrowserTab. normal/tab/tab_bg/window: Get passed to BrowserTab.
@ -77,7 +77,7 @@ class HintContext:
args: Custom arguments for userscript/spawn args: Custom arguments for userscript/spawn
rapid: Whether to do rapid hinting. rapid: Whether to do rapid hinting.
mainframe: The main QWebFrame where we started hinting in. mainframe: The main QWebFrame where we started hinting in.
group: The group of webelements to hint. group: The group of web elements to hint.
""" """
def __init__(self): def __init__(self):
@ -455,7 +455,7 @@ class HintManager(QObject):
"""Yank an element to the clipboard or primary selection. """Yank an element to the clipboard or primary selection.
Args: Args:
url: The URL to open as a QURL. url: The URL to open as a QUrl.
context: The HintContext to use. context: The HintContext to use.
""" """
sel = context.target == Target.yank_primary sel = context.target == Target.yank_primary
@ -816,7 +816,7 @@ class HintManager(QObject):
'<font color="{}">{}</font>{}'.format( '<font color="{}">{}</font>{}'.format(
match_color, matched, rest)) match_color, matched, rest))
if self._is_hidden(elems.label): if self._is_hidden(elems.label):
# hidden element which matches again -> unhide it # hidden element which matches again -> show it
self._show_elem(elems.label) self._show_elem(elems.label)
else: else:
# element doesn't match anymore -> hide it # element doesn't match anymore -> hide it
@ -835,7 +835,7 @@ class HintManager(QObject):
if (filterstr is None or if (filterstr is None or
str(elems.elem).lower().startswith(filterstr)): str(elems.elem).lower().startswith(filterstr)):
if self._is_hidden(elems.label): if self._is_hidden(elems.label):
# hidden element which matches again -> unhide it # hidden element which matches again -> show it
self._show_elem(elems.label) self._show_elem(elems.label)
else: else:
# element doesn't match anymore -> hide it # element doesn't match anymore -> hide it

View File

@ -176,7 +176,7 @@ class NetworkManager(QNetworkAccessManager):
if answer is not None: if answer is not None:
# Since the answer could be something else than (user, password) # Since the answer could be something else than (user, password)
# pylint seems to think we're unpacking a non-sequence. However we # pylint seems to think we're unpacking a non-sequence. However we
# *did* explicitely ask for a tuple, so it *will* always be one. # *did* explicitly ask for a tuple, so it *will* always be one.
user, password = answer user, password = answer
authenticator.setUser(user) authenticator.setUser(user)
authenticator.setPassword(password) authenticator.setPassword(password)

View File

@ -133,7 +133,7 @@ def serialize(items):
Return: Return:
A (stream, data, user_data) tuple. A (stream, data, user_data) tuple.
stream: The resetted QDataStream. stream: The reseted QDataStream.
data: The QByteArray with the raw data. data: The QByteArray with the raw data.
user_data: A list with each item's user data. user_data: A list with each item's user data.

View File

@ -332,7 +332,7 @@ def get_child_frames(startframe):
def focus_elem(frame): def focus_elem(frame):
"""Get the focused element in a webframe. """Get the focused element in a web frame.
FIXME: Add tests. FIXME: Add tests.

View File

@ -41,7 +41,7 @@ class BrowserPage(QWebPage):
"""Our own QWebPage with advanced features. """Our own QWebPage with advanced features.
Attributes: Attributes:
error_occured: Whether an error occured while loading. error_occurred: Whether an error occurred while loading.
open_target: Where to open the next navigation request. open_target: Where to open the next navigation request.
("normal", "tab", "tab_bg") ("normal", "tab", "tab_bg")
_hint_target: Override for open_target while hinting, or None. _hint_target: Override for open_target while hinting, or None.
@ -69,7 +69,7 @@ class BrowserPage(QWebPage):
QWebPage.ChooseMultipleFilesExtension: self._handle_multiple_files, QWebPage.ChooseMultipleFilesExtension: self._handle_multiple_files,
} }
self._ignore_load_started = False self._ignore_load_started = False
self.error_occured = False self.error_occurred = False
self.open_target = usertypes.ClickTarget.normal self.open_target = usertypes.ClickTarget.normal
self._hint_target = None self._hint_target = None
self._networkmanager = networkmanager.NetworkManager( self._networkmanager = networkmanager.NetworkManager(
@ -147,7 +147,7 @@ class BrowserPage(QWebPage):
else: else:
error_str = info.errorString error_str = info.errorString
if error_str == networkmanager.HOSTBLOCK_ERROR_STRING: if error_str == networkmanager.HOSTBLOCK_ERROR_STRING:
# We don't set error_occured in this case. # We don't set error_occurred in this case.
error_str = "Request blocked by host blocker." error_str = "Request blocked by host blocker."
main_frame = info.frame.page().mainFrame() main_frame = info.frame.page().mainFrame()
if info.frame != main_frame: if info.frame != main_frame:
@ -160,7 +160,7 @@ class BrowserPage(QWebPage):
return False return False
else: else:
self._ignore_load_started = True self._ignore_load_started = True
self.error_occured = True self.error_occurred = True
log.webview.error("Error while loading {}: {}".format( log.webview.error("Error while loading {}: {}".format(
urlstr, error_str)) urlstr, error_str))
log.webview.debug("Error domain: {}, error code: {}".format( log.webview.debug("Error domain: {}, error code: {}".format(
@ -248,7 +248,7 @@ class BrowserPage(QWebPage):
frame.setScrollPosition, cur_data['scroll-pos'])) frame.setScrollPosition, cur_data['scroll-pos']))
def display_content(self, reply, mimetype): def display_content(self, reply, mimetype):
"""Display a QNetworkReply with an explicitely set mimetype.""" """Display a QNetworkReply with an explicitly set mimetype."""
self.mainFrame().setContent(reply.readAll(), mimetype, reply.url()) self.mainFrame().setContent(reply.readAll(), mimetype, reply.url())
reply.deleteLater() reply.deleteLater()
@ -312,11 +312,11 @@ class BrowserPage(QWebPage):
@pyqtSlot() @pyqtSlot()
def on_load_started(self): def on_load_started(self):
"""Reset error_occured when loading of a new page started.""" """Reset error_occurred when loading of a new page started."""
if self._ignore_load_started: if self._ignore_load_started:
self._ignore_load_started = False self._ignore_load_started = False
else: else:
self.error_occured = False self.error_occurred = False
@pyqtSlot('QWebFrame', 'QWebPage::Feature') @pyqtSlot('QWebFrame', 'QWebPage::Feature')
def on_feature_permission_requested(self, frame, feature): def on_feature_permission_requested(self, frame, feature):
@ -393,8 +393,8 @@ class BrowserPage(QWebPage):
# With Qt 5.2.1 (Ubuntu Trusty) we get this when closing a tab: # With Qt 5.2.1 (Ubuntu Trusty) we get this when closing a tab:
# RuntimeError: wrapped C/C++ object of type BrowserPage has # RuntimeError: wrapped C/C++ object of type BrowserPage has
# been deleted # been deleted
# Since the information here isn't that important for closing # Since the information here isn't that important for closing web
# webviews anyways, we ignore this error. # views anyways, we ignore this error.
return return
data = { data = {
'zoom': frame.zoomFactor(), 'zoom': frame.zoomFactor(),

View File

@ -52,7 +52,7 @@ class WebView(QWebView):
hintmanager: The HintManager instance for this view. hintmanager: The HintManager instance for this view.
progress: loading progress of this page. progress: loading progress of this page.
scroll_pos: The current scroll position as (x%, y%) tuple. scroll_pos: The current scroll position as (x%, y%) tuple.
statusbar_message: The current javscript statusbar message. statusbar_message: The current javascript statusbar message.
inspector: The QWebInspector used for this webview. inspector: The QWebInspector used for this webview.
load_status: loading status of this page (index into LoadStatus) load_status: loading status of this page (index into LoadStatus)
viewing_source: Whether the webview is currently displaying source viewing_source: Whether the webview is currently displaying source
@ -63,7 +63,7 @@ class WebView(QWebView):
tab_id: The tab ID of the view. tab_id: The tab ID of the view.
win_id: The window ID of the view. win_id: The window ID of the view.
_cur_url: The current URL (accessed via cur_url property). _cur_url: The current URL (accessed via cur_url property).
_has_ssl_errors: Whether SSL errors occured during loading. _has_ssl_errors: Whether SSL errors occurred during loading.
_zoom: A NeighborList with the zoom levels. _zoom: A NeighborList with the zoom levels.
_old_scroll_pos: The old scroll position. _old_scroll_pos: The old scroll position.
_check_insertmode: If True, in mouseReleaseEvent we should check if we _check_insertmode: If True, in mouseReleaseEvent we should check if we
@ -234,7 +234,7 @@ class WebView(QWebView):
# me, but it works this way. # me, but it works this way.
hitresult = frame.hitTestContent(pos) hitresult = frame.hitTestContent(pos)
if hitresult.isNull(): if hitresult.isNull():
# For some reason, the whole hitresult can be null sometimes (e.g. # For some reason, the whole hit result can be null sometimes (e.g.
# on doodle menu links). If this is the case, we schedule a check # on doodle menu links). If this is the case, we schedule a check
# later (in mouseReleaseEvent) which uses webelem.focus_elem. # later (in mouseReleaseEvent) which uses webelem.focus_elem.
log.mouse.debug("Hitresult is null!") log.mouse.debug("Hitresult is null!")
@ -243,7 +243,7 @@ class WebView(QWebView):
try: try:
elem = webelem.WebElementWrapper(hitresult.element()) elem = webelem.WebElementWrapper(hitresult.element())
except webelem.IsNullError: except webelem.IsNullError:
# For some reason, the hitresult element can be a null element # For some reason, the hit result element can be a null element
# sometimes (e.g. when clicking the timetable fields on # sometimes (e.g. when clicking the timetable fields on
# http://www.sbb.ch/ ). If this is the case, we schedule a check # http://www.sbb.ch/ ). If this is the case, we schedule a check
# later (in mouseReleaseEvent) which uses webelem.focus_elem. # later (in mouseReleaseEvent) which uses webelem.focus_elem.
@ -372,7 +372,7 @@ class WebView(QWebView):
@pyqtSlot('QMouseEvent') @pyqtSlot('QMouseEvent')
def on_mouse_event(self, evt): def on_mouse_event(self, evt):
"""Post a new mouseevent from a hintmanager.""" """Post a new mouse event from a hintmanager."""
log.modes.debug("Hint triggered, focusing {!r}".format(self)) log.modes.debug("Hint triggered, focusing {!r}".format(self))
self.setFocus() self.setFocus()
QApplication.postEvent(self, evt) QApplication.postEvent(self, evt)
@ -393,7 +393,7 @@ class WebView(QWebView):
true when the QWebPage has an ErrorPageExtension implemented. true when the QWebPage has an ErrorPageExtension implemented.
See https://github.com/The-Compiler/qutebrowser/issues/84 See https://github.com/The-Compiler/qutebrowser/issues/84
""" """
ok = not self.page().error_occured ok = not self.page().error_occurred
if ok and not self._has_ssl_errors: if ok and not self._has_ssl_errors:
self._set_load_status(LoadStatus.success) self._set_load_status(LoadStatus.success)
elif ok: elif ok:

View File

@ -32,7 +32,7 @@ class CommandError(Exception):
class CommandMetaError(Exception): class CommandMetaError(Exception):
"""Common base class for exceptions occuring before a command is run.""" """Common base class for exceptions occurring before a command is run."""
class NoSuchCommandError(CommandMetaError): class NoSuchCommandError(CommandMetaError):

View File

@ -101,7 +101,7 @@ class register: # pylint: disable=invalid-name
_instance: The object from the object registry to be used as "self". _instance: The object from the object registry to be used as "self".
_scope: The scope to get _instance for. _scope: The scope to get _instance for.
_name: The name (as string) or names (as list) of the command. _name: The name (as string) or names (as list) of the command.
_maxsplit: The maxium amounts of splits to do for the commandline, or _maxsplit: The maximum amounts of splits to do for the commandline, or
None. None.
_hide: Whether to hide the command or not. _hide: Whether to hide the command or not.
_completion: Which completion to use for arguments, as a list of _completion: Which completion to use for arguments, as a list of
@ -151,7 +151,7 @@ class register: # pylint: disable=invalid-name
def _get_names(self, func): def _get_names(self, func):
"""Get the name(s) which should be used for the current command. """Get the name(s) which should be used for the current command.
If the name hasn't been overridden explicitely, the function name is If the name hasn't been overridden explicitly, the function name is
transformed. transformed.
If it has been set, it can either be a string which is If it has been set, it can either be a string which is

View File

@ -160,7 +160,7 @@ class Command:
return type_conv return type_conv
def _get_nameconv(self, param, annotation_info): def _get_nameconv(self, param, annotation_info):
"""Get a dict with a name conversion for the paraeter. """Get a dict with a name conversion for the parameter.
Args: Args:
param: The inspect.Parameter to handle. param: The inspect.Parameter to handle.

View File

@ -55,7 +55,7 @@ def replace_variables(win_id, arglist):
class SearchRunner(QObject): class SearchRunner(QObject):
"""Run searches on webpages. """Run searches on web pages.
Attributes: Attributes:
_text: The text from the last search. _text: The text from the last search.

View File

@ -52,7 +52,7 @@ class _QtFIFOReader(QObject):
@pyqtSlot() @pyqtSlot()
def read_line(self): def read_line(self):
"""(Try to) read a line from the fifo.""" """(Try to) read a line from the FIFO."""
log.procs.debug("QSocketNotifier triggered!") log.procs.debug("QSocketNotifier triggered!")
self._notifier.setEnabled(False) self._notifier.setEnabled(False)
for line in self.fifo: for line in self.fifo:
@ -60,7 +60,7 @@ class _QtFIFOReader(QObject):
self._notifier.setEnabled(True) self._notifier.setEnabled(True)
def cleanup(self): def cleanup(self):
"""Clean up so the fifo can be closed.""" """Clean up so the FIFO can be closed."""
self._notifier.setEnabled(False) self._notifier.setEnabled(False)

View File

@ -245,7 +245,7 @@ class Completer(QObject):
if self._cmd.prefix() != ':': if self._cmd.prefix() != ':':
# This is a search or gibberish, so we don't need to complete # This is a search or gibberish, so we don't need to complete
# anything (yet) # anything (yet)
# FIXME complete searchs # FIXME complete searches
# https://github.com/The-Compiler/qutebrowser/issues/32 # https://github.com/The-Compiler/qutebrowser/issues/32
completion.hide() completion.hide()
return return

View File

@ -20,8 +20,8 @@
"""Configuration storage and config-related utilities. """Configuration storage and config-related utilities.
This borrows a lot of ideas from configparser, but also has some things that This borrows a lot of ideas from configparser, but also has some things that
are fundamentally different. This is why nothing inherts from configparser, but are fundamentally different. This is why nothing inherits from configparser,
we borrow some methods and classes from there where it makes sense. but we borrow some methods and classes from there where it makes sense.
""" """
import os import os
@ -144,7 +144,7 @@ def _init_main_config():
for sect in config_obj.sections.values(): for sect in config_obj.sections.values():
for opt in sect.values.values(): for opt in sect.values.values():
if opt.values['conf'] is None: if opt.values['conf'] is None:
# Option added to builtin defaults but not in user's # Option added to built-in defaults but not in user's
# config yet # config yet
save_manager.save('config', explicit=True, force=True) save_manager.save('config', explicit=True, force=True)
return return
@ -262,8 +262,8 @@ class ConfigManager(QObject):
('completion', 'history-length'): 'cmd-history-max-items', ('completion', 'history-length'): 'cmd-history-max-items',
} }
DELETED_OPTIONS = [ DELETED_OPTIONS = [
('colors', 'tab.seperator'), ('colors', 'tab.separator'),
('colors', 'tabs.seperator'), ('colors', 'tabs.separator'),
('colors', 'completion.item.bg'), ('colors', 'completion.item.bg'),
] ]
@ -476,7 +476,7 @@ class ConfigManager(QObject):
def items(self, sectname, raw=True): def items(self, sectname, raw=True):
"""Get a list of (optname, value) tuples for a section. """Get a list of (optname, value) tuples for a section.
Implemented for configparser interpolation compatbility. Implemented for configparser interpolation compatibility
Args: Args:
sectname: The name of the section to get. sectname: The name of the section to get.
@ -539,7 +539,7 @@ class ConfigManager(QObject):
The value of the option. The value of the option.
""" """
if not self._initialized: if not self._initialized:
raise Exception("get got called before initialisation was " raise Exception("get got called before initialization was "
"complete!") "complete!")
try: try:
sect = self.sections[sectname] sect = self.sections[sectname]

View File

@ -56,7 +56,7 @@ FIRST_COMMENT = r"""
# described below. # described below.
# #
# This is the default config, so if you want to remove anything from # This is the default config, so if you want to remove anything from
# here (as opposed to change/add), for example a keybinding, set it to # here (as opposed to change/add), for example a key binding, set it to
# an empty value. # an empty value.
# #
# You will need to escape the following values: # You will need to escape the following values:
@ -270,7 +270,7 @@ DATA = collections.OrderedDict([
"are defined:\n\n" "are defined:\n\n"
"* `{perc}`: The percentage as a string like `[10%]`.\n" "* `{perc}`: The percentage as a string like `[10%]`.\n"
"* `{perc_raw}`: The raw percentage, e.g. `10`\n" "* `{perc_raw}`: The raw percentage, e.g. `10`\n"
"* `{title}`: The title of the current webpage\n" "* `{title}`: The title of the current web page\n"
"* `{title_sep}`: The string ` - ` if a title is set, empty " "* `{title_sep}`: The string ` - ` if a title is set, empty "
"otherwise.\n" "otherwise.\n"
"* `{id}`: The internal window ID of this window."), "* `{id}`: The internal window ID of this window."),
@ -350,11 +350,11 @@ DATA = collections.OrderedDict([
('input', sect.KeyValue( ('input', sect.KeyValue(
('timeout', ('timeout',
SettingValue(typ.Int(minval=0, maxval=MAXVALS['int']), '500'), SettingValue(typ.Int(minval=0, maxval=MAXVALS['int']), '500'),
"Timeout for ambiguous keybindings."), "Timeout for ambiguous key bindings."),
('partial-timeout', ('partial-timeout',
SettingValue(typ.Int(minval=0, maxval=MAXVALS['int']), '1000'), SettingValue(typ.Int(minval=0, maxval=MAXVALS['int']), '1000'),
"Timeout for partially typed keybindings."), "Timeout for partially typed key bindings."),
('insert-mode-on-plugins', ('insert-mode-on-plugins',
SettingValue(typ.Bool(), 'false'), SettingValue(typ.Bool(), 'false'),
@ -414,7 +414,7 @@ DATA = collections.OrderedDict([
('new-tab-position-explicit', ('new-tab-position-explicit',
SettingValue(typ.NewTabPosition(), 'last'), SettingValue(typ.NewTabPosition(), 'last'),
"How new tabs opened explicitely are positioned."), "How new tabs opened explicitly are positioned."),
('last-close', ('last-close',
SettingValue(typ.LastClose(), 'ignore'), SettingValue(typ.LastClose(), 'ignore'),
@ -422,11 +422,11 @@ DATA = collections.OrderedDict([
('hide-auto', ('hide-auto',
SettingValue(typ.Bool(), 'false'), SettingValue(typ.Bool(), 'false'),
"Hide the tabbar if only one tab is open."), "Hide the tab bar if only one tab is open."),
('hide-always', ('hide-always',
SettingValue(typ.Bool(), 'false'), SettingValue(typ.Bool(), 'false'),
"Always hide the tabbar."), "Always hide the tab bar."),
('wrap', ('wrap',
SettingValue(typ.Bool(), 'true'), SettingValue(typ.Bool(), 'true'),
@ -473,7 +473,7 @@ DATA = collections.OrderedDict([
"are defined:\n\n" "are defined:\n\n"
"* `{perc}`: The percentage as a string like `[10%]`.\n" "* `{perc}`: The percentage as a string like `[10%]`.\n"
"* `{perc_raw}`: The raw percentage, e.g. `10`\n" "* `{perc_raw}`: The raw percentage, e.g. `10`\n"
"* `{title}`: The title of the current webpage\n" "* `{title}`: The title of the current web page\n"
"* `{title_sep}`: The string ` - ` if a title is set, empty " "* `{title_sep}`: The string ` - ` if a title is set, empty "
"otherwise.\n" "otherwise.\n"
"* `{index}`: The index of this tab.\n" "* `{index}`: The index of this tab.\n"
@ -810,7 +810,7 @@ DATA = collections.OrderedDict([
('tabs.bg.bar', ('tabs.bg.bar',
SettingValue(typ.QtColor(), '#555555'), SettingValue(typ.QtColor(), '#555555'),
"Background color of the tabbar."), "Background color of the tab bar."),
('tabs.indicator.start', ('tabs.indicator.start',
SettingValue(typ.QtColor(), '#0000aa'), SettingValue(typ.QtColor(), '#0000aa'),
@ -881,7 +881,7 @@ DATA = collections.OrderedDict([
('tabbar', ('tabbar',
SettingValue(typ.QtFont(), DEFAULT_FONT_SIZE + ' ${_monospace}'), SettingValue(typ.QtFont(), DEFAULT_FONT_SIZE + ' ${_monospace}'),
"Font used in the tabbar."), "Font used in the tab bar."),
('statusbar', ('statusbar',
SettingValue(typ.Font(), DEFAULT_FONT_SIZE + ' ${_monospace}'), SettingValue(typ.Font(), DEFAULT_FONT_SIZE + ' ${_monospace}'),
@ -949,7 +949,7 @@ DATA = collections.OrderedDict([
KEY_FIRST_COMMENT = """ KEY_FIRST_COMMENT = """
# vim: ft=conf # vim: ft=conf
# #
# In this config file, qutebrowser's keybindings are configured. # In this config file, qutebrowser's key bindings are configured.
# The format looks like this: # The format looks like this:
# #
# [keymode] # [keymode]
@ -962,8 +962,8 @@ KEY_FIRST_COMMENT = """
# All blank lines and lines starting with '#' are ignored. # All blank lines and lines starting with '#' are ignored.
# Inline-comments are not permitted. # Inline-comments are not permitted.
# #
# keymode is a comma separated list of modes in which the keybinding should be # keymode is a comma separated list of modes in which the key binding should be
# active. If keymode starts with !, the keybinding is active in all modes # active. If keymode starts with !, the key binding is active in all modes
# except the listed modes. # except the listed modes.
# #
# For special keys (can't be part of a keychain), enclose them in `<`...`>`. # For special keys (can't be part of a keychain), enclose them in `<`...`>`.
@ -975,7 +975,7 @@ KEY_FIRST_COMMENT = """
# * Shift: `Shift` # * Shift: `Shift`
# #
# For simple keys (no `<>`-signs), a capital letter means the key is pressed # For simple keys (no `<>`-signs), a capital letter means the key is pressed
# with Shift. For special keys (with `<>`-signs), you need to explicitely add # with Shift. For special keys (with `<>`-signs), you need to explicitly add
# `Shift-` to match a key pressed with shift. You can bind multiple commands # `Shift-` to match a key pressed with shift. You can bind multiple commands
# by separating them with `;;`. # by separating them with `;;`.
""" """

View File

@ -32,9 +32,9 @@ class ValidationError(Error):
"""Raised when a value for a config type was invalid. """Raised when a value for a config type was invalid.
Attributes: Attributes:
section: Section in which the error occured (added when catching and section: Section in which the error occurred (added when catching and
re-raising the exception). re-raising the exception).
option: Option in which the error occured. option: Option in which the error occurred.
""" """
def __init__(self, value, msg): def __init__(self, value, msg):

View File

@ -1328,7 +1328,7 @@ class AcceptCookies(BaseType):
"""Whether to accept a cookie.""" """Whether to accept a cookie."""
valid_values = ValidValues(('default', "Default QtWebKit behaviour."), valid_values = ValidValues(('default', "Default QtWebKit behavior."),
('never', "Don't accept cookies at all.")) ('never', "Don't accept cookies at all."))

View File

@ -60,7 +60,7 @@ class ReadConfigParser(configparser.ConfigParser):
class ReadWriteConfigParser(ReadConfigParser): class ReadWriteConfigParser(ReadConfigParser):
"""ConfigParser subclass used for auxillary config files.""" """ConfigParser subclass used for auxiliary config files."""
def save(self): def save(self):
"""Save the config file.""" """Save the config file."""

View File

@ -34,7 +34,7 @@ class KeyConfigError(Exception):
"""Raised on errors with the key config. """Raised on errors with the key config.
Attributes: Attributes:
lineno: The config line in which the exception occured. lineno: The config line in which the exception occurred.
""" """
def __init__(self, msg=None): def __init__(self, msg=None):
@ -73,7 +73,7 @@ class KeyConfigParser(QObject):
super().__init__(parent) super().__init__(parent)
self._cur_section = None self._cur_section = None
self._cur_command = None self._cur_command = None
# Mapping of section name(s) to keybinding -> command dicts. # Mapping of section name(s) to key binding -> command dicts.
self.keybindings = collections.OrderedDict() self.keybindings = collections.OrderedDict()
if configdir is None: if configdir is None:
self._configfile = None self._configfile = None
@ -208,7 +208,7 @@ class KeyConfigParser(QObject):
return sections return sections
def _load_default(self): def _load_default(self):
"""Load the built-in default keybindings.""" """Load the built-in default key bindings."""
for sectname, sect in configdata.KEY_DATA.items(): for sectname, sect in configdata.KEY_DATA.items():
sectname = self._normalize_sectname(sectname) sectname = self._normalize_sectname(sectname)
if not sect: if not sect:
@ -242,7 +242,7 @@ class KeyConfigParser(QObject):
e.lineno = i e.lineno = i
raise raise
except OSError: except OSError:
log.keyboard.exception("Failed to read keybindings!") log.keyboard.exception("Failed to read key bindings!")
for sectname in self.keybindings: for sectname in self.keybindings:
self.changed.emit(sectname) self.changed.emit(sectname)
@ -258,9 +258,9 @@ class KeyConfigParser(QObject):
self._cur_command = line self._cur_command = line
def _read_keybinding(self, line): def _read_keybinding(self, line):
"""Read a keybinding from a line.""" """Read a key binding from a line."""
if self._cur_command is None: if self._cur_command is None:
raise KeyConfigError("Got keybinding '{}' without getting a " raise KeyConfigError("Got key binding '{}' without getting a "
"command!".format(line)) "command!".format(line))
else: else:
assert self._cur_section is not None assert self._cur_section is not None
@ -280,7 +280,7 @@ class KeyConfigParser(QObject):
self.keybindings[sectname][keychain] = command self.keybindings[sectname][keychain] = command
def get_bindings_for(self, section): def get_bindings_for(self, section):
"""Get a dict with all merged keybindings for a section.""" """Get a dict with all merged key bindings for a section."""
bindings = {} bindings = {}
for sectstring, d in self.keybindings.items(): for sectstring, d in self.keybindings.items():
if sectstring.startswith('!'): if sectstring.startswith('!'):

View File

@ -133,7 +133,7 @@ class ValueList(Section):
"""This class represents a section with a list key-value settings. """This class represents a section with a list key-value settings.
These are settings inside sections which don't have fixed keys, but instead These are settings inside sections which don't have fixed keys, but instead
have a dynamic list of "key = value" pairs, like keybindings or have a dynamic list of "key = value" pairs, like key bindings or
searchengines. searchengines.
They basically consist of two different SettingValues. They basically consist of two different SettingValues.

View File

@ -94,7 +94,7 @@ class ColorDict(dict):
log.style.exception("No color defined for {}!") log.style.exception("No color defined for {}!")
return '' return ''
if isinstance(val, QColor): if isinstance(val, QColor):
# This could happen when accidentaly declarding something as # This could happen when accidentally declaring something as
# QtColor instead of Color in the config, and it'd go unnoticed as # QtColor instead of Color in the config, and it'd go unnoticed as
# the CSS is invalid then. # the CSS is invalid then.
raise TypeError("QColor passed to ColorDict!") raise TypeError("QColor passed to ColorDict!")

View File

@ -26,7 +26,7 @@ class SettingValue:
"""Base class for setting values. """Base class for setting values.
Intended to be subclassed by config value "types". Intended to be sub-classed by config value "types".
Attributes: Attributes:
typ: A BaseType subclass instance. typ: A BaseType subclass instance.

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>. # along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Base class for vim-like keysequence parser.""" """Base class for vim-like key sequence parser."""
import re import re
import functools import functools
@ -44,20 +44,20 @@ class BaseKeyParser(QObject):
ambiguous: There are both a partial and a definitive match. ambiguous: There are both a partial and a definitive match.
none: No more matches possible. none: No more matches possible.
Types: type of a keybinding. Types: type of a key binding.
chain: execute() was called via a chain-like keybinding chain: execute() was called via a chain-like key binding
special: execute() was called via a special keybinding special: execute() was called via a special key binding
do_log: Whether to log keypresses or not. do_log: Whether to log keypresses or not.
Attributes: Attributes:
bindings: Bound keybindings bindings: Bound key bindings
special_bindings: Bound special bindings (<Foo>). special_bindings: Bound special bindings (<Foo>).
_win_id: The window ID this keyparser is associated with. _win_id: The window ID this keyparser is associated with.
_warn_on_keychains: Whether a warning should be logged when binding _warn_on_keychains: Whether a warning should be logged when binding
keychains in a section which does not support them. keychains in a section which does not support them.
_keystring: The currently entered key sequence _keystring: The currently entered key sequence
_ambigious_timer: Timer for delayed execution with ambigious bindings. _ambiguous_timer: Timer for delayed execution with ambiguous bindings.
_modename: The name of the input mode associated with this keyparser. _modename: The name of the input mode associated with this keyparser.
_supports_count: Whether count is supported _supports_count: Whether count is supported
_supports_chains: Whether keychains are supported _supports_chains: Whether keychains are supported
@ -78,8 +78,8 @@ class BaseKeyParser(QObject):
supports_chains=False): supports_chains=False):
super().__init__(parent) super().__init__(parent)
self._win_id = win_id self._win_id = win_id
self._ambigious_timer = usertypes.Timer(self, 'ambigious-match') self._ambiguous_timer = usertypes.Timer(self, 'ambiguous-match')
self._ambigious_timer.setSingleShot(True) self._ambiguous_timer.setSingleShot(True)
self._modename = None self._modename = None
self._keystring = '' self._keystring = ''
if supports_count is None: if supports_count is None:
@ -248,11 +248,11 @@ class BaseKeyParser(QObject):
def _stop_timers(self): def _stop_timers(self):
"""Stop a delayed execution if any is running.""" """Stop a delayed execution if any is running."""
if self._ambigious_timer.isActive() and self.do_log: if self._ambiguous_timer.isActive() and self.do_log:
log.keyboard.debug("Stopping delayed execution.") log.keyboard.debug("Stopping delayed execution.")
self._ambigious_timer.stop() self._ambiguous_timer.stop()
try: try:
self._ambigious_timer.timeout.disconnect() self._ambiguous_timer.timeout.disconnect()
except TypeError: except TypeError:
# no connections # no connections
pass pass
@ -274,10 +274,10 @@ class BaseKeyParser(QObject):
# execute in `time' ms # execute in `time' ms
self._debug_log("Scheduling execution of {} in {}ms".format( self._debug_log("Scheduling execution of {} in {}ms".format(
binding, time)) binding, time))
self._ambigious_timer.setInterval(time) self._ambiguous_timer.setInterval(time)
self._ambigious_timer.timeout.connect( self._ambiguous_timer.timeout.connect(
functools.partial(self.delayed_exec, binding, count)) functools.partial(self.delayed_exec, binding, count))
self._ambigious_timer.start() self._ambiguous_timer.start()
def delayed_exec(self, command, count): def delayed_exec(self, command, count):
"""Execute a delayed command. """Execute a delayed command.
@ -350,7 +350,7 @@ class BaseKeyParser(QObject):
@pyqtSlot(str) @pyqtSlot(str)
def on_keyconfig_changed(self, mode): def on_keyconfig_changed(self, mode):
"""Re-read the config if a keybinding was changed.""" """Re-read the config if a key binding was changed."""
if self._modename is None: if self._modename is None:
raise AttributeError("on_keyconfig_changed called but no section " raise AttributeError("on_keyconfig_changed called but no section "
"defined!") "defined!")

View File

@ -95,7 +95,7 @@ def maybe_leave(win_id, mode, reason=None):
class EventFilter(QObject): class EventFilter(QObject):
"""Event filter which passes the event to the corrent ModeManager.""" """Event filter which passes the event to the current ModeManager."""
def __init__(self, parent=None): def __init__(self, parent=None):
super().__init__(parent) super().__init__(parent)
@ -229,7 +229,7 @@ class ModeManager(QObject):
""" """
# handle like matching KeyPress # handle like matching KeyPress
if event in self._releaseevents_to_pass: if event in self._releaseevents_to_pass:
# remove all occurences # remove all occurrences
self._releaseevents_to_pass = [ self._releaseevents_to_pass = [
e for e in self._releaseevents_to_pass if e != event] e for e in self._releaseevents_to_pass if e != event]
filter_this = False filter_this = False
@ -245,7 +245,7 @@ class ModeManager(QObject):
Args: Args:
mode: The name of the mode. mode: The name of the mode.
handler: Handler for keyPressEvents. handler: Handler for keyPressEvents.
passthrough: Whether to pass keybindings in this mode through to passthrough: Whether to pass key bindings in this mode through to
the widgets. the widgets.
""" """
if not isinstance(mode, usertypes.KeyMode): if not isinstance(mode, usertypes.KeyMode):

View File

@ -37,7 +37,7 @@ LastPress = usertypes.enum('LastPress', ['none', 'filtertext', 'keystring'])
class NormalKeyParser(keyparser.CommandKeyParser): class NormalKeyParser(keyparser.CommandKeyParser):
"""KeyParser for normalmode with added STARTCHARS detection and more. """KeyParser for normal mode with added STARTCHARS detection and more.
Attributes: Attributes:
_partial_timer: Timer to clear partial keypresses. _partial_timer: Timer to clear partial keypresses.

View File

@ -43,7 +43,7 @@ class MainWindow(QWidget):
"""The main window of qutebrowser. """The main window of qutebrowser.
Adds all needed components to a vbox, initializes subwidgets and connects Adds all needed components to a vbox, initializes sub-widgets and connects
signals. signals.
Attributes: Attributes:
@ -84,7 +84,7 @@ class MainWindow(QWidget):
self._load_state_geometry() self._load_state_geometry()
else: else:
self._set_default_geometry() self._set_default_geometry()
log.init.debug("Initial mainwindow geometry: {}".format( log.init.debug("Initial main window geometry: {}".format(
self.geometry())) self.geometry()))
self._vbox = QVBoxLayout(self) self._vbox = QVBoxLayout(self)
self._vbox.setContentsMargins(0, 0, 0, 0) self._vbox.setContentsMargins(0, 0, 0, 0)

View File

@ -179,7 +179,7 @@ class Command(misc.MinimalLineEditMixin, misc.CommandLineEdit):
def on_mode_left(self, mode): def on_mode_left(self, mode):
"""Clear up when command mode was left. """Clear up when command mode was left.
- Clear the statusbar text if it's explicitely unfocused. - Clear the statusbar text if it's explicitly unfocused.
- Clear completion selection - Clear completion selection
- Hide completion - Hide completion

View File

@ -187,7 +187,7 @@ class Prompter(QObject):
def shutdown(self): def shutdown(self):
"""Cancel all blocking questions. """Cancel all blocking questions.
Quits and removes all running eventloops. Quits and removes all running event loops.
Return: Return:
True if loops needed to be aborted, True if loops needed to be aborted,

View File

@ -32,7 +32,7 @@ class TextBase(QLabel):
Unlike QLabel, the text will get elided. Unlike QLabel, the text will get elided.
Eliding is loosly based on Eliding is loosely based on
http://gedgedev.blogspot.ch/2010/12/elided-labels-in-qt.html http://gedgedev.blogspot.ch/2010/12/elided-labels-in-qt.html
Attributes: Attributes:
@ -64,7 +64,7 @@ class TextBase(QLabel):
This update the elided text after setting the text, and also works This update the elided text after setting the text, and also works
around a weird QLabel redrawing bug where it doesn't redraw correctly around a weird QLabel redrawing bug where it doesn't redraw correctly
when the text is empty -- we explicitely need to call repaint() to when the text is empty -- we explicitly need to call repaint() to
resolve this. resolve this.
More info: More info:

View File

@ -40,7 +40,7 @@ class UrlText(textbase.TextBase):
_normal_url: The normal URL to be displayed as a UrlType instance. _normal_url: The normal URL to be displayed as a UrlType instance.
_normal_url_type: The type of the normal URL as a UrlType instance. _normal_url_type: The type of the normal URL as a UrlType instance.
_hover_url: The URL we're currently hovering over. _hover_url: The URL we're currently hovering over.
_ssl_errors: Whether SSL errors occured while loading. _ssl_errors: Whether SSL errors occurred while loading.
Class attributes: Class attributes:
_urltype: The URL type to show currently (normal/ok/error/warn/hover). _urltype: The URL type to show currently (normal/ok/error/warn/hover).

View File

@ -48,12 +48,12 @@ class TabbedBrowser(tabwidget.TabWidget):
"""A TabWidget with QWebViews inside. """A TabWidget with QWebViews inside.
Provides methods to manage tabs, convenience methods to interact with the Provides methods to manage tabs, convenience methods to interact with the
current tab (cur_*) and filters signals to re-emit them when they occured current tab (cur_*) and filters signals to re-emit them when they occurred
in the currently visible tab. in the currently visible tab.
For all tab-specific signals (cur_*) emitted by a tab, this happens: For all tab-specific signals (cur_*) emitted by a tab, this happens:
- the signal gets filtered with _filter_signals and self.cur_* gets - the signal gets filtered with _filter_signals and self.cur_* gets
emitted if the signal occured in the current tab. emitted if the signal occurred in the current tab.
Attributes: Attributes:
_win_id: The window ID this tabbedbrowser is associated with. _win_id: The window ID this tabbedbrowser is associated with.
@ -331,7 +331,7 @@ class TabbedBrowser(tabwidget.TabWidget):
url: The URL to open as QUrl or None for an empty tab. url: The URL to open as QUrl or None for an empty tab.
background: Whether to open the tab in the background. background: Whether to open the tab in the background.
if None, the background-tabs setting decides. if None, the background-tabs setting decides.
explicit: Whether the tab was opened explicitely. explicit: Whether the tab was opened explicitly.
If this is set, the new position might be different. With If this is set, the new position might be different. With
the default settings we handle it like Chromium does: the default settings we handle it like Chromium does:
- Tabs from clicked links etc. are to the right of - Tabs from clicked links etc. are to the right of
@ -368,7 +368,7 @@ class TabbedBrowser(tabwidget.TabWidget):
"""Get the index of a tab to insert. """Get the index of a tab to insert.
Args: Args:
explicit: Whether the tab was opened explicitely. explicit: Whether the tab was opened explicitly.
Return: Return:
The index of the new tab. The index of the new tab.
@ -590,7 +590,7 @@ class TabbedBrowser(tabwidget.TabWidget):
except TabDeletedError: except TabDeletedError:
# We can get signals for tabs we already deleted... # We can get signals for tabs we already deleted...
return return
if tab.page().error_occured: if tab.page().error_occurred:
color = config.get('colors', 'tabs.indicator.error') color = config.get('colors', 'tabs.indicator.error')
else: else:
start = config.get('colors', 'tabs.indicator.start') start = config.get('colors', 'tabs.indicator.start')

View File

@ -41,7 +41,7 @@ PM_TabBarPadding = QStyle.PM_CustomBase
class TabWidget(QTabWidget): class TabWidget(QTabWidget):
"""The tabwidget used for TabbedBrowser.""" """The tab widget used for TabbedBrowser."""
def __init__(self, win_id, parent=None): def __init__(self, win_id, parent=None):
super().__init__(parent) super().__init__(parent)
@ -65,10 +65,10 @@ class TabWidget(QTabWidget):
self.setMovable(config.get('tabs', 'movable')) self.setMovable(config.get('tabs', 'movable'))
self.setTabsClosable(False) self.setTabsClosable(False)
position = config.get('tabs', 'position') position = config.get('tabs', 'position')
selection_behaviour = config.get('tabs', 'select-on-remove') selection_behavior = config.get('tabs', 'select-on-remove')
self.setTabPosition(position) self.setTabPosition(position)
tabbar.vertical = position in (QTabWidget.West, QTabWidget.East) tabbar.vertical = position in (QTabWidget.West, QTabWidget.East)
tabbar.setSelectionBehaviorOnRemove(selection_behaviour) tabbar.setSelectionBehaviorOnRemove(selection_behavior)
tabbar.refresh() tabbar.refresh()
def set_tab_indicator_color(self, idx, color): def set_tab_indicator_color(self, idx, color):
@ -187,7 +187,7 @@ class TabWidget(QTabWidget):
class TabBar(QTabBar): class TabBar(QTabBar):
"""Custom tabbar with our own style. """Custom tab bar with our own style.
FIXME: Dragging tabs doesn't look as nice as it does in QTabBar. However, FIXME: Dragging tabs doesn't look as nice as it does in QTabBar. However,
fixing this would be a lot of effort, so we'll postpone it until we're fixing this would be a lot of effort, so we'll postpone it until we're
@ -221,16 +221,16 @@ class TabBar(QTabBar):
@config.change_filter('tabs', 'hide-auto') @config.change_filter('tabs', 'hide-auto')
def autohide(self): def autohide(self):
"""Hide tabbar if needed when tabs->hide-auto got changed.""" """Hide tab bar if needed when tabs->hide-auto got changed."""
self._tabhide() self._tabhide()
@config.change_filter('tabs', 'hide-always') @config.change_filter('tabs', 'hide-always')
def alwayshide(self): def alwayshide(self):
"""Hide tabbar if needed when tabs->hide-always got changed.""" """Hide tab bar if needed when tabs->hide-always got changed."""
self._tabhide() self._tabhide()
def _tabhide(self): def _tabhide(self):
"""Hide the tabbar if needed.""" """Hide the tab bar if needed."""
hide_auto = config.get('tabs', 'hide-auto') hide_auto = config.get('tabs', 'hide-auto')
hide_always = config.get('tabs', 'hide-always') hide_always = config.get('tabs', 'hide-always')
if hide_always or (hide_auto and self.count() == 1): if hide_always or (hide_auto and self.count() == 1):
@ -264,7 +264,7 @@ class TabBar(QTabBar):
Args: Args:
idx: The tab index to get the title for. idx: The tab index to get the title for.
handle_unset: Whether to return an emtpy string on KeyError. handle_unset: Whether to return an empty string on KeyError.
""" """
try: try:
return self.tab_data(idx, 'page-title') return self.tab_data(idx, 'page-title')
@ -279,12 +279,12 @@ class TabBar(QTabBar):
@config.change_filter('fonts', 'tabbar') @config.change_filter('fonts', 'tabbar')
def set_font(self): def set_font(self):
"""Set the tabbar font.""" """Set the tab bar font."""
self.setFont(config.get('fonts', 'tabbar')) self.setFont(config.get('fonts', 'tabbar'))
@config.change_filter('colors', 'tabs.bg.bar') @config.change_filter('colors', 'tabs.bg.bar')
def set_colors(self): def set_colors(self):
"""Set the tabbar colors.""" """Set the tab bar colors."""
p = self.palette() p = self.palette()
p.setColor(QPalette.Window, config.get('colors', 'tabs.bg.bar')) p.setColor(QPalette.Window, config.get('colors', 'tabs.bg.bar'))
self.setPalette(p) self.setPalette(p)
@ -311,7 +311,7 @@ class TabBar(QTabBar):
"""Set the minimum tab size to indicator/icon/... text. """Set the minimum tab size to indicator/icon/... text.
Args: Args:
index: The index of the tab to get a sizehint for. index: The index of the tab to get a size hint for.
Return: Return:
A QSize. A QSize.

View File

@ -149,7 +149,7 @@ class ConsoleWidget(QWidget):
_output: The output widget in the console. _output: The output widget in the console.
_vbox: The layout which contains everything. _vbox: The layout which contains everything.
_more: A flag which is set when more input is expected. _more: A flag which is set when more input is expected.
_buffer: The buffer for multiline commands. _buffer: The buffer for multi-line commands.
_interpreter: The InteractiveInterpreter to execute code with. _interpreter: The InteractiveInterpreter to execute code with.
""" """
@ -195,13 +195,13 @@ class ConsoleWidget(QWidget):
self._buffer.append(line) self._buffer.append(line)
source = '\n'.join(self._buffer) source = '\n'.join(self._buffer)
self.write(line + '\n') self.write(line + '\n')
# We do two special things with the contextmanagers here: # We do two special things with the context managers here:
# - We replace stdout/stderr to capture output. Even if we could # - We replace stdout/stderr to capture output. Even if we could
# override InteractiveInterpreter's write method, most things are # override InteractiveInterpreter's write method, most things are
# printed elsewhere (e.g. by exec). Other Python GUI shells do the # printed elsewhere (e.g. by exec). Other Python GUI shells do the
# same. # same.
# - We disable our exception hook, so exceptions from the console get # - We disable our exception hook, so exceptions from the console get
# printed and don't ooen a crashdialog. # printed and don't open a crashdialog.
with utils.fake_io(self.write), utils.disabled_excepthook(): with utils.fake_io(self.write), utils.disabled_excepthook():
self._more = self._interpreter.runsource(source, '<console>') self._more = self._interpreter.runsource(source, '<console>')
self.write(self._curprompt()) self.write(self._curprompt())

View File

@ -82,7 +82,7 @@ def get_fatal_crash_dialog(debug, data):
else: else:
title = "qutebrowser was restarted after a fatal crash!" title = "qutebrowser was restarted after a fatal crash!"
text = ("<b>qutebrowser was restarted after a fatal crash!</b><br/>" text = ("<b>qutebrowser was restarted after a fatal crash!</b><br/>"
"Unfortunately, this crash occured in Qt (the library " "Unfortunately, this crash occurred in Qt (the library "
"qutebrowser uses), and your version ({}) is outdated - " "qutebrowser uses), and your version ({}) is outdated - "
"Qt 5.4 or later is recommended. Unfortuntately Debian and " "Qt 5.4 or later is recommended. Unfortuntately Debian and "
"Ubuntu don't ship a newer version (yet?)...".format( "Ubuntu don't ship a newer version (yet?)...".format(
@ -403,12 +403,12 @@ class ExceptionCrashDialog(_CrashDialog):
class FatalCrashDialog(_CrashDialog): class FatalCrashDialog(_CrashDialog):
"""Dialog which gets shown when a fatal error occured. """Dialog which gets shown when a fatal error occurred.
Attributes: Attributes:
_log: The log text to display. _log: The log text to display.
_type: The type of error which occured. _type: The type of error which occurred.
_func: The function (top of the stack) in which the error occured. _func: The function (top of the stack) in which the error occurred.
_chk_history: A checkbox for the user to decide if page history should _chk_history: A checkbox for the user to decide if page history should
be sent. be sent.
""" """

View File

@ -39,7 +39,7 @@ try:
except ImportError: except ImportError:
tkinter = None tkinter = None
# NOTE: No qutebrowser or PyQt import should be done here, as some early # NOTE: No qutebrowser or PyQt import should be done here, as some early
# initialisation needs to take place before that! # initialization needs to take place before that!
def _missing_str(name, *, windows=None, pip=None): def _missing_str(name, *, windows=None, pip=None):
@ -97,7 +97,7 @@ def _die(message, exception=None):
def init_faulthandler(fileobj=sys.__stderr__): def init_faulthandler(fileobj=sys.__stderr__):
"""Enable faulthandler module if available. """Enable faulthandler module if available.
This print a nice traceback on segfauls. This print a nice traceback on segfaults.
We use sys.__stderr__ instead of sys.stderr here so this will still work We use sys.__stderr__ instead of sys.stderr here so this will still work
when sys.stderr got replaced, e.g. by "Python Tools for Visual Studio". when sys.stderr got replaced, e.g. by "Python Tools for Visual Studio".
@ -163,7 +163,7 @@ def fix_harfbuzz(args):
elif args.harfbuzz in ('old', 'new'): elif args.harfbuzz in ('old', 'new'):
# forced harfbuzz variant # forced harfbuzz variant
# FIXME looking at the Qt code, 'new' isn't a valid value, but leaving # FIXME looking at the Qt code, 'new' isn't a valid value, but leaving
# it empty and using new yields different behaviour... # it empty and using new yields different behavior...
# (probably irrelevant when workaround gets removed) # (probably irrelevant when workaround gets removed)
log.init.debug("Using {} harfbuzz engine (forced)".format( log.init.debug("Using {} harfbuzz engine (forced)".format(
args.harfbuzz)) args.harfbuzz))
@ -263,7 +263,7 @@ def init_log(args):
def earlyinit(args): def earlyinit(args):
"""Do all needed early initialisation. """Do all needed early initialization.
Note that it's vital the other earlyinit functions get called in the right Note that it's vital the other earlyinit functions get called in the right
order! order!
@ -272,7 +272,7 @@ def earlyinit(args):
args: The argparse namespace. args: The argparse namespace.
""" """
# First we initialize the faulthandler as early as possible, so we # First we initialize the faulthandler as early as possible, so we
# theoretically could catch segfaults occuring later during earlyinit. # theoretically could catch segfaults occurring later during earlyinit.
init_faulthandler() init_faulthandler()
# Here we check if QtCore is available, and if not, print a message to the # Here we check if QtCore is available, and if not, print a message to the
# console or via Tk. # console or via Tk.

View File

@ -127,7 +127,7 @@ class _CommandValidator(QValidator):
Args: Args:
string: The string to validate. string: The string to validate.
pos: The current curser position. pos: The current cursor position.
Return: Return:
A tuple (status, string, pos) as a QValidator should. A tuple (status, string, pos) as a QValidator should.

View File

@ -39,7 +39,8 @@ class Saveable:
_save_handler: The function to call to save this Saveable. _save_handler: The function to call to save this Saveable.
_save_on_exit: Whether to always save this saveable on exit. _save_on_exit: Whether to always save this saveable on exit.
_config_opt: A (section, option) tuple of a config option which decides _config_opt: A (section, option) tuple of a config option which decides
whether to autosave or not. None if no such option exists. whether to auto-save or not. None if no such option
exists.
_filename: The filename of the underlying file. _filename: The filename of the underlying file.
""" """
@ -77,7 +78,7 @@ class Saveable:
Args: Args:
is_exit: Whether we're currently exiting qutebrowser. is_exit: Whether we're currently exiting qutebrowser.
explicit: Whether the user explicitely requested this save. explicit: Whether the user explicitly requested this save.
silent: Don't write informations to log. silent: Don't write informations to log.
force: Force saving, no matter what. force: Force saving, no matter what.
""" """
@ -119,7 +120,7 @@ class SaveManager(QObject):
return utils.get_repr(self, saveables=self.saveables) return utils.get_repr(self, saveables=self.saveables)
def init_autosave(self): def init_autosave(self):
"""Initialize autosaving. """Initialize auto-saving.
We don't do this in __init__ because the config needs to be initialized We don't do this in __init__ because the config needs to be initialized
first, but the config needs the save manager. first, but the config needs the save manager.
@ -129,7 +130,7 @@ class SaveManager(QObject):
@config.change_filter('general', 'auto-save-interval') @config.change_filter('general', 'auto-save-interval')
def set_autosave_interval(self): def set_autosave_interval(self):
"""Set the autosave interval.""" """Set the auto-save interval."""
interval = config.get('general', 'auto-save-interval') interval = config.get('general', 'auto-save-interval')
if interval == 0: if interval == 0:
self._save_timer.stop() self._save_timer.stop()
@ -145,7 +146,7 @@ class SaveManager(QObject):
name: The name to use. name: The name to use.
save: The function to call to save this saveable. save: The function to call to save this saveable.
changed: The signal emitted when this saveable changed. changed: The signal emitted when this saveable changed.
config_opt: A (section, option) tuple deciding whether to autosave config_opt: A (section, option) tuple deciding whether to auto-save
or not. or not.
filename: The filename of the underlying file, so we can force filename: The filename of the underlying file, so we can force
saving if it doesn't exist. saving if it doesn't exist.
@ -161,7 +162,7 @@ class SaveManager(QObject):
Args: Args:
is_exit: Whether we're currently exiting qutebrowser. is_exit: Whether we're currently exiting qutebrowser.
explicit: Whether this save operation was triggered explicitely. explicit: Whether this save operation was triggered explicitly.
silent: Don't write informations to log. Used to reduce log spam silent: Don't write informations to log. Used to reduce log spam
when autosaving. when autosaving.
force: Force saving, no matter what. force: Force saving, no matter what.

View File

@ -49,7 +49,7 @@ class ShellLexer:
self.reset() self.reset()
def reset(self): def reset(self):
"""Reset the statemachine state to the defaults.""" """Reset the state machine state to the defaults."""
self.quoted = False self.quoted = False
self.escapedstate = ' ' self.escapedstate = ' '
self.token = '' self.token = ''
@ -190,7 +190,7 @@ def simple_split(s, keep=False, maxsplit=None):
whitespace = '\n\t ' whitespace = '\n\t '
if maxsplit == 0: if maxsplit == 0:
# re.split with maxsplit=0 splits everything, while str.split splits # re.split with maxsplit=0 splits everything, while str.split splits
# nothing (which is the behaviour we want). # nothing (which is the behavior we want).
if keep: if keep:
return [s] return [s]
else: else:

View File

@ -133,7 +133,7 @@ def main():
""" """
return app.exec_() return app.exec_()
# We set qApp explicitely here to reduce the risk of segfaults while # We set qApp explicitly here to reduce the risk of segfaults while
# quitting. # quitting.
# See https://bugs.launchpad.net/ubuntu/+source/python-qt4/+bug/561303/comments/7 # See https://bugs.launchpad.net/ubuntu/+source/python-qt4/+bug/561303/comments/7
# While this is a workaround for PyQt4 which should be fixed in PyQt, it # While this is a workaround for PyQt4 which should be fixed in PyQt, it

View File

@ -36,7 +36,7 @@ DEFAULT_NAME = 'qutebrowser-download'
class AttachmentTestCase(unittest.TestCase): class AttachmentTestCase(unittest.TestCase):
"""Helper class with some convienence methods to check filenames.""" """Helper class with some convenience methods to check filenames."""
def _check_filename(self, header, filename): def _check_filename(self, header, filename):
"""Check if the passed header has the given filename.""" """Check if the passed header has the given filename."""
@ -120,7 +120,7 @@ class InlineTests(unittest.TestCase):
variation of the test checks whether whatever handles PDF display variation of the test checks whether whatever handles PDF display
receives the filename information, and acts upon it (this was tested receives the filename information, and acts upon it (this was tested
with the latest Acrobat Reader plugin, or, in the case of Chrome, using with the latest Acrobat Reader plugin, or, in the case of Chrome, using
the builtin PDF handler). the built-in PDF handler).
""" """
self._check_filename('inline; filename="foo.pdf"', "foo.pdf") self._check_filename('inline; filename="foo.pdf"', "foo.pdf")
@ -824,7 +824,7 @@ class EncodingFallbackTests(AttachmentTestCase):
"filename=\"foo-ae.html\"", 'foo-ä.html') "filename=\"foo-ae.html\"", 'foo-ä.html')
def test_attfnboth3(self): def test_attfnboth3(self):
"""'attachment', specifying an ambigious filename. """'attachment', specifying an ambiguous filename.
currency-sign=¤ in the simple RFC2231/5987 format, and euro-sign= in currency-sign=¤ in the simple RFC2231/5987 format, and euro-sign= in
RFC2231-with-continuations format. RFC2231-with-continuations format.

View File

@ -40,8 +40,8 @@ def get_webelem(geometry=None, frame=None, null=False, visibility='',
geometry: The geometry of the QWebElement as QRect. geometry: The geometry of the QWebElement as QRect.
frame: The QWebFrame the element is in. frame: The QWebFrame the element is in.
null: Whether the element is null or not. null: Whether the element is null or not.
visibility: The CSS visibility style property calue. visibility: The CSS visibility style property value.
display: The CSS display style property calue. display: The CSS display style property value.
attributes: Boolean HTML attributes to be added. attributes: Boolean HTML attributes to be added.
tagname: The tag name. tagname: The tag name.
classes: HTML classes to be added. classes: HTML classes to be added.
@ -535,7 +535,7 @@ class IsEditableTests(unittest.TestCase):
self.assertFalse(elem.is_editable()) self.assertFalse(elem.is_editable())
def test_div_noneditable(self): def test_div_noneditable(self):
"""Test div-element with non-editableclass.""" """Test div-element with non-editable class."""
elem = get_webelem(tagname='div', classes='foo-kix-bar') elem = get_webelem(tagname='div', classes='foo-kix-bar')
self.assertFalse(elem.is_editable()) self.assertFalse(elem.is_editable())

View File

@ -1828,7 +1828,7 @@ class SearchEngineUrlTests(unittest.TestCase):
self.t.validate('http://example.com/?q={}') self.t.validate('http://example.com/?q={}')
def test_validate_invalid_url(self): def test_validate_invalid_url(self):
"""Test validate with an invalud URL.""" """Test validate with an invalid URL."""
with self.assertRaises(configexc.ValidationError): with self.assertRaises(configexc.ValidationError):
self.t.validate(':{}') self.t.validate(':{}')

View File

@ -210,11 +210,11 @@ class KeyChainTests(unittest.TestCase):
@mock.patch('qutebrowser.keyinput.basekeyparser.config', @mock.patch('qutebrowser.keyinput.basekeyparser.config',
new=stubs.ConfigStub(CONFIG)) new=stubs.ConfigStub(CONFIG))
def test_ambigious_keychain(self): def test_ambiguous_keychain(self):
"""Test ambigious keychain.""" """Test ambiguous keychain."""
timer = self.kp._ambigious_timer timer = self.kp._ambiguous_timer
self.assertFalse(timer.isActive()) self.assertFalse(timer.isActive())
# We start with 'a' where the keychain gives us an ambigious result. # We start with 'a' where the keychain gives us an ambiguous result.
# Then we check if the timer has been set up correctly # Then we check if the timer has been set up correctly
self.kp.handle(helpers.fake_keyevent(Qt.Key_A, text='a')) self.kp.handle(helpers.fake_keyevent(Qt.Key_A, text='a'))
self.assertFalse(self.kp.execute.called) self.assertFalse(self.kp.execute.called)

View File

@ -52,7 +52,7 @@ def qt_message_handler(msg_type, context, msg):
QtFatalMsg: logging.CRITICAL, QtFatalMsg: logging.CRITICAL,
} }
level = qt_to_logging[msg_type] level = qt_to_logging[msg_type]
# There's very similiar code in utils.log, but we want it duplicated here # There's very similar code in utils.log, but we want it duplicated here
# for the tests. # for the tests.
if context.function is None: if context.function is None:
func = 'none' func = 'none'

View File

@ -100,7 +100,7 @@ class FileHandlingTests(unittest.TestCase):
self.editor = editor.ExternalEditor(0) self.editor = editor.ExternalEditor(0)
def test_file_handling_closed_ok(self, _proc_mock): def test_file_handling_closed_ok(self, _proc_mock):
"""Test file handling when closing with an exitstatus == 0.""" """Test file handling when closing with an exit status == 0."""
self.editor.edit("") self.editor.edit("")
filename = self.editor._filename filename = self.editor._filename
self.assertTrue(os.path.exists(filename)) self.assertTrue(os.path.exists(filename))
@ -108,7 +108,7 @@ class FileHandlingTests(unittest.TestCase):
self.assertFalse(os.path.exists(filename)) self.assertFalse(os.path.exists(filename))
def test_file_handling_closed_error(self, _proc_mock): def test_file_handling_closed_error(self, _proc_mock):
"""Test file handling when closing with an exitstatus != 0.""" """Test file handling when closing with an exit status != 0."""
self.editor.edit("") self.editor.edit("")
filename = self.editor._filename filename = self.editor._filename
self.assertTrue(os.path.exists(filename)) self.assertTrue(os.path.exists(filename))

View File

@ -146,20 +146,20 @@ class SimpleSplitTests(unittest.TestCase):
} }
def test_str_split(self): def test_str_split(self):
"""Test if the behaviour matches str.split.""" """Test if the behavior matches str.split."""
for test in self.TESTS: for test in self.TESTS:
with self.subTest(string=test): with self.subTest(string=test):
self.assertEqual(split.simple_split(test), self.assertEqual(split.simple_split(test),
test.rstrip().split()) test.rstrip().split())
def test_str_split_maxsplit_1(self): def test_str_split_maxsplit_1(self):
"""Test if the behaviour matches str.split with maxsplit=1.""" """Test if the behavior matches str.split with maxsplit=1."""
string = "foo bar baz" string = "foo bar baz"
self.assertEqual(split.simple_split(string, maxsplit=1), self.assertEqual(split.simple_split(string, maxsplit=1),
string.rstrip().split(maxsplit=1)) string.rstrip().split(maxsplit=1))
def test_str_split_maxsplit_0(self): def test_str_split_maxsplit_0(self):
"""Test if the behaviour matches str.split with maxsplit=0.""" """Test if the behavior matches str.split with maxsplit=0."""
string = " foo bar baz " string = " foo bar baz "
self.assertEqual(split.simple_split(string, maxsplit=0), self.assertEqual(split.simple_split(string, maxsplit=0),
string.rstrip().split(maxsplit=0)) string.rstrip().split(maxsplit=0))

View File

@ -36,7 +36,7 @@ class QEnumKeyTests(unittest.TestCase):
"""Tests for qenum_key.""" """Tests for qenum_key."""
def test_no_metaobj(self): def test_no_metaobj(self):
"""Test with an enum with no metaobject.""" """Test with an enum with no meta-object."""
with self.assertRaises(AttributeError): with self.assertRaises(AttributeError):
# Make sure it doesn't have a meta object # Make sure it doesn't have a meta object
# pylint: disable=pointless-statement,no-member # pylint: disable=pointless-statement,no-member
@ -45,9 +45,9 @@ class QEnumKeyTests(unittest.TestCase):
self.assertEqual(key, 'PE_PanelButtonCommand') self.assertEqual(key, 'PE_PanelButtonCommand')
def test_metaobj(self): def test_metaobj(self):
"""Test with an enum with metaobject.""" """Test with an enum with meta-object."""
# pylint: disable=pointless-statement # pylint: disable=pointless-statement
QFrame.staticMetaObject # make sure it has a metaobject QFrame.staticMetaObject # make sure it has a meta-object
key = debug.qenum_key(QFrame, QFrame.Sunken) key = debug.qenum_key(QFrame, QFrame.Sunken)
self.assertEqual(key, 'Sunken') self.assertEqual(key, 'Sunken')

View File

@ -114,7 +114,7 @@ class LogFilterTests(unittest.TestCase):
self.assertTrue(logfilter.filter(record)) self.assertTrue(logfilter.filter(record))
def test_matching(self): def test_matching(self):
"""Test if a filter lets an exactly matching logrecord through.""" """Test if a filter lets an exactly matching log record through."""
logfilter = log.LogFilter(["eggs", "bacon"]) logfilter = log.LogFilter(["eggs", "bacon"])
record = self._make_record("eggs") record = self._make_record("eggs")
self.assertTrue(logfilter.filter(record)) self.assertTrue(logfilter.filter(record))

View File

@ -83,7 +83,7 @@ class CheckOverflowTests(unittest.TestCase):
def argparser_exit(status=0, message=None): # pylint: disable=unused-argument def argparser_exit(status=0, message=None): # pylint: disable=unused-argument
"""Function to monkeypatch .exit() of the argparser so it doesn't exit.""" """Function to monkey-patch .exit() of the argparser so it doesn't exit."""
raise Exception raise Exception

View File

@ -46,7 +46,7 @@ class GetStandardDirLinuxTests(unittest.TestCase):
@unittest.skipUnless(sys.platform.startswith("linux"), "requires Linux") @unittest.skipUnless(sys.platform.startswith("linux"), "requires Linux")
def test_data_explicit(self): def test_data_explicit(self):
"""Test data dir with XDG_DATA_HOME explicitely set.""" """Test data dir with XDG_DATA_HOME explicitly set."""
with helpers.environ_set_temp({'XDG_DATA_HOME': self.temp_dir}): with helpers.environ_set_temp({'XDG_DATA_HOME': self.temp_dir}):
standarddir.init(None) standarddir.init(None)
expected = os.path.join(self.temp_dir, 'qutebrowser') expected = os.path.join(self.temp_dir, 'qutebrowser')
@ -54,7 +54,7 @@ class GetStandardDirLinuxTests(unittest.TestCase):
@unittest.skipUnless(sys.platform.startswith("linux"), "requires Linux") @unittest.skipUnless(sys.platform.startswith("linux"), "requires Linux")
def test_config_explicit(self): def test_config_explicit(self):
"""Test config dir with XDG_CONFIG_HOME explicitely set.""" """Test config dir with XDG_CONFIG_HOME explicitly set."""
with helpers.environ_set_temp({'XDG_CONFIG_HOME': self.temp_dir}): with helpers.environ_set_temp({'XDG_CONFIG_HOME': self.temp_dir}):
standarddir.init(None) standarddir.init(None)
expected = os.path.join(self.temp_dir, 'qutebrowser') expected = os.path.join(self.temp_dir, 'qutebrowser')
@ -62,7 +62,7 @@ class GetStandardDirLinuxTests(unittest.TestCase):
@unittest.skipUnless(sys.platform.startswith("linux"), "requires Linux") @unittest.skipUnless(sys.platform.startswith("linux"), "requires Linux")
def test_cache_explicit(self): def test_cache_explicit(self):
"""Test cache dir with XDG_CACHE_HOME explicitely set.""" """Test cache dir with XDG_CACHE_HOME explicitly set."""
with helpers.environ_set_temp({'XDG_CACHE_HOME': self.temp_dir}): with helpers.environ_set_temp({'XDG_CACHE_HOME': self.temp_dir}):
standarddir.init(None) standarddir.init(None)
expected = os.path.join(self.temp_dir, 'qutebrowser') expected = os.path.join(self.temp_dir, 'qutebrowser')

View File

@ -71,7 +71,7 @@ class ReadFileTests(unittest.TestCase):
"""Test read_file.""" """Test read_file."""
def test_readfile(self): def test_readfile(self):
"""Read a testfile.""" """Read a test file."""
content = utils.read_file(os.path.join('test', 'testfile')) content = utils.read_file(os.path.join('test', 'testfile'))
self.assertEqual(content.splitlines()[0], "Hello World!") self.assertEqual(content.splitlines()[0], "Hello World!")
@ -299,13 +299,13 @@ class KeyEventToStringTests(unittest.TestCase):
"""Test keyevent_to_string.""" """Test keyevent_to_string."""
def test_only_control(self): def test_only_control(self):
"""Test keyeevent when only control is pressed.""" """Test keyevent when only control is pressed."""
evt = helpers.fake_keyevent(key=Qt.Key_Control, evt = helpers.fake_keyevent(key=Qt.Key_Control,
modifiers=Qt.ControlModifier) modifiers=Qt.ControlModifier)
self.assertIsNone(utils.keyevent_to_string(evt)) self.assertIsNone(utils.keyevent_to_string(evt))
def test_only_hyper_l(self): def test_only_hyper_l(self):
"""Test keyeevent when only Hyper_L is pressed.""" """Test keyevent when only Hyper_L is pressed."""
evt = helpers.fake_keyevent(key=Qt.Key_Hyper_L, evt = helpers.fake_keyevent(key=Qt.Key_Hyper_L,
modifiers=Qt.MetaModifier) modifiers=Qt.MetaModifier)
self.assertIsNone(utils.keyevent_to_string(evt)) self.assertIsNone(utils.keyevent_to_string(evt))
@ -423,7 +423,7 @@ class ForceEncodingTests(unittest.TestCase):
"""Test force_encoding.""" """Test force_encoding."""
def test_fitting_ascii(self): def test_fitting_ascii(self):
"""Test with a text fitting into ascii.""" """Test with a text fitting into ASCII."""
text = 'hello world' text = 'hello world'
self.assertEqual(utils.force_encoding(text, 'ascii'), text) self.assertEqual(utils.force_encoding(text, 'ascii'), text)
@ -433,7 +433,7 @@ class ForceEncodingTests(unittest.TestCase):
self.assertEqual(utils.force_encoding(text, 'utf-8'), text) self.assertEqual(utils.force_encoding(text, 'utf-8'), text)
def test_not_fitting_ascii(self): def test_not_fitting_ascii(self):
"""Test with a text not fitting into ascii.""" """Test with a text not fitting into ASCII."""
text = 'hellö wörld' text = 'hellö wörld'
self.assertEqual(utils.force_encoding(text, 'ascii'), 'hell? w?rld') self.assertEqual(utils.force_encoding(text, 'ascii'), 'hell? w?rld')

View File

@ -245,14 +245,14 @@ class BlockTests(unittest.TestCase):
mode=usertypes.NeighborList.Modes.block) mode=usertypes.NeighborList.Modes.block)
def test_first(self): def test_first(self):
"""Test ouf of bounds previtem().""" """Test out of bounds previtem()."""
self.nl.firstitem() self.nl.firstitem()
self.assertEqual(self.nl._idx, 0) self.assertEqual(self.nl._idx, 0)
self.assertEqual(self.nl.previtem(), 1) self.assertEqual(self.nl.previtem(), 1)
self.assertEqual(self.nl._idx, 0) self.assertEqual(self.nl._idx, 0)
def test_last(self): def test_last(self):
"""Test ouf of bounds nextitem().""" """Test out of bounds nextitem()."""
self.nl.lastitem() self.nl.lastitem()
self.assertEqual(self.nl._idx, 4) self.assertEqual(self.nl._idx, 4)
self.assertEqual(self.nl.nextitem(), 5) self.assertEqual(self.nl.nextitem(), 5)
@ -272,14 +272,14 @@ class WrapTests(unittest.TestCase):
[1, 2, 3, 4, 5], default=3, mode=usertypes.NeighborList.Modes.wrap) [1, 2, 3, 4, 5], default=3, mode=usertypes.NeighborList.Modes.wrap)
def test_first(self): def test_first(self):
"""Test ouf of bounds previtem().""" """Test out of bounds previtem()."""
self.nl.firstitem() self.nl.firstitem()
self.assertEqual(self.nl._idx, 0) self.assertEqual(self.nl._idx, 0)
self.assertEqual(self.nl.previtem(), 5) self.assertEqual(self.nl.previtem(), 5)
self.assertEqual(self.nl._idx, 4) self.assertEqual(self.nl._idx, 4)
def test_last(self): def test_last(self):
"""Test ouf of bounds nextitem().""" """Test out of bounds nextitem()."""
self.nl.lastitem() self.nl.lastitem()
self.assertEqual(self.nl._idx, 4) self.assertEqual(self.nl._idx, 4)
self.assertEqual(self.nl.nextitem(), 1) self.assertEqual(self.nl.nextitem(), 1)
@ -300,7 +300,7 @@ class RaiseTests(unittest.TestCase):
mode=usertypes.NeighborList.Modes.exception) mode=usertypes.NeighborList.Modes.exception)
def test_first(self): def test_first(self):
"""Test ouf of bounds previtem().""" """Test out of bounds previtem()."""
self.nl.firstitem() self.nl.firstitem()
self.assertEqual(self.nl._idx, 0) self.assertEqual(self.nl._idx, 0)
with self.assertRaises(IndexError): with self.assertRaises(IndexError):
@ -308,7 +308,7 @@ class RaiseTests(unittest.TestCase):
self.assertEqual(self.nl._idx, 0) self.assertEqual(self.nl._idx, 0)
def test_last(self): def test_last(self):
"""Test ouf of bounds nextitem().""" """Test out of bounds nextitem()."""
self.nl.lastitem() self.nl.lastitem()
self.assertEqual(self.nl._idx, 4) self.assertEqual(self.nl._idx, 4)
with self.assertRaises(IndexError): with self.assertRaises(IndexError):

View File

@ -49,7 +49,7 @@ class Loader(jinja2.BaseLoader):
def _guess_autoescape(template_name): def _guess_autoescape(template_name):
"""Turn autoescape on/off based on the filetype. """Turn auto-escape on/off based on the file type.
Based on http://jinja.pocoo.org/docs/dev/api/#autoescaping Based on http://jinja.pocoo.org/docs/dev/api/#autoescaping
""" """

View File

@ -77,7 +77,7 @@ def _from_args(typ, args):
Return: Return:
A (override, path) tuple. A (override, path) tuple.
override: boolean, if the user did override the path override: boolean, if the user did override the path
path: The overriden path, or None to turn off storage. path: The overridden path, or None to turn off storage.
""" """
typ_to_argparse_arg = { typ_to_argparse_arg = {
QStandardPaths.ConfigLocation: 'confdir' QStandardPaths.ConfigLocation: 'confdir'

View File

@ -148,7 +148,7 @@ def fuzzy_url(urlstr, cwd=None, relative=False, do_search=True):
do_search: Whether to perform a search on non-URLs. do_search: Whether to perform a search on non-URLs.
Return: Return:
A target QUrl to a searchpage or the original URL. A target QUrl to a search page or the original URL.
""" """
expanded = os.path.expanduser(urlstr) expanded = os.path.expanduser(urlstr)
if relative and cwd: if relative and cwd:

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>. # along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Custom useful datatypes. """Custom useful data types.
Module attributes: Module attributes:
_UNSET: Used as default argument in the constructor so default can be None. _UNSET: Used as default argument in the constructor so default can be None.
@ -40,7 +40,7 @@ def enum(name, items, start=1, is_int=False):
Args: Args:
name: Name of the enum name: Name of the enum
items: Iterable of ttems to be sequentally enumerated. items: Iterable of items to be sequentially enumerated.
start: The number to use for the first value. start: The number to use for the first value.
We use 1 as default so enum members are always True. We use 1 as default so enum members are always True.
is_init: True if the enum should be a Python IntEnum is_init: True if the enum should be a Python IntEnum
@ -309,7 +309,7 @@ class Question(QObject):
@pyqtSlot() @pyqtSlot()
def done(self): def done(self):
"""Must be called when the queston was answered completely.""" """Must be called when the question was answered completely."""
self.answered.emit(self.answer) self.answered.emit(self.answer)
if self.mode == PromptMode.yesno: if self.mode == PromptMode.yesno:
if self.answer: if self.answer:

View File

@ -95,7 +95,7 @@ def read_file(filename, binary=False):
def actute_warning(): def actute_warning():
"""Display a warning about the dead_actute issue if needed.""" """Display a warning about the dead_actute issue if needed."""
# WORKAROUND (remove this when we bump the requirements to 5.3.0) # WORKAROUND (remove this when we bump the requirements to 5.3.0)
# Non linux OS' aren't affected # Non Linux OS' aren't affected
if not sys.platform.startswith('linux'): if not sys.platform.startswith('linux'):
return return
# If no compose file exists for some reason, we're not affected # If no compose file exists for some reason, we're not affected
@ -151,7 +151,7 @@ def interpolate_color(start, end, percent, colorspace=QColor.Rgb):
start: The start color. start: The start color.
end: The end color. end: The end color.
percent: Which value to get (0 - 100) percent: Which value to get (0 - 100)
colorspace: The desired interpolation colorsystem, colorspace: The desired interpolation color system,
QColor::{Rgb,Hsv,Hsl} (from QColor::Spec enum) QColor::{Rgb,Hsv,Hsl} (from QColor::Spec enum)
Return: Return:
@ -435,7 +435,7 @@ class prevent_exceptions: # pylint: disable=invalid-name
silently ignores them. silently ignores them.
We used to re-raise the exception with a single-shot QTimer in a similar We used to re-raise the exception with a single-shot QTimer in a similar
case, but that lead to a strange proble with a KeyError with some random case, but that lead to a strange problem with a KeyError with some random
jinja template stuff as content. For now, we only log it, so it doesn't jinja template stuff as content. For now, we only log it, so it doesn't
pass 100% silently. pass 100% silently.

View File

@ -34,7 +34,7 @@ from scripts import utils
def check_git(): def check_git():
"""Check for uncommited git files..""" """Check for uncommitted git files.."""
if not os.path.isdir(".git"): if not os.path.isdir(".git"):
print("No .git dir, ignoring") print("No .git dir, ignoring")
print() print()

View File

@ -74,7 +74,7 @@ def main():
('http://www.binpress.com/', False), ('http://www.binpress.com/', False),
('http://david.li/flow/', False), ('http://david.li/flow/', False),
('https://imzdl.com/', False), ('https://imzdl.com/', False),
# not reproducable # not reproducible
# https://bugreports.qt-project.org/browse/QTBUG-39847 # https://bugreports.qt-project.org/browse/QTBUG-39847
('http://www.20min.ch/', True), ('http://www.20min.ch/', True),
# HarfBuzz, https://bugreports.qt-project.org/browse/QTBUG-39278 # HarfBuzz, https://bugreports.qt-project.org/browse/QTBUG-39278

View File

@ -61,7 +61,7 @@ term_attributes = {
def _esc(code): def _esc(code):
"""Get an ANSII color code based on a color number.""" """Get an ANSI color code based on a color number."""
return '\033[{}m'.format(code) return '\033[{}m'.format(code)