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
e0b2c6c4
Commit
e0b2c6c4
authored
Jun 14, 2003
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly deal with tuples in Open._fixresult. Fixes bug reported in
follow-up to #621891.
parent
dd51b4a2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
5 deletions
+20
-5
Lib/lib-tk/tkFileDialog.py
Lib/lib-tk/tkFileDialog.py
+16
-3
Modules/_tkinter.c
Modules/_tkinter.c
+4
-2
No files found.
Lib/lib-tk/tkFileDialog.py
View file @
e0b2c6c4
...
@@ -76,6 +76,21 @@ class Open(_Dialog):
...
@@ -76,6 +76,21 @@ class Open(_Dialog):
command
=
"tk_getOpenFile"
command
=
"tk_getOpenFile"
def
_fixresult
(
self
,
widget
,
result
):
if
isinstance
(
result
,
tuple
):
# multiple results:
result
=
tuple
([
getattr
(
r
,
"string"
,
r
)
for
r
in
result
])
if
result
:
import
os
path
,
file
=
os
.
path
.
split
(
result
[
0
])
self
.
options
[
"initialdir"
]
=
path
# don't set initialfile or filename, as we have multiple of these
return
result
if
not
widget
.
tk
.
wantobjects
()
and
"multiple"
in
self
.
options
:
# Need to split result explicitly
return
self
.
_fixresult
(
widget
,
widget
.
tk
.
splitlist
(
result
))
return
_Dialog
.
_fixresult
(
widget
,
result
)
class
SaveAs
(
_Dialog
):
class
SaveAs
(
_Dialog
):
"Ask for a filename to save as"
"Ask for a filename to save as"
...
@@ -115,9 +130,7 @@ def askopenfilenames(**options):
...
@@ -115,9 +130,7 @@ def askopenfilenames(**options):
cancel button selected
cancel button selected
"""
"""
options
[
"multiple"
]
=
1
options
[
"multiple"
]
=
1
files
=
Open
(
**
options
).
show
()
return
Open
(
**
options
).
show
()
return
files
.
split
()
# FIXME: are the following perhaps a bit too convenient?
# FIXME: are the following perhaps a bit too convenient?
...
...
Modules/_tkinter.c
View file @
e0b2c6c4
...
@@ -2604,9 +2604,11 @@ static PyObject *
...
@@ -2604,9 +2604,11 @@ static PyObject *
Tkapp_WantObjects
(
PyObject
*
self
,
PyObject
*
args
)
Tkapp_WantObjects
(
PyObject
*
self
,
PyObject
*
args
)
{
{
int
wantobjects
;
int
wantobjects
=
-
1
;
if
(
!
PyArg_ParseTuple
(
args
,
"i:wantobjects"
,
&
wantobjects
))
if
(
!
PyArg_ParseTuple
(
args
,
"
|
i:wantobjects"
,
&
wantobjects
))
return
NULL
;
return
NULL
;
if
(
wantobjects
==
-
1
)
return
PyBool_FromLong
(((
TkappObject
*
)
self
)
->
wantobjects
);
((
TkappObject
*
)
self
)
->
wantobjects
=
wantobjects
;
((
TkappObject
*
)
self
)
->
wantobjects
=
wantobjects
;
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
...
...
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