[ui] Add an icon and tooltip on a node's header if it has a comment

If the "Comments" internal attribute is filled, add a corresponding
icon in the node's header, as well as a tooltip that contains the
comment.
This commit is contained in:
Candice Bentéjac 2022-10-13 14:57:24 +02:00
parent b645db99f7
commit 1015ea448a
2 changed files with 36 additions and 0 deletions

View file

@ -541,6 +541,15 @@ class BaseNode(BaseObject):
return self.internalAttribute("color").value.strip()
return ""
def getComment(self):
"""
Returns:
str: the comments on the node if they exist, empty string otherwise
"""
if self.hasInternalAttribute("comment"):
return self.internalAttribute("comment").value
return ""
@Slot(str, result=str)
def nameToLabel(self, name):
"""
@ -1104,6 +1113,7 @@ class BaseNode(BaseObject):
name = Property(str, getName, constant=True)
label = Property(str, getLabel, constant=True)
color = Property(str, getColor, constant=True)
comment = Property(str, getComment, constant=True)
nodeType = Property(str, nodeType.fget, constant=True)
documentation = Property(str, getDocumentation, constant=True)
positionChanged = Signal()