@@ -61,7 +61,7 @@ def __init__(self, app_logic, *args, **kwargs):
61
61
62
62
fileMenu = wx .Menu ()
63
63
64
- newMenuItem = fileMenu .Append (wx .ID_ANY , "&New " , "Create a new file" )
64
+ newMenuItem = fileMenu .Append (wx .ID_ANY , "&Save As... " , "Create a new file" )
65
65
self .Bind (wx .EVT_MENU , self .onNew , newMenuItem )
66
66
67
67
openMenuItem = fileMenu .Append (wx .ID_ANY , "&Open" , "Open an existing file" )
@@ -80,12 +80,6 @@ def __init__(self, app_logic, *args, **kwargs):
80
80
81
81
self .SetMenuBar (menuBar )
82
82
83
- # def onNew (self, evt=None):
84
- # print "Create menu selected"
85
- # self.file_create()
86
-
87
- # def onOpen(self, evt=None):
88
- # print "open menu selected"
89
83
90
84
def onClose (self , evt = None ):
91
85
print "close menu selected"
@@ -118,7 +112,7 @@ def onNew ( self, evt=None ):
118
112
# process the data.
119
113
if dlg .ShowModal () == wx .ID_OK :
120
114
path = dlg .GetPath ()
121
-
115
+ print "In onNew, the path is %s" % path
122
116
# Normally, at this point you would save your data using the file and path
123
117
# data that the user provided to you, but since we didn't actually start
124
118
# with any data to work with, that would be difficult.
@@ -132,6 +126,8 @@ def onNew ( self, evt=None ):
132
126
#
133
127
# You might want to add some error checking :-)
134
128
#
129
+ else :
130
+ print "The file dialog was canceled before anything was selected"
135
131
136
132
# Note that the current working dir didn't change. This is good since
137
133
# that's the way we set it up.
@@ -166,16 +162,18 @@ def onOpen(self, evt=None):
166
162
if dlg .ShowModal () == wx .ID_OK :
167
163
# This returns a Python list of files that were selected.
168
164
path = dlg .GetPath ()
169
-
165
+ print "I'd be opening file in onOpen " , path
166
+ self .app_logic .file_open ( path )
167
+ else :
168
+ print "The file dialog was canceled before anything was selected"
169
+
170
170
171
171
172
172
173
173
# Destroy the dialog. Don't do this until you are done with it!
174
174
# BAD things can happen otherwise!
175
175
dlg .Destroy ()
176
176
177
- print "I'd be opening file in onOpen " , path
178
- self .app_logic .file_open ( path )
179
177
180
178
def file_close (self ):
181
179
"""This method closes a file"""
0 commit comments