keep track of opened, saved file to appropriately prompt save xml when needed, add Save As menu option

This commit is contained in:
Huy Pham 2020-03-04 14:15:02 -08:00
parent 7dee59e86e
commit f50c1e4db4
2 changed files with 3 additions and 0 deletions

View file

@ -90,6 +90,7 @@ class MenuAction:
if file_path:
self.add_recent_file_to_gui_config(file_path)
self.app.core.save_xml(file_path)
self.app.core.xml_file = file_path
def file_open_xml(self, event: tk.Event = None):
init_dir = self.app.core.xml_dir
@ -196,3 +197,4 @@ class MenuAction:
def new_session(self):
self.prompt_save_running_session()
self.app.core.create_new_session()
self.app.core.xml_file = None

View file

@ -57,6 +57,7 @@ class Menubar(tk.Menu):
)
self.app.bind_all("<Control-o>", self.menuaction.file_open_xml)
menu.add_command(label="Save", accelerator="Ctrl+S", command=self.save)
menu.add_command(label="Save As", command=self.menuaction.file_save_as_xml)
menu.add_command(label="Reload", underline=0, state=tk.DISABLED)
self.app.bind_all("<Control-s>", self.save)