MCPcopy Index your code
hub / github.com/python/cpython / SaveFileDialog

Class SaveFileDialog

Lib/tkinter/filedialog.py:247–272  ·  view source on GitHub ↗

File selection dialog which checks that the file may be created.

Source from the content-addressed store, hash-verified

245
246
247class SaveFileDialog(FileDialog):
248
249 """File selection dialog which checks that the file may be created."""
250
251 title = "Save File Selection Dialog"
252
253 def ok_command(self):
254 file = self.get_selection()
255 if os.path.exists(file):
256 if os.path.isdir(file):
257 self.master.bell()
258 return
259 d = Dialog(self.top,
260 title="Overwrite Existing File Question",
261 text="Overwrite existing file %r?" % (file,),
262 bitmap='questhead',
263 default=1,
264 strings=("Yes", "Cancel"))
265 if d.num != 0:
266 return
267 else:
268 head, tail = os.path.split(file)
269 if not os.path.isdir(head):
270 self.master.bell()
271 return
272 self.quit(file)
273
274
275# For the following classes and modules:

Callers 1

testFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…