Decorate DownloadItem slots with @pyqtSlot.
Before, using the right-click menu to cancel the download didn't actually cancel it, as the QAction.toggled signal was emitted with checked=False which got interpreted as remove_data=False.
This commit is contained in:
parent
c5a2039da4
commit
94434ea739
@ -341,6 +341,7 @@ class DownloadItem(QObject):
|
|||||||
return utils.interpolate_color(
|
return utils.interpolate_color(
|
||||||
start, stop, self.stats.percentage(), system)
|
start, stop, self.stats.percentage(), system)
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
def cancel(self, remove_data=True):
|
def cancel(self, remove_data=True):
|
||||||
"""Cancel the download.
|
"""Cancel the download.
|
||||||
|
|
||||||
@ -363,6 +364,7 @@ class DownloadItem(QObject):
|
|||||||
self.finished.emit()
|
self.finished.emit()
|
||||||
self.data_changed.emit()
|
self.data_changed.emit()
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
def delete(self):
|
def delete(self):
|
||||||
"""Delete the downloaded file"""
|
"""Delete the downloaded file"""
|
||||||
try:
|
try:
|
||||||
@ -371,12 +373,14 @@ class DownloadItem(QObject):
|
|||||||
except OSError:
|
except OSError:
|
||||||
log.downloads.exception("Failed to remove partial file")
|
log.downloads.exception("Failed to remove partial file")
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
def retry(self):
|
def retry(self):
|
||||||
"""Retry a failed download."""
|
"""Retry a failed download."""
|
||||||
self.cancel()
|
self.cancel()
|
||||||
new_reply = self.retry_info.manager.get(self.retry_info.request)
|
new_reply = self.retry_info.manager.get(self.retry_info.request)
|
||||||
self.do_retry.emit(new_reply)
|
self.do_retry.emit(new_reply)
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
def open_file(self):
|
def open_file(self):
|
||||||
"""Open the downloaded file."""
|
"""Open the downloaded file."""
|
||||||
assert self.successful
|
assert self.successful
|
||||||
|
Loading…
Reference in New Issue
Block a user