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:
James Westman 2023-05-09 19:42:33 -05:00
parent aebf8be278
commit 04509e4b2e
31 changed files with 175 additions and 55 deletions

View file

@ -516,7 +516,7 @@ class Class(GirNode, GirType):
class TemplateType(GirType):
def __init__(self, name: str, parent: T.Optional[Class]):
def __init__(self, name: str, parent: T.Optional[GirType]):
self._name = name
self.parent = parent
@ -534,14 +534,14 @@ class TemplateType(GirType):
@cached_property
def properties(self) -> T.Mapping[str, Property]:
if self.parent is None or isinstance(self.parent, ExternType):
if not (isinstance(self.parent, Class) or isinstance(self.parent, Interface)):
return {}
else:
return self.parent.properties
@cached_property
def signals(self) -> T.Mapping[str, Signal]:
if self.parent is None or isinstance(self.parent, ExternType):
if not (isinstance(self.parent, Class) or isinstance(self.parent, Interface)):
return {}
else:
return self.parent.signals