mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-15 18:16:57 +02:00
[core] add GroupAttribute.childAttribute method
* easier access to child attributes * callable from QML
This commit is contained in:
parent
9b2338488b
commit
1a22fc8ae8
1 changed files with 17 additions and 1 deletions
|
@ -4,7 +4,7 @@ import collections
|
||||||
import re
|
import re
|
||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
from meshroom.common import BaseObject, Property, Variant, Signal, ListModel, DictModel
|
from meshroom.common import BaseObject, Property, Variant, Signal, ListModel, DictModel, Slot
|
||||||
from meshroom.core import desc, pyCompatibility, hashValue
|
from meshroom.core import desc, pyCompatibility, hashValue
|
||||||
|
|
||||||
|
|
||||||
|
@ -371,6 +371,22 @@ class GroupAttribute(Attribute):
|
||||||
for key, value in exportedValue.items():
|
for key, value in exportedValue.items():
|
||||||
self._value.get(key).value = value
|
self._value.get(key).value = value
|
||||||
|
|
||||||
|
@Slot(str, result=Attribute)
|
||||||
|
def childAttribute(self, key):
|
||||||
|
"""
|
||||||
|
Get child attribute by name or None if none was found.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
key (str): the name of the child attribute
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Attribute: the child attribute or None
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
return self._value.get(key)
|
||||||
|
except KeyError:
|
||||||
|
return None
|
||||||
|
|
||||||
def uid(self, uidIndex):
|
def uid(self, uidIndex):
|
||||||
uids = []
|
uids = []
|
||||||
for k, v in self._value.items():
|
for k, v in self._value.items():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue