4.11. File widget class

The File class inherits QWidget Qt class.

Widget's input value

A filesystem path.

Widget's attributes

verbose
If set to False, data is never encoded (in file(s) and dir mode), the getValue function only returns the URI. The default is True.
mode
This attribute holds the mode of operation, possible values are : file for selection of a single file, files for selection of one or more files, dir for selection of a directory and save for selection of a file to save to. The default mode is file.
filter
This attribute is used to filter the content of a directory before being shown, ex: "Images (*.png *.xpm *.jpg)". To specify multiple filters, use a semicolon-separated list of filters. This attribute is ignored in the dir mode.
init
This attribute holds the initial directory shown in the selection dialog, it defaults to "~" which correspond to the current user's home.
max_size
Prevent selection of items with a size greater than max_size. It defaults to 0 which means no size limit.
ro_editor
If set to True, the line edit will be read only and it is not possible to enter a path manually.

Widget's output value

A dict in the form {'uri':URI, 'data':DATA}.

If mode is file, URI is the path of the file and DATA is a base64 representation of the file's content.

If mode is files, URI is a list of files paths and DATA is a list of base64 representations is the same order as URI.

If mode is dir, URI is the path of the directory and DATA is a base64 representation of a tar file of the directory.

If mode is save, URI is the path of the selected file and DATA is None.

If verbose is False, DATA is always None.