diff --git a/watchy-image-editor/app.py b/watchy-image-editor/app.py index 1e130c1..c2fb7cc 100644 --- a/watchy-image-editor/app.py +++ b/watchy-image-editor/app.py @@ -220,14 +220,25 @@ class App(ttk.Frame): self.open_file(path) def _file_save(self) -> None: - self.save_file(self.current_file.path) + if self.current_file.path is None: + self._file_save_as() + else: + self.save_file(self.current_file.path) def _file_save_as(self) -> None: path = filedialog.asksaveasfilename( filetypes=File.FILE_TYPES, defaultextension=File.FILE_TYPES, - initialfile=os.path.basename(self.current_file.path), - initialdir=os.path.dirname(self.current_file.path), + initialfile=( + os.path.basename(self.current_file.path) + if self.current_file.path is not None + else None + ), + initialdir=( + os.path.dirname(self.current_file.path) + if self.current_file.path is not None + else None + ), ) if path: self.save_file(path) diff --git a/watchy-image-editor/main.py b/watchy-image-editor/main.py index 508fb56..30b0417 100644 --- a/watchy-image-editor/main.py +++ b/watchy-image-editor/main.py @@ -1,11 +1,9 @@ import tkinter as tk +import os.path from app import App if __name__ == "__main__": app = App(tk.Tk()) - # TODO remove debug - app.open_file("../watchfaces/tetris-2.0/tetris.h") - app.mainloop()