diff --git a/qutebrowser/api/config.py b/qutebrowser/api/config.py index c1394d46a..6558cf42a 100644 --- a/qutebrowser/api/config.py +++ b/qutebrowser/api/config.py @@ -21,6 +21,9 @@ import typing -from qutebrowser.config import config +MYPY = False +if MYPY: + # pylint: disable=unused-import,useless-suppression + from qutebrowser.config import config val = typing.cast('config.ConfigContainer', None) diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index bce185298..43257d0a8 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -218,7 +218,7 @@ class HintActions: if context.target in [Target.normal, Target.current]: # Set the pre-jump mark ', so we can jump back here after following - context.tab.scroll.before_jump_requested.emit() + context.tab.scroller.before_jump_requested.emit() try: if context.target == Target.hover: diff --git a/qutebrowser/components/misccommands.py b/qutebrowser/components/misccommands.py index 4f730af3c..af10dc707 100644 --- a/qutebrowser/components/misccommands.py +++ b/qutebrowser/components/misccommands.py @@ -22,7 +22,6 @@ import os import signal import functools -import typing import logging try: @@ -30,16 +29,15 @@ try: except ImportError: hunter = None -from qutebrowser.api import cmdutils, apitypes, message, config - from PyQt5.QtCore import Qt from PyQt5.QtPrintSupport import QPrintPreviewDialog +from qutebrowser.api import cmdutils, apitypes, message, config + @cmdutils.register(name='reload') -@cmdutils.argument('count', value=cmdutils.Value.count) @cmdutils.argument('tab', value=cmdutils.Value.count_tab) -def reloadpage(tab, force=False, count=None): +def reloadpage(tab, force=False): """Reload the current/[count]th tab. Args: @@ -51,9 +49,8 @@ def reloadpage(tab, force=False, count=None): @cmdutils.register() -@cmdutils.argument('count', value=cmdutils.Value.count) @cmdutils.argument('tab', value=cmdutils.Value.count_tab) -def stop(tab, count=None): +def stop(tab): """Stop loading in the current/[count]th tab. Args: @@ -92,9 +89,8 @@ def _print_pdf(tab, filename): @cmdutils.register(name='print') @cmdutils.argument('tab', value=cmdutils.Value.count_tab) -@cmdutils.argument('count', value=cmdutils.Value.count) @cmdutils.argument('pdf', flag='f', metavar='file') -def printpage(tab, preview=False, count=None, *, pdf=None): +def printpage(tab, preview=False, *, pdf=None): """Print the current/[count]th tab. Args: @@ -228,8 +224,7 @@ def debug_webaction(tab, action, count=1): @cmdutils.register() @cmdutils.argument('tab', value=cmdutils.Value.cur_tab) -@cmdutils.argument('count', value=cmdutils.Value.count) -def tab_mute(tab, count=None): +def tab_mute(tab): """Mute/Unmute the current/[count]th tab. Args: diff --git a/qutebrowser/components/zoomcommands.py b/qutebrowser/components/zoomcommands.py index 16afa18e2..05d2d8481 100644 --- a/qutebrowser/components/zoomcommands.py +++ b/qutebrowser/components/zoomcommands.py @@ -61,7 +61,7 @@ def zoom_out(tab: apitypes.Tab, count=1, quiet=False): @cmdutils.register() @cmdutils.argument('tab', value=cmdutils.Value.cur_tab) @cmdutils.argument('count', value=cmdutils.Value.count) -def zoom(tab: apitypes.Tab, zoom=None, count=None, quiet=False): +def zoom(tab: apitypes.Tab, level=None, count=None, quiet=False): """Set the zoom level for the current tab. The zoom can be given as argument or as [count]. If neither is @@ -69,19 +69,20 @@ def zoom(tab: apitypes.Tab, zoom=None, count=None, quiet=False): use [count]. Args: - zoom: The zoom percentage to set. + level: The zoom percentage to set. count: The zoom percentage to set. quiet: Don't show a zoom level message. """ - if zoom is not None: + if level is not None: try: - zoom = int(zoom.rstrip('%')) + level = int(level.rstrip('%')) except ValueError: raise cmdutils.CommandError("zoom: Invalid int value {}" - .format(zoom)) + .format(level)) - level = count if count is not None else zoom - if level is None: + if count is not None: + level = count + elif level is None: level = config.val.zoom.default try: diff --git a/qutebrowser/misc/utilcmds.py b/qutebrowser/misc/utilcmds.py index 7c515cb0e..c2b2e6168 100644 --- a/qutebrowser/misc/utilcmds.py +++ b/qutebrowser/misc/utilcmds.py @@ -21,7 +21,6 @@ import functools import os -import signal import traceback from PyQt5.QtCore import QUrl