Skip to content

Commit

Permalink
Fix save as issue
Browse files Browse the repository at this point in the history
  • Loading branch information
bmaltais committed Dec 19, 2022
1 parent c9a62dd commit 61a9481
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dreambooth_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions library/common_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 61a9481

Please sign in to comment.