cca
diff Interface.py @ 76:cb06850ea930
correct defect in save file
author | is_rusinov |
---|---|
date | Sun, 12 Dec 2010 13:54:51 +0300 |
parents | e39ec20208de |
children | c18bb7548057 |
line diff
1.1 --- a/Interface.py Sun Dec 12 13:41:37 2010 +0300 1.2 +++ b/Interface.py Sun Dec 12 13:54:51 2010 +0300 1.3 @@ -47,7 +47,8 @@ 1.4 1.5 def save_file(self, event=None): 1.6 file = tkFileDialog.asksaveasfile(defaultextension=".caf", title="Save automata as", filetypes=[('Cyclic cell Automata File', '*.caf')]) 1.7 - pickle.dump([automata.field, automata.states], file) 1.8 + if file != None: 1.9 + pickle.dump([automata.field, automata.states], file) 1.10 1.11 def open_file(self, event=None): 1.12 file = tkFileDialog.askopenfile(title="Open file", filetypes=[('Cyclic cell Automata File', '*.caf')]) 1.13 @@ -673,7 +674,8 @@ 1.14 menu_file = Menu(menubar) 1.15 menu_file.add_command(label="New", command=handlers.new_file) 1.16 menu_file.add_command(label="Open...", command=handlers.open_file) 1.17 -menu_file.add_command(label="Save...", command=handlers.save_file) 1.18 +menu_file.add_command(label="Save...", command=handlers.save_file, accelerator="Ctrl+S") 1.19 +menu_file.bind_all("<Control-s>", handlers.save_file) 1.20 menu_file.add_separator() 1.21 menu_file.add_command(label="Exit", command=root.destroy) 1.22 menubar.add_cascade(label="File", menu=menu_file)