enaml.widgets.file_dialog

Classes

FileDialog

A dialog widget that allows the user to open and save files and directories.

class enaml.widgets.file_dialog.FileDialog(parent=None, **kwargs)[source]

Bases: enaml.widgets.toolkit_object.ToolkitObject

A dialog widget that allows the user to open and save files and directories.

title

The title to use for the dialog.

mode

The mode of the dialog.

path

The selected path in the dialog. This value will be used to set the initial working directory and file, as appropriate, when the dialog is opened. It will aslo be updated when the dialog is closed and accepted.

paths

The list of selected paths in the dialog. It will be updated when the dialog is closed and accepted. It is output only and is only applicable for the open_files mode.

filters

The string filters used to restrict the user’s selections.

selected_filter

The selected filter from the list of filters. This value will be used as the initial working filter when the dialog is opened. It will also be updated when the dialog is closed and accepted.

native_dialog

Whether to use a platform native dialog, when available. This attribute is deprecated and no longer has any effect. Native dialogs are always used when available in a given toolkit.

result

An enum indicating if the dialog was accepted or rejected by the user. It will be updated when the dialog is closed. This value is output only.

callback

An optional callback which will be invoked when the dialog is closed. This is a convenience to make it easier to handle a dialog opened in non-blocking mode. The callback must accept a single argument, which will be the dialog instance.

accepted

An event fired if the dialog is accepted. The payload will be the selected path.

rejected

An event fired when the dialog is rejected. It has no payload.

closed

An event fired when the dialog is closed. It has no payload.

destroy_on_close

Whether to destroy the dialog widget on close. The default is True since dialogs are typically used in a transitory fashion.

proxy

A reference to the ProxyFileDialog object.

open()[source]

Open the dialog in a non-blocking fashion.

This method will always return None. The state of the dialog will be updated when the dialog is closed by the user.

exec_()[source]

Open the dialog in a blocking fashion.

Returns

result – The path selected by the user, or an empty string if the dialog is cancelled.

Return type

unicode