small fixes
This commit is contained in:
@@ -220,14 +220,25 @@ class App(ttk.Frame):
|
|||||||
self.open_file(path)
|
self.open_file(path)
|
||||||
|
|
||||||
def _file_save(self) -> None:
|
def _file_save(self) -> None:
|
||||||
|
if self.current_file.path is None:
|
||||||
|
self._file_save_as()
|
||||||
|
else:
|
||||||
self.save_file(self.current_file.path)
|
self.save_file(self.current_file.path)
|
||||||
|
|
||||||
def _file_save_as(self) -> None:
|
def _file_save_as(self) -> None:
|
||||||
path = filedialog.asksaveasfilename(
|
path = filedialog.asksaveasfilename(
|
||||||
filetypes=File.FILE_TYPES,
|
filetypes=File.FILE_TYPES,
|
||||||
defaultextension=File.FILE_TYPES,
|
defaultextension=File.FILE_TYPES,
|
||||||
initialfile=os.path.basename(self.current_file.path),
|
initialfile=(
|
||||||
initialdir=os.path.dirname(self.current_file.path),
|
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:
|
if path:
|
||||||
self.save_file(path)
|
self.save_file(path)
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
|
import os.path
|
||||||
|
|
||||||
from app import App
|
from app import App
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app = App(tk.Tk())
|
app = App(tk.Tk())
|
||||||
|
|
||||||
# TODO remove debug
|
|
||||||
app.open_file("../watchfaces/tetris-2.0/tetris.h")
|
|
||||||
|
|
||||||
app.mainloop()
|
app.mainloop()
|
||||||
|
|||||||
Reference in New Issue
Block a user