This commit is contained in:
Florian Bruhin 2018-11-30 16:25:19 +01:00
parent 40d376fbcf
commit 34aaca2aa0
5 changed files with 19 additions and 21 deletions

View File

@ -21,6 +21,9 @@
import typing 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) val = typing.cast('config.ConfigContainer', None)

View File

@ -218,7 +218,7 @@ class HintActions:
if context.target in [Target.normal, Target.current]: if context.target in [Target.normal, Target.current]:
# Set the pre-jump mark ', so we can jump back here after following # 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: try:
if context.target == Target.hover: if context.target == Target.hover:

View File

@ -22,7 +22,6 @@
import os import os
import signal import signal
import functools import functools
import typing
import logging import logging
try: try:
@ -30,16 +29,15 @@ try:
except ImportError: except ImportError:
hunter = None hunter = None
from qutebrowser.api import cmdutils, apitypes, message, config
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
from PyQt5.QtPrintSupport import QPrintPreviewDialog from PyQt5.QtPrintSupport import QPrintPreviewDialog
from qutebrowser.api import cmdutils, apitypes, message, config
@cmdutils.register(name='reload') @cmdutils.register(name='reload')
@cmdutils.argument('count', value=cmdutils.Value.count)
@cmdutils.argument('tab', value=cmdutils.Value.count_tab) @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. """Reload the current/[count]th tab.
Args: Args:
@ -51,9 +49,8 @@ def reloadpage(tab, force=False, count=None):
@cmdutils.register() @cmdutils.register()
@cmdutils.argument('count', value=cmdutils.Value.count)
@cmdutils.argument('tab', value=cmdutils.Value.count_tab) @cmdutils.argument('tab', value=cmdutils.Value.count_tab)
def stop(tab, count=None): def stop(tab):
"""Stop loading in the current/[count]th tab. """Stop loading in the current/[count]th tab.
Args: Args:
@ -92,9 +89,8 @@ def _print_pdf(tab, filename):
@cmdutils.register(name='print') @cmdutils.register(name='print')
@cmdutils.argument('tab', value=cmdutils.Value.count_tab) @cmdutils.argument('tab', value=cmdutils.Value.count_tab)
@cmdutils.argument('count', value=cmdutils.Value.count)
@cmdutils.argument('pdf', flag='f', metavar='file') @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. """Print the current/[count]th tab.
Args: Args:
@ -228,8 +224,7 @@ def debug_webaction(tab, action, count=1):
@cmdutils.register() @cmdutils.register()
@cmdutils.argument('tab', value=cmdutils.Value.cur_tab) @cmdutils.argument('tab', value=cmdutils.Value.cur_tab)
@cmdutils.argument('count', value=cmdutils.Value.count) def tab_mute(tab):
def tab_mute(tab, count=None):
"""Mute/Unmute the current/[count]th tab. """Mute/Unmute the current/[count]th tab.
Args: Args:

View File

@ -61,7 +61,7 @@ def zoom_out(tab: apitypes.Tab, count=1, quiet=False):
@cmdutils.register() @cmdutils.register()
@cmdutils.argument('tab', value=cmdutils.Value.cur_tab) @cmdutils.argument('tab', value=cmdutils.Value.cur_tab)
@cmdutils.argument('count', value=cmdutils.Value.count) @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. """Set the zoom level for the current tab.
The zoom can be given as argument or as [count]. If neither is 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]. use [count].
Args: Args:
zoom: The zoom percentage to set. level: The zoom percentage to set.
count: The zoom percentage to set. count: The zoom percentage to set.
quiet: Don't show a zoom level message. quiet: Don't show a zoom level message.
""" """
if zoom is not None: if level is not None:
try: try:
zoom = int(zoom.rstrip('%')) level = int(level.rstrip('%'))
except ValueError: except ValueError:
raise cmdutils.CommandError("zoom: Invalid int value {}" raise cmdutils.CommandError("zoom: Invalid int value {}"
.format(zoom)) .format(level))
level = count if count is not None else zoom if count is not None:
if level is None: level = count
elif level is None:
level = config.val.zoom.default level = config.val.zoom.default
try: try:

View File

@ -21,7 +21,6 @@
import functools import functools
import os import os
import signal
import traceback import traceback
from PyQt5.QtCore import QUrl from PyQt5.QtCore import QUrl