Some style fixes.

This commit is contained in:
Joel Torstensson 2015-02-09 12:06:49 +01:00
parent 6bbb655a54
commit 767ca42e46
2 changed files with 19 additions and 3 deletions

View File

@ -912,7 +912,7 @@ class CommandDispatcher:
@cmdutils.register(instance='command-dispatcher', scope='window')
def download(self, url=None, dest=None):
"""Download a given URL, or current page if none given.
"""Download a given URL, or current page if no URL given.
Args:
url: The URL to download, or None to download current page.
@ -920,7 +920,7 @@ class CommandDispatcher:
"""
download_manager = objreg.get('download-manager', scope='window',
window=self._win_id)
if (url):
if url:
url = urlutils.qurl_from_user_input(url)
urlutils.raise_cmdexc_if_invalid(url)
download_manager.get(url, filename=dest)
@ -928,6 +928,12 @@ class CommandDispatcher:
page = self._current_widget().page()
download_manager.get(self._current_url(), page)
@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')
def view_source(self):
"""Show the source of the current page."""

View File

@ -745,6 +745,16 @@ class DownloadManager(QAbstractListModel):
raise cmdexc.CommandError("There's no download {}!".format(count))
download.cancel()
@cmdutils.register(instance='download-manager', scope='window',
deprecated="Use :download instead.")
def cancel_download(self, count: {'special': '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')
def download_open(self, count: {'special': 'count'}=0):
"""Open the last/[count]th download.