1
0
Fork 0
mirror of synced 2024-06-02 10:44:40 +12:00

GameDlcWidget: Dynamically load DLC cover image on show

This commit is contained in:
loathingKernel 2023-12-28 14:27:31 +02:00
parent a8a1a84df7
commit e467dc996c

View file

@ -1,6 +1,7 @@
from typing import Optional, List from typing import Optional, List
from PyQt5.QtCore import Qt, pyqtSlot, pyqtSignal from PyQt5.QtCore import Qt, pyqtSlot, pyqtSignal
from PyQt5.QtGui import QShowEvent
from PyQt5.QtWidgets import QFrame, QMessageBox, QToolBox from PyQt5.QtWidgets import QFrame, QMessageBox, QToolBox
from rare.models.game import RareGame from rare.models.game import RareGame
@ -37,6 +38,14 @@ class GameDlcWidget(QFrame):
@pyqtSlot() @pyqtSlot()
def __update(self): def __update(self):
self.ui.action_button.setEnabled(self.rdlc.is_idle) self.ui.action_button.setEnabled(self.rdlc.is_idle)
self.image.setPixmap(self.rdlc.pixmap)
def showEvent(self, a0: QShowEvent) -> None:
if a0.spontaneous():
return super().showEvent(a0)
if self.rdlc.pixmap.isNull():
self.rdlc.load_pixmap()
super().showEvent(a0)
class InstalledGameDlcWidget(GameDlcWidget): class InstalledGameDlcWidget(GameDlcWidget):