Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d5e1cef9
Commit
d5e1cef9
authored
Dec 19, 2002
by
Kurt B. Kaiser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
If Edit window has not been saved, offer to save if user tries to Run or
Check the module.
parent
dfb80867
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
14 deletions
+21
-14
Lib/idlelib/ScriptBinding.py
Lib/idlelib/ScriptBinding.py
+21
-14
No files found.
Lib/idlelib/ScriptBinding.py
View file @
d5e1cef9
...
@@ -141,22 +141,29 @@ class ScriptBinding:
...
@@ -141,22 +141,29 @@ class ScriptBinding:
interp
.
runcode
(
code
)
interp
.
runcode
(
code
)
def
getfilename
(
self
):
def
getfilename
(
self
):
# Logic to make sure we have a saved filename
"""Get source filename. If not saved, offer to save (or create) file
# XXX Better logic would offer to save!
The debugger requires a source file. Make sure there is one, and that
the current version of the source buffer has been saved. If the user
declines to save or cancels the Save As dialog, return None.
"""
if
not
self
.
editwin
.
get_saved
():
if
not
self
.
editwin
.
get_saved
():
name
=
(
self
.
editwin
.
short_title
()
or
msg
=
"""Source Must Be Saved
self
.
editwin
.
long_title
()
or
OK to Save?"""
"Untitled"
)
mb
=
tkMessageBox
.
Message
(
self
.
errorbox
(
"Not saved"
,
title
=
"Save Before Run or Check"
,
"The buffer for %s is not saved.
\
n
"
%
name
+
message
=
msg
,
"Please save it first!"
)
icon
=
tkMessageBox
.
QUESTION
,
self
.
editwin
.
text
.
focus_set
()
type
=
tkMessageBox
.
OKCANCEL
,
return
master
=
self
.
editwin
.
text
)
reply
=
mb
.
show
()
if
reply
==
"ok"
:
self
.
editwin
.
io
.
save
(
None
)
else
:
return
None
# filename is None if file doesn't exist
filename
=
self
.
editwin
.
io
.
filename
filename
=
self
.
editwin
.
io
.
filename
if
not
filename
:
self
.
editwin
.
text
.
focus_set
()
self
.
errorbox
(
"No file name"
,
"This window has no file name"
)
return
return
filename
return
filename
def
errorbox
(
self
,
title
,
message
):
def
errorbox
(
self
,
title
,
message
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment