[core] Coloring a Node: Exposed the Node Color to be set externally

This commit is contained in:
waaake 2024-11-25 09:20:11 +05:30
parent b5dda4efd0
commit 58a9b74a72

View file

@ -556,6 +556,15 @@ class BaseNode(BaseObject):
return self.internalAttribute("color").value.strip()
return ""
def setColor(self, color: str):
""" Sets the color of the Node.
Args:
color (str): The hex of the color to set on the node.
"""
if self.hasInternalAttribute("color"):
self.internalAttribute("color").value = color
def getInvalidationMessage(self):
"""
Returns:
@ -1386,7 +1395,7 @@ class BaseNode(BaseObject):
internalAttributes = Property(BaseObject, getInternalAttributes, constant=True)
internalAttributesChanged = Signal()
label = Property(str, getLabel, notify=internalAttributesChanged)
color = Property(str, getColor, notify=internalAttributesChanged)
color = Property(str, getColor, setColor, notify=internalAttributesChanged)
invalidation = Property(str, getInvalidationMessage, notify=internalAttributesChanged)
comment = Property(str, getComment, notify=internalAttributesChanged)
internalFolderChanged = Signal()