🚧 More work on managers
This commit is contained in:
12
src/store/display_manager.py
Normal file
12
src/store/display_manager.py
Normal 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
10
src/store/file_manager.py
Normal 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
11
src/store/sgdb_manager.py
Normal 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
|
||||
11
src/store/steam_api_manager.py
Normal file
11
src/store/steam_api_manager.py
Normal 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
|
||||
@@ -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 = {}
|
||||
|
||||
Reference in New Issue
Block a user