X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6bcfd974ef26faf6f91a62cac09827e09463fd1..aeec2045cf0fd285e12546dc4eceb9440c3dec51:/wxPython/demo/wxFileDialog.py?ds=sidebyside diff --git a/wxPython/demo/wxFileDialog.py b/wxPython/demo/wxFileDialog.py index 476efcf8bd..a87dc17194 100644 --- a/wxPython/demo/wxFileDialog.py +++ b/wxPython/demo/wxFileDialog.py @@ -1,13 +1,26 @@ from wxPython.wx import * +import os #--------------------------------------------------------------------------- +wildcard = "Python source (*.py)|*.py|" \ + "Compiled Python (*.pyc)|*.pyc|" \ + "All files (*.*)|*.*" + def runTest(frame, nb, log): - dlg = wxFileDialog(frame, "Choose a file", ".", "", "*.*", wxOPEN|wxMULTIPLE) + log.WriteText("CWD: %s\n" % os.getcwd()) + dlg = wxFileDialog(frame, "Choose a file", os.getcwd(), "", wildcard, + wxOPEN + | wxMULTIPLE + #| wxCHANGE_DIR + ) if dlg.ShowModal() == wxID_OK: - for path in dlg.GetPaths(): - log.WriteText('You selected: %s\n' % path) + paths = dlg.GetPaths() + log.WriteText('You selected %d files:' % len(paths)) + for path in paths: + log.WriteText(' %s\n' % path) + log.WriteText("CWD: %s\n" % os.getcwd()) dlg.Destroy() #--------------------------------------------------------------------------- @@ -18,46 +31,14 @@ def runTest(frame, nb, log): - - - - - - - overview = """\ -This class represents the file chooser dialog. - -wxFileDialog() ----------------------------- - -wxFileDialog(wxWindow* parent, const wxString& message = "Choose a file", const wxString& defaultDir = "" -, const wxString& defaultFile = "", const wxString& wildcard = "*.*", long style = 0, const wxPoint& pos = wxDefaultPosition) - -Constructor. Use wxFileDialog::ShowModal to show the dialog. +This class provides the file chooser dialog. -Parameters -------------------- - -parent = Parent window. - -message = Message to show on the dialog. - -defaultDir = The default directory, or the empty string. - -defaultFile = The default filename, or the empty string. - -wildcard = A wildcard, such as "*.*". - -style = A dialog style. A bitlist of: - -wxOPEN This is an open dialog (Windows only). - -wxSAVE This is a save dialog (Windows only). +""" -wxHIDE_READONLY Hide read-only files (Windows only). -wxOVERWRITE_PROMPT Prompt for a conformation if a file will be overridden (Windows only). +if __name__ == '__main__': + import sys,os + import run + run.main(['', os.path.basename(sys.argv[0])]) -pos = Dialog position. -"""