Skip to content

Gio.FilenameCompleter

class — extends GObject.Object

Completes partial file and directory names given a partial string by looking in the file system for clues. Can return a list of possible completion strings for widget implementations.

Constructors

new

@classmethod
def new(cls) -> FilenameCompleter

Creates a new filename completer.

Methods

get_completion_suffix

def get_completion_suffix(self, initial_text: str) -> str | None

Obtains a suffix completion for initial_text from completer.

Suffix will be an empty string if there's no shared suffix among matching completions. If there's no matching completions anyway, NULL is returned.

Parameters:

  • initial_text — text to be completed.

get_completions

def get_completions(self, initial_text: str) -> list[str]

Gets an array of completion strings for a given initial text.

Parameters:

  • initial_text — text to be completed.

set_dirs_only

def set_dirs_only(self, dirs_only: bool) -> None

If dirs_only is True, completer will only complete directory names, and not file names.

This function needs to be called before waiting for results from the completer to be populated.

Parameters:

  • dirs_only — a #gboolean.

Virtual methods

do_got_completion_data

def do_got_completion_data(self) -> None

Signals

got-completion-data

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

Emitted when the file name completion information comes available.