gtk.file_dialog
Module for [FileDialog] class
Types 3
A [gtk.file_dialog.FileDialog] object collects the arguments that are needed to present a file chooser dialog to the user, such as a title for the dialog and whether it should be modal.
The dialog is shown with [gtk.file_dialog.FileDialog.open], [gtk.file_dialog.FileDialog.save], etc. These APIs follow the GIO async pattern, and the result can be obtained by calling the corresponding finish function, for example [gtk.file_dialog.FileDialog.openFinish].
Methods
FileDialog self()Returns `this`, for use in `with` statements.FileDialogGidBuilder builder()Get builder for [gtk.file_dialog.FileDialog] Returns: New builder objectstring acceptLabel() @propertyGet `acceptLabel` property. Returns: Label for the file chooser's accept button.void acceptLabel(string propval) @propertySet `acceptLabel` property. Params: propval = Label for the file chooser's accept button.gtk.file_filter.FileFilter defaultFilter() @propertyGet `defaultFilter` property. Returns: The default filter, that is, the filter that is initially active in the file chooser dialog.void defaultFilter(gtk.file_filter.FileFilter propval) @propertySet `defaultFilter` property. Params: propval = The default filter, that is, the filter that is initially active in the file chooser dialog.void filters(gio.list_model.ListModel propval) @propertySet `filters` property. Params: propval = The list of filters.gio.file.File initialFile() @propertyGet `initialFile` property. Returns: The initial file, that is, the file that is initially selected in the file chooser dialogvoid initialFile(gio.file.File propval) @propertySet `initialFile` property. Params: propval = The initial file, that is, the file that is initially selected in the file chooser dialoggio.file.File initialFolder() @propertyGet `initialFolder` property. Returns: The initial folder, that is, the directory that is initially opened in the file chooser dialogvoid initialFolder(gio.file.File propval) @propertySet `initialFolder` property. Params: propval = The initial folder, that is, the directory that is initially opened in the file chooser dialogstring initialName() @propertyGet `initialName` property. Returns: The initial name, that is, the filename that is initially selected in the file chooser dialog.void initialName(string propval) @propertySet `initialName` property. Params: propval = The initial name, that is, the filename that is initially selected in the file chooser dialog.void modal(bool propval) @propertySet `modal` property. Params: propval = Whether the file chooser dialog is modal.string title() @propertyGet `title` property. Returns: A title that may be shown on the file chooser dialog.void title(string propval) @propertySet `title` property. Params: propval = A title that may be shown on the file chooser dialog.string getAcceptLabel()gtk.file_filter.FileFilter getDefaultFilter()Gets the filter that will be selected by default in the file chooser dialog. Returns: the current filtergio.list_model.ListModel getFilters()Gets the filters that will be offered to the user in the file chooser dialog. Returns: the filters, as a [gio.list_model.ListModel] of `GtkFileFilters`gio.file.File getInitialFile()Gets the file that will be initially selected in the file chooser dialog. Returns: the filegio.file.File getInitialFolder()Gets the folder that will be set as the initial folder in the file chooser dialog. Returns: the folderstring getInitialName()Gets the name for the file that should be initially set. Returns: the namebool getModal()Returns whether the file chooser dialog blocks interaction with the parent window while it is presented. Returns: `TRUE` if the file chooser dialog is modalstring getTitle()Returns the title that will be shown on the file chooser dialog. Returns: the titlevoid open(gtk.window.Window parent = null, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)This function initiates a file selection operation by presenting a file chooser dialog to the user.gio.file.File openFinish(gio.async_result.AsyncResult result)Finishes the [gtk.file_dialog.FileDialog.open] call and returns the resulting file.void openMultiple(gtk.window.Window parent = null, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)This function initiates a multi-file selection operation by presenting a file chooser dialog to the user.gio.list_model.ListModel openMultipleFinish(gio.async_result.AsyncResult result)Finishes the [gtk.filedialog.FileDialog.open] call and returns the resulting files in a [gio.listmodel.ListModel].void save(gtk.window.Window parent = null, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)This function initiates a file save operation by presenting a file chooser dialog to the user.gio.file.File saveFinish(gio.async_result.AsyncResult result)Finishes the [gtk.file_dialog.FileDialog.save] call and returns the resulting file.void selectFolder(gtk.window.Window parent = null, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)This function initiates a directory selection operation by presenting a file chooser dialog to the user.gio.file.File selectFolderFinish(gio.async_result.AsyncResult result)Finishes the [gtk.file_dialog.FileDialog.selectFolder] call and returns the resulting file.void selectMultipleFolders(gtk.window.Window parent = null, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)This function initiates a multi-directory selection operation by presenting a file chooser dialog to the user.gio.list_model.ListModel selectMultipleFoldersFinish(gio.async_result.AsyncResult result)Finishes the [gtk.filedialog.FileDialog.selectMultipleFolders] call and returns the resulting files in a [gio.listmodel.ListModel].void setAcceptLabel(string acceptLabel = null)Sets the label shown on the file chooser's accept button.void setDefaultFilter(gtk.file_filter.FileFilter filter = null)Sets the filter that will be selected by default in the file chooser dialog.void setFilters(gio.list_model.ListModel filters = null)Sets the filters that will be offered to the user in the file chooser dialog.void setInitialFile(gio.file.File file = null)Sets the file that will be initially selected in the file chooser dialog.void setInitialFolder(gio.file.File folder = null)Sets the folder that will be set as the initial folder in the file chooser dialog.void setInitialName(string name = null)Sets the name for the file that should be initially set. For saving dialogs, this will usually be pre-entered into the name field.void setModal(bool modal)Sets whether the file chooser dialog blocks interaction with the parent window while it is presented.void setTitle(string title)Sets the title that will be shown on the file chooser dialog.Methods
T acceptLabel(string propval)Set `acceptLabel` property. Params: propval = Label for the file chooser's accept button. Returns: Builder instance for fluent chainingT defaultFilter(gtk.file_filter.FileFilter propval)Set `defaultFilter` property. Params: propval = The default filter, that is, the filter that is initially active in the file chooser dialog.T filters(gio.list_model.ListModel propval)Set `filters` property. Params: propval = The list of filters.T initialFile(gio.file.File propval)Set `initialFile` property. Params: propval = The initial file, that is, the file that is initially selected in the file chooser dialogT initialFolder(gio.file.File propval)Set `initialFolder` property. Params: propval = The initial folder, that is, the directory that is initially opened in the file chooser dialog Returns: Builder instance for fluent chainingT initialName(string propval)Set `initialName` property. Params: propval = The initial name, that is, the filename that is initially selected in the file chooser dialog. Returns: Builder instance for fluent chainingT modal(bool propval)Set `modal` property. Params: propval = Whether the file chooser dialog is modal. Returns: Builder instance for fluent chainingT title(string propval)Set `title` property. Params: propval = A title that may be shown on the file chooser dialog. Returns: Builder instance for fluent chainingFluent builder for [gtk.file_dialog.FileDialog]
Methods