Add GtkComboBoxText items

This commit is contained in:
James Westman 2021-11-12 18:40:26 -06:00
parent f1e1811e1f
commit aa447466c0
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
12 changed files with 137 additions and 17 deletions

View file

@ -455,15 +455,16 @@ class BaseAttribute(AstNode):
""" A helper class for attribute syntax of the form `name: literal_value;`"""
tag_name: str = ""
attr_name: str = "name"
def emit_xml(self, xml: XmlEmitter):
value = self.children[Value][0]
translatable = isinstance(value, TranslatedStringValue)
xml.start_tag(
self.tag_name,
name=self.tokens["name"],
translatable="true" if translatable else None,
)
attrs = {
self.attr_name: self.tokens["name"],
"translatable": "true" if translatable else None
}
xml.start_tag(self.tag_name, **attrs)
if translatable:
xml.put_text(value.string)
else: