GimpUi.FileChooser

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.Orientable Gtk.Orientable GObject.GInterface->Gtk.Orientable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned GimpUi.FileChooser GimpUi.FileChooser Gtk.Box Gtk.Box Gtk.Box->GimpUi.FileChooser Gtk.Buildable->Gtk.Widget Gtk.Container Gtk.Container Gtk.Container->Gtk.Box Gtk.Orientable->Gtk.Box Gtk.Widget->Gtk.Container

Subclasses:

None

Methods

Inherited:

Gtk.Box (14), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gtk.Orientable (2)

Structs:

Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)

class

new (action, label, title, file)

get_action ()

get_file ()

get_label ()

get_label_widget ()

get_title ()

set_action (action)

set_file (file)

set_label (text)

set_title (text)

Virtual Methods

Inherited:

Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10)

Properties

Inherited:

Gtk.Box (3), Gtk.Container (3), Gtk.Widget (39), Gtk.Orientable (1)

Name

Type

Flags

Short Description

action

Gimp.FileChooserAction

r/w/en

The action determining the chooser UI

file

Gio.File

r/w/en

The currently selected file

label

str

r/w/en

The label to be used next to the button

title

str

r/w/en

The title to be used for the file selection popup dialog and as placeholder text in file entry.

Child Properties

Inherited:

Gtk.Box (5)

Style Properties

Inherited:

Gtk.Widget (17)

Signals

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Fields

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Class Details

class GimpUi.FileChooser(*args, **kwargs)
Bases:

Gtk.Box

Abstract:

No

Structure:

GimpUi.FileChooserClass

The chooser contains an optional label and other interface allowing to select files for different use cases.

New in version 3.0.

classmethod new(action, label, title, file)
Parameters:
Returns:

A [class`GimpUi`.FileChooser].

Return type:

Gtk.Widget

Creates a new Gtk.Widget that lets a user choose a file according to action.

[enum`Gimp`.FileChooserAction.ANY] is not a valid value for action.

New in version 3.0.

get_action()
Returns:

the action which determined the UI of self.

Return type:

Gimp.FileChooserAction

Gets the current action.

New in version 3.0.

get_file()
Returns:

an internal copy of the file which must not be freed.

Return type:

Gio.File

Gets the currently selected file.

New in version 3.0.

get_label()
Returns:

the label set.

Return type:

str or None

Gets the current label text. A None label means that the label widget is hidden.

Note: the label text may contain a mnemonic.

New in version 3.0.

get_label_widget()
Returns:

the [class`Gtk`.Widget] showing the label text.

Return type:

Gtk.Widget

Returns the label widget. This can be useful for instance when aligning dialog’s widgets with a [class`Gtk`.SizeGroup].

New in version 3.0.

get_title()
Returns:

the text used for the title of self's dialog.

Return type:

str or None

Gets the text currently used for the file dialog’s title and for entry’s placeholder text.

A None value means that the file dialog uses default title and the entry has no placeholder text.

New in version 3.0.

set_action(action)
Parameters:

action (Gimp.FileChooserAction) – Action to set.

Changes how self is set to select a file. It may completely change the internal widget structure so you should not depend on a specific widget composition.

Warning: with GTK deprecations, we may have soon to change the internal implementation. So this is all the more reason for you not to rely on specific child widgets being present (e.g.: we use currently [class`Gtk`.FileChooserButton] internally but it was removed in GTK4 so we will eventually replace it by custom code). We will also likely move to native file dialogs at some point.

[enum`Gimp`.FileChooserAction.ANY] is not a valid value for action.

New in version 3.0.

set_file(file)
Parameters:

file (Gio.File) – File to set.

Sets the currently selected file.

New in version 3.0.

set_label(text)
Parameters:

text (str or None) – Label text.

Set the label text with mnemonic.

Setting a None label text will hide the label widget.

New in version 3.0.

set_title(text)
Parameters:

text (str or None) – Dialog’s title text.

Set the text to be used for the file dialog’s title and for entry’s placeholder text.

Setting a None title text will mean that the file dialog will use a generic title and there will be no placeholder text in the entry.

New in version 3.0.

Property Details

GimpUi.FileChooser.props.action
Name:

action

Type:

Gimp.FileChooserAction

Default Value:

Gimp.FileChooserAction.OPEN

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The action determining the chooser UI.

New in version 3.0.

GimpUi.FileChooser.props.file
Name:

file

Type:

Gio.File

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The currently selected file.

New in version 3.0.

GimpUi.FileChooser.props.label
Name:

label

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Label text with mnemonic.

New in version 3.0.

GimpUi.FileChooser.props.title
Name:

title

Type:

str

Default Value:

'File Selection'

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The title to be used for the file selection popup dialog. If None, the “label” property is used instead.

New in version 3.0.