From 59f21d6c7e97e7eb1ad70d31523929d398d27972 Mon Sep 17 00:00:00 2001 From: vg Date: Mon, 2 Jan 2023 18:23:33 +0100 Subject: git-sync on dita --- pygame/Makefile | 6 +++--- pygame/__init__.py | 11 +++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'pygame') diff --git a/pygame/Makefile b/pygame/Makefile index 36729a7..3ca825c 100644 --- a/pygame/Makefile +++ b/pygame/Makefile @@ -14,10 +14,10 @@ all: deploy .PHONY: deploy deploy: - rm -rf ~/games/.saves/tools/bin/libs/gamechestgui + #rm -rf ~/games/.saves/tools/bin/libs/gamechestgui mkdir -p ~/games/.saves/tools/bin/libs/gamechestgui - pip3 install --target ~/games/.saves/tools/bin/libs/gamechestgui -r ../gamechestcli/requirements.txt - pip3 install --target ~/games/.saves/tools/bin/libs/gamechestgui -r requirements.txt + pip3 install -U --target ~/games/.saves/tools/bin/libs/gamechestgui -r ../gamechestcli/requirements.txt + pip3 install -U --target ~/games/.saves/tools/bin/libs/gamechestgui -r requirements.txt rsync -Pa ../gamechestcli/gamechest ~/games/.saves/tools/bin/libs/gamechestgui/. rsync -Pa __init__.py profiledb.py ~/games/.saves/tools/bin/libs/gamechestgui/. rsync -Pa gamechestgui ~/games/.saves/tools/bin/. diff --git a/pygame/__init__.py b/pygame/__init__.py index 04bc45a..8dae792 100755 --- a/pygame/__init__.py +++ b/pygame/__init__.py @@ -15,7 +15,7 @@ from .profiledb import ProfileDB from .gamechest.cliactions import run from .gamechest.gamedb import GameDB from .gamechest.statusdb import StatusDB -from .gamechest.gameconfig import config +from .gamechest.gameconfig import config, status from .gamechest.runners.install import Install from .gamechest.runners.remove import Remove @@ -175,8 +175,9 @@ class ProfileData(ObservedSubject): self.profiles_len = len(self.profiledb.get_profiles()) self.current_profile_index = 0 configured_default_profile = config.get_profile_id() + last_loaded_profile = status.last_loaded_profile or configured_default_profile for index, profile in enumerate(self.profiledb.get_profiles()): - if profile['name'] == configured_default_profile: + if profile['name'] == last_loaded_profile: self.current_profile_index = index def change_active_profile(self, new_index): @@ -261,6 +262,10 @@ class GameData(ObservedSubject): self.games_idtitles = list(self.game_db.get_idtitles()) self.games_len = len(self.games_idtitles) self.game_index = 0 + last_loaded_game = status.last_loaded_game + for index, (game_id, _) in enumerate(self.games_idtitles): + if game_id == last_loaded_game: + self.game_index = index def change_active_game(self, new_index): if new_index < 0: @@ -621,6 +626,8 @@ class GuiAppSub1(GuiApp): if not self.status_db.is_installed(game_info): print('Game', game_id, 'is not installed, aborting.', file=sys.stderr) else: + status.set_last_loaded_game(game_id) + status.set_last_loaded_profile(profile_id) command = self.game_db.get_game_command(profile_id, game_id) subprocess.run(command) elif action == 'install': -- cgit v1.2.3