mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Got empty Downloads looking good
This commit is contained in:
parent
c0e6968b2b
commit
a5b549770a
@ -248,8 +248,15 @@ class Common(object):
|
||||
border-radius: 5px;
|
||||
}""",
|
||||
|
||||
'downloads_uploads': """
|
||||
'downloads_uploads_empty': """
|
||||
QWidget {
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #999999;
|
||||
}
|
||||
QWidget QLabel {
|
||||
background-color: none;
|
||||
border: 0px;
|
||||
}
|
||||
""",
|
||||
|
||||
'downloads_uploads_empty_text': """
|
||||
@ -262,6 +269,8 @@ class Common(object):
|
||||
font-weight: bold;
|
||||
font-size 14px;
|
||||
text-align: center;
|
||||
background-color: none;
|
||||
border: none;
|
||||
}""",
|
||||
|
||||
'downloads_uploads_clear': """
|
||||
|
@ -78,7 +78,7 @@ class Download(object):
|
||||
self.started)
|
||||
|
||||
|
||||
class Downloads(QtWidgets.QScrollArea):
|
||||
class Downloads(QtWidgets.QWidget):
|
||||
"""
|
||||
The downloads chunk of the GUI. This lists all of the active download
|
||||
progress bars.
|
||||
@ -90,11 +90,6 @@ class Downloads(QtWidgets.QScrollArea):
|
||||
self.downloads = {}
|
||||
|
||||
self.setMinimumWidth(350)
|
||||
self.setStyleSheet(self.common.css['downloads_uploads'])
|
||||
|
||||
# Scroll bar
|
||||
self.vbar = self.verticalScrollBar()
|
||||
self.vbar.rangeChanged.connect(self.resizeScroll)
|
||||
|
||||
# When there are no downloads
|
||||
empty_image = QtWidgets.QLabel()
|
||||
@ -109,6 +104,7 @@ class Downloads(QtWidgets.QScrollArea):
|
||||
empty_layout.addWidget(empty_text)
|
||||
empty_layout.addStretch()
|
||||
self.empty = QtWidgets.QWidget()
|
||||
self.empty.setStyleSheet(self.common.css['downloads_uploads_empty'])
|
||||
self.empty.setLayout(empty_layout)
|
||||
|
||||
# When there are downloads
|
||||
@ -122,25 +118,29 @@ class Downloads(QtWidgets.QScrollArea):
|
||||
download_header.addWidget(downloads_label)
|
||||
download_header.addStretch()
|
||||
download_header.addWidget(clear_button)
|
||||
self.not_empty = QtWidgets.QWidget()
|
||||
self.not_empty.setLayout(download_header)
|
||||
|
||||
self.downloads_layout = QtWidgets.QVBoxLayout()
|
||||
not_empty_layout = QtWidgets.QVBoxLayout()
|
||||
not_empty_layout.addLayout(download_header)
|
||||
not_empty_layout.addLayout(self.downloads_layout)
|
||||
self.not_empty = QtWidgets.QWidget()
|
||||
self.not_empty.setLayout(not_empty_layout)
|
||||
|
||||
# Layout
|
||||
self.widget = QtWidgets.QWidget()
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
layout.addWidget(self.empty)
|
||||
layout.addWidget(self.not_empty)
|
||||
layout.addLayout(self.downloads_layout)
|
||||
layout.addStretch()
|
||||
self.widget.setLayout(layout)
|
||||
self.setWidget(self.widget)
|
||||
self.setLayout(layout)
|
||||
|
||||
# Reset once at the beginning
|
||||
self.reset()
|
||||
|
||||
"""
|
||||
# Scroll bar
|
||||
self.vbar = self.verticalScrollBar()
|
||||
self.vbar.rangeChanged.connect(self.resizeScroll)
|
||||
"""
|
||||
|
||||
def resizeEvent(self, event):
|
||||
"""
|
||||
When the widget resizes, resize the inner widget to match
|
||||
@ -152,7 +152,8 @@ class Downloads(QtWidgets.QScrollArea):
|
||||
"""
|
||||
Scroll to the bottom of the window when the range changes.
|
||||
"""
|
||||
self.vbar.setValue(maximum)
|
||||
pass
|
||||
#self.vbar.setValue(maximum)
|
||||
|
||||
def add(self, download_id, total_bytes):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user