Store improvements

- Store games by source
- Added convenience dunder methods (contains, iter, len, getitem)
- Added store.get
- Changed `enable_in_pipeline` for `toggle_in_pipeline`
This commit is contained in:
GeoffreyCoulaud
2023-07-07 18:06:07 +02:00
parent dc232e1e43
commit 87a4319360
5 changed files with 55 additions and 15 deletions

View File

@@ -155,9 +155,10 @@ class DetailsWindow(Adw.Window):
return
# Increment the number after the game id (eg. imported_1, imported_2)
source_id = "imported"
numbers = [0]
game_id: str
for game_id in shared.store.games:
for game_id in shared.source_games[source_id]:
prefix = "imported_"
if not game_id.startswith(prefix):
continue
@@ -168,7 +169,7 @@ class DetailsWindow(Adw.Window):
{
"game_id": f"imported_{game_number}",
"hidden": False,
"source": "imported",
"source": source_id,
"added": int(time()),
}
)