[Pkg-privacy-commits] [onionshare] 26/256: Hide downloads progress bars until download starts, and improve the look of progress bar display
Ulrike Uhlig
ulrike at moszumanska.debian.org
Fri May 26 12:53:05 UTC 2017
This is an automated email from the git hooks/post-receive script.
ulrike pushed a commit to branch master
in repository onionshare.
commit 4bafd1eb2a799103f0be9c535e714141b060358b
Author: Micah Lee <micah at micahflee.com>
Date: Thu Dec 22 15:15:37 2016 -0800
Hide downloads progress bars until download starts, and improve the look of progress bar display
---
onionshare_gui/downloads.py | 16 +++++-----------
onionshare_gui/onionshare_gui.py | 22 +++++++++++-----------
2 files changed, 16 insertions(+), 22 deletions(-)
diff --git a/onionshare_gui/downloads.py b/onionshare_gui/downloads.py
index 7729f8c..1c54ab5 100644
--- a/onionshare_gui/downloads.py
+++ b/onionshare_gui/downloads.py
@@ -77,33 +77,27 @@ class Download(object):
self.started)
-class Downloads(QtWidgets.QVBoxLayout):
+class Downloads(QtWidgets.QWidget):
"""
The downloads chunk of the GUI. This lists all of the active download
progress bars.
"""
def __init__(self):
super(Downloads, self).__init__()
-
self.downloads = {}
-
- # downloads label
- self.downloads_label = QtWidgets.QLabel(strings._('gui_downloads', True))
- self.downloads_label.hide()
-
- # add the widgets
- self.addWidget(self.downloads_label)
+ self.layout = QtWidgets.QVBoxLayout()
+ self.setLayout(self.layout)
def add_download(self, download_id, total_bytes):
"""
Add a new download progress bar.
"""
- self.downloads_label.show()
+ self.parent().show()
# add it to the list
download = Download(download_id, total_bytes)
self.downloads[download_id] = download
- self.insertWidget(-1, download.progress_bar)
+ self.layout.insertWidget(-1, download.progress_bar)
def update_download(self, download_id, downloaded_bytes):
"""
diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py
index 2f86632..8a738d2 100644
--- a/onionshare_gui/onionshare_gui.py
+++ b/onionshare_gui/onionshare_gui.py
@@ -102,13 +102,12 @@ class OnionShareGui(QtWidgets.QMainWindow):
# downloads
self.downloads = Downloads()
- self.downloads_layout = QtWidgets.QGroupBox()
- self.downloads_layout.setLayout(self.downloads)
- self.downloads_layout_container = QtWidgets.QScrollArea()
- self.downloads_layout_container.setWidget(self.downloads_layout)
- self.downloads_layout_container.setWidgetResizable(True)
- self.downloads_layout_container.setFixedHeight(80)
- self.vbar = self.downloads_layout_container.verticalScrollBar()
+ self.downloads_container = QtWidgets.QScrollArea()
+ self.downloads_container.setWidget(self.downloads)
+ self.downloads_container.setWidgetResizable(True)
+ self.downloads_container.setMaximumHeight(200)
+ self.vbar = self.downloads_container.verticalScrollBar()
+ self.downloads_container.hide() # downloads start out hidden
self.new_download = False
# options
@@ -120,14 +119,14 @@ class OnionShareGui(QtWidgets.QMainWindow):
version_label = QtWidgets.QLabel('v{0:s}'.format(helpers.get_version()))
version_label.setStyleSheet('color: #666666; padding: 0 10px;')
self.status_bar.addPermanentWidget(version_label)
- self.setStatusBar(self.status_bar)
+ self.setStatusBar(self.status_bar)
# main layout
self.layout = QtWidgets.QVBoxLayout()
self.layout.addLayout(self.file_selection)
self.layout.addLayout(self.server_status)
self.layout.addWidget(self.filesize_warning)
- self.layout.addWidget(self.downloads_layout_container)
+ self.layout.addWidget(self.downloads_container)
self.layout.addLayout(self.options)
central_widget = QtWidgets.QWidget()
central_widget.setLayout(self.layout)
@@ -229,7 +228,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
def check_for_requests(self):
"""
Check for messages communicated from the web app, and update the GUI accordingly.
- """
+ """
self.update()
# scroll to the bottom of the dl progress bar log pane
# if a new download has been added
@@ -255,6 +254,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.status_bar.showMessage(strings._('download_page_loaded', True))
elif event["type"] == web.REQUEST_DOWNLOAD:
+ self.downloads_container.show() # show the downloads layout
self.downloads.add_download(event["data"]["id"], web.zip_filesize)
self.new_download = True
@@ -264,7 +264,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
elif event["type"] == web.REQUEST_PROGRESS:
self.downloads.update_download(event["data"]["id"], event["data"]["bytes"])
-
+
# is the download complete?
if event["data"]["bytes"] == web.zip_filesize:
# close on finish?
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/onionshare.git
More information about the Pkg-privacy-commits
mailing list