Implement save project as

This commit is contained in:
mrkubax10 2024-03-03 20:21:35 +01:00
parent 7b07074989
commit d6558a77dd

11
main.py
View File

@ -89,7 +89,7 @@ def menu_file_open_project_click():
update_glyph_preview()
def menu_file_save_project_click():
def save_project(ask):
global canvas_editor
global project
@ -97,7 +97,7 @@ def menu_file_save_project_click():
return
path=None
if project.path:
if project.path and not ask:
path=project.path
else:
# show file save dialog
@ -116,9 +116,6 @@ def menu_file_save_project_click():
tkinter.messagebox.showerror("Saving project",f"Failed to save project '{path}': {e}")
def menu_file_save_project_as_click():
pass
def button_prev_glyph_click():
global canvas_editor
global project
@ -183,8 +180,8 @@ menubar=tkinter.Menu(window)
menu_file=tkinter.Menu(menubar,tearoff=False)
menu_file.add_command(label="New project",command=menu_file_new_project_click)
menu_file.add_command(label="Open project",command=menu_file_open_project_click)
menu_file.add_command(label="Save project",command=menu_file_save_project_click)
menu_file.add_command(label="Save project as",command=menu_file_save_project_as_click)
menu_file.add_command(label="Save project",command=lambda: save_project(False))
menu_file.add_command(label="Save project as",command=lambda: save_project(True))
menubar.add_cascade(label="File",menu=menu_file)
canvas_editor=EditorCanvas(project,window,bg="black")