[ui] GraphEditor: only connect compatible attributes

This commit is contained in:
Fabien Castan 2020-12-28 15:29:10 +01:00
parent 85044e50cb
commit 5fb6a5fb0f
3 changed files with 35 additions and 18 deletions

View file

@ -93,6 +93,9 @@ class Attribute(BaseObject):
def getType(self):
return self.attributeDesc.__class__.__name__
def getBaseType(self):
return self.getType()
def getLabel(self):
return self._label
@ -258,6 +261,7 @@ class Attribute(BaseObject):
fullName = Property(str, getFullName, constant=True)
label = Property(str, getLabel, constant=True)
type = Property(str, getType, constant=True)
baseType = Property(str, getType, constant=True)
desc = Property(desc.Attribute, lambda self: self.attributeDesc, constant=True)
valueChanged = Signal()
value = Property(Variant, _get_value, _set_value, notify=valueChanged)
@ -292,6 +296,9 @@ class ListAttribute(Attribute):
def __len__(self):
return len(self._value)
def getBaseType(self):
return self.attributeDesc.elementDesc.__class__.__name__
def at(self, idx):
""" Returns child attribute at index 'idx' """
# implement 'at' rather than '__getitem__'
@ -396,6 +403,7 @@ class ListAttribute(Attribute):
# Override value property setter
value = Property(Variant, Attribute._get_value, _set_value, notify=Attribute.valueChanged)
isDefault = Property(bool, _isDefault, notify=Attribute.valueChanged)
baseType = Property(str, getBaseType, constant=True)
class GroupAttribute(Attribute):