Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/cca/diff/cb06850ea930/Interface.py
Дата изменения: Unknown
Дата индексирования: Sun Feb 3 10:48:42 2013
Кодировка:
cca: Interface.py diff

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)