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
fba37580
Commit
fba37580
authored
May 12, 2011
by
Kurt B. Kaiser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #11896: Save on Close failed despite selecting "Yes" in dialog.
Backport 70055:35ed0efd7dd3
parent
1b737dd1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
32 deletions
+34
-32
Lib/idlelib/IOBinding.py
Lib/idlelib/IOBinding.py
+22
-22
Lib/idlelib/NEWS.txt
Lib/idlelib/NEWS.txt
+5
-1
Lib/idlelib/ScriptBinding.py
Lib/idlelib/ScriptBinding.py
+7
-9
No files found.
Lib/idlelib/IOBinding.py
View file @
fba37580
...
...
@@ -320,17 +320,20 @@ class IOBinding:
return
"yes"
message
=
"Do you want to save %s before closing?"
%
(
self
.
filename
or
"this untitled document"
)
m
=
tkMessageBox
.
Message
(
title
=
"Save On Close"
,
message
=
message
,
icon
=
tkMessageBox
.
QUESTION
,
type
=
tkMessageBox
.
YESNOCANCEL
,
master
=
self
.
text
)
reply
=
m
.
show
()
if
reply
==
"yes"
:
confirm
=
tkMessageBox
.
askyesnocancel
(
title
=
"Save On Close"
,
message
=
message
,
default
=
tkMessageBox
.
YES
,
master
=
self
.
text
)
if
confirm
:
reply
=
"yes"
self
.
save
(
None
)
if
not
self
.
get_saved
():
reply
=
"cancel"
elif
confirm
is
None
:
reply
=
"cancel"
else
:
reply
=
"no"
self
.
text
.
focus_set
()
return
reply
...
...
@@ -339,7 +342,7 @@ class IOBinding:
self
.
save_as
(
event
)
else
:
if
self
.
writefile
(
self
.
filename
):
self
.
set_saved
(
1
)
self
.
set_saved
(
True
)
try
:
self
.
editwin
.
store_file_breaks
()
except
AttributeError
:
# may be a PyShell
...
...
@@ -465,15 +468,12 @@ class IOBinding:
self
.
text
.
insert
(
"end-1c"
,
"
\
n
"
)
def
print_window
(
self
,
event
):
m
=
tkMessageBox
.
Message
(
title
=
"Print"
,
message
=
"Print to Default Printer"
,
icon
=
tkMessageBox
.
QUESTION
,
type
=
tkMessageBox
.
OKCANCEL
,
default
=
tkMessageBox
.
OK
,
master
=
self
.
text
)
reply
=
m
.
show
()
if
reply
!=
tkMessageBox
.
OK
:
confirm
=
tkMessageBox
.
askokcancel
(
title
=
"Print"
,
message
=
"Print to Default Printer"
,
default
=
tkMessageBox
.
OK
,
master
=
self
.
text
)
if
not
confirm
:
self
.
text
.
focus_set
()
return
"break"
tempfilename
=
None
...
...
@@ -488,8 +488,8 @@ class IOBinding:
if
not
self
.
writefile
(
tempfilename
):
os
.
unlink
(
tempfilename
)
return
"break"
platform
=
os
.
name
printPlatform
=
1
platform
=
os
.
name
printPlatform
=
True
if
platform
==
'posix'
:
#posix platform
command
=
idleConf
.
GetOption
(
'main'
,
'General'
,
'print-command-posix'
)
...
...
@@ -497,7 +497,7 @@ class IOBinding:
elif
platform
==
'nt'
:
#win32 platform
command
=
idleConf
.
GetOption
(
'main'
,
'General'
,
'print-command-win'
)
else
:
#no printing for this platform
printPlatform
=
0
printPlatform
=
False
if
printPlatform
:
#we can try to print for this platform
command
=
command
%
filename
pipe
=
os
.
popen
(
command
,
"r"
)
...
...
@@ -511,7 +511,7 @@ class IOBinding:
output
=
"Printing command: %s
\
n
"
%
repr
(
command
)
+
output
tkMessageBox
.
showerror
(
"Print status"
,
output
,
master
=
self
.
text
)
else
:
#no printing for this platform
message
=
"Printing is not enabled for this platform: %s"
%
platform
message
=
"Printing is not enabled for this platform: %s"
%
platform
tkMessageBox
.
showinfo
(
"Print status"
,
message
,
master
=
self
.
text
)
if
tempfilename
:
os
.
unlink
(
tempfilename
)
...
...
Lib/idlelib/NEWS.txt
View file @
fba37580
...
...
@@ -3,8 +3,12 @@ What's New in IDLE 2.7.2?
*Release date: XX-XX-XXXX*
- Issue #11896: Save on Close failed despite selecting "Yes" in dialog.
- <Home> toggle failing on Tk 8.5, causing IDLE exits and strange selection
behavior. Issue 4676. Improve selection extension behaviour.
- <Home> toggle non-functional when NumLock set on Windows. Issue 3851.
...
...
@@ -31,7 +35,7 @@ What's New in IDLE 2.7?
- Tk 8.5 Text widget requires 'wordprocessor' tabstyle attr to handle
mixed space/tab properly. Issue 5129, patch by Guilherme Polo.
- Issue #3549: On MacOS the preferences menu was not present
...
...
Lib/idlelib/ScriptBinding.py
View file @
fba37580
...
...
@@ -184,9 +184,9 @@ class ScriptBinding:
if
autosave
and
filename
:
self
.
editwin
.
io
.
save
(
None
)
else
:
reply
=
self
.
ask_save_dialog
()
confirm
=
self
.
ask_save_dialog
()
self
.
editwin
.
text
.
focus_set
()
if
reply
==
"ok"
:
if
confirm
:
self
.
editwin
.
io
.
save
(
None
)
filename
=
self
.
editwin
.
io
.
filename
else
:
...
...
@@ -195,13 +195,11 @@ class ScriptBinding:
def
ask_save_dialog
(
self
):
msg
=
"Source Must Be Saved
\
n
"
+
5
*
' '
+
"OK to Save?"
mb
=
tkMessageBox
.
Message
(
title
=
"Save Before Run or Check"
,
message
=
msg
,
icon
=
tkMessageBox
.
QUESTION
,
type
=
tkMessageBox
.
OKCANCEL
,
default
=
tkMessageBox
.
OK
,
master
=
self
.
editwin
.
text
)
return
mb
.
show
()
confirm
=
tkMessageBox
.
askokcancel
(
title
=
"Save Before Run or Check"
,
message
=
msg
,
default
=
tkMessageBox
.
OK
,
master
=
self
.
editwin
.
text
)
return
confirm
def
errorbox
(
self
,
title
,
message
):
# XXX This should really be a function of EditorWindow...
...
...
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