cleanup and add get_api method

This commit is contained in:
Morgan 'ARR\!' Allen 2025-04-08 12:20:55 -07:00
parent da64ab6b6e
commit cfdbdd32bb

View file

@ -2,7 +2,6 @@ class BaseObject:
TYPE = None
def __init__(self, feature):
print(self.__class__)
self.feature = feature
feature.Proxy = self
@ -13,12 +12,18 @@ class BaseObject:
feature.Type = self.TYPE
def execute(self, feature):
pass
# TODO this might not be the right move
self.onDocumentRestored(feature)
def setup_extensions(self):
if hasattr(self.parent.__class__, 'EXTENSIONS'):
for ext in self.parent.__class__.EXTENSIONS:
self.feature.addExtension(ext)
def get_api(self):
p = self.feature
while p:
if p.Type == 'KiConnect::Project':
return [ o for o in p.Group if hasattr(o, 'Type') and o.Type == 'KiConnect::API' ][0].Proxy
p = p.getParent()
return None
def onBeforeChange(self, feature, prop):
pass