-
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
EMSUSD-181: Tooltips are not formatted correctly #3536
Conversation
* Use tooltip cleaning method similiar to UsdView to remove leading whitespace from multi-line doc strings. * Added tooltips to all attributes.
@@ -433,7 +434,7 @@ def arrayCustomControlCreator(aeTemplate, c): | |||
def defaultControlCreator(aeTemplate, c): | |||
ufeAttr = aeTemplate.attrS.attribute(c) | |||
uiLabel = getNiceAttributeName(ufeAttr, c) if aeTemplate.useNiceName else c | |||
cmds.editorTemplate(addControl=[c], label=uiLabel) | |||
cmds.editorTemplate(addControl=[c], label=uiLabel, annotation=cleanAndFormatTooltip(ufeAttr.getDocumentation())) |
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.
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>' |
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.
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
instead of newline. Finally don't allow tooltip to wrap, as it contains breaks.
I think this is better than what UsdView is doing since it also removes the single leading space that subsequent lines have.
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.
LGTM
The PF failure was a testing glitch and not related to my changes. |
EMSUSD-181: Tooltips are not formatted correctly