mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-06-22 23:19:25 -04:00
xml: Convert GirType to type name automatically
Makes some of the emit_xml code a bit simpler.
This commit is contained in:
parent
4e1398f238
commit
0da0c9399f
3 changed files with 15 additions and 10 deletions
|
@ -109,7 +109,7 @@ class Object(AstNode):
|
|||
from .gtkbuilder_child import Child
|
||||
|
||||
xml.start_tag("object", **{
|
||||
"class": self.gir_class.glib_type_name if self.gir_class else self.tokens["class_name"],
|
||||
"class": self.gir_class or self.tokens["class_name"],
|
||||
"id": self.tokens["id"],
|
||||
})
|
||||
for child in self.children:
|
||||
|
|
|
@ -38,13 +38,11 @@ class Template(Object):
|
|||
pass # does not apply to templates
|
||||
|
||||
def emit_xml(self, xml: XmlEmitter):
|
||||
if self.gir_class:
|
||||
parent = self.gir_class.glib_type_name
|
||||
elif self.tokens["class_name"]:
|
||||
parent = self.tokens["class_name"]
|
||||
else:
|
||||
parent = None
|
||||
xml.start_tag("template", **{"class": self.tokens["name"]}, parent=parent)
|
||||
xml.start_tag(
|
||||
"template",
|
||||
**{"class": self.tokens["name"]},
|
||||
parent=self.gir_class or self.tokens["class_name"]
|
||||
)
|
||||
for child in self.children:
|
||||
child.emit_xml(xml)
|
||||
xml.end_tag()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue