Implement project saving

This commit is contained in:
2024-03-02 22:35:58 +01:00
parent f552becc18
commit 164b71a0c3
2 changed files with 32 additions and 1 deletions

21
main.py
View File

@@ -46,7 +46,26 @@ def menu_file_open_project_click():
def menu_file_save_project_click():
pass
global project
path=None
if project.loaded:
path=project.path
else:
# show file save dialog
path=filedialog.asksaveasfilename(
title="Save font project",
filetypes=[("Font project (json)", "*.fontproj")],
defaultextension=".fontproj"
)
if path=="":
return
try:
project.save(path)
except IOError as e:
tkinter.messagebox.showerror("Saving project",f"Failed to save project '{path}': {e}")
def menu_file_save_project_as_click():
pass