Dismiss loose toasts when cleaning up games
This commit is contained in:
@@ -324,9 +324,12 @@ class Importer(ErrorProducer):
|
||||
shared.store[game_id].update()
|
||||
shared.store[game_id].save()
|
||||
|
||||
self.imported_game_ids = set()
|
||||
self.removed_game_ids = set()
|
||||
self.summary_toast.dismiss()
|
||||
|
||||
logging.info("Import undone")
|
||||
|
||||
def create_summary_toast(self):
|
||||
"""N games imported, removed toast"""
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ class Store:
|
||||
self.pipeline_managers.discard(self.managers[manager_type])
|
||||
|
||||
def cleanup_game(self, game: Game) -> None:
|
||||
"""Remove a game's files"""
|
||||
"""Remove a game's files, dismiss any loose toasts"""
|
||||
for path in (
|
||||
shared.games_dir / f"{game.game_id}.json",
|
||||
shared.covers_dir / f"{game.game_id}.tiff",
|
||||
@@ -99,6 +99,13 @@ class Store:
|
||||
):
|
||||
path.unlink(missing_ok=True)
|
||||
|
||||
# TODO: don't run this if the state is startup
|
||||
for undo in ("remove", "hide"):
|
||||
try:
|
||||
shared.win.toasts[(game, undo)].dismiss()
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
def add_game(
|
||||
self, game: Game, additional_data: dict, run_pipeline=True
|
||||
) -> Pipeline | None:
|
||||
|
||||
Reference in New Issue
Block a user