1
0
Fork 0
mirror of synced 2024-06-26 18:20:50 +12:00

GameInfo: Work-around slowdown on widget update_game() request

This commit is contained in:
Stelios Tsampas 2022-09-10 19:04:40 +03:00
parent 21ea2af8e1
commit 7a1935335e
4 changed files with 11 additions and 7 deletions

View file

@ -58,7 +58,7 @@ class ImageWorker(LaunchWorker):
self.core.lgd.set_game_meta(game.app_name, game)
self.signals.progress.emit(
int(i / len(game_list) * 50),
self.tr("Downloading image for {}").format(game.app_title)
self.tr("Downloading image for <b>{}</b>").format(game.app_title)
)
self.image_manager.download_image_blocking(game)
@ -69,7 +69,7 @@ class ImageWorker(LaunchWorker):
for i, igame in enumerate(igame_list):
self.signals.progress.emit(
int(i / len(igame_list) * 50) + 50,
self.tr("Validating install for {}").format(igame.title)
self.tr("Validating install for <b>{}</b>").format(igame.title)
)
if not os.path.exists(igame.install_path):
# lk; since install_path is lost anyway, set keep_files to True

View file

@ -63,8 +63,8 @@ class GameInfo(QWidget, Ui_GameInfo):
self.lbl_grade.setVisible(False)
self.grade.setVisible(False)
else:
self.steam_worker = SteamWorker(self.core)
self.steam_worker.signals.rating_signal.connect(self.grade.setText)
self.steam_worker: SteamWorker = SteamWorker(self.core)
self.steam_worker.signals.rating.connect(self.grade.setText)
self.steam_worker.setAutoDelete(False)
self.game_actions_stack.setCurrentIndex(0)

View file

@ -135,11 +135,15 @@ class MoveGamePopUp(QWidget):
return True, dir_selected, str()
def update_game(self, app_name):
igame = self.core.get_installed_game(app_name, False)
igame = self.core.get_installed_game(app_name, skip_sync=True)
if igame is None:
return
self.install_path = igame.install_path
# FIXME: Make edit_func lighter instead of blocking signals
self.move_path_edit.line_edit.blockSignals(True)
self.move_path_edit.setText(igame.install_path)
# FIXME: Make edit_func lighter instead of blocking signals
self.move_path_edit.line_edit.blockSignals(False)
self.warn_overwriting.setText(
self.tr("Moving here will overwrite the dir/file {}/").format(Path(self.install_path).stem)
)

View file

@ -16,7 +16,7 @@ url = "https://api.steampowered.com/ISteamApps/GetAppList/v2/"
class SteamWorker(QRunnable):
class Signals(QObject):
rating_signal = pyqtSignal(str)
rating = pyqtSignal(str)
app_name: str = ""
@ -39,7 +39,7 @@ class SteamWorker(QRunnable):
self.app_name = app_name
def run(self) -> None:
self.signals.rating_signal.emit(
self.signals.rating.emit(
self.ratings.get(get_rating(self.app_name), self.ratings["fail"])
)