-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EMSUSD-181: Tooltips are not formatted correctly #3536
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,14 @@ def getNiceAttributeName(ufeAttr, attrName): | |
attrName = str(ufeAttr.getMetadata("uiname")) | ||
return mayaUsd.lib.Util.prettifyName(attrName) | ||
|
||
def cleanAndFormatTooltip(s): | ||
# Remove leading/trailing whitespace and replace newlines. | ||
lines = s.splitlines() | ||
stripped = [line.strip() for line in lines] | ||
cleaned = '<br>'.join(stripped) | ||
|
||
# Don't allow the tooltip to word-wrap. | ||
return "<p style='white-space:pre'>" + cleaned + '</p>' | ||
Comment on lines
+35
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. splitlines() returns list splitting string at line breaks. Then create new list by removing spaces at beginning and end of strings. Then create one string using I think this is better than what UsdView is doing since it also removes the single leading space that subsequent lines have. |
||
|
||
class AttributeCustomControl(object): | ||
''' | ||
|
@@ -55,4 +63,3 @@ def getUILabel(self): | |
Return the label to be used in the UI for the attribute set on this object. | ||
''' | ||
return self.getAttributeUILabel(self.ufeAttr, self.attrName) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When debugging this I realized that we were only adding tooltips to the array and connected attributes. After discussion with Nat I added them to all the attributes.