mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Change template syntax
Templates now use a TypeName instead of an identifier, which makes it clearer that it's an extern symbol (or that it's a Gtk.ListItem).
This commit is contained in:
parent
aebf8be278
commit
04509e4b2e
31 changed files with 175 additions and 55 deletions
|
@ -8,6 +8,7 @@ from .xml_emitter import XmlEmitter
|
|||
class XmlOutput(OutputFormat):
|
||||
def emit(self, ui: UI) -> str:
|
||||
xml = XmlEmitter()
|
||||
self._ui = ui
|
||||
self._emit_ui(ui, xml)
|
||||
return xml.result
|
||||
|
||||
|
@ -32,7 +33,9 @@ class XmlOutput(OutputFormat):
|
|||
xml.put_self_closing("requires", lib="gtk", version=gtk.gir_namespace.version)
|
||||
|
||||
def _emit_template(self, template: Template, xml: XmlEmitter):
|
||||
xml.start_tag("template", **{"class": template.id}, parent=template.class_name)
|
||||
xml.start_tag(
|
||||
"template", **{"class": template.gir_class}, parent=template.parent_type
|
||||
)
|
||||
self._emit_object_or_template(template, xml)
|
||||
xml.end_tag()
|
||||
|
||||
|
@ -188,6 +191,8 @@ class XmlOutput(OutputFormat):
|
|||
xml.put_text(value.ident)
|
||||
elif isinstance(value_type, gir.Enumeration):
|
||||
xml.put_text(str(value_type.members[value.ident].value))
|
||||
elif value.ident == "template" and self._ui.template is not None:
|
||||
xml.put_text(self._ui.template.gir_class.glib_type_name)
|
||||
else:
|
||||
xml.put_text(value.ident)
|
||||
elif isinstance(value, TypeLiteral):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue