Refactor ReceiveMode and Downloads, to push more download-related logic into Downloads

This commit is contained in:
Micah Lee 2018-05-04 16:06:24 -07:00
parent ed28fdf123
commit 30c9f50d2e
No known key found for this signature in database
GPG key ID: 403C2657CD994F73
2 changed files with 20 additions and 25 deletions

View file

@ -131,11 +131,17 @@ class Downloads(QtWidgets.QWidget):
"""
Add a new download progress bar.
"""
# add it to the list
# Hide the no_downloads_label
self.no_downloads_label.hide()
# Add it to the list
download = Download(self.common, download_id, total_bytes)
self.downloads[download_id] = download
self.downloads_layout.addWidget(download.progress_bar)
# Scroll to the bottom
self.downloads_container.vbar.setValue(self.downloads_container.vbar.maximum())
def update_download(self, download_id, downloaded_bytes):
"""
Update the progress of a download progress bar.
@ -156,3 +162,6 @@ class Downloads(QtWidgets.QWidget):
self.downloads_layout.removeWidget(download.progress_bar)
download.progress_bar.close()
self.downloads = {}
self.no_downloads_label.show()
self.downloads_container.resize(self.downloads_container.sizeHint())