From 8aae9a3b012cf94b06831ee6e015858b21fb7e7b Mon Sep 17 00:00:00 2001 From: Cyril Danilevski Date: Wed, 1 Jul 2020 11:51:20 +0200 Subject: [PATCH] Fix blank recipe editor on cancel save changes See kirienko/gourmet PR #135 --- gourmet/reccard.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gourmet/reccard.py b/gourmet/reccard.py index 88bb26d61..6763b6dc8 100644 --- a/gourmet/reccard.py +++ b/gourmet/reccard.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -from typing import Callable, List, Optional +from typing import Callable, List, Optional, Tuple import gc import webbrowser @@ -1055,7 +1055,7 @@ def revert_cb (self, *args): def delete_cb (self, *args): self.rg.rec_tree_delete_recs([self.current_rec]) - def close_cb (self, *args): + def close_cb(self, *args: Tuple[Gtk.Window, Gdk.Event]) -> bool: if self.edited: try: save_me = de.getBoolean( @@ -1064,9 +1064,11 @@ def close_cb (self, *args): custom_yes=Gtk.STOCK_SAVE, ) except de.UserCancelledError: - return + return True # keep the window open + if save_me: self.save_cb() + self.window.hide() self.reccard.hide() if self.new: