:right-sidebar: True SnippetChunk =================================================================== .. currentmodule:: gi.repository.GtkSource .. class:: SnippetChunk(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` 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 :obj:`~gi.repository.GtkSource.SnippetChunk.props.focus_position` property set. Constructors ------------ .. rst-class:: interim-class .. class:: SnippetChunk :no-index: .. classmethod:: new() -> ~gi.repository.GtkSource.SnippetChunk Create a new ``GtkSourceSnippetChunk`` that can be added to a :obj:`~gi.repository.GtkSource.Snippet`\. Methods ------- .. rst-class:: interim-class .. class:: SnippetChunk :no-index: .. method:: get_context() -> ~gi.repository.GtkSource.SnippetContext Gets the context for the snippet insertion. .. method:: get_focus_position() -> int Gets the :obj:`~gi.repository.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. .. method:: get_spec() -> str | 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 :obj:`~gi.repository.GtkSource.SnippetChunk.props.text` and :obj:`~gi.repository.GtkSource.SnippetChunk.props.text_set` properties are updated. .. method:: get_text() -> str Gets the :obj:`~gi.repository.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 :obj:`~gi.repository.GtkSource.SnippetChunk.props.spec` property is returned. .. method:: get_text_set() -> bool Gets the :obj:`~gi.repository.GtkSource.SnippetChunk.props.text_set` property. This is typically set when the user has edited a snippet chunk. .. method:: get_tooltip_text() -> str .. method:: set_context(context: ~gi.repository.GtkSource.SnippetContext) -> None :param context: .. method:: set_focus_position(focus_position: int) -> None Sets the :obj:`~gi.repository.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. :param focus_position: the focus-position .. method:: set_spec(spec: str) -> None 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 :obj:`~gi.repository.GtkSource.SnippetChunk.props.text and` :obj:`~gi.repository.GtkSource.SnippetChunk.props.text_set` properties are updated. :param spec: the new specification for the chunk .. method:: set_text(text: str) -> None 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. :param text: the text of the property .. method:: set_text_set(text_set: bool) -> None Sets the :obj:`~gi.repository.GtkSource.SnippetChunk.props.text_set` property. This is typically set when the user has edited a snippet chunk by the snippet engine. :param text_set: the property value .. method:: set_tooltip_text(tooltip_text: str) -> None :param tooltip_text: Properties ---------- .. rst-class:: interim-class .. class:: SnippetChunk :no-index: .. attribute:: props.context :type: ~gi.repository.GtkSource.SnippetContext The type of the None singleton. .. attribute:: props.focus_position :type: int The type of the None singleton. .. attribute:: props.spec :type: str The type of the None singleton. .. attribute:: props.text :type: str The type of the None singleton. .. attribute:: props.text_set :type: bool The type of the None singleton. .. attribute:: props.tooltip_text :type: str The type of the None singleton.