WIP: Add AdwMessageDialog support

Support AdwMessageDialog's custom XML.
This commit is contained in:
James Westman 2022-07-09 15:43:50 -05:00
parent 08da6f79c7
commit c5aeb9a16f
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
8 changed files with 156 additions and 0 deletions

View file

@ -32,6 +32,9 @@ class BaseAttribute(AstNode):
def name(self):
return self.tokens["name"]
def extra_attributes(self):
return {}
def emit_xml(self, xml: XmlEmitter):
value = self.children[Value][0]
attrs = { self.attr_name: self.name }
@ -39,6 +42,8 @@ class BaseAttribute(AstNode):
if isinstance(value, TranslatedStringValue):
attrs = { **attrs, **value.attrs }
attrs = { **attrs, **self.extra_attributes() }
xml.start_tag(self.tag_name, **attrs)
value.emit_xml(xml)
xml.end_tag()