Optimized the CPU usage a little by creating one QTimer that updates all progress indicators instead of having a different QTimer for each Widget.

This commit is contained in:
The Wobbler 2025-03-01 17:27:03 +01:00
parent 105cc5ddf9
commit 8d74c1e14c
3 changed files with 17 additions and 21 deletions

View file

@ -1,12 +1,9 @@
#!/usr/bin/python3
from PyQt6.QtCore import Qt, QTimer
from PyQt6.QtCore import Qt
from PyQt6.QtGui import QMouseEvent
from PyQt6.QtWidgets import QSlider, QStyle, QStyleOptionSlider
PROGRESS_UPDATE_RATE = 60
PROGRESS_UPDATE_INTERVAL = 1000 // PROGRESS_UPDATE_RATE
class TrackProgressSlider(QSlider):
def __init__(self, app, parent=None):
@ -17,10 +14,6 @@ class TrackProgressSlider(QSlider):
self.dragged = False
self.progress_update_timer = QTimer()
self.progress_update_timer.timeout.connect(self.update_progress)
self.progress_update_timer.start(PROGRESS_UPDATE_INTERVAL)
option = QStyleOptionSlider()
style = self.style()