GtkSource.GutterLines

g GObject.Object GObject.Object GtkSource.GutterLines GtkSource.GutterLines GObject.Object->GtkSource.GutterLines

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

add_class (line, name)

add_qclass (line, qname)

get_buffer ()

get_first ()

get_iter_at_line (line)

get_last ()

get_line_yrange (line, mode)

get_view ()

has_any_class (line)

has_class (line, name)

has_qclass (line, qname)

is_cursor (line)

is_prelit (line)

is_selected (line)

remove_class (line, name)

remove_qclass (line, qname)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class GtkSource.GutterLines(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

GtkSource.GutterLinesClass

Collected information about visible lines.

The GtkSourceGutterLines object is used to collect information about visible lines.

Use this from your [signal`GutterRenderer`:py:func:::query-data<GtkSource.GutterLines.signals.query_data>] to collect the necessary information on visible lines. Doing so reduces the number of passes through the text btree allowing GtkSource.View to reach more frames-per-second while performing kinetic scrolling.

add_class(line, name)
Parameters:
  • line (int) – a line number starting from zero

  • name (str) – a class name

Adds the class name to line.

name will be converted to a [alias`GLib`.Quark] as part of this process. A faster version of this function is available via [method`GutterLines`.add_qclass] for situations where the [alias`GLib`.Quark] is known ahead of time.

add_qclass(line, qname)
Parameters:
  • line (int) – a line number starting from zero

  • qname (int) – a class name as a #GQuark

Adds the class denoted by qname to line.

You may check if a line has qname by calling [method`GutterLines`.has_qclass].

You can remove qname by calling [method`GutterLines`.remove_qclass].

get_buffer()
Returns:

a Gtk.TextBuffer

Return type:

Gtk.TextBuffer

Gets the [class`Gtk`.TextBuffer] that the GtkSourceGutterLines represents.

get_first()
Returns:

a line number starting from 0

Return type:

int

Gets the line number (starting from 0) for the first line that is user visible.

get_iter_at_line(line)
Parameters:

line (int) – the line number

Returns:

a location for a Gtk.TextIter

Return type:

iter: Gtk.TextIter

Gets a Gtk.TextIter for the current buffer at line

get_last()
Returns:

a line number starting from 0

Return type:

int

Gets the line number (starting from 0) for the last line that is user visible.

get_line_yrange(line, mode)
Parameters:
Returns:

y:

a location for the Y position in widget coordinates

height:

the line height based on mode

Return type:

(y: int, height: int)

Gets the Y range for a line based on mode.

The value for y is relative to the renderers widget coordinates.

get_view()
Returns:

a Gtk.TextView

Return type:

Gtk.TextView

Gets the [class`Gtk`.TextView] that the GtkSourceGutterLines represents.

has_any_class(line)
Parameters:

line (int) – a line contained within self

Returns:

True if any quark was set for the line

Return type:

bool

Checks to see if the line has any GQuark classes set. This can be used to help renderer implementations avoid work if nothing has been set on the class.

New in version 5.6.

has_class(line, name)
Parameters:
  • line (int) – a line number starting from zero

  • name (str) – a class name that may be converted, to a #GQuark

Returns:

True if line contains name

Return type:

bool

Checks to see if [method`GutterLines`.add_class] was called with the name for line.

A faster version of this function is provided via [method`GutterLines`.has_qclass] for situations where the quark is known ahead of time.

has_qclass(line, qname)
Parameters:
  • line (int) – a line number starting from zero

  • qname (int) – a #GQuark containing the class name

Returns:

True if line contains qname

Return type:

bool

Checks to see if [method`GutterLines`.add_qclass] was called with the quark denoted by qname for line.

is_cursor(line)
Parameters:

line (int) – a line number starting from zero

Returns:

True if the insertion cursor is on line

Return type:

bool

Checks to see if line contains the insertion cursor.

is_prelit(line)
Parameters:

line (int) – a line number starting from zero

Returns:

True if the line is prelit

Return type:

bool

Checks to see if line is marked as prelit. Generally, this means the mouse pointer is over the line within the gutter.

is_selected(line)
Parameters:

line (int) – a line number starting from zero

Returns:

True if the line contains a selection

Return type:

bool

Checks to see if the view had a selection and if that selection overlaps line in some way.

remove_class(line, name)
Parameters:
  • line (int) – a line number starting from zero

  • name (str) – a class name

Removes the class matching name from line.

A faster version of this function is available via [method`GutterLines`.remove_qclass] for situations where the #GQuark is known ahead of time.

remove_qclass(line, qname)
Parameters:
  • line (int) – a line number starting from zero

  • qname (int) – a #GQuark to remove from line

Reverses a call to [method`GutterLines`.add_qclass] by removing the [alias`GLib`.Quark] matching qname.