mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Separate output into its own module
This commit is contained in:
parent
8cf793023d
commit
a24f16109f
33 changed files with 407 additions and 291 deletions
|
@ -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()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue