def menu_save(self):
if len(self.cfg_file_name.get()) == 0:
self.menu_saveas()
elif self.root_element is None:
tkMessageBox.showwarning(None, "Cannot save empty configuration.")
else:
try:
with open(self.cfg_file_name.get(), "w") as handle:
write_json(self.root_element.serialize(), handle)
except IOError:
tkMessageBox.showerror(None, "Failed to save config file.")
else:
tkMessageBox.showinfo(None, "Save successful:\n{}".format(self.cfg_file_name.get()))
评论列表
文章目录