Add docstrings. Also add safe_cast function. Finally

fix some minor issues.
This commit is contained in:
alessandro90
2019-05-25 15:18:06 +02:00
parent a7e36505e9
commit 43a9ce954e
14 changed files with 531 additions and 181 deletions

View File

@@ -4,30 +4,31 @@ from constants import Constants
class ClickableProgressBar(QProgressBar):
"""Subclass QProgressBar. Clickable progress bar class."""
clicked = pyqtSignal()
def __init__(self, parent=None):
"""Initialize the instance."""
self.__text = ''
super().__init__(parent)
# def __set_text(self, text):
# self.__text = text
def text(self):
"""Return the text displayed on the bar."""
return self.__text
def set_idle(self):
# self.__set_text(Constants.CLICK_TO_UPDATE_STR)
"""Set the bar to a non-downloading status."""
self.__text = Constants.CLICK_TO_UPDATE_STR
self.setMaximum(self.minimum() + 1)
def set_updating(self):
# self.__set_text(Constants.UPDATING_STR)
"""Set the bar to a downloading status."""
self.__text = Constants.UPDATING_STR
self.setMaximum(self.minimum())
def mousePressEvent(self, event):
"""Override QWidget.mousePressEvent. Detect a click on the bar."""
if event.button() == Qt.LeftButton:
self.clicked.emit()
else: