Skip to content
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

Merged

Conversation

seando-adsk
Copy link
Collaborator

EMSUSD-181: Tooltips are not formatted correctly

  • Use tooltip cleaning method similiar to UsdView to remove leading whitespace from multi-line doc strings.
  • Added tooltips to all attributes.

* 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()))
Copy link
Collaborator Author

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.

Comment on lines +35 to +42
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>'
Copy link
Collaborator Author

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.

@seando-adsk seando-adsk added the adsk Related to Autodesk plugin label Dec 22, 2023
Copy link
Collaborator

@pierrebai-adsk pierrebai-adsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@seando-adsk seando-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Jan 4, 2024
@seando-adsk
Copy link
Collaborator Author

The PF failure was a testing glitch and not related to my changes.

@seando-adsk seando-adsk merged commit 8f5704b into dev Jan 4, 2024
10 of 11 checks passed
@seando-adsk seando-adsk deleted the donnels/EMSUSD-181/clean_attribute_tooltip_strings branch January 4, 2024 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adsk Related to Autodesk plugin ready-for-merge Development process is finished, PR is ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants