mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-27 00:09:50 -05:00
Fix the auto-scrolling to bottom of Download and Upload windows
This commit is contained in:
parent
06f90b91ce
commit
d54b52691c
@ -227,6 +227,7 @@ class Uploads(QtWidgets.QScrollArea):
|
||||
self.setWindowIcon(QtGui.QIcon(common.get_resource_path('images/logo.png')))
|
||||
self.setWindowFlags(QtCore.Qt.Sheet | QtCore.Qt.WindowTitleHint | QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.CustomizeWindowHint)
|
||||
self.vbar = self.verticalScrollBar()
|
||||
self.vbar.rangeChanged.connect(self.resizeScroll)
|
||||
|
||||
uploads_label = QtWidgets.QLabel(strings._('gui_uploads', True))
|
||||
uploads_label.setStyleSheet(self.common.css['downloads_uploads_label'])
|
||||
@ -243,6 +244,12 @@ class Uploads(QtWidgets.QScrollArea):
|
||||
widget.setLayout(layout)
|
||||
self.setWidget(widget)
|
||||
|
||||
def resizeScroll(self, minimum, maximum):
|
||||
"""
|
||||
Scroll to the bottom of the window when the range changes.
|
||||
"""
|
||||
self.vbar.setValue(maximum)
|
||||
|
||||
def add(self, upload_id, content_length):
|
||||
"""
|
||||
Add a new upload.
|
||||
@ -256,9 +263,6 @@ class Uploads(QtWidgets.QScrollArea):
|
||||
self.uploads[upload_id] = upload
|
||||
self.uploads_layout.addWidget(upload)
|
||||
|
||||
# Scroll to the bottom
|
||||
self.vbar.setValue(self.vbar.maximum())
|
||||
|
||||
def update(self, upload_id, progress):
|
||||
"""
|
||||
Update the progress of an upload.
|
||||
|
@ -97,6 +97,7 @@ class Downloads(QtWidgets.QScrollArea):
|
||||
self.setWindowIcon(QtGui.QIcon(common.get_resource_path('images/logo.png')))
|
||||
self.setWindowFlags(QtCore.Qt.Sheet | QtCore.Qt.WindowTitleHint | QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.CustomizeWindowHint)
|
||||
self.vbar = self.verticalScrollBar()
|
||||
self.vbar.rangeChanged.connect(self.resizeScroll)
|
||||
|
||||
downloads_label = QtWidgets.QLabel(strings._('gui_downloads', True))
|
||||
downloads_label.setStyleSheet(self.common.css['downloads_uploads_label'])
|
||||
@ -113,6 +114,12 @@ class Downloads(QtWidgets.QScrollArea):
|
||||
widget.setLayout(layout)
|
||||
self.setWidget(widget)
|
||||
|
||||
def resizeScroll(self, minimum, maximum):
|
||||
"""
|
||||
Scroll to the bottom of the window when the range changes.
|
||||
"""
|
||||
self.vbar.setValue(maximum)
|
||||
|
||||
def add(self, download_id, total_bytes):
|
||||
"""
|
||||
Add a new download progress bar.
|
||||
@ -125,9 +132,6 @@ class Downloads(QtWidgets.QScrollArea):
|
||||
self.downloads[download_id] = download
|
||||
self.downloads_layout.addWidget(download.progress_bar)
|
||||
|
||||
# Scroll to the bottom
|
||||
self.vbar.setValue(self.vbar.maximum())
|
||||
|
||||
def update(self, download_id, downloaded_bytes):
|
||||
"""
|
||||
Update the progress of a download progress bar.
|
||||
|
Loading…
Reference in New Issue
Block a user