parent
19a9985f0d
commit
612174ada0
@ -18,6 +18,7 @@
|
|||||||
|<<download-delete,download-delete>>|Delete the last/[count]th download from disk.
|
|<<download-delete,download-delete>>|Delete the last/[count]th download from disk.
|
||||||
|<<download-open,download-open>>|Open the last/[count]th download.
|
|<<download-open,download-open>>|Open the last/[count]th download.
|
||||||
|<<download-remove,download-remove>>|Remove the last/[count]th download from the list.
|
|<<download-remove,download-remove>>|Remove the last/[count]th download from the list.
|
||||||
|
|<<download-retry,download-retry>>|Retry the first failed/[count]th download.
|
||||||
|<<forward,forward>>|Go forward in the history of the current tab.
|
|<<forward,forward>>|Go forward in the history of the current tab.
|
||||||
|<<fullscreen,fullscreen>>|Toggle fullscreen mode.
|
|<<fullscreen,fullscreen>>|Toggle fullscreen mode.
|
||||||
|<<help,help>>|Show help about a command or setting.
|
|<<help,help>>|Show help about a command or setting.
|
||||||
@ -189,6 +190,13 @@ Remove the last/[count]th download from the list.
|
|||||||
==== count
|
==== count
|
||||||
The index of the download to cancel.
|
The index of the download to cancel.
|
||||||
|
|
||||||
|
[[download-retry]]
|
||||||
|
=== download-retry
|
||||||
|
Retry the first failed/[count]th download.
|
||||||
|
|
||||||
|
==== count
|
||||||
|
The index of the download to cancel.
|
||||||
|
|
||||||
[[forward]]
|
[[forward]]
|
||||||
=== forward
|
=== forward
|
||||||
Syntax: +:forward [*--tab*] [*--bg*] [*--window*]+
|
Syntax: +:forward [*--tab*] [*--bg*] [*--window*]+
|
||||||
|
@ -909,6 +909,31 @@ class DownloadManager(QAbstractListModel):
|
|||||||
raise cmdexc.CommandError("Download {} is not done!".format(count))
|
raise cmdexc.CommandError("Download {} is not done!".format(count))
|
||||||
download.open_file()
|
download.open_file()
|
||||||
|
|
||||||
|
@cmdutils.register(instance='download-manager', scope='window',
|
||||||
|
count='count')
|
||||||
|
def download_retry(self, count=0):
|
||||||
|
"""Retry the first failed/[count]th download.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
count: The index of the download to cancel.
|
||||||
|
"""
|
||||||
|
if count:
|
||||||
|
try:
|
||||||
|
download = self.downloads[count - 1]
|
||||||
|
except IndexError:
|
||||||
|
self.raise_no_download(count)
|
||||||
|
if download.successful or not download.done:
|
||||||
|
raise cmdexc.CommandError("Download {} did not fail!".format(
|
||||||
|
count))
|
||||||
|
else:
|
||||||
|
to_retry = [d for d in self.downloads
|
||||||
|
if d.done and not d.successful]
|
||||||
|
if not to_retry:
|
||||||
|
raise cmdexc.CommandError("No failed downloads!")
|
||||||
|
else:
|
||||||
|
download = to_retry[0]
|
||||||
|
download.retry()
|
||||||
|
|
||||||
@pyqtSlot(QNetworkRequest, QNetworkReply)
|
@pyqtSlot(QNetworkRequest, QNetworkReply)
|
||||||
def on_redirect(self, download, request, reply):
|
def on_redirect(self, download, request, reply):
|
||||||
"""Handle a HTTP redirect of a download.
|
"""Handle a HTTP redirect of a download.
|
||||||
|
Loading…
Reference in New Issue
Block a user