08ab130c5c
Introduces the LibraryLayout from #196. This layout distributes the available space in either horizontal side and in-between the widgets. Known issues: When searching for a game, it will re-align visible widgets, effectively centering the results. This is because the search and grouping functions are interleaved. #196 handles it differently by adjusting the opacity and re-ordering of the irrelevant widgets. Signed-off-by: loathingKernel <142770+loathingKernel@users.noreply.github.com>
41 lines
1.4 KiB
Python
41 lines
1.4 KiB
Python
from logging import getLogger
|
|
|
|
from PyQt5.QtCore import pyqtSignal, Qt
|
|
from PyQt5.QtWidgets import QFrame, QAction
|
|
from legendary.models.game import Game
|
|
|
|
from rare.shared.image_manager import ImageManagerSingleton, ImageSize
|
|
from rare.widgets.image_widget import ImageWidget
|
|
|
|
logger = getLogger("Uninstalled")
|
|
|
|
|
|
class BaseUninstalledWidget(QFrame):
|
|
show_uninstalled_info = pyqtSignal(Game)
|
|
|
|
def __init__(self, game, core, pixmap):
|
|
super(BaseUninstalledWidget, self).__init__()
|
|
self.image_manager = ImageManagerSingleton()
|
|
|
|
self.game = game
|
|
if self.game.app_title == "Unreal Engine":
|
|
self.game.app_title = f"{self.game.app_title} {self.game.app_name.split('_')[-1]}"
|
|
|
|
self.core = core
|
|
self.image = ImageWidget(self)
|
|
self.image.setFixedSize(ImageSize.Display)
|
|
self.image.setPixmap(pixmap)
|
|
self.installing = False
|
|
self.setContextMenuPolicy(Qt.ActionsContextMenu)
|
|
|
|
reload_image = QAction(self.tr("Reload Image"), self)
|
|
reload_image.triggered.connect(self.reload_image)
|
|
self.addAction(reload_image)
|
|
|
|
def reload_image(self):
|
|
self.image_manager.download_image_blocking(self.game, force=True)
|
|
pm = self.image_manager.get_pixmap(self.game.app_name, color=False)
|
|
self.image.setPixmap(pm)
|
|
|
|
def install(self):
|
|
self.show_uninstalled_info.emit(self.game)
|