Fixed some Bugs
This commit is contained in:
parent
2376bd5fee
commit
29969228e6
|
@ -48,9 +48,9 @@ class GameList(QStackedWidget):
|
|||
IMAGE_DIR = self.settings.value("img_dir", os.path.expanduser("~/.cache/rare"), str)
|
||||
self.updates = []
|
||||
self.widgets = {}
|
||||
|
||||
# Installed Games
|
||||
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"):
|
||||
pixmap = QPixmap(f"{IMAGE_DIR}/{game.app_name}/FinalArt.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)
|
||||
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)
|
||||
|
||||
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.install_game.connect(self.install_game.emit)
|
||||
|
||||
list_widget = ListWidgetUninstalled(self.core, game, pixmap)
|
||||
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.list_layout.addStretch(1)
|
||||
self.icon_widget.setLayout(self.icon_layout)
|
||||
self.list_widget.setLayout(self.list_layout)
|
||||
|
||||
|
@ -126,8 +128,10 @@ class GameList(QStackedWidget):
|
|||
if not icon_view:
|
||||
self.setCurrentIndex(1)
|
||||
|
||||
if self.settings.value("installed_only", False, bool):
|
||||
self.installed_only(True)
|
||||
|
||||
def launch(self, app_name):
|
||||
print("Launch")
|
||||
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.setText(self.tr("Game running"))
|
||||
|
@ -142,11 +146,10 @@ class GameList(QStackedWidget):
|
|||
w.setVisible(False)
|
||||
|
||||
def installed_only(self, i_o: bool):
|
||||
# TODO save state
|
||||
|
||||
for t in self.widgets.values():
|
||||
for w in t:
|
||||
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):
|
||||
print("Updating List")
|
||||
|
|
|
@ -20,7 +20,7 @@ class GameWidgetInstalled(BaseInstalledWidget):
|
|||
show_info = pyqtSignal(str)
|
||||
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)
|
||||
self.setObjectName("game_widget_parent")
|
||||
|
||||
|
@ -29,7 +29,6 @@ class GameWidgetInstalled(BaseInstalledWidget):
|
|||
self.layout = QVBoxLayout()
|
||||
self.core = core
|
||||
self.running = False
|
||||
settings = QSettings()
|
||||
self.info_text = ""
|
||||
|
||||
if self.update_available:
|
||||
|
|
|
@ -3,6 +3,7 @@ from logging import getLogger
|
|||
|
||||
from PyQt5.QtCore import QProcess, pyqtSignal
|
||||
from PyQt5.QtWidgets import QHBoxLayout, QLabel, QPushButton, QStyle, QVBoxLayout
|
||||
from qtawesome import icon
|
||||
|
||||
from Rare.Components.Tabs.Games.GameWidgets.BaseInstalledWidget import BaseInstalledWidget
|
||||
from custom_legendary.core import LegendaryCore
|
||||
|
@ -34,7 +35,7 @@ class InstalledListWidget(BaseInstalledWidget):
|
|||
self.image.setPixmap(self.pixmap)
|
||||
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.app_name_label = QLabel(self.igame.app_name)
|
||||
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.app_name_label)
|
||||
self.childLayout.addWidget(self.developer_label)
|
||||
if os.name != "nt":
|
||||
self.childLayout.addWidget(self.wine_rating)
|
||||
#if os.name != "nt":
|
||||
# self.childLayout.addWidget(self.wine_rating)
|
||||
self.childLayout.addWidget(self.version_label)
|
||||
self.childLayout.addWidget(self.size_label)
|
||||
|
||||
|
|
|
@ -72,6 +72,8 @@ class GameListHeadBar(QWidget):
|
|||
super(GameListHeadBar, self).__init__()
|
||||
self.layout = QHBoxLayout()
|
||||
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.addStretch(1)
|
||||
|
|
|
@ -206,10 +206,10 @@ class SelectViewWidget(QWidget):
|
|||
self.icon_view_button = QPushButton()
|
||||
self.list_view = QPushButton()
|
||||
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"))
|
||||
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.icon_view_button.clicked.connect(self.icon)
|
||||
|
|
Loading…
Reference in a new issue