1
0
Fork 0
mirror of synced 2024-07-08 07:56:01 +12:00
Rare/rare/components/tabs/games/game_widgets/base_uninstalled_widget.py
loathingKernel 08ab130c5c LibraryLayout from #196
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>
2022-06-20 19:04:46 +03:00

42 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)