Gtk.CssSection

Fields

None

Methods

get_end_line ()

get_end_position ()

get_file ()

get_parent ()

get_section_type ()

get_start_line ()

get_start_position ()

ref ()

unref ()

Details

class Gtk.CssSection

Defines a part of a CSS document. Because sections are nested into one another, you can use Gtk.CssSection.get_parent() to get the containing region.

New in version 3.2.

get_end_line()[source]
Returns:

the line number

Return type:

int

Returns the line in the CSS document where this section end. The line number is 0-indexed, so the first line of the document will return 0. This value may change in future invocations of this function if self is not yet parsed completely. This will for example happen in the Gtk.CssProvider ::parsing-error signal. The end position and line may be identical to the start position and line for sections which failed to parse anything successfully.

New in version 3.2.

get_end_position()[source]
Returns:

the offset in bytes from the start of the line.

Return type:

int

Returns the offset in bytes from the start of the current line returned via Gtk.CssSection.get_end_line(). This value may change in future invocations of this function if self is not yet parsed completely. This will for example happen in the Gtk.CssProvider ::parsing-error signal. The end position and line may be identical to the start position and line for sections which failed to parse anything successfully.

New in version 3.2.

get_file()[source]
Returns:

the Gio.File that self was parsed from or None if self was parsed from other data

Return type:

Gio.File

Gets the file that self was parsed from. If no such file exists, for example because the CSS was loaded via gtk_css_provider_load_from_data(), then None is returned.

New in version 3.2.

get_parent()[source]
Returns:

the parent section or None if none

Return type:

Gtk.CssSection or None

Gets the parent section for the given self. The parent section is the section that contains this self. A special case are sections of type Gtk.CssSectionType.DOCUMENT. Their parent will either be None if they are the original CSS document that was loaded by Gtk.CssProvider.load_from_file() or a section of type Gtk.CssSectionType.IMPORT if it was loaded with an import rule from a different file.

New in version 3.2.

get_section_type()[source]
Returns:

the type of self

Return type:

Gtk.CssSectionType

Gets the type of information that self describes.

New in version 3.2.

get_start_line()[source]
Returns:

the line number

Return type:

int

Returns the line in the CSS document where this section starts. The line number is 0-indexed, so the first line of the document will return 0.

New in version 3.2.

get_start_position()[source]
Returns:

the offset in bytes from the start of the line.

Return type:

int

Returns the offset in bytes from the start of the current line returned via Gtk.CssSection.get_start_line().

New in version 3.2.

ref()[source]
Returns:

self itself.

Return type:

Gtk.CssSection

Increments the reference count on self.

New in version 3.2.

unref()[source]

Decrements the reference count on self, freeing the structure if the reference count reaches 0.

New in version 3.2.