Remove various deprecated commands/arguments.
This commit is contained in:
parent
ffc76b2a5c
commit
fcf94fd527
@ -96,6 +96,15 @@ Deprecated
|
|||||||
- `:download <url> <destination>` is now deprecated and
|
- `:download <url> <destination>` is now deprecated and
|
||||||
`:download --dest <destination> <url>` should be used instead.
|
`:download --dest <destination> <url>` should be used instead.
|
||||||
|
|
||||||
|
Removed
|
||||||
|
~~~~~~~
|
||||||
|
|
||||||
|
- `:scroll` with two pixel-arguments (deprecated in v0.3.0)
|
||||||
|
- The `:run-userscript` command (deprecated in v0.2.0)
|
||||||
|
- The `rapid` and `rapid-win` targets for `:hint` (deprecated in v0.2.0)
|
||||||
|
- The `:cancel-download` command (deprecated in v0.2.0)
|
||||||
|
- The `:download-page` command (deprecated in v0.2.0)
|
||||||
|
|
||||||
Fixed
|
Fixed
|
||||||
~~~~~
|
~~~~~
|
||||||
|
|
||||||
|
@ -1136,7 +1136,7 @@ This acts like readline's yank.
|
|||||||
|
|
||||||
[[scroll]]
|
[[scroll]]
|
||||||
=== scroll
|
=== scroll
|
||||||
Syntax: +:scroll 'direction' ['dy']+
|
Syntax: +:scroll 'direction'+
|
||||||
|
|
||||||
Scroll the current tab in the given direction.
|
Scroll the current tab in the given direction.
|
||||||
|
|
||||||
|
@ -508,32 +508,14 @@ class CommandDispatcher:
|
|||||||
|
|
||||||
@cmdutils.register(instance='command-dispatcher', hide=True,
|
@cmdutils.register(instance='command-dispatcher', hide=True,
|
||||||
scope='window', count='count')
|
scope='window', count='count')
|
||||||
def scroll(self,
|
def scroll(self, direction: {'type': (str, int)}, count=1):
|
||||||
direction: {'type': (str, int)},
|
|
||||||
dy: {'type': int, 'hide': True}=None,
|
|
||||||
count=1):
|
|
||||||
"""Scroll the current tab in the given direction.
|
"""Scroll the current tab in the given direction.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
direction: In which direction to scroll
|
direction: In which direction to scroll
|
||||||
(up/down/left/right/top/bottom).
|
(up/down/left/right/top/bottom).
|
||||||
dy: Deprecated argument to support the old dx/dy form.
|
|
||||||
count: multiplier
|
count: multiplier
|
||||||
"""
|
"""
|
||||||
# pylint: disable=too-many-locals
|
|
||||||
try:
|
|
||||||
# Check for deprecated dx/dy form (like with scroll-px).
|
|
||||||
dx = int(direction)
|
|
||||||
dy = int(dy)
|
|
||||||
except (ValueError, TypeError):
|
|
||||||
# Invalid values will get handled later.
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
message.warning(self._win_id, ":scroll with dx/dy arguments is "
|
|
||||||
"deprecated - use :scroll-px instead!")
|
|
||||||
self.scroll_px(dx, dy, count=count)
|
|
||||||
return
|
|
||||||
|
|
||||||
fake_keys = {
|
fake_keys = {
|
||||||
'up': Qt.Key_Up,
|
'up': Qt.Key_Up,
|
||||||
'down': Qt.Key_Down,
|
'down': Qt.Key_Down,
|
||||||
@ -953,7 +935,7 @@ class CommandDispatcher:
|
|||||||
cmd, args, userscript))
|
cmd, args, userscript))
|
||||||
if userscript:
|
if userscript:
|
||||||
# ~ expansion is handled by the userscript module.
|
# ~ expansion is handled by the userscript module.
|
||||||
self.run_userscript(cmd, *args, verbose=verbose)
|
self._run_userscript(cmd, *args, verbose=verbose)
|
||||||
else:
|
else:
|
||||||
cmd = os.path.expanduser(cmd)
|
cmd = os.path.expanduser(cmd)
|
||||||
proc = guiprocess.GUIProcess(self._win_id, what='command',
|
proc = guiprocess.GUIProcess(self._win_id, what='command',
|
||||||
@ -969,9 +951,7 @@ class CommandDispatcher:
|
|||||||
"""Open main startpage in current tab."""
|
"""Open main startpage in current tab."""
|
||||||
self.openurl(config.get('general', 'startpage')[0])
|
self.openurl(config.get('general', 'startpage')[0])
|
||||||
|
|
||||||
@cmdutils.register(instance='command-dispatcher', scope='window',
|
def _run_userscript(self, cmd, *args, verbose=False):
|
||||||
deprecated='Use :spawn --userscript instead!')
|
|
||||||
def run_userscript(self, cmd, *args: {'nargs': '*'}, verbose=False):
|
|
||||||
"""Run a userscript given as argument.
|
"""Run a userscript given as argument.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -1184,12 +1164,6 @@ class CommandDispatcher:
|
|||||||
else:
|
else:
|
||||||
mhtml.start_download_checked(dest, web_view=web_view)
|
mhtml.start_download_checked(dest, web_view=web_view)
|
||||||
|
|
||||||
@cmdutils.register(instance='command-dispatcher', scope='window',
|
|
||||||
deprecated="Use :download instead.")
|
|
||||||
def download_page(self):
|
|
||||||
"""Download the current page."""
|
|
||||||
self.download()
|
|
||||||
|
|
||||||
@cmdutils.register(instance='command-dispatcher', scope='window')
|
@cmdutils.register(instance='command-dispatcher', scope='window')
|
||||||
def view_source(self):
|
def view_source(self):
|
||||||
"""Show the source of the current page."""
|
"""Show the source of the current page."""
|
||||||
|
@ -947,17 +947,6 @@ class DownloadManager(QAbstractListModel):
|
|||||||
download.delete()
|
download.delete()
|
||||||
self.remove_item(download)
|
self.remove_item(download)
|
||||||
|
|
||||||
@cmdutils.register(instance='download-manager', scope='window',
|
|
||||||
deprecated="Use :download-cancel instead.",
|
|
||||||
count='count')
|
|
||||||
def cancel_download(self, count=1):
|
|
||||||
"""Cancel the first/[count]th download.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
count: The index of the download to cancel.
|
|
||||||
"""
|
|
||||||
self.download_cancel(count)
|
|
||||||
|
|
||||||
@cmdutils.register(instance='download-manager', scope='window',
|
@cmdutils.register(instance='download-manager', scope='window',
|
||||||
count='count')
|
count='count')
|
||||||
def download_open(self, count=0):
|
def download_open(self, count=0):
|
||||||
|
@ -43,8 +43,8 @@ ElemTuple = collections.namedtuple('ElemTuple', ['elem', 'label'])
|
|||||||
|
|
||||||
Target = usertypes.enum('Target', ['normal', 'tab', 'tab_fg', 'tab_bg',
|
Target = usertypes.enum('Target', ['normal', 'tab', 'tab_fg', 'tab_bg',
|
||||||
'window', 'yank', 'yank_primary', 'run',
|
'window', 'yank', 'yank_primary', 'run',
|
||||||
'fill', 'hover', 'rapid', 'rapid_win',
|
'fill', 'hover', 'download', 'userscript',
|
||||||
'download', 'userscript', 'spawn'])
|
'spawn'])
|
||||||
|
|
||||||
|
|
||||||
@pyqtSlot(usertypes.KeyMode)
|
@pyqtSlot(usertypes.KeyMode)
|
||||||
@ -69,7 +69,6 @@ class HintContext:
|
|||||||
yank/yank_primary: Yank to clipboard/primary selection.
|
yank/yank_primary: Yank to clipboard/primary selection.
|
||||||
run: Run a command.
|
run: Run a command.
|
||||||
fill: Fill commandline with link.
|
fill: Fill commandline with link.
|
||||||
rapid: Rapid mode with background tabs
|
|
||||||
download: Download the link.
|
download: Download the link.
|
||||||
userscript: Call a custom userscript.
|
userscript: Call a custom userscript.
|
||||||
spawn: Spawn a simple command.
|
spawn: Spawn a simple command.
|
||||||
@ -415,8 +414,6 @@ class HintManager(QObject):
|
|||||||
context: The HintContext to use.
|
context: The HintContext to use.
|
||||||
"""
|
"""
|
||||||
target_mapping = {
|
target_mapping = {
|
||||||
Target.rapid: usertypes.ClickTarget.tab_bg,
|
|
||||||
Target.rapid_win: usertypes.ClickTarget.window,
|
|
||||||
Target.normal: usertypes.ClickTarget.normal,
|
Target.normal: usertypes.ClickTarget.normal,
|
||||||
Target.tab_fg: usertypes.ClickTarget.tab,
|
Target.tab_fg: usertypes.ClickTarget.tab,
|
||||||
Target.tab_bg: usertypes.ClickTarget.tab_bg,
|
Target.tab_bg: usertypes.ClickTarget.tab_bg,
|
||||||
@ -437,7 +434,7 @@ class HintManager(QObject):
|
|||||||
action, elem, pos.x(), pos.y()))
|
action, elem, pos.x(), pos.y()))
|
||||||
self.start_hinting.emit(target_mapping[context.target])
|
self.start_hinting.emit(target_mapping[context.target])
|
||||||
if context.target in [Target.tab, Target.tab_fg, Target.tab_bg,
|
if context.target in [Target.tab, Target.tab_fg, Target.tab_bg,
|
||||||
Target.window, Target.rapid, Target.rapid_win]:
|
Target.window]:
|
||||||
modifiers = Qt.ControlModifier
|
modifiers = Qt.ControlModifier
|
||||||
else:
|
else:
|
||||||
modifiers = Qt.NoModifier
|
modifiers = Qt.NoModifier
|
||||||
@ -802,7 +799,6 @@ class HintManager(QObject):
|
|||||||
self._context.args = args
|
self._context.args = args
|
||||||
self._context.mainframe = mainframe
|
self._context.mainframe = mainframe
|
||||||
self._context.group = group
|
self._context.group = group
|
||||||
self._handle_old_rapid_targets(win_id)
|
|
||||||
self._init_elements()
|
self._init_elements()
|
||||||
message_bridge = objreg.get('message-bridge', scope='window',
|
message_bridge = objreg.get('message-bridge', scope='window',
|
||||||
window=self._win_id)
|
window=self._win_id)
|
||||||
@ -811,29 +807,6 @@ class HintManager(QObject):
|
|||||||
modeman.enter(self._win_id, usertypes.KeyMode.hint,
|
modeman.enter(self._win_id, usertypes.KeyMode.hint,
|
||||||
'HintManager.start')
|
'HintManager.start')
|
||||||
|
|
||||||
def _handle_old_rapid_targets(self, win_id):
|
|
||||||
"""Switch to the new way for rapid hinting with a rapid target.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
win_id: The window ID to display the warning in.
|
|
||||||
|
|
||||||
DEPRECATED.
|
|
||||||
"""
|
|
||||||
old_rapid_targets = {
|
|
||||||
Target.rapid: Target.tab_bg,
|
|
||||||
Target.rapid_win: Target.window,
|
|
||||||
}
|
|
||||||
target = self._context.target
|
|
||||||
if target in old_rapid_targets:
|
|
||||||
self._context.target = old_rapid_targets[target]
|
|
||||||
self._context.rapid = True
|
|
||||||
name = target.name.replace('_', '-')
|
|
||||||
group_name = self._context.group.name.replace('_', '-')
|
|
||||||
new_name = self._context.target.name.replace('_', '-')
|
|
||||||
message.warning(
|
|
||||||
win_id, ':hint with target {} is deprecated, use :hint '
|
|
||||||
'--rapid {} {} instead!'.format(name, group_name, new_name))
|
|
||||||
|
|
||||||
def handle_partial_key(self, keystr):
|
def handle_partial_key(self, keystr):
|
||||||
"""Handle a new partial keypress."""
|
"""Handle a new partial keypress."""
|
||||||
log.hints.debug("Handling new keystring: '{}'".format(keystr))
|
log.hints.debug("Handling new keystring: '{}'".format(keystr))
|
||||||
|
@ -95,16 +95,6 @@ Feature: Scrolling
|
|||||||
Then the error "Invalid value 'foobar' for direction - expected one of: bottom, down, left, page-down, page-up, right, top, up" should be shown
|
Then the error "Invalid value 'foobar' for direction - expected one of: bottom, down, left, page-down, page-up, right, top, up" should be shown
|
||||||
And the page should not be scrolled
|
And the page should not be scrolled
|
||||||
|
|
||||||
Scenario: :scroll with deprecated pixel argument
|
|
||||||
When I run :scroll 0 10
|
|
||||||
Then the warning ":scroll with dx/dy arguments is deprecated - use :scroll-px instead!" should be shown
|
|
||||||
Then the page should be scrolled vertically
|
|
||||||
|
|
||||||
Scenario: :scroll with deprecated pixel argument (float)
|
|
||||||
When I run :scroll 2.5 2.5
|
|
||||||
Then the error "scroll: Argument dy: invalid int value: '2.5'" should be shown
|
|
||||||
And the page should not be scrolled
|
|
||||||
|
|
||||||
Scenario: Scrolling down and up with count
|
Scenario: Scrolling down and up with count
|
||||||
When I run :scroll down with count 2
|
When I run :scroll down with count 2
|
||||||
And I run :scroll up
|
And I run :scroll up
|
||||||
|
Loading…
Reference in New Issue
Block a user