🚧 More work on managers

This commit is contained in:
GeoffreyCoulaud
2023-05-23 02:31:00 +02:00
parent 3df9380c2d
commit 9ea2e9652d
8 changed files with 57 additions and 13 deletions

View File

@@ -0,0 +1,12 @@
import src.shared as shared
from src.store.manager import Manager
from src.game import Game
class DisplayManager(Manager):
"""Manager in charge of adding a game to the UI"""
def run(self, game: Game) -> None:
# TODO decouple a game from its widget
shared.win.games[game.game_id] = game
game.update()

10
src/store/file_manager.py Normal file
View File

@@ -0,0 +1,10 @@
from src.store.manager import Manager
from src.game import Game
class FileManager(Manager):
"""Manager in charge of saving a game to a file"""
def run(self, game: Game) -> None:
# TODO make game.save (disk) not trigger game.update (UI)
game.save()

11
src/store/sgdb_manager.py Normal file
View File

@@ -0,0 +1,11 @@
from src.store.manager import Manager
from src.game import Game
from src.utils.steamgriddb import SGDBHelper
class SGDBManager(Manager):
"""Manager in charge of downloading a game's cover from steamgriddb"""
def run(self, game: Game) -> None:
# TODO
pass

View File

@@ -0,0 +1,11 @@
from src.store.manager import Manager
from src.game import Game
from src.utils.steam import SteamHelper
class SteamAPIManager(Manager):
"""Manager in charge of completing a game's data from the Steam API"""
def run(self, game: Game) -> None:
# TODO
pass

View File

@@ -1,3 +1,4 @@
import src.shared as shared
from src.game import Game
from src.store.manager import Manager
from src.utils.task import Task
@@ -32,6 +33,7 @@ class Store:
games: dict[str, Game]
def __init__(self) -> None:
shared.store = self
self.managers = set()
self.games = {}
self.pipelines = {}