mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-25 18:52:58 -03:00
Style a prettier progress bar
This commit is contained in:
parent
d25c6d949f
commit
acf453e094
2 changed files with 24 additions and 5 deletions
|
@ -32,14 +32,24 @@ class Download(object):
|
||||||
self.downloaded_bytes = 0
|
self.downloaded_bytes = 0
|
||||||
|
|
||||||
# make a new progress bar
|
# make a new progress bar
|
||||||
|
cssStyleData ="""
|
||||||
|
QProgressBar {
|
||||||
|
border: 2px solid grey;
|
||||||
|
border-radius: 5px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
QProgressBar::chunk {
|
||||||
|
background: qlineargradient(x1: 0.5, y1: 0, x2: 0.5, y2: 1, stop: 0 #b366ff, stop: 1 #d9b3ff);
|
||||||
|
width: 10px;
|
||||||
|
}"""
|
||||||
self.progress_bar = QtWidgets.QProgressBar()
|
self.progress_bar = QtWidgets.QProgressBar()
|
||||||
self.progress_bar.setTextVisible(True)
|
self.progress_bar.setTextVisible(True)
|
||||||
self.progress_bar.setAlignment(QtCore.Qt.AlignHCenter)
|
self.progress_bar.setAlignment(QtCore.Qt.AlignHCenter)
|
||||||
self.progress_bar.setMinimum(0)
|
self.progress_bar.setMinimum(0)
|
||||||
self.progress_bar.setMaximum(total_bytes)
|
self.progress_bar.setMaximum(total_bytes)
|
||||||
self.progress_bar.setValue(0)
|
self.progress_bar.setValue(0)
|
||||||
self.progress_bar.setStyleSheet(
|
self.progress_bar.setStyleSheet(cssStyleData)
|
||||||
"QProgressBar::chunk { background-color: #05B8CC; }")
|
|
||||||
self.progress_bar.total_bytes = total_bytes
|
self.progress_bar.total_bytes = total_bytes
|
||||||
|
|
||||||
# start at 0
|
# start at 0
|
||||||
|
|
|
@ -471,9 +471,18 @@ class ZipProgressBar(QtWidgets.QProgressBar):
|
||||||
self.setMinimumWidth(200)
|
self.setMinimumWidth(200)
|
||||||
self.setValue(0)
|
self.setValue(0)
|
||||||
self.setFormat(strings._('zip_progress_bar_format'))
|
self.setFormat(strings._('zip_progress_bar_format'))
|
||||||
self.setStyleSheet(
|
cssStyleData ="""
|
||||||
"QProgressBar::chunk { background-color: #05B8CC; } "
|
QProgressBar {
|
||||||
)
|
border: 2px solid grey;
|
||||||
|
border-radius: 5px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
QProgressBar::chunk {
|
||||||
|
background: qlineargradient(x1: 0.5, y1: 0, x2: 0.5, y2: 1, stop: 0 #b366ff, stop: 1 #d9b3ff);
|
||||||
|
width: 10px;
|
||||||
|
}"""
|
||||||
|
self.setStyleSheet(cssStyleData)
|
||||||
|
|
||||||
self._total_files_size = total_files_size
|
self._total_files_size = total_files_size
|
||||||
self._processed_size = 0
|
self._processed_size = 0
|
||||||
|
|
Loading…
Add table
Reference in a new issue