Dabo.ui.getFile

From Dabo Wiki
Jump to: navigation, search

Signature:

dabo.ui.getFile(*args, **kwargs)

Additionally, you can pass Keyword args:

  • message= Text string to use as the prompt (title of the dialog window).
  • defaultPath= Directory to use as the starting place for file dialog.
  • multiple=True Allows the selection of multiple files.

Description:

Displays the file selection dialog for the platform.

Returns:

Returns the path to the selected file, or None if no selection was made.

Comments:

The reason that getFile() has the unspecified parameter list is that it is extremely flexible in how you specify the file types you want the dialog to display. It can take a single named parameter wildcard, or you can pass in as many file extensions as you like. If the file extensions are among the types that Dabo understands, you will get a full descriptive name along with the extension. If you pass multiple extensions, the dialog's file type selector will contain an entry for each type you pass.

Understood File Extensions:

  • * (All files)
  • py (Python files)
  • cnxml (Dabo Connection files)
  • rfxml (Dabo Report Designer files)
  • cdxml (Dabo Class Designer files)
  • fsxml (Dabo FieldSpec files)
  • html (HTML files)
  • xml (XML files)
  • txt (Text files)
  • jpg (JPEG files)
  • gif (GIF files)
  • png (PNG files)
  • ico (Icon files)
  • bmp (Bitmap files)

Examples:

dabo.ui.getFile("*", defaultPath=".")  # Displays all files in current directory.
dabo.ui.getFile("py", "*")  # Displays either just Python scripts, or all files.
dabo.ui.getFile("png", "jpg", "gif")  #Allows the user to select from any of these three graphic formats.