Merge prev-page/next-page into a navigate command.

This commit is contained in:
Florian Bruhin 2014-09-22 20:57:50 +02:00
parent 42826a2214
commit 51413094bf
2 changed files with 17 additions and 21 deletions

View File

@ -308,28 +308,24 @@ class CommandDispatcher:
self._current_widget().hintmanager.follow_hint()
@cmdutils.register(instance='mainwindow.tabs.cmd')
def prev_page(self, tab=False):
"""Open a "previous" link.
def navigate(self, where : ('prev', 'next'), tab=False):
"""Open typical prev/next links.
This tries to automatically click on typical _Previous Page_ links
using some heuristics.
This tries to automatically click on typical _Previous Page_ or
_Next Page_ links using some heuristics.
Args:
where: What to open.
- `prev`: Open a _previous_ link.
- `next`: Open a _next_ link.
tab: Open in a new tab.
"""
self._prevnext(prev=True, newtab=tab)
@cmdutils.register(instance='mainwindow.tabs.cmd')
def next_page(self, tab=False):
"""Open a "next" link.
This tries to automatically click on typical _Next Page_ links using
some heuristics.
Args:
tab: Open in a new tab.
"""
self._prevnext(prev=False, newtab=tab)
if where == 'prev':
self._prevnext(prev=True, newtab=tab)
elif where == 'next':
self._prevnext(prev=False, newtab=tab)
@cmdutils.register(instance='mainwindow.tabs.cmd', hide=True)
def scroll(self, dx: float, dy: float, count=1):

View File

@ -927,10 +927,10 @@ KEY_DATA = collections.OrderedDict([
('zoom-out', ['-']),
('zoom-in', ['+']),
('zoom', ['=']),
('prev-page', ['[[']),
('next-page', [']]']),
('prev-page -t', ['{{']),
('next-page -t', ['}}']),
('navigate prev', ['[[']),
('navigate next', [']]']),
('navigate prev -t', ['{{']),
('navigate next -t', ['}}']),
('inspector', ['wi']),
('download-page', ['gd']),
('cancel-download', ['ad']),