From 61a948190360618069c2f5cda1180ad2a962bc56 Mon Sep 17 00:00:00 2001 From: bmaltais Date: Mon, 19 Dec 2022 09:47:35 -0500 Subject: [PATCH] Fix save as issue --- dreambooth_gui.py | 2 +- library/common_gui.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/dreambooth_gui.py b/dreambooth_gui.py index f5cba87..0abe59f 100644 --- a/dreambooth_gui.py +++ b/dreambooth_gui.py @@ -84,7 +84,7 @@ def save_configuration( # ) file_path = get_saveasfile_path(file_path) - if file_path == None: + if file_path == None or file_path == '': return original_file_path # In case a file_path was provided and the user decide to cancel the open action # Return the values of the variables as a dictionary diff --git a/library/common_gui.py b/library/common_gui.py index 7e34057..3979f77 100644 --- a/library/common_gui.py +++ b/library/common_gui.py @@ -44,11 +44,16 @@ def get_saveasfile_path(file_path='', defaultextension='.json'): root = Tk() root.wm_attributes('-topmost', 1) root.withdraw() - file_path = filedialog.asksaveasfile(filetypes = (("Config files", "*.json"), ("All files", "*")), defaultextension=defaultextension) + save_file_path = filedialog.asksaveasfile(filetypes = (("Config files", "*.json"), ("All files", "*")), defaultextension=defaultextension) root.destroy() - file_path = file_path.name + # file_path = file_path.name if file_path == '': file_path = current_file_path + else: + print(save_file_path.name) + file_path = save_file_path.name + + print(file_path) return file_path \ No newline at end of file