1
0
Fork 0
mirror of synced 2024-06-26 10:11:19 +12:00

Fixed some Bugs

This commit is contained in:
Dummerle 2021-03-25 14:15:18 +01:00
parent 2376bd5fee
commit 29969228e6
5 changed files with 17 additions and 12 deletions

View file

@ -48,9 +48,9 @@ class GameList(QStackedWidget):
IMAGE_DIR = self.settings.value("img_dir", os.path.expanduser("~/.cache/rare"), str) IMAGE_DIR = self.settings.value("img_dir", os.path.expanduser("~/.cache/rare"), str)
self.updates = [] self.updates = []
self.widgets = {} self.widgets = {}
# Installed Games # Installed Games
for game in sorted(self.core.get_installed_list(), key=lambda x: x.title): for game in sorted(self.core.get_installed_list(), key=lambda x: x.title):
print(game.title)
if os.path.exists(f"{IMAGE_DIR}/{game.app_name}/FinalArt.png"): if os.path.exists(f"{IMAGE_DIR}/{game.app_name}/FinalArt.png"):
pixmap = QPixmap(f"{IMAGE_DIR}/{game.app_name}/FinalArt.png") pixmap = QPixmap(f"{IMAGE_DIR}/{game.app_name}/FinalArt.png")
elif os.path.exists(f"{IMAGE_DIR}/{game.app_name}/DieselGameBoxTall.png"): elif os.path.exists(f"{IMAGE_DIR}/{game.app_name}/DieselGameBoxTall.png"):
@ -66,7 +66,7 @@ class GameList(QStackedWidget):
download_image(game, force=True) download_image(game, force=True)
pixmap = QPixmap(f"{IMAGE_DIR}/{game.app_name}/DieselGameBoxTall.png") pixmap = QPixmap(f"{IMAGE_DIR}/{game.app_name}/DieselGameBoxTall.png")
icon_widget = GameWidgetInstalled(self.core, game, pixmap) icon_widget = GameWidgetInstalled(game, self.core, pixmap)
list_widget = InstalledListWidget(game, self.core, pixmap) list_widget = InstalledListWidget(game, self.core, pixmap)
icon_widget.show_info.connect(self.show_game_info.emit) icon_widget.show_info.connect(self.show_game_info.emit)
@ -106,6 +106,7 @@ class GameList(QStackedWidget):
icon_widget = IconWidgetUninstalled(game, self.core, pixmap) icon_widget = IconWidgetUninstalled(game, self.core, pixmap)
icon_widget.install_game.connect(self.install_game.emit) icon_widget.install_game.connect(self.install_game.emit)
list_widget = ListWidgetUninstalled(self.core, game, pixmap) list_widget = ListWidgetUninstalled(self.core, game, pixmap)
list_widget.install_game.connect(self.install_game.emit) list_widget.install_game.connect(self.install_game.emit)
@ -114,6 +115,7 @@ class GameList(QStackedWidget):
self.widgets[game.app_name] = (icon_widget, list_widget) self.widgets[game.app_name] = (icon_widget, list_widget)
self.list_layout.addStretch(1)
self.icon_widget.setLayout(self.icon_layout) self.icon_widget.setLayout(self.icon_layout)
self.list_widget.setLayout(self.list_layout) self.list_widget.setLayout(self.list_layout)
@ -126,8 +128,10 @@ class GameList(QStackedWidget):
if not icon_view: if not icon_view:
self.setCurrentIndex(1) self.setCurrentIndex(1)
if self.settings.value("installed_only", False, bool):
self.installed_only(True)
def launch(self, app_name): def launch(self, app_name):
print("Launch")
self.widgets[app_name][0].info_text = self.tr("Game running") self.widgets[app_name][0].info_text = self.tr("Game running")
self.widgets[app_name][1].launch_button.setDisabled(True) self.widgets[app_name][1].launch_button.setDisabled(True)
self.widgets[app_name][1].launch_button.setText(self.tr("Game running")) self.widgets[app_name][1].launch_button.setText(self.tr("Game running"))
@ -142,11 +146,10 @@ class GameList(QStackedWidget):
w.setVisible(False) w.setVisible(False)
def installed_only(self, i_o: bool): def installed_only(self, i_o: bool):
# TODO save state
for t in self.widgets.values(): for t in self.widgets.values():
for w in t: for w in t:
w.setVisible(not (not self.core.is_installed(w.game.app_name) and i_o)) w.setVisible(not (not self.core.is_installed(w.game.app_name) and i_o))
self.settings.setValue("installed_only", i_o)
def update_list(self, icon_view=True): def update_list(self, icon_view=True):
print("Updating List") print("Updating List")

View file

