fix Ctrl-S issue and node context menu issue

This commit is contained in:
Huy Pham 2020-01-17 15:59:12 -08:00
parent b8ded52a66
commit 88625ffad8
6 changed files with 32 additions and 9 deletions

View file

@ -52,11 +52,9 @@ class Menubar(tk.Menu):
label="Open...", command=self.menuaction.file_open_xml, accelerator="Ctrl+O"
)
self.app.bind_all("<Control-o>", self.menuaction.file_open_xml)
menu.add_command(
label="Save", accelerator="Ctrl+S", command=self.menuaction.file_save_as_xml
)
menu.add_command(label="Save", accelerator="Ctrl+S", command=self.save)
menu.add_command(label="Reload", underline=0, state=tk.DISABLED)
self.app.bind_all("<Control-s>", self.menuaction.file_save_as_xml)
self.app.bind_all("<Control-s>", self.save)
menu.add_separator()
menu.add_command(label="Export Python script...", state=tk.DISABLED)
menu.add_command(label="Execute XML or Python script...", state=tk.DISABLED)
@ -410,3 +408,13 @@ class Menubar(tk.Menu):
)
menu.add_command(label="About", command=self.menuaction.show_about)
self.add_cascade(label="Help", menu=menu)
def save(self):
print("save")
xml_file = self.app.core.xml_file
print(xml_file is None)
if xml_file:
print("go here")
self.app.core.save_xml(xml_file)
else:
self.menuaction.file_save_as_xml()