-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Update :class:~.Text
to use new ManimPango
color setting
#2341
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
Conversation
befa878
to
13c01d7
Compare
Did you check |
53c6c65
to
87ee54f
Compare
Do you know any reason why macOS tests hangs https://github.com/ManimCommunity/manim/runs/4499349852?check_suite_focus=true#step:18:23? Is it something related to ManimPango? |
I don't know. I don't own a Mac and the github CI message is cryptic. I've tried removing test I added, but it shouldn't break it, since the test is not even run on MacOS. |
@ManimCommunity/macos Can anyone confirm whether this PR works on macOS and the recent version of ManimPango works correctly/doesn't crash? |
@PhilippImhof Do tests pass? |
Just tried. First, I had a crash, similar to the tests in CI. Checking the output, I modified @pytest.mark.skip(msg="Temporarily skip due to failing in Mac CI")
def test_force_window_opengl_render_with_format(
using_temp_opengl_config,
force_window_config_pngs,
disabling_caching,
):
"""force_window creates window when format is set"""
scene = SquareToCircle()
renderer = scene.renderer
renderer.update_frame = Mock(wraps=renderer.update_frame)
scene.render()
assert renderer.window is not None
renderer.window.close() Now I have
So no failing tests related to this PR and the crash is due to OpenGL, but I cannot say more, because I am absolutely not into that. |
Hmm, does that mean the recent update in ManimPango (at least macOS binary wheels) caused this? Can you confirm that by building manimpango from source and installing it in your venv and then running tests? (run |
Also, do you reproduce this test failure/crash when running in the main branch? |
Running the tests on Doing So just to be sure, I changed the dependencies for ManimPango to 0.4.0 and updated the packages. Now Thus, I would say that ManimPango is not the culprit. |
51787c1
to
e774bdd
Compare
I can see CI tests are still failing for Mac OS. However, on my machine all tests are passing, except for the unrelated |
f299c24
to
b4d6c34
Compare
@naveen521kk It took a while, but I've managed to pinpoint the problem. It's the wheels of ManimPango 0.4.0 for macos. As you can see after modifying files to build ManimPango from sources the macos tests pass (windows fails but this is unimportant). I don't have any experience with wheels, do you have any idea what could cause the problem? |
Ah, I see. I thought the same. On ManimCommunity/ManimPango#68 I have changed the macOS to statically link with Pango and for some reason, it crashes here. I think reverting that change would be easier than actually debugging why it crashes here. I work on doing that soon. Thanks for investigating. |
With @naveen521kk's changes from ManimCommunity/ManimPango#71 the problem will most certainly be solved. Well done! |
A new version is released( |
3df473f
to
df3b73d
Compare
Tests are now working fine on Mac, problem solved. IMHO this should now be marked as ready for review. Thanks for the work! Oh and...Happy New Year! |
Any ideas why there is an error in the Linux tests now? IIRC all tests passed before, except for Mac where they crashed... |
I think some new tests were added that exposed a bug in my current implementation. I'm trying to fix it now. |
Text
to use new ManimPango color setting
@@ -594,55 +590,137 @@ def set_color_by_t2c(self, t2c=None): | |||
"""Internally used function. Sets color for specified strings.""" | |||
t2c = t2c if t2c else self.t2c | |||
for word, color in list(t2c.items()): | |||
for start, end in self.find_indexes(word, self.original_text): | |||
for start, end in self.find_indexes(word, self.text): | |||
self.chars[start:end].set_color(color) | |||
|
|||
def set_color_by_t2g(self, t2g=None): |
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.
Is this function used anywhere else? If not you can deprecate it or rather remove it. Same for set_color_by_t2c
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 other than the comment above
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 now
Text
to use new ManimPango color setting~.Text
to use new ManimPango
color setting
Overview: What does this pull request change?
~.Text
class now uses color setting introduced inManimPango 0.4.0
for color and gradient.Motivation and Explanation: Why and how do your changes improve the library?
Fixes #2330
Links to added or changed documentation pages
Further Information and Comments
Reviewer Checklist