dabo Commit
Revision 869
Date: 2005-03-02 13:26:22 -0800 (Wed, 02 Mar 2005)
Author: ed
Changed:
U trunk/ui/uiwx/__init__.py
Log:
Changed the parameters to the getFile() function. Since most of the time that this will be used, it will be called with one or more file extensions, I modified the params so that you can use commands such as:
f = dabo.ui.getFile("py")
=> Only *.py files are listed
f = dabo.ui.getFile("html", "xml")
=> You get a choice of filtering on either HTML or XML files
f = dabo.ui.getFile("py", "txt", defaultPath="/home/ed")
=> *.py and *.txt are your filter options, and the dialog
will start in the /home/ed directory.
Diff:
Modified: trunk/ui/uiwx/__init__.py
===================================================================
--- trunk/ui/uiwx/__init__.py 2005-03-02 14:12:08 UTC (rev 868)
+++ trunk/ui/uiwx/__init__.py 2005-03-02 21:26:22 UTC (rev 869)
@@ -93,9 +93,14 @@
fd.release()
return ret
-def getFile(message="Choose a file", defaultPath="", defaultFile="", wildcard="*"):
- return _getPath(dFileDialog, message=message, defaultPath=defaultPath,
- defaultFile=defaultFile, wildcard=wildcard)
+def getFile(*args, **kwargs):
+ wc = "*"
+ if args:
+ arglist = []
+ for a in args:
+ arglist.append("%s files (*.%s)|*.%s" % (a,a,a))
+ wc = "|".join(arglist)
+ return _getPath(dFileDialog, wildcard=wc, **kwargs)
def getSaveAs(message="Save to:", defaultPath="", defaultFile="", wildcard="*"):
return _getPath(dSaveDialog, message=message, defaultPath=defaultPath,