GtkSource.SnippetChunk¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
The snippet context. |
||
r/w/en |
The focus position for the chunk. |
||
r/w/en |
The specification to expand using the context. |
||
r/w/en |
The text for the chunk. |
||
r/w/en |
If the text property has been manually set. |
||
r/w/en |
The tooltip text for the chunk. |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class GtkSource.SnippetChunk(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
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:
Create a new
GtkSourceSnippetChunk
that can be added to a [class`Snippet`].
- copy()¶
- Returns:
- Return type:
Copies the source snippet.
- get_context()¶
- Returns:
- Return type:
Gets the context for the snippet insertion.
- get_focus_position()¶
- Returns:
the focus-position
- Return type:
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()¶
-
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:
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:
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.
- 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.
Property Details¶
- GtkSource.SnippetChunk.props.context¶
- Name:
context
- Type:
- Default Value:
- Flags:
The snippet context.
- GtkSource.SnippetChunk.props.focus_position¶
- Name:
focus-position
- Type:
- Default Value:
-1
- Flags:
The focus position for the chunk.
- GtkSource.SnippetChunk.props.spec¶
- Name:
spec
- Type:
- Default Value:
- Flags:
The specification to expand using the context.
- GtkSource.SnippetChunk.props.text¶
- Name:
text
- Type:
- Default Value:
- Flags:
The text for the chunk.
- GtkSource.SnippetChunk.props.text_set¶
- Name:
text-set
- Type:
- Default Value:
- Flags:
If the text property has been manually set.