Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions rare/components/tabs/library/widgets/game_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def __init__(self, rgame: RareGame, parent=None):
'not_can_launch': self.tr("Can't launch"),
}

self._pixmap_timer: bool = False
self._ui = None

# lk: abstract class for typing, the `self.ui` attribute should be used
Expand All @@ -123,14 +124,16 @@ def start_progress(self):
pass

def paintEvent(self, a0: QPaintEvent) -> None:
if self._pixmap_timer:
return super().paintEvent(a0)
if not self.visibleRegion().isNull() and not self.rgame.has_pixmap:
self._pixmap_timer = True
self.startTimer(random.randrange(42, 2361, 129), Qt.TimerType.CoarseTimer)
# self.startTimer(random.randrange(42, 2361, 363), Qt.VeryCoarseTimer)
# self.rgame.load_pixmap()
super().paintEvent(a0)
return super().paintEvent(a0)

def timerEvent(self, a0):
self.killTimer(a0.timerId())
self._pixmap_timer = False
self.rgame.load_pixmaps()

def showEvent(self, a0: QShowEvent) -> None:
Expand Down
6 changes: 4 additions & 2 deletions rare/components/tabs/library/widgets/library_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,16 @@ def showProgress(self, color_pm: QPixmap, gray_pm: QPixmap) -> None:
self.updateProgress(0)

@Slot(int)
def updateProgress(self, progress: int):
def updateProgress(self, progress: int) -> None:
self.progress_label.setText(f'{progress:02}%')
if self._color_pixmap is None or self._gray_pixmap is None:
return
if progress > self._progress:
self._progress = progress
self.setPixmap(self.progressPixmap(self._color_pixmap, self._gray_pixmap, progress))

@Slot(bool)
def hideProgress(self, stopped: bool):
def hideProgress(self, stopped: bool) -> None:
self._color_pixmap = None
self._gray_pixmap = None
self.progress_label.setVisible(stopped)
Expand Down
Loading