GtkSource.SnippetChunk

g GObject.InitiallyUnowned GObject.InitiallyUnowned GtkSource.SnippetChunk GtkSource.SnippetChunk GObject.InitiallyUnowned->GtkSource.SnippetChunk GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

copy ()

get_context ()

get_focus_position ()

get_spec ()

get_text ()

get_text_set ()

get_tooltip_text ()

set_context (context)

set_focus_position (focus_position)

set_spec (spec)

set_text (text)

set_text_set (text_set)

set_tooltip_text (tooltip_text)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

context

GtkSource.SnippetContext

r/w/en

The snippet context.

focus-position

int

r/w/en

The focus position for the chunk.

spec

str

r/w/en

The specification to expand using the context.

text

str

r/w/en

The text for the chunk.

text-set

bool

r/w/en

If the text property has been manually set.

tooltip-text

str

r/w/en

The tooltip text for the chunk.

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class GtkSource.SnippetChunk(**kwargs)
Bases:

GObject.InitiallyUnowned

Abstract:

No

Structure:

GtkSource.SnippetChunkClass

A chunk of text within the source snippet.

The GtkSourceSnippetChunk represents a single chunk of text that may or may not be an edit point within the snippet. Chunks that are an edit point (also called a tab stop) have the [property`SnippetChunk`:py:data::focus-position<GtkSource.SnippetChunk.props.focus_position>] property set.

classmethod new()
Return type:

GtkSource.SnippetChunk

Create a new GtkSourceSnippetChunk that can be added to a [class`Snippet`].

copy()
Returns:

A GtkSource.SnippetChunk

Return type:

GtkSource.SnippetChunk

Copies the source snippet.

get_context()
Returns:

A GtkSource.SnippetContext

Return type:

GtkSource.SnippetContext

Gets the context for the snippet insertion.

get_focus_position()
Returns:

the focus-position

Return type:

int

Gets the [property`SnippetChunk`:py:data::focus-position<GtkSource.SnippetChunk.props.focus_position>].

The focus-position is used to determine how many tabs it takes for the snippet to advanced to this chunk.

A focus-position of zero will be the last focus position of the snippet and snippet editing ends when it has been reached.

A focus-position of -1 means the chunk cannot be focused by the user.

get_spec()
Returns:

the specification, if any

Return type:

str or None

Gets the specification for the chunk.

The specification is evaluated for variables when other chunks are edited within the snippet context. If the user has changed the text, the [property`SnippetChunk`:py:data::text<GtkSource.SnippetChunk.props.text>] and [property`SnippetChunk`:py:data::text-set<GtkSource.SnippetChunk.props.text_set>] properties are updated.

get_text()
Returns:

the text of the chunk

Return type:

str

Gets the [property`SnippetChunk`:py:data::text<GtkSource.SnippetChunk.props.text>] property.

The text property is updated when the user edits the text of the chunk. If it has not been edited, the [property`SnippetChunk`:py:data::spec<GtkSource.SnippetChunk.props.spec>] property is returned.

get_text_set()
Return type:

bool

Gets the [property`SnippetChunk`:py:data::text-set<GtkSource.SnippetChunk.props.text_set>] property.

This is typically set when the user has edited a snippet chunk.

get_tooltip_text()
Return type:

str

set_context(context)
Parameters:

context (GtkSource.SnippetContext) –

set_focus_position(focus_position)
Parameters:

focus_position (int) – the focus-position

Sets the [property`SnippetChunk`:py:data::focus-position<GtkSource.SnippetChunk.props.focus_position>] property.

The focus-position is used to determine how many tabs it takes for the snippet to advanced to this chunk.

A focus-position of zero will be the last focus position of the snippet and snippet editing ends when it has been reached.

A focus-position of -1 means the chunk cannot be focused by the user.

set_spec(spec)
Parameters:

spec (str) – the new specification for the chunk

Sets the specification for the chunk.

The specification is evaluated for variables when other chunks are edited within the snippet context. If the user has changed the text, the ‘property@SnippetChunk:text and [property@SnippetChunk:text-set]’ properties are updated.

set_text(text)
Parameters:

text (str) – the text of the property

Sets the text for the snippet chunk.

This is usually used by the snippet engine to update the text, but may be useful when creating custom snippets to avoid expansion of any specification.

set_text_set(text_set)
Parameters:

text_set (bool) – the property value

Sets the [property`SnippetChunk`:py:data::text-set<GtkSource.SnippetChunk.props.text_set>] property.

This is typically set when the user has edited a snippet chunk by the snippet engine.

set_tooltip_text(tooltip_text)
Parameters:

tooltip_text (str) –

Property Details

GtkSource.SnippetChunk.props.context
Name:

context

Type:

GtkSource.SnippetContext

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The snippet context.

GtkSource.SnippetChunk.props.focus_position
Name:

focus-position

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The focus position for the chunk.

GtkSource.SnippetChunk.props.spec
Name:

spec

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The specification to expand using the context.

GtkSource.SnippetChunk.props.text
Name:

text

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The text for the chunk.

GtkSource.SnippetChunk.props.text_set
Name:

text-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

If the text property has been manually set.

GtkSource.SnippetChunk.props.tooltip_text
Name:

tooltip-text

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The tooltip text for the chunk.