Tepl.Buffer

g GObject.Object GObject.Object Gtk.TextBuffer Gtk.TextBuffer GObject.Object->Gtk.TextBuffer GtkSource.Buffer GtkSource.Buffer Gtk.TextBuffer->GtkSource.Buffer Tepl.Buffer Tepl.Buffer GtkSource.Buffer->Tepl.Buffer

Subclasses:

None

Methods

Inherited:

GtkSource.Buffer (36), Gtk.TextBuffer (74), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

get_file ()

get_full_title ()

get_metadata ()

get_selection_type ()

get_short_title ()

get_style_scheme_id ()

is_untouched ()

load_metadata_from_metadata_manager ()

provide_style_scheme_id_gsetting (settings, setting_key, bind_to_property)

save_metadata_into_metadata_manager ()

set_style_scheme_id (style_scheme_id)

Virtual Methods

Inherited:

GtkSource.Buffer (3), Gtk.TextBuffer (13), GObject.Object (7)

do_tepl_cursor_moved ()

Properties

Inherited:

GtkSource.Buffer (9), Gtk.TextBuffer (6)

Name

Type

Flags

Short Description

tepl-full-title

str

r

tepl-short-title

str

r

tepl-style-scheme-id

str

r/w

Signals

Inherited:

GtkSource.Buffer (5), Gtk.TextBuffer (13), GObject.Object (1)

Name

Short Description

tepl-cursor-moved

The ::tepl-cursor-moved signal is emitted when the insert mark is moved explicitely or when the buffer changes (insert/delete).

Fields

Inherited:

GtkSource.Buffer (5), Gtk.TextBuffer (13), GObject.Object (1)

Name

Type

Access

Description

parent_instance

GtkSource.Buffer

r

Class Details

class Tepl.Buffer(**kwargs)
Bases:

GtkSource.Buffer

Abstract:

No

Structure:

Tepl.BufferClass

classmethod new()
Returns:

a new Tepl.Buffer.

Return type:

Tepl.Buffer

New in version 1.0.

get_file()
Returns:

the associated Tepl.File.

Return type:

Tepl.File

Returns the Tepl.File of self. The returned object is guaranteed to be the same for the lifetime of self.

Tepl.Buffer creates the Tepl.File with Tepl.AbstractFactory.create_file().

New in version 1.0.

get_full_title()
Returns:

the self full title. Free the return value with GLib.free() when no longer needed.

Return type:

str

Returns a title suitable for a Gtk.Window title. It contains (in that order):

New in version 3.0.

get_metadata()
Returns:

the associated Tepl.Metadata.

Return type:

Tepl.Metadata

Returns the Tepl.Metadata of self. The returned object is guaranteed to be the same for the lifetime of self.

New in version 5.0.

get_selection_type()
Returns:

the current Tepl.SelectionType.

Return type:

Tepl.SelectionType

New in version 1.0.

get_short_title()
Returns:

the self short title. Free the return value with GLib.free() when no longer needed.

Return type:

str

Returns a title suitable for a tab label. It contains (in that order):

New in version 3.0.

get_style_scheme_id()
Returns:

the Tepl.Buffer :tepl-style-scheme-id. Free with GLib.free().

Return type:

str

New in version 2.0.

is_untouched()
Returns:

True if self has not been touched, False otherwise.

Return type:

bool

Returns whether self is untouched.

This function is for example useful to know if we can re-use this buffer to load a file, instead of opening a new tab or window.

For this function to return True, the self must be empty, non-modified, the undo/redo GtkSource.Buffer history must be empty, and the Tepl.File :location must be None.

New in version 1.0.

load_metadata_from_metadata_manager()

Calls Tepl.MetadataManager.copy_from() for Tepl.File :location (if not None) to the associated Tepl.Metadata of self.

New in version 5.0.

provide_style_scheme_id_gsetting(settings, setting_key, bind_to_property)
Parameters:

A convenience function to provide a Gio.Settings key corresponding to the Tepl.Buffer :tepl-style-scheme-id property.

Once this function is called, calling Tepl.Buffer.set_style_scheme_id() or setting the property will benefit from a fallback mechanism that takes the default value of the Gio.Settings key (see Gio.Settings.get_default_value()).

If bind_to_property is True, then this function additionally binds the Gio.Settings key to the property with the Gio.SettingsBindFlags.GET flag.

New in version 6.4.

save_metadata_into_metadata_manager()

Calls Tepl.MetadataManager.merge_into() for Tepl.File :location (if not None) from the associated Tepl.Metadata of self.

New in version 5.0.

set_style_scheme_id(style_scheme_id)
Parameters:

style_scheme_id (str) – the new value.

Sets the Tepl.Buffer :tepl-style-scheme-id property.

The GtkSource.StyleScheme is taken from the default GtkSource.StyleSchemeManager as returned by GtkSource.StyleSchemeManager.get_default().

Since 6.4, if there are no GtkSource.StyleScheme for style_scheme_id, there is a fallback mechanism that takes the default value of the provided Gio.Settings key (see Tepl.Buffer.provide_style_scheme_id_gsetting()); if the Gio.Settings key was not provided, it takes a recommended GtkSource.StyleScheme provided by GtkSource.View (see the documentation of GtkSource.Buffer.set_style_scheme()).

If more flexibility is desired, don’t use the Tepl.Buffer :tepl-style-scheme-id property, use the GtkSource.Buffer API instead.

New in version 2.0.

do_tepl_cursor_moved() virtual

Signal Details

Tepl.Buffer.signals.tepl_cursor_moved(buffer)
Signal Name:

tepl-cursor-moved

Flags:

RUN_FIRST

Parameters:

buffer (Tepl.Buffer) – The object which received the signal

The ::tepl-cursor-moved signal is emitted when the insert mark is moved explicitely or when the buffer changes (insert/delete).

A typical use-case for this signal is to update the cursor position in a statusbar.

New in version 2.0.

Property Details

Tepl.Buffer.props.tepl_full_title
Name:

tepl-full-title

Type:

str

Default Value:

None

Flags:

READABLE

The full title. See Tepl.Buffer.get_full_title().

New in version 3.0.

Tepl.Buffer.props.tepl_short_title
Name:

tepl-short-title

Type:

str

Default Value:

None

Flags:

READABLE

The short title. See Tepl.Buffer.get_short_title().

New in version 3.0.

Tepl.Buffer.props.tepl_style_scheme_id
Name:

tepl-style-scheme-id

Type:

str

Default Value:

''

Flags:

READABLE, WRITABLE

The GtkSource.Buffer :style-scheme ID, as a string. This property is useful for binding it to a Gio.Settings key.

When the GtkSource.Buffer :style-scheme is None, Tepl.Buffer :tepl-style-scheme-id contains the empty string.

New in version 2.0.