mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-16 18:46:27 +02:00
[core] GroupAttribute: add new ways of setting value
- Add: set value with JS Object - Add: set value from a JSON String
This commit is contained in:
parent
e9151b2ee0
commit
cd89a49156
2 changed files with 32 additions and 11 deletions
|
@ -410,10 +410,16 @@ class GroupAttribute(Attribute):
|
|||
raise AttributeError(key)
|
||||
|
||||
def _set_value(self, exportedValue):
|
||||
self.desc.validateValue(exportedValue)
|
||||
# set individual child attribute values
|
||||
for key, value in exportedValue.items():
|
||||
self._value.get(key).value = value
|
||||
value = self.desc.validateValue(exportedValue)
|
||||
if isinstance(value, dict):
|
||||
# set individual child attribute values
|
||||
for key, v in exportedValue.items():
|
||||
self._value.get(key).value = v
|
||||
elif isinstance(value, (list, tuple)):
|
||||
for attrDesc, v in zip(self.desc._groupDesc, value):
|
||||
self._value.get(attrDesc.name).value = v
|
||||
else:
|
||||
raise AttributeError("Failed to set on GroupAttribute: {}".format(str(exportedValue)))
|
||||
|
||||
@Slot(str, result=Attribute)
|
||||
def childAttribute(self, key):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue