1
0
Fork 0
mirror of synced 2024-06-02 18:54:41 +12:00

Some fixes for windows

This commit is contained in:
Dummerle 2021-11-25 21:54:34 +01:00
parent 0c59dd1f70
commit db177e162f
6 changed files with 19 additions and 12 deletions

View file

@ -28,7 +28,7 @@ class MainWindow(QMainWindow):
self.setCentralWidget(self.tab_widget)
width, height = 1280, 720
if self.settings.value("save_size", False):
if self.settings.value("save_size", False, bool):
width, height = self.settings.value("window_size", (width, height), tuple)
# move the window outside the viewport
@ -55,7 +55,7 @@ class MainWindow(QMainWindow):
if shared.args.subparser == "launch":
if shared.args.app_name in [i.app_name for i in self.tab_widget.games_tab.installed]:
logger.info("Launching " + self.core.get_installed_game(shared.args.app_name).title)
self.tab_widget.games_tab.widgets[shared.args.app_name][1].prepare_launch()
self.tab_widget.games_tab.game_utils.prepare_launch(shared.args.app_name)
else:
logger.info(
f"Could not find {shared.args.app_name} in Games or it is not installed")

View file

@ -99,6 +99,7 @@ class GamesTab(QStackedWidget, Ui_GamesTab):
self.signals.installation_started.connect(self.installation_started)
self.signals.update_gamelist.connect(self.update_list)
self.signals.installation_finished.connect(lambda x: self.installing_widget.setVisible(False))
self.signals.game_uninstalled.connect(lambda name: self.update_list([name]))
self.game_utils.update_list.connect(self.update_list)
@ -253,6 +254,7 @@ class GamesTab(QStackedWidget, Ui_GamesTab):
w.setVisible(visible)
def update_list(self, app_names: list = None):
logger.debug("Updating list for " + str(app_names))
if app_names:
update_list = False
for app_name in app_names:

View file

@ -110,7 +110,8 @@ class GameSettings(QWidget, Ui_GameSettings):
self.linux_settings_contents_layout.addWidget(self.linux_settings)
self.linux_settings_contents_layout.setAlignment(Qt.AlignTop)
else:
self.proton_groupbox.setVisible(False)
self.game_settings_layout.setAlignment(Qt.AlignTop)
self.linux_settings_scroll.setVisible(False)
# skip_update_check

View file

@ -20,6 +20,7 @@ logger = getLogger("GameUtils")
class GameProcess(QProcess):
game_finished = pyqtSignal(int, str)
# noinspection PyUnresolvedReferences
def __init__(self, app_name):
super(GameProcess, self).__init__()
self.app_name = app_name
@ -95,6 +96,11 @@ class GameUtils(QObject):
game = self.core.get_game(app_name)
igame = self.core.get_installed_game(app_name)
if not game:
logger.error(f"{app_name} not found")
self.finished.emit(app_name, self.tr("Game not found in available games"))
return
if QSettings().value("confirm_start", False, bool):
if not QMessageBox.question(None, "Launch", self.tr("Do you want to launch {}").format(game.app_title),
QMessageBox.Yes | QMessageBox.No) == QMessageBox.Yes:
@ -106,10 +112,8 @@ class GameUtils(QObject):
if game.third_party_store == "Origin":
offline = False
else:
if not game:
logger.error("Game not found")
self.finished.emit(app_name, self.tr("Game not found in available games"))
return
if not igame:
logger.error(f"{app_name} is not installed")
if game.is_dlc:
logger.error("Game is dlc")
self.finished.emit(app_name, self.tr("Game is a DLC. Please launch base game instead"))
@ -175,6 +179,7 @@ class GameUtils(QObject):
running_game = RunningGameModel(process=process, app_name=app_name, always_ask_sync=ask_always_sync)
process.start(full_params[0], full_params[1:])
self.game_launched.emit(app_name)
logger.info(f"{game.app_title} launched")
self.running_games[game.app_name] = running_game

View file

@ -27,7 +27,6 @@ class EGLSyncGroup(QGroupBox, Ui_EGLSyncGroup):
if platform.system() == 'Windows':
self.egl_path_edit_label.setVisible(False)
self.egl_path_edit.setVisible(False)
self.egl_path_info_label.setVisible(False)
self.egl_path_info.setVisible(False)
else:
@ -135,7 +134,7 @@ class EGLSyncGroup(QGroupBox, Ui_EGLSyncGroup):
def update_lists(self):
# self.egl_watcher.blockSignals(True)
if have_path := bool(shared.core.egl.programdata_path) and self.egl_path_edit.is_valid:
if have_path := bool(shared.core.egl.programdata_path) and os.path.exists(shared.core.egl.programdata_path):
# NOTE: need to clear known manifests to force refresh
shared.core.egl.manifests.clear()
self.egl_sync_check_label.setEnabled(have_path)
@ -244,8 +243,8 @@ class EGLSyncListGroup(QGroupBox, Ui_EGLSyncListGroup):
self.populate(True)
if errors:
QMessageBox.warning(
self,
self.tr('The following errors occured while {}.').format(
self.parent(),
self.tr('The following errors occurred while {}.').format(
self.tr('exporting') if self.export else self.tr('importing')),
'\n'.join(errors)
)

View file

@ -93,7 +93,7 @@ class RareSettings(QWidget, Ui_RareSettings):
lambda: self.settings.setValue("notification", self.notification.isChecked())
)
self.save_size.stateChanged.connect(
lambda: self.settings.setValue("save_size", self.save_size.isChecked())
self.save_window_size
)
self.log_games.stateChanged.connect(
lambda: self.settings.setValue("show_console", self.log_games.isChecked())