CssSection#
- class CssSection(**kwargs)#
Defines a part of a CSS document.
Because sections are nested into one another, you can use
get_parent
to get the containing region.
Constructors#
- class CssSection
- classmethod new(file: File | None, start: CssLocation, end: CssLocation) CssSection #
Creates a new
GtkCssSection
referring to the section in the givenfile
from thestart
location to theend
location.- Parameters:
file – The file this section refers to
start – The start location
end – The end location
- classmethod new_with_bytes(file: File | None, bytes: Bytes | None, start: CssLocation, end: CssLocation) CssSection #
Creates a new
GtkCssSection
referring to the section in the givenfile
or the givenbytes
from thestart
location to theend
location.Added in version 4.16.
- Parameters:
file – The file this section refers to
bytes – The bytes this sections refers to
start – The start location
end – The end location
Methods#
- class CssSection
-
- get_end_location() CssLocation #
Returns the location in the CSS document where this section ends.
- get_file() File | None #
Gets the file that
section
was parsed from.If no such file exists, for example because the CSS was loaded via
load_from_data
, thenNULL
is returned.
- get_parent() CssSection | None #
Gets the parent section for the given
section
.The parent section is the section that contains this
section
. A special case are sections of typeGTK_CSS_SECTION_DOCUMEN``T. Their parent will either be ``NULL
if they are the original CSS document that was loaded byload_from_file
or a section of typeGTK_CSS_SECTION_IMPORT
if it was loaded with an`import`
rule from a different file.
- get_start_location() CssLocation #
Returns the location in the CSS document where this section starts.