mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-19 03:56:26 +02:00
[ui] support for appending multiple elements to a ListAttribute at once
This commit is contained in:
parent
9bc8eaeb1b
commit
f6ae3ae057
2 changed files with 14 additions and 5 deletions
|
@ -168,18 +168,23 @@ class ListAttributeAppendCommand(GraphCommand):
|
|||
assert isinstance(listAttribute, ListAttribute)
|
||||
self.attrName = listAttribute.fullName()
|
||||
self.index = None
|
||||
self.value = value
|
||||
self.count = 1
|
||||
self.value = value if len(value) else None
|
||||
self.setText("Append to {}".format(self.attrName))
|
||||
|
||||
def redoImpl(self):
|
||||
listAttribute = self.graph.attribute(self.attrName)
|
||||
listAttribute.append(self.value)
|
||||
self.index = len(listAttribute) - 1
|
||||
self.index = len(listAttribute)
|
||||
if isinstance(self.value, list):
|
||||
listAttribute.extend(self.value)
|
||||
self.count = len(self.value)
|
||||
else:
|
||||
listAttribute.append(self.value)
|
||||
return True
|
||||
|
||||
def undoImpl(self):
|
||||
listAttribute = self.graph.attribute(self.attrName)
|
||||
listAttribute.remove(self.index)
|
||||
listAttribute.remove(self.index, self.count)
|
||||
|
||||
|
||||
class ListAttributeRemoveCommand(GraphCommand):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue