Skip to content

Gtk.FileChooserWidget

class — extends Widget, Accessible, Buildable, ConstraintTarget, FileChooser

:::warning Deprecated since 4.10 This API is deprecated. :::

GtkFileChooserWidget is a widget for choosing files.

It exposes the FileChooser interface, and you should use the methods of this interface to interact with the widget.

Shortcuts and Gestures

GtkFileChooserWidget supports the following keyboard shortcuts:

  • <kbd>Shift</kbd>+<kbd>F10</kbd> or <kbd>Menu</kbd> opens the context menu.

The following signals have default keybindings:

CSS nodes

GtkFileChooserWidget has a single CSS node with name filechooser.

Constructors

new

@classmethod
def new(cls, action: FileChooserAction | int) -> Widget

:::warning Deprecated since 4.10 This API is deprecated. :::

Creates a new GtkFileChooserWidget.

This is a file chooser widget that can be embedded in custom windows, and it is the same widget that is used by GtkFileChooserDialog.

Parameters:

  • action — Open or save mode for the widget

Properties

search_mode

search_mode: bool  # read/write

Whether search mode is enabled.

show_time

show_time: bool  # read-only

Whether to show the time.

subtitle

subtitle: str  # read-only

The subtitle of the file chooser widget.

Signals

desktop-folder

def on_desktop_folder(self) -> None: ...

Emitted when the user asks for it.

This is a keybinding signal.

This is used to make the file chooser show the user's Desktop folder in the file list.

The default binding for this signal is <kbd>Alt</kbd>-<kbd>D</kbd>.

down-folder

def on_down_folder(self) -> None: ...

Emitted when the user asks for it.

This is a keybinding signal.

This is used to make the file chooser go to a child of the current folder in the file hierarchy. The subfolder that will be used is displayed in the path bar widget of the file chooser. For example, if the path bar is showing "/foo/bar/baz", with bar currently displayed, then this will cause the file chooser to switch to the "baz" subfolder.

The default binding for this signal is <kbd>Alt</kbd>-<kbd>Down</kbd>.

home-folder

def on_home_folder(self) -> None: ...

Emitted when the user asks for it.

This is a keybinding signal.

This is used to make the file chooser show the user's home folder in the file list.

The default binding for this signal is <kbd>Alt</kbd>-<kbd>Home</kbd>.

location-popup

def on_location_popup(self, path: str) -> None: ...

Emitted when the user asks for it.

This is a keybinding signal.

This is used to make the file chooser show a "Location" prompt which the user can use to manually type the name of the file he wishes to select.

The default bindings for this signal are <kbd>Control</kbd>-<kbd>L</kbd> with a path string of "" (the empty string). It is also bound to <kbd>/</kbd> with a path string of "/" (a slash): this lets you type / and immediately type a path name. On Unix systems, this is bound to <kbd>~</kbd> (tilde) with a path string of "~" itself for access to home directories.

location-popup-on-paste

def on_location_popup_on_paste(self) -> None: ...

Emitted when the user asks for it.

This is a keybinding signal.

This is used to make the file chooser show a "Location" prompt when the user pastes into a GtkFileChooserWidget.

The default binding for this signal is <kbd>Control</kbd>-<kbd>V</kbd>.

location-toggle-popup

def on_location_toggle_popup(self) -> None: ...

Emitted when the user asks for it.

This is a keybinding signal.

This is used to toggle the visibility of a "Location" prompt which the user can use to manually type the name of the file he wishes to select.

The default binding for this signal is <kbd>Control</kbd>-<kbd>L</kbd>.

places-shortcut

def on_places_shortcut(self) -> None: ...

Emitted when the user asks for it.

This is a keybinding signal.

This is used to move the focus to the places sidebar.

The default binding for this signal is <kbd>Alt</kbd>-<kbd>P</kbd>.

quick-bookmark

def on_quick_bookmark(self, bookmark_index: int) -> None: ...

Emitted when the user asks for it.

This is a keybinding signal.

This is used to make the file chooser switch to the bookmark specified in the bookmark_index parameter. For example, if you have three bookmarks, you can pass 0, 1, 2 to this signal to switch to each of them, respectively.

The default binding for this signal is <kbd>Alt</kbd>-<kbd>1</kbd>, <kbd>Alt</kbd>-<kbd>2</kbd>, etc. until <kbd>Alt</kbd>-<kbd>0</kbd>. Note that in the default binding, that <kbd>Alt</kbd>-<kbd>1</kbd> is actually defined to switch to the bookmark at index 0, and so on successively.

recent-shortcut

def on_recent_shortcut(self) -> None: ...

Emitted when the user asks for it.

This is a keybinding signal.

This is used to make the file chooser show the Recent location.

The default binding for this signal is <kbd>Alt</kbd>-<kbd>R</kbd>.

search-shortcut

def on_search_shortcut(self) -> None: ...

Emitted when the user asks for it.

This is a keybinding signal.

This is used to make the file chooser show the search entry.

The default binding for this signal is <kbd>Alt</kbd>-<kbd>S</kbd>.

show-hidden

def on_show_hidden(self) -> None: ...

Emitted when the user asks for it.

This is a keybinding signal.

This is used to make the file chooser display hidden files.

The default binding for this signal is <kbd>Control</kbd>-<kbd>H</kbd>.

up-folder

def on_up_folder(self) -> None: ...

Emitted when the user asks for it.

This is a keybinding signal.

This is used to make the file chooser go to the parent of the current folder in the file hierarchy.

The default binding for this signal is <kbd>Alt</kbd>-<kbd>Up</kbd>.