From cb9513ff1323a021950bd3e5623b4105b67db8f0 Mon Sep 17 00:00:00 2001 From: kramo Date: Tue, 15 Aug 2023 21:46:58 +0200 Subject: [PATCH] Fix import undo logic --- src/store/store.py | 1 + src/window.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/store/store.py b/src/store/store.py index 89c7f11..a11bf5a 100644 --- a/src/store/store.py +++ b/src/store/store.py @@ -103,6 +103,7 @@ class Store: for undo in ("remove", "hide"): try: shared.win.toasts[(game, undo)].dismiss() + shared.win.toasts.pop((game, undo)) except KeyError: pass diff --git a/src/window.py b/src/window.py index 37bad99..ac2ab42 100644 --- a/src/window.py +++ b/src/window.py @@ -331,7 +331,9 @@ class CartridgesWindow(Adw.ApplicationWindow): def on_undo_action(self, _widget, game=None, undo=None): if not game: # If the action was activated via Ctrl + Z - if shared.importer.imported_game_ids or shared.importer.removed_game_ids: + if shared.importer and ( + shared.importer.imported_game_ids or shared.importer.removed_game_ids + ): undo = "import" else: try: