Fix speed calculation if downloadProgress hasn't been called yet.
This commit is contained in:
parent
22a0639825
commit
905eb9056d
@ -133,7 +133,11 @@ class DownloadItem(QObject):
|
|||||||
def update_speed(self):
|
def update_speed(self):
|
||||||
"""Recalculate the current download speed."""
|
"""Recalculate the current download speed."""
|
||||||
if self._last_done is None:
|
if self._last_done is None:
|
||||||
|
if self.bytes_done is None:
|
||||||
|
self.speed = 0
|
||||||
|
else:
|
||||||
delta = self.bytes_done
|
delta = self.bytes_done
|
||||||
|
self.speed = delta * 1000 / self.REFRESH_INTERVAL
|
||||||
else:
|
else:
|
||||||
delta = self.bytes_done - self._last_done
|
delta = self.bytes_done - self._last_done
|
||||||
self.speed = delta * 1000 / self.REFRESH_INTERVAL
|
self.speed = delta * 1000 / self.REFRESH_INTERVAL
|
||||||
|
Loading…
Reference in New Issue
Block a user