Got the indicator label to display in the correct location for share mode

This commit is contained in:
Micah Lee 2018-09-29 14:40:55 -07:00
parent fa4ebbf263
commit 4b3a68bb65
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
2 changed files with 15 additions and 5 deletions

View File

@ -284,9 +284,10 @@ class Common(object):
color: #ffffff; color: #ffffff;
background-color: #f44449; background-color: #f44449;
font-weight: bold; font-weight: bold;
padding: 5px;
border-radius: 5px;
font-size: 10px; font-size: 10px;
padding: 2px;
border-radius: 8px;
text-align: center;
}""", }""",
'downloads_uploads_progress_bar': """ 'downloads_uploads_progress_bar': """

View File

@ -45,7 +45,7 @@ class ShareModeInfo(QtWidgets.QWidget):
# Toggle button # Toggle button
self.toggle_button = QtWidgets.QPushButton() self.toggle_button = QtWidgets.QPushButton()
self.toggle_button.setDefault(False) self.toggle_button.setDefault(False)
self.toggle_button.setFixedWidth(30) self.toggle_button.setFixedWidth(35)
self.toggle_button.setFixedHeight(30) self.toggle_button.setFixedHeight(30)
self.toggle_button.setFlat(True) self.toggle_button.setFlat(True)
self.toggle_button.setIcon( QtGui.QIcon(self.common.get_resource_path('images/downloads_toggle.png')) ) self.toggle_button.setIcon( QtGui.QIcon(self.common.get_resource_path('images/downloads_toggle.png')) )
@ -53,17 +53,24 @@ class ShareModeInfo(QtWidgets.QWidget):
# Keep track of indicator # Keep track of indicator
self.indicator_count = 0 self.indicator_count = 0
self.indicator_label = QtWidgets.QLabel() self.indicator_label = QtWidgets.QLabel(parent=self.toggle_button)
self.indicator_label.setStyleSheet(self.common.css['download_uploads_indicator']) self.indicator_label.setStyleSheet(self.common.css['download_uploads_indicator'])
self.update_indicator() self.update_indicator()
"""
# Add it to the toggle button
toggle_button_layout = QtWidgets.QHBoxLayout()
toggle_button_layout.addSpacing(10)
toggle_button_layout.addWidget(self.indicator_label)
self.toggle_button.setLayout(toggle_button_layout)
"""
# Layout # Layout
layout = QtWidgets.QHBoxLayout() layout = QtWidgets.QHBoxLayout()
layout.addWidget(self.label) layout.addWidget(self.label)
layout.addStretch() layout.addStretch()
layout.addWidget(self.in_progress_downloads_count) layout.addWidget(self.in_progress_downloads_count)
layout.addWidget(self.completed_downloads_count) layout.addWidget(self.completed_downloads_count)
layout.addWidget(self.indicator_label)
layout.addWidget(self.toggle_button) layout.addWidget(self.toggle_button)
self.setLayout(layout) self.setLayout(layout)
@ -90,6 +97,8 @@ class ShareModeInfo(QtWidgets.QWidget):
if self.indicator_count == 0: if self.indicator_count == 0:
self.indicator_label.hide() self.indicator_label.hide()
else: else:
size = self.indicator_label.sizeHint()
self.indicator_label.setGeometry(35-size.width(), 0, size.width(), size.height())
self.indicator_label.show() self.indicator_label.show()
def update_downloads_completed(self): def update_downloads_completed(self):