cleanup and add get_api method
This commit is contained in:
parent
da64ab6b6e
commit
cfdbdd32bb
1 changed files with 11 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue