Module vrFileDialog
[frames] | no frames]

Module vrFileDialog



 Contains the functionality to let the user interactively choose file or directory names.

All directory names are with / as delimiters (e.g. windows c:/tmp and linux /tmp).

The filter parameter can be a list of filters, e.g. if you need a single filter use ["Windows Bitmaps (*.bmp)"] or ["Images (*.bmp *.jpg *.tif)"].

If you want to use multiple filters, populate the list with multiple entries ["Images (*.bmp *.jpg *.tif)","Textdocuments (*.txt)"].

Functions
string
getExistingDirectory(caption, directory, dirsonly, resolvesymlinks)
Opens a file dialog and lets the user choose an existing directory.
string
getOpenFileName(caption, filename, filter)
Opens a file dialog box lets the user choose a filename by clicking onto an existing file.
list of strings
getOpenFileNames(caption, filename, filter)
Opens a file dialog and lets the user choose several files by selecting them.
list of strings
getOpenFileNamesQt(caption, filename, filter)
Opens a qt file dialog and lets the user choose several files by selecting them.
string
getSaveFileName(caption, filename, filter, confirmOverwrite)
Opens a file dialog and lets the user choose a filename by clicking onto an existing file or typing in a new name.
Function Details

getExistingDirectory(caption, directory, dirsonly, resolvesymlinks)

 

Opens a file dialog and lets the user choose an existing directory.

Parameters:
  • caption (string) - The caption of the file dialog.
  • directory (string) - The start directory.
  • dirsonly (bool) - A flag indicating if only directories shall be shown. This parameter can be omitted (default is true).
  • resolvesymlinks (bool) - A flag indicating if symbolic links (linux only) shall be resolved. If true the dialog will show /var/tmp when clicking on /usr/tmp. The parameter can be omitted (default is false).
Returns: string
The directory the user has chosen or an empty string.

getOpenFileName(caption, filename, filter)

 

Opens a file dialog box lets the user choose a filename by clicking onto an existing file.

Parameters:
  • caption (string) - The caption of the file dialog.
  • filename (string) - The start filename/directory.
  • filter (list of strings) - The list of file filters.
Returns: string
The filename the user has chosen or an empty string.

getOpenFileNames(caption, filename, filter)

 

Opens a file dialog and lets the user choose several files by selecting them.

Parameters:
  • caption (string) - The caption of the file dialog.
  • filename (string) - The start filename/directory.
  • filter (list of strings) - The list of file filters.
Returns: list of strings
The list of filenames (or empty list) the user has chosen.

getOpenFileNamesQt(caption, filename, filter)

 

Opens a qt file dialog and lets the user choose several files by selecting them.

Parameters:
  • caption (string) - The caption of the file dialog.
  • filename (string) - The start filename/directory.
  • filter (list of strings) - The list of file filters.
Returns: list of strings
The list of filenames (or empty list) the user has chosen.

getSaveFileName(caption, filename, filter, confirmOverwrite)

 

Opens a file dialog and lets the user choose a filename by clicking onto an existing file or typing in a new name.

Parameters:
  • caption (string) - The caption of the file dialog.
  • filename (string) - The start filename/directory.
  • filter (list of strings) - The list of file filters.
  • confirmOverwrite (bool) - A flag indicating if the user shall be prompted to overwrite an existing filename. If true the will be prompted, else the existing filename will be returned. The parameter can be omitted (default is true).
Returns: string
The filename the user has chosen or an empty string.