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
GtkCssSectionreferring to the section in the givenfilefrom thestartlocation to theendlocation.- 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
GtkCssSectionreferring to the section in the givenfileor the givenbytesfrom thestartlocation to theendlocation.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
sectionwas parsed from.If no such file exists, for example because the CSS was loaded via
load_from_data, thenNULLis 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_DOCUMENT. Their parent will either beNULLif they are the original CSS document that was loaded byload_from_fileor a section of typeGTK_CSS_SECTION_IMPORTif it was loaded with an@importrule from a different file.
- get_start_location() CssLocation#
Returns the location in the CSS document where this section starts.