@ -20,7 +20,7 @@ class GameWidgetInstalled(BaseInstalledWidget):
show_info = pyqtSignal(str) show_info = pyqtSignal(str)
update_game = pyqtSignal() update_game = pyqtSignal()
def __init__(self, core: LegendaryCore, game: InstalledGame, pixmap): def __init__(self, game: InstalledGame, core: LegendaryCore, pixmap):
super(GameWidgetInstalled, self).__init__(game, core, pixmap) super(GameWidgetInstalled, self).__init__(game, core, pixmap)
self.setObjectName("game_widget_parent") self.setObjectName("game_widget_parent")
@ -29,7 +29,6 @@ class GameWidgetInstalled(BaseInstalledWidget):
self.layout = QVBoxLayout() self.layout = QVBoxLayout()
self.core = core self.core = core
self.running = False self.running = False
settings = QSettings()
self.info_text = "" self.info_text = ""
if self.update_available: if self.update_available:

View file

@ -3,6 +3,7 @@ from logging import getLogger
from PyQt5.QtCore import QProcess, pyqtSignal from PyQt5.QtCore import QProcess, pyqtSignal
from PyQt5.QtWidgets import QHBoxLayout, QLabel, QPushButton, QStyle, QVBoxLayout from PyQt5.QtWidgets import QHBoxLayout, QLabel, QPushButton, QStyle, QVBoxLayout
from qtawesome import icon
from Rare.Components.Tabs.Games.GameWidgets.BaseInstalledWidget import BaseInstalledWidget from Rare.Components.Tabs.Games.GameWidgets.BaseInstalledWidget import BaseInstalledWidget
from custom_legendary.core import LegendaryCore from custom_legendary.core import LegendaryCore
@ -34,7 +35,7 @@ class InstalledListWidget(BaseInstalledWidget):
self.image.setPixmap(self.pixmap) self.image.setPixmap(self.pixmap)
self.layout.addWidget(self.image) self.layout.addWidget(self.image)
play_icon = self.style().standardIcon(getattr(QStyle, 'SP_MediaPlay')) play_icon = icon("ei.play", color="white")
self.title_widget = QLabel(f"<h1>{self.igame.title}</h1>") self.title_widget = QLabel(f"<h1>{self.igame.title}</h1>")
self.app_name_label = QLabel(self.igame.app_name) self.app_name_label = QLabel(self.igame.app_name)
self.launch_button = QPushButton(play_icon, self.tr("Launch")) self.launch_button = QPushButton(play_icon, self.tr("Launch"))
@ -56,8 +57,8 @@ class InstalledListWidget(BaseInstalledWidget):
self.childLayout.addWidget(self.info) self.childLayout.addWidget(self.info)
self.childLayout.addWidget(self.app_name_label) self.childLayout.addWidget(self.app_name_label)
self.childLayout.addWidget(self.developer_label) self.childLayout.addWidget(self.developer_label)
if os.name != "nt": #if os.name != "nt":
self.childLayout.addWidget(self.wine_rating) # self.childLayout.addWidget(self.wine_rating)
self.childLayout.addWidget(self.version_label) self.childLayout.addWidget(self.version_label)
self.childLayout.addWidget(self.size_label) self.childLayout.addWidget(self.size_label)

View file

@ -72,6 +72,8 @@ class GameListHeadBar(QWidget):
super(GameListHeadBar, self).__init__() super(GameListHeadBar, self).__init__()
self.layout = QHBoxLayout() self.layout = QHBoxLayout()
self.installed_only = QCheckBox(self.tr("Installed only")) self.installed_only = QCheckBox(self.tr("Installed only"))
self.settings = QSettings()
self.installed_only.setChecked(self.settings.value("installed_only", False, bool))
self.layout.addWidget(self.installed_only) self.layout.addWidget(self.installed_only)
self.layout.addStretch(1) self.layout.addStretch(1)

View file

@ -206,10 +206,10 @@ class SelectViewWidget(QWidget):
self.icon_view_button = QPushButton() self.icon_view_button = QPushButton()
self.list_view = QPushButton() self.list_view = QPushButton()
if icon_view: if icon_view:
self.icon_view_button.setIcon(icon("fa.th-large", color="orange")) self.icon_view_button.setIcon(icon("mdi.view-grid-outline", color="orange"))
self.list_view.setIcon(icon("fa5s.list", color="white")) self.list_view.setIcon(icon("fa5s.list", color="white"))
else: else:
self.icon_view_button.setIcon(icon("fa.th-large", color="white")) self.icon_view_button.setIcon(icon("mdi.view-grid-outline", color="white"))
self.list_view.setIcon(icon("fa5s.list", color="orange")) self.list_view.setIcon(icon("fa5s.list", color="orange"))
self.icon_view_button.clicked.connect(self.icon) self.icon_view_button.clicked.connect(self.icon)