GutterRenderer

class GutterRenderer(**properties: Any)

Superclasses: Widget, InitiallyUnowned, Object

Subclasses: GutterRendererPixbuf, GutterRendererText

Implemented Interfaces: Accessible, Buildable, ConstraintTarget

Constructors:

GutterRenderer(**properties)

Methods

class GutterRenderer
activate(iter: TextIter, area: Rectangle, button: int, state: ModifierType, n_presses: int) None

Emits the activate signal of the renderer. This is called from Gutter and should never have to be called manually.

Parameters:
  • iter – a TextIter at the start of the line where the renderer is activated

  • area – a Rectangle of the cell area where the renderer is activated

  • button – the button that was pressed

  • state – a ModifierType

  • n_presses – the number of button presses

align_cell(line: int, width: float, height: float) tuple[float, float]

Locates where to render content that is width x height based on the renderers alignment and padding.

The location will be placed into x and y and is relative to the renderer’s coordinates.

It is encouraged that renderers use this function when snappshotting to ensure consistent placement of their contents.

Parameters:
  • line – the line number for content

  • width – the width of the content to draw

  • height – the height of the content to draw

get_alignment_mode() GutterRendererAlignmentMode

Get the alignment mode.

The alignment mode describes the manner in which the renderer is aligned (see xalign and yalign).

get_buffer() Buffer | None

Gets the Buffer for which the gutter renderer is drawing.

get_view() View

Get the view associated to the gutter renderer

get_xalign() float

Gets the xalign property.

This may be used to adjust where within the cell rectangle the renderer will draw.

get_xpad() int

Gets the xpad property.

This may be used to adjust the cell rectangle that the renderer will use to draw.

get_yalign() float

Gets the yalign property.

This may be used to adjust where within the cell rectangle the renderer will draw.

get_ypad() int

Gets the ypad property.

This may be used to adjust the cell rectangle that the renderer will use to draw.

query_activatable(iter: TextIter, area: Rectangle) bool

Get whether the renderer is activatable at the location provided. This is called from Gutter to determine whether a renderer is activatable using the mouse pointer.

Parameters:
  • iter – a TextIter at the start of the line to be activated

  • area – a Rectangle of the cell area to be activated

set_alignment_mode(mode: GutterRendererAlignmentMode) None

Set the alignment mode. The alignment mode describes the manner in which the renderer is aligned (see xalign and yalign).

Parameters:

mode – a GutterRendererAlignmentMode

set_xalign(xalign: float) None

Adjusts the xalign property.

This may be used to adjust where within the cell rectangle the renderer will draw.

Parameters:

xalign – the Y padding for the drawing cell

set_xpad(xpad: int) None

Adjusts the xpad property.

This may be used to adjust the cell rectangle that the renderer will use to draw.

Parameters:

xpad – the Y padding for the drawing cell

set_yalign(yalign: float) None

Adjusts the yalign property.

This may be used to adjust where within the cell rectangle the renderer will draw.

Parameters:

yalign – the Y padding for the drawing cell

set_ypad(ypad: int) None

Adjusts the ypad property.

This may be used to adjust the cell rectangle that the renderer will use to draw.

Parameters:

ypad – the Y padding for the drawing cell

Properties

class GutterRenderer
props.alignment_mode: GutterRendererAlignmentMode

The alignment mode of the renderer.

This can be used to indicate that in the case a cell spans multiple lines (due to text wrapping) the alignment should work on either the full cell, the first line or the last line.

props.lines: GutterLines

Contains information about the lines to be rendered.

It should be used by GutterRenderer implementations from snapshot.

props.view: TextView

The view on which the renderer is placed.

props.xalign: float

The horizontal alignment of the renderer.

Set to 0 for a left alignment. 1 for a right alignment. And 0.5 for centering the cells. A value lower than 0 doesn’t modify the alignment.

props.xpad: int

The left and right padding of the renderer.

props.yalign: float

The vertical alignment of the renderer.

Set to 0 for a top alignment. 1 for a bottom alignment. And 0.5 for centering the cells. A value lower than 0 doesn’t modify the alignment.

props.ypad: int

The top and bottom padding of the renderer.

Signals

class GutterRenderer.signals
activate(iter: TextIter, area: Rectangle, button: int, state: ModifierType, n_presses: int) None

The signal is emitted when the renderer is activated.

Parameters:
  • iter – a TextIter

  • area – a Rectangle

  • button – the button that was pressed

  • state – a ModifierType of state

  • n_presses – the number of button presses

query_activatable(iter: TextIter, area: Rectangle) bool

The signal is emitted when the renderer can possibly be activated.

Parameters:
query_data(object: Object, p0: int) None
Parameters:
  • object

  • p0

Virtual Methods

class GutterRenderer
do_activate(iter: TextIter, area: Rectangle, button: int, state: ModifierType, n_presses: int) None

Emits the activate signal of the renderer. This is called from Gutter and should never have to be called manually.

Parameters:
  • iter – a TextIter at the start of the line where the renderer is activated

  • area – a Rectangle of the cell area where the renderer is activated

  • button – the button that was pressed

  • state – a ModifierType

  • n_presses – the number of button presses

do_begin(lines: GutterLines) None
Parameters:

lines

do_change_buffer(old_buffer: Buffer | None = None) None

This is called when the text buffer changes for renderer.

Parameters:

old_buffer – the old TextBuffer.

do_change_view(old_view: View | None = None) None

This is called when the text view changes for renderer.

Parameters:

old_view – the old TextView.

do_end() None
do_query_activatable(iter: TextIter, area: Rectangle) bool

Get whether the renderer is activatable at the location provided. This is called from Gutter to determine whether a renderer is activatable using the mouse pointer.

Parameters:
  • iter – a TextIter at the start of the line to be activated

  • area – a Rectangle of the cell area to be activated

do_query_data(lines: GutterLines, line: int) None
Parameters:
  • lines

  • line

do_snapshot_line(snapshot: Snapshot, lines: GutterLines, line: int) None
Parameters:
  • snapshot

  • lines

  • line

Fields

class GutterRenderer
parent_instance