Clean up and fix minor issues with GUI extensions

This commit is contained in:
Veronica Berglyd Olsen
2023-11-29 22:21:56 +01:00
parent 78a75d5719
commit a6d346fcb6
7 changed files with 15 additions and 35 deletions
+7 -8
View File
@@ -41,14 +41,13 @@ class NProgressSimple(QProgressBar):
def paintEvent(self, event: QPaintEvent) -> None:
"""Custom painter for the progress bar."""
if self.value() == 0:
return
progress = ceil(self.width()*float(self.value())/self.maximum())
qPaint = QPainter(self)
qPaint.setRenderHint(QPainter.Antialiasing, True)
qPaint.setPen(self.palette().highlight().color())
qPaint.setBrush(self.palette().highlight())
qPaint.drawRect(0, 0, progress, self.height())
if (value := self.value()) > 0:
progress = ceil(self.width()*float(value)/self.maximum())
qPaint = QPainter(self)
qPaint.setRenderHint(QPainter.Antialiasing, True)
qPaint.setPen(self.palette().highlight().color())
qPaint.setBrush(self.palette().highlight())
qPaint.drawRect(0, 0, progress, self.height())
return
# END Class NProgressSimple