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
Make TextActor2D extend UI instead of object #1298
Conversation
What do you think, @ranveeraggarwal , @Garyfallidis ? Do I need to update the UI tests? |
Actually, Edit: We'll also need to fix the existing UI elements that use this. |
dipy/viz/ui.py
Outdated
position : (float, float) | ||
|
||
""" | ||
self.actor.SetPosition(*position) |
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.
Use the property instead.
self.position = position
For the tests, you can add a textblock to an existing panel's test so that the |
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #1298 +/- ##
==========================================
+ Coverage 87.02% 87.03% +<.01%
==========================================
Files 228 228
Lines 28812 28821 +9
Branches 3094 3094
==========================================
+ Hits 25075 25085 +10
Misses 3034 3034
+ Partials 703 702 -1
Continue to review full report at Codecov.
|
1 similar comment
dipy/viz/tests/test_ui.py
Outdated
text_block_test = ui.TextBlock2D() | ||
text_block_test.message = 'TextBlock' | ||
text_block_test.color = (0, 0, 0) | ||
# /TextBlock |
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.
Are comments like this necessary?
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.
No, I just copied the style I saw for other tests. I'll remove them.
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.
I just added them for easy readability, since we're putting in all components in a single file. They can be removed, no problem.
dipy/viz/tests/test_ui.py
Outdated
npt.assert_equal((1, 0, 0), text_block.color) | ||
text_block.position = (2, 3) | ||
npt.assert_equal((2, 3), text_block.position) | ||
# /TextBlock2D |
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.
Same here.
I tried the code in my computer. Seems working well. Apart from some minor comments, seems this is ready to be merged. |
@ranveeraggarwal Those components look good to me in the viz_ui.py example, so I think it is good to go. I'm pretty sure I just had to switch the name. |
1 similar comment
Thank you @dmreagan |
Make TextActor2D extend UI instead of object
Previously,
TextActor2D
was used by other classes likeTextBox2D
andLineSlider2D
, but could not be added to theShowManager
nor to aPanel2D
as a standalone UI element. However,TextActor2D
can be useful as a text label which is not editable by users, so this PR promotes it to a full member ofviz.ui
.