GtkSource.Completion

g GObject.GInterface GObject.GInterface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable GObject.Object GObject.Object GtkSource.Completion GtkSource.Completion GObject.Object->GtkSource.Completion Gtk.Buildable->GtkSource.Completion

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gtk.Buildable (10)

Structs:

GObject.ObjectClass (5)

add_provider (provider)

block_interactive ()

create_context (position)

get_info_window ()

get_providers ()

get_view ()

hide ()

move_window (iter)

remove_provider (provider)

show (providers, context)

unblock_interactive ()

Virtual Methods

Inherited:

GObject.Object (7), Gtk.Buildable (10)

do_activate_proposal ()

do_hide ()

do_move_cursor (step, num)

do_move_page (step, num)

do_populate_context (context)

do_proposal_activated (provider, proposal)

do_show ()

Properties

Name

Type

Flags

Short Description

accelerators

int

r/w/c

Number of proposal accelerators to show

auto-complete-delay

int

r/w/c

Completion popup delay for interactive completion

proposal-page-size

int

r/w/c

Proposal scrolling page size

provider-page-size

int

r/w/c

Provider scrolling page size

remember-info-visibility

bool

r/w/c

Remember the last info window visibility state

select-on-show

bool

r/w/c

Select first proposal when completion is shown

show-headers

bool

r/w/c

Show provider headers when proposals from multiple providers are available

show-icons

bool

r/w/c

Show provider and proposal icons in the completion popup

view

GtkSource.View

r/w/co

The GtkSource.View bound to the completion

Signals

Inherited:

GObject.Object (1)

Name

Short Description

activate-proposal

The GtkSource.Completion ::activate-proposal signal is a keybinding signal which gets emitted when the user initiates a proposal activation.

hide

Emitted when the completion window is hidden.

move-cursor

The GtkSource.Completion ::move-cursor signal is a keybinding signal which gets emitted when the user initiates a cursor movement.

move-page

The GtkSource.Completion ::move-page signal is a keybinding signal which gets emitted when the user initiates a page movement (i.e.

populate-context

Emitted just before starting to populate the completion with providers.

show

Emitted when the completion window is shown.

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class GtkSource.Completion(**kwargs)
Bases:

GObject.Object, Gtk.Buildable

Abstract:

No

Structure:

GtkSource.CompletionClass

add_provider(provider)
Parameters:

provider (GtkSource.CompletionProvider) – a GtkSource.CompletionProvider.

Raises:

GLib.Error

Returns:

True if provider was successfully added, otherwise if error is provided, it will be set with the error and False is returned.

Return type:

bool

Add a new GtkSource.CompletionProvider to the completion object. This will add a reference provider, so make sure to unref your own copy when you no longer need it.

block_interactive()

Block interactive completion. This can be used to disable interactive completion when inserting or deleting text from the buffer associated with the completion. Use GtkSource.Completion.unblock_interactive() to enable interactive completion again.

This function may be called multiple times. It will continue to block interactive completion until GtkSource.Completion.unblock_interactive() has been called the same number of times.

create_context(position)
Parameters:

position (Gtk.TextIter or None) – a Gtk.TextIter, or None.

Returns:

a new GtkSource.CompletionContext. The reference being returned is a ‘floating’ reference, so if you invoke GtkSource.Completion.show() with this context you don’t need to unref it.

Return type:

GtkSource.CompletionContext

Create a new GtkSource.CompletionContext for self. The position where the completion occurs can be specified by position. If position is None, the current cursor position will be used.

get_info_window()
Returns:

The GtkSource.CompletionInfo window associated with self.

Return type:

GtkSource.CompletionInfo

The info widget is the window where the completion displays optional extra information of the proposal.

get_providers()
Returns:

list of GtkSource.CompletionProvider.

Return type:

[GtkSource.CompletionProvider]

Get list of providers registered on self. The returned list is owned by the completion and should not be freed.

get_view()
Returns:

The GtkSource.View associated with self, or None.

Return type:

GtkSource.View or None

The GtkSource.View associated with self, or None if the view has been destroyed.

hide()

Hides the completion if it is active (visible).

move_window(iter)
Parameters:

iter (Gtk.TextIter) – a Gtk.TextIter.

Move the completion window to a specific iter.

Deprecated since version 3.8: Use GtkSource.CompletionProvider.get_start_iter() instead.

remove_provider(provider)
Parameters:

provider (GtkSource.CompletionProvider) – a GtkSource.CompletionProvider.

Raises:

GLib.Error

Returns:

True if provider was successfully removed, otherwise if error is provided, it will be set with the error and False is returned.

Return type:

bool

Remove provider from the completion.

show(providers, context)
Parameters:
Returns:

True if it was possible to the show completion window.

Return type:

bool

Starts a new completion with the specified GtkSource.CompletionContext and a list of potential candidate providers for completion.

It can be convenient for showing a completion on-the-fly, without the need to add or remove providers to the GtkSource.Completion.

Another solution is to add providers with GtkSource.Completion.add_provider(), and implement GtkSource.CompletionProvider.match() for each provider.

unblock_interactive()

Unblock interactive completion. This can be used after using GtkSource.Completion.block_interactive() to enable interactive completion again.

do_activate_proposal() virtual
do_hide() virtual

Hides the completion if it is active (visible).

do_move_cursor(step, num) virtual
Parameters:
do_move_page(step, num) virtual
Parameters:
do_populate_context(context) virtual
Parameters:

context (GtkSource.CompletionContext) –

do_proposal_activated(provider, proposal) virtual
Parameters:
Return type:

bool

do_show() virtual

Signal Details

GtkSource.Completion.signals.activate_proposal(completion)
Signal Name:

activate-proposal

Flags:

RUN_LAST, ACTION

Parameters:

completion (GtkSource.Completion) – The object which received the signal

The GtkSource.Completion ::activate-proposal signal is a keybinding signal which gets emitted when the user initiates a proposal activation.

Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control the proposal activation programmatically.

GtkSource.Completion.signals.hide(completion)
Signal Name:

hide

Flags:

RUN_LAST, ACTION

Parameters:

completion (GtkSource.Completion) – The object which received the signal

Emitted when the completion window is hidden. The default handler will actually hide the window.

GtkSource.Completion.signals.move_cursor(completion, step, num)
Signal Name:

move-cursor

Flags:

RUN_LAST, ACTION

Parameters:

The GtkSource.Completion ::move-cursor signal is a keybinding signal which gets emitted when the user initiates a cursor movement.

The Up, Down,

PageUp, PageDown, Home and End keys are bound to the normal behavior expected by those keys.

When step is equal to Gtk.ScrollStep.PAGES, the page size is defined by the GtkSource.Completion :proposal-page-size property. It is used for the PageDown and PageUp keys.

Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control the cursor programmatically.

GtkSource.Completion.signals.move_page(completion, step, num)
Signal Name:

move-page

Flags:

RUN_LAST, ACTION

Parameters:

The GtkSource.Completion ::move-page signal is a keybinding signal which gets emitted when the user initiates a page movement (i.e. switches between provider pages).

Control + Left is for going to the previous provider.

Control + Right is for going to the next provider.

Control + Home is for displaying all the providers.

Control + End is for going to the last provider.

When step is equal to Gtk.ScrollStep.PAGES, the page size is defined by the GtkSource.Completion :provider-page-size property.

Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control the page selection programmatically.

GtkSource.Completion.signals.populate_context(completion, context)
Signal Name:

populate-context

Flags:

RUN_LAST, ACTION

Parameters:

Emitted just before starting to populate the completion with providers. You can use this signal to add additional attributes in the context.

GtkSource.Completion.signals.show(completion)
Signal Name:

show

Flags:

RUN_LAST, ACTION

Parameters:

completion (GtkSource.Completion) – The object which received the signal

Emitted when the completion window is shown. The default handler will actually show the window.

Property Details

GtkSource.Completion.props.accelerators
Name:

accelerators

Type:

int

Default Value:

5

Flags:

READABLE, WRITABLE, CONSTRUCT

Number of keyboard accelerators to show for the first proposals. For example, to activate the first proposal, the user can press

Alt + 1.

GtkSource.Completion.props.auto_complete_delay
Name:

auto-complete-delay

Type:

int

Default Value:

250

Flags:

READABLE, WRITABLE, CONSTRUCT

Determines the popup delay (in milliseconds) at which the completion will be shown for interactive completion.

GtkSource.Completion.props.proposal_page_size
Name:

proposal-page-size

Type:

int

Default Value:

5

Flags:

READABLE, WRITABLE, CONSTRUCT

The scroll page size of the proposals in the completion window. In other words, when PageDown or

PageUp is pressed, the selected proposal becomes the one which is located one page size backward or forward.

See also the GtkSource.Completion ::move-cursor signal.

GtkSource.Completion.props.provider_page_size
Name:

provider-page-size

Type:

int

Default Value:

5

Flags:

READABLE, WRITABLE, CONSTRUCT

The scroll page size of the provider pages in the completion window.

See the GtkSource.Completion ::move-page signal.

GtkSource.Completion.props.remember_info_visibility
Name:

remember-info-visibility

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT

Determines whether the visibility of the info window should be saved when the completion is hidden, and restored when the completion is shown again.

GtkSource.Completion.props.select_on_show
Name:

select-on-show

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, CONSTRUCT

Determines whether the first proposal should be selected when the completion is first shown.

GtkSource.Completion.props.show_headers
Name:

show-headers

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, CONSTRUCT

Determines whether provider headers should be shown in the proposal list. It can be useful to disable when there is only one provider.

GtkSource.Completion.props.show_icons
Name:

show-icons

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, CONSTRUCT

Determines whether provider and proposal icons should be shown in the completion popup.

GtkSource.Completion.props.view
Name:

view

Type:

GtkSource.View

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The GtkSource.View bound to the completion object.