Add a stretch at the bottom of the downloads window, so that progess bars are always lined up at the top

This commit is contained in:
Micah Lee 2018-04-22 15:25:28 -07:00
parent 359bd59828
commit 16eab5e850
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73

View File

@ -114,9 +114,13 @@ class Downloads(QtWidgets.QWidget):
self.downloads_label.setStyleSheet('QLabel { font-weight: bold; font-size 14px; text-align: center; }')
self.no_downloads_label = QtWidgets.QLabel(strings._('gui_no_downloads', True))
self.downloads_layout = QtWidgets.QVBoxLayout()
self.layout = QtWidgets.QVBoxLayout()
self.layout.addWidget(self.downloads_label)
self.layout.addWidget(self.no_downloads_label)
self.layout.addLayout(self.downloads_layout)
self.layout.addStretch()
self.setLayout(self.layout)
def add_download(self, download_id, total_bytes):
@ -126,7 +130,7 @@ class Downloads(QtWidgets.QWidget):
# add it to the list
download = Download(download_id, total_bytes)
self.downloads[download_id] = download
self.layout.addWidget(download.progress_bar)
self.downloads_layout.addWidget(download.progress_bar)
def update_download(self, download_id, downloaded_bytes):
"""
@ -145,6 +149,6 @@ class Downloads(QtWidgets.QWidget):
Reset the downloads back to zero
"""
for download in self.downloads.values():
self.layout.removeWidget(download.progress_bar)
self.downloads_layout.removeWidget(download.progress_bar)
download.progress_bar.close()
self.downloads = {}