summaryrefslogtreecommitdiffstats
path: root/pygame/__init__.py
diff options
context:
space:
mode:
authorvg <vgm+dev@devys.org>2023-01-02 18:23:33 +0100
committervg <vgm+dev@devys.org>2023-01-02 18:23:33 +0100
commit59f21d6c7e97e7eb1ad70d31523929d398d27972 (patch)
tree48b1fb25a459c6b9cf444dc883fb54c3b9945495 /pygame/__init__.py
parent096312be3165c9f6775c2a082aeaabd24aaaed53 (diff)
downloadgamechest-59f21d6c7e97e7eb1ad70d31523929d398d27972.tar.gz
gamechest-59f21d6c7e97e7eb1ad70d31523929d398d27972.tar.bz2
gamechest-59f21d6c7e97e7eb1ad70d31523929d398d27972.zip
git-sync on dita
Diffstat (limited to 'pygame/__init__.py')
-rwxr-xr-xpygame/__init__.py11
1 files changed, 9 insertions, 2 deletions
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':