WIP: Add gir.PartialClass

This commit is contained in:
James Westman 2022-07-19 20:25:46 -05:00
parent 632e9d7df6
commit 6fdb12fd5d
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
17 changed files with 231 additions and 147 deletions

View file

@ -17,6 +17,7 @@
#
# SPDX-License-Identifier: LGPL-3.0-or-later
from functools import cached_property
from .gobject_object import Object, ObjectContent
from .common import *
@ -34,11 +35,14 @@ class Template(Object):
ObjectContent,
]
@property
@cached_property
def gir_class(self):
# Templates might not have a parent class defined
parent = None
if len(self.children[ClassName]):
return self.children[ClassName][0].gir_type
parent = self.children[ClassName][0].gir_type
return gir.PartialClass(self.tokens["id"], parent)
@validate("id")
def unique_in_parent(self):