small fixes

This commit is contained in:
Klemek
2021-08-27 13:27:18 +02:00
parent 9830801101
commit cca1d503f2
2 changed files with 15 additions and 6 deletions
+14 -3
View File
@@ -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)