1
0
Fork 0
mirror of synced 2024-06-29 03:31:06 +12:00

Fix other wrappers than proton; + minor other bug fixes

This commit is contained in:
Dummerle 2021-11-28 02:04:30 +01:00
parent 8d4f25b8c2
commit 01674f2e5e
No known key found for this signature in database
GPG key ID: AB68CC59CA39F2F1
3 changed files with 17 additions and 12 deletions

View file

@ -1,7 +1,7 @@
import datetime
from dataclasses import dataclass
from logging import getLogger
from typing import Union
from typing import Union, List
from PyQt5.QtCore import QObject, pyqtSignal, QRunnable, QThreadPool, Qt, QSettings
from PyQt5.QtWidgets import QDialog, QMessageBox, QSizePolicy, QLayout
@ -118,12 +118,12 @@ class CloudSaveUtils(QObject):
if not shared.args.offline:
self.latest_saves = self.get_latest_saves(saves)
else:
self.latest_saves = dict
self.latest_saves = dict()
self.settings = QSettings()
self.thread_pool = QThreadPool.globalInstance()
def get_latest_saves(self, saves) -> dict:
def get_latest_saves(self, saves: List[SaveGameFile]) -> dict:
save_games = set()
for igame in self.core.get_installed_list():
game = self.core.get_game(igame.app_name)

View file

@ -102,7 +102,8 @@ class GameSettings(QWidget, Ui_GameSettings):
# FIXME: Remove the spacerItem and margins from the linux settings
# FIXME: This should be handled differently at soem point in the future
self.linux_settings.layout().setContentsMargins(0, 0, 0, 0)
for item in [self.linux_settings.layout().itemAt(idx) for idx in range(self.linux_settings.layout().count())]:
for item in [self.linux_settings.layout().itemAt(idx) for idx in
range(self.linux_settings.layout().count())]:
if item.spacerItem():
self.linux_settings.layout().removeItem(item)
del item
@ -129,9 +130,11 @@ class GameSettings(QWidget, Ui_GameSettings):
resolver.signals.result_ready.connect(lambda x: self.wine_resolver_finished(x, app_name))
QThreadPool.globalInstance().start(resolver)
return
self.cloud_save_path_edit.setText(new_path)
else:
self.cloud_save_path_edit.setText(new_path)
def wine_resolver_finished(self, path, app_name):
logger.info(f"Wine resolver finished for {app_name}. Computed save path: {path}")
if app_name == self.game.app_name:
self.cloud_save_path_edit.setDisabled(False)
self.compute_save_path_button.setDisabled(False)
@ -145,9 +148,10 @@ class GameSettings(QWidget, Ui_GameSettings):
self.game.app_title, path))
return
if not path:
self.cloud_save_path_edit.setText("")
return
self.cloud_save_path_edit.setText(path)
else:
elif path:
igame = self.core.get_installed_game(app_name)
igame.save_path = path
self.core.lgd.set_installed_game(app_name, igame)
@ -285,7 +289,7 @@ class GameSettings(QWidget, Ui_GameSettings):
self.linux_settings.update_game(app_name)
proton = self.core.lgd.config.get(f"{app_name}", "wrapper", fallback="").replace('"', "")
if proton != "":
if proton and "proton" in proton:
self.proton_prefix.setEnabled(True)
self.proton_wrapper.setCurrentText(f'"{proton.replace(" run", "")}" run')
proton_prefix = self.core.lgd.config.get(f"{app_name}.env", "STEAM_COMPAT_DATA_PATH",

View file

@ -59,10 +59,11 @@ class LinuxSettings(QWidget, Ui_LinuxSettings):
logger.debug(f"Set {setting} in {f'[{section}]'} to {text}")
else:
shared.core.lgd.config.remove_option(section, setting)
logger.debug(f"Unset {setting} from {f'[{section}]'}")
if not shared.core.lgd.config[section]:
shared.core.lgd.config.remove_section(section)
logger.debug(f"Removed {f'[{section}]'} configuration section")
if shared.core.lgd.config.has_section(section) and shared.core.lgd.config.has_option(section, setting):
shared.core.lgd.config.remove_option(section, setting)
logger.debug(f"Unset {setting} from {f'[{section}]'}")
if not shared.core.lgd.config[section]:
shared.core.lgd.config.remove_section(section)
logger.debug(f"Removed {f'[{section}]'} configuration section")
shared.core.lgd.save_config()