Separate output into its own module

This commit is contained in:
James Westman 2022-10-14 21:04:37 -05:00
parent 8cf793023d
commit a24f16109f
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
33 changed files with 407 additions and 291 deletions

View file

@ -19,22 +19,26 @@
import typing as T
from blueprintcompiler.language.values import Value
from .attributes import BaseAttribute
from .gobject_object import Object, ObjectContent
from .common import *
class Menu(Object):
def emit_xml(self, xml: XmlEmitter):
xml.start_tag(self.tokens["tag"], id=self.tokens["id"])
for child in self.children:
child.emit_xml(xml)
xml.end_tag()
class Menu(AstNode):
@property
def gir_class(self):
return self.root.gir.namespaces["Gtk"].lookup_type("Gio.Menu")
@property
def id(self) -> str:
return self.tokens["id"]
@property
def tag(self) -> str:
return self.tokens["tag"]
class MenuAttribute(BaseAttribute):
tag_name = "attribute"
@ -43,6 +47,10 @@ class MenuAttribute(BaseAttribute):
def value_type(self):
return None
@property
def value(self) -> Value:
return self.children[Value][0]
menu_contents = Sequence()