mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Change template syntax
Templates now use a TypeName instead of an identifier, which makes it clearer that it's an extern symbol (or that it's a Gtk.ListItem).
This commit is contained in:
parent
aebf8be278
commit
04509e4b2e
31 changed files with 175 additions and 55 deletions
|
@ -43,7 +43,7 @@ class UI(AstNode):
|
|||
]
|
||||
|
||||
@property
|
||||
def gir(self):
|
||||
def gir(self) -> gir.GirContext:
|
||||
gir_ctx = gir.GirContext()
|
||||
self._gir_errors = []
|
||||
|
||||
|
@ -84,6 +84,20 @@ class UI(AstNode):
|
|||
or isinstance(child, Menu)
|
||||
]
|
||||
|
||||
@property
|
||||
def template(self) -> T.Optional[Template]:
|
||||
if len(self.children[Template]):
|
||||
return self.children[Template][0]
|
||||
else:
|
||||
return None
|
||||
|
||||
def is_legacy_template(self, id: str) -> bool:
|
||||
return (
|
||||
id not in self.context[ScopeCtx].objects
|
||||
and self.template is not None
|
||||
and self.template.class_name.glib_type_name == id
|
||||
)
|
||||
|
||||
@context(ScopeCtx)
|
||||
def scope_ctx(self) -> ScopeCtx:
|
||||
return ScopeCtx(node=self)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue