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
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)

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

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