Template.Template¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/c/en |
The locator used for resolving includes |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Template.Template(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod new(locator)¶
- Parameters:
locator (
Template.TemplateLocator
orNone
) – ATemplate.TemplateLocator
orNone
.- Returns:
- Return type:
Creates a new
Template.Template
.If locator is specified, locator will be used to resolve include directives when parsing the template.
- expand(stream, scope, cancellable)¶
- Parameters:
stream (
Gio.OutputStream
) – aGio.OutputStream
to write the results toscope (
Template.Scope
orNone
) – ATemplate.Scope
containing state for the template, orNone
.cancellable (
Gio.Cancellable
orNone
) – An optional cancellable for the operation.
- Raises:
- Returns:
- Return type:
Expands a template into stream using the scope provided.
scope should have all of the variables set that are required to expand the template, or you will get a symbol reference error and
False
will be returned.To set a symbol value, get the symbol with
Template.Scope.get
() and assign a value using tmpl_scope_assign_value() or similar methods.
- expand_string(scope)¶
- Parameters:
scope (
Template.Scope
orNone
) – ATemplate.Scope
orNone
.- Raises:
- Returns:
A newly allocated string, or
None
upon failure.- Return type:
Expands the template and returns the result as a string.
- get_locator()¶
- Returns:
a
Template.TemplateLocator
orNone
.- Return type:
Gets the template locator used when resolving template includes.
- parse(stream, cancellable)¶
- Parameters:
stream (
Gio.InputStream
) –cancellable (
Gio.Cancellable
orNone
) –
- Raises:
- Return type:
- parse_file(file, cancellable)¶
- Parameters:
file (
Gio.File
) –cancellable (
Gio.Cancellable
orNone
) –
- Raises:
- Return type:
- parse_path(path, cancellable)¶
- Parameters:
path (
str
) –cancellable (
Gio.Cancellable
orNone
) –
- Raises:
- Return type:
- parse_resource(path, cancellable)¶
- Parameters:
path (
str
) –cancellable (
Gio.Cancellable
orNone
) –
- Raises:
- Return type:
- set_locator(locator)¶
- Parameters:
locator (
Template.TemplateLocator
) –
Property Details¶
- Template.Template.props.locator¶
- Name:
locator
- Type:
- Default Value:
- Flags:
The locator used for resolving includes