[processGraph] Attribute.value as an "hybrid" property

Use "hybrid" property to simplify naming of properties. No matter the backend used (qt or core), the property is always accessible via its name, without differently named getter or setter methods.
This commit is contained in:
Yann Lanthony 2017-10-02 17:47:39 +02:00
parent d556547d0b
commit a81aa53a6b
2 changed files with 12 additions and 7 deletions

View file

@ -117,11 +117,14 @@ class SetAttributeCommand(GraphCommand):
self.nodeName = attribute.node.getName()
self.attrName = attribute.getName()
self.value = value
self.oldValue = attribute.getValue()
self.oldValue = attribute.value
self.setText("Set Attribute '{}'".format(attribute.fullName()))
def redoImpl(self):
self.graph.node(self.nodeName).attribute(self.attrName).setValue(self.value)
if self.value == self.oldValue:
return False
self.graph.node(self.nodeName).attribute(self.attrName).value = self.value
return True
def undoImpl(self):
self.graph.node(self.nodeName).attribute(self.attrName).setValue(self.oldValue)
self.graph.node(self.nodeName).attribute(self.attrName).value = self.oldValue