From d6558a77dddc35df49ec369552f313eab6160e28 Mon Sep 17 00:00:00 2001 From: mrkubax10 Date: Sun, 3 Mar 2024 20:21:35 +0100 Subject: [PATCH] Implement save project as --- main.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index d931aee..89a7024 100644 --- a/main.py +++ b/main.py @@ -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")