-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Display download progress for file downloads
Display a vanilla progress bar for file downloads that simply shows how much of the file has been downloaded so far. A new FileDownloadProgressBar widget replaces the existing animated spinner, and we inject a signal through to the SDK to pass the current progress back to the widget. TODO: * Download speed? * Visual alignment issue; need padding on the right side * tests? Fixes #1104.
- Loading branch information
Showing
9 changed files
with
102 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from PyQt5.QtCore import pyqtSignal | ||
from PyQt5.QtWidgets import QProgressBar | ||
|
||
|
||
class FileDownloadProgressBar(QProgressBar): | ||
""" | ||
A progress bar for file downloads. | ||
Use the signal to increment the progress; see the SDK's ProgressProxy type. | ||
""" | ||
signal = pyqtSignal(int) | ||
|
||
def __init__(self, file_size: int) -> None: | ||
super().__init__() | ||
self.setObjectName("FileDownloadProgressBar") | ||
self.setMaximum(file_size) | ||
self.signal.connect(self.setValue) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from PyQt5.QtCore import pyqtBoundSignal | ||
|
||
|
||
class ProgressProxy: | ||
"""Wraps a PyQt signal and emits it when set_value is called""" | ||
|
||
def __init__(self, inner: pyqtBoundSignal | None) -> None: | ||
self.inner = inner | ||
|
||
def set_value(self, value: int) -> None: | ||
if self.inner: | ||
self.inner.emit(value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.