[Python-checkins] CVS: python/dist/src/Lib/lib-tk tkFileDialog.py,1.2,1.3
Martin v. L?wis
loewis@users.sourceforge.net
2001年11月07日 14:38:11 -0800
Update of /cvsroot/python/python/dist/src/Lib/lib-tk
In directory usw-pr-cvs1:/tmp/cvs-serv397/Lib/lib-tk
Modified Files:
tkFileDialog.py
Log Message:
Patch #478654: Expose tk_chooseDirectory.
Also delegate kw arguments through ** calls.
Index: tkFileDialog.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/tkFileDialog.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** tkFileDialog.py 1998年03月20日 20:45:49 1.2
--- tkFileDialog.py 2001年11月07日 22:38:08 1.3
***************
*** 65,68 ****
--- 65,72 ----
command = "tk_getSaveFile"
+ class Directory(_Dialog):
+ "Ask for a directory"
+
+ command = "tk_chooseDirectory"
#
***************
*** 72,81 ****
"Ask for a filename to open"
! return apply(Open, (), options).show()
def asksaveasfilename(**options):
"Ask for a filename to save as"
! return apply(SaveAs, (), options).show()
# FIXME: are the following two perhaps a bit too convenient?
--- 76,85 ----
"Ask for a filename to open"
! return Open(**options).show()
def asksaveasfilename(**options):
"Ask for a filename to save as"
! return SaveAs(**options).show()
# FIXME: are the following two perhaps a bit too convenient?
***************
*** 84,88 ****
"Ask for a filename to open, and returned the opened file"
! filename = apply(Open, (), options).show()
if filename:
return open(filename, mode)
--- 88,92 ----
"Ask for a filename to open, and returned the opened file"
! filename = Open(**options).show()
if filename:
return open(filename, mode)
***************
*** 92,100 ****
"Ask for a filename to save as, and returned the opened file"
! filename = apply(SaveAs, (), options).show()
if filename:
return open(filename, mode)
return None
# --------------------------------------------------------------------
--- 96,107 ----
"Ask for a filename to save as, and returned the opened file"
! filename = SaveAs(**options).show()
if filename:
return open(filename, mode)
return None
+ def askdirectory (**options):
+ "Ask for a directory, and return the file name"
+ return Directory(**options).show()
# --------------------------------------------------------------------