mirror of
https://github.com/onionshare/onionshare.git
synced 2025-06-21 13:04:36 -04:00
Got empty Downloads looking good
This commit is contained in:
parent
481bc8bdc1
commit
9390a0d199
2 changed files with 27 additions and 17 deletions
|
@ -248,8 +248,15 @@ class Common(object):
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}""",
|
}""",
|
||||||
|
|
||||||
'downloads_uploads': """
|
'downloads_uploads_empty': """
|
||||||
background-color: #ffffff;
|
QWidget {
|
||||||
|
background-color: #ffffff;
|
||||||
|
border: 1px solid #999999;
|
||||||
|
}
|
||||||
|
QWidget QLabel {
|
||||||
|
background-color: none;
|
||||||
|
border: 0px;
|
||||||
|
}
|
||||||
""",
|
""",
|
||||||
|
|
||||||
'downloads_uploads_empty_text': """
|
'downloads_uploads_empty_text': """
|
||||||
|
@ -262,6 +269,8 @@ class Common(object):
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size 14px;
|
font-size 14px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
background-color: none;
|
||||||
|
border: none;
|
||||||
}""",
|
}""",
|
||||||
|
|
||||||
'downloads_uploads_clear': """
|
'downloads_uploads_clear': """
|
||||||
|
|
|
@ -78,7 +78,7 @@ class Download(object):
|
||||||
self.started)
|
self.started)
|
||||||
|
|
||||||
|
|
||||||
class Downloads(QtWidgets.QScrollArea):
|
class Downloads(QtWidgets.QWidget):
|
||||||
"""
|
"""
|
||||||
The downloads chunk of the GUI. This lists all of the active download
|
The downloads chunk of the GUI. This lists all of the active download
|
||||||
progress bars.
|
progress bars.
|
||||||
|
@ -90,11 +90,6 @@ class Downloads(QtWidgets.QScrollArea):
|
||||||
self.downloads = {}
|
self.downloads = {}
|
||||||
|
|
||||||
self.setMinimumWidth(350)
|
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
|
# When there are no downloads
|
||||||
empty_image = QtWidgets.QLabel()
|
empty_image = QtWidgets.QLabel()
|
||||||
|
@ -109,6 +104,7 @@ class Downloads(QtWidgets.QScrollArea):
|
||||||
empty_layout.addWidget(empty_text)
|
empty_layout.addWidget(empty_text)
|
||||||
empty_layout.addStretch()
|
empty_layout.addStretch()
|
||||||
self.empty = QtWidgets.QWidget()
|
self.empty = QtWidgets.QWidget()
|
||||||
|
self.empty.setStyleSheet(self.common.css['downloads_uploads_empty'])
|
||||||
self.empty.setLayout(empty_layout)
|
self.empty.setLayout(empty_layout)
|
||||||
|
|
||||||
# When there are downloads
|
# When there are downloads
|
||||||
|
@ -122,25 +118,29 @@ class Downloads(QtWidgets.QScrollArea):
|
||||||
download_header.addWidget(downloads_label)
|
download_header.addWidget(downloads_label)
|
||||||
download_header.addStretch()
|
download_header.addStretch()
|
||||||
download_header.addWidget(clear_button)
|
download_header.addWidget(clear_button)
|
||||||
self.not_empty = QtWidgets.QWidget()
|
|
||||||
self.not_empty.setLayout(download_header)
|
|
||||||
|
|
||||||
self.downloads_layout = QtWidgets.QVBoxLayout()
|
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
|
# Layout
|
||||||
self.widget = QtWidgets.QWidget()
|
|
||||||
layout = QtWidgets.QVBoxLayout()
|
layout = QtWidgets.QVBoxLayout()
|
||||||
layout.setContentsMargins(0, 0, 0, 0)
|
layout.setContentsMargins(0, 0, 0, 0)
|
||||||
layout.addWidget(self.empty)
|
layout.addWidget(self.empty)
|
||||||
layout.addWidget(self.not_empty)
|
layout.addWidget(self.not_empty)
|
||||||
layout.addLayout(self.downloads_layout)
|
self.setLayout(layout)
|
||||||
layout.addStretch()
|
|
||||||
self.widget.setLayout(layout)
|
|
||||||
self.setWidget(self.widget)
|
|
||||||
|
|
||||||
# Reset once at the beginning
|
# Reset once at the beginning
|
||||||
self.reset()
|
self.reset()
|
||||||
|
|
||||||
|
"""
|
||||||
|
# Scroll bar
|
||||||
|
self.vbar = self.verticalScrollBar()
|
||||||
|
self.vbar.rangeChanged.connect(self.resizeScroll)
|
||||||
|
"""
|
||||||
|
|
||||||
def resizeEvent(self, event):
|
def resizeEvent(self, event):
|
||||||
"""
|
"""
|
||||||
When the widget resizes, resize the inner widget to match
|
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.
|
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):
|
def add(self, download_id, total_bytes):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue