-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
feat(cli/lib): use scene background color as default #160
Conversation
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.
Thank you for your work @Fairlight8, I requested a few changes before I can merge :-)
manim_slides/config.py
Outdated
@@ -150,6 +150,7 @@ class PresentationConfig(BaseModel): # type: ignore | |||
slides: List[SlideConfig] | |||
files: List[FilePath] | |||
resolution: Tuple[PositiveInt, PositiveInt] = (1920, 1080) | |||
background_color: str = "black" |
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.
background_color: str = "black" | |
background_color: str = Color |
Please use the Color
type from Pydantic: https://docs.pydantic.dev/usage/types/#color-type.
manim_slides/present.py
Outdated
self.label.setStyleSheet( | ||
f"background-color: {self.thread.current_presentation.background_color}" | ||
) |
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.
self.label.setStyleSheet( | |
f"background-color: {self.thread.current_presentation.background_color}" | |
) | |
self.label.setStyleSheet( | |
f"background-color: {self.thread.current_background_color}" | |
) |
For readability, create a current_background_color
property :-)
manim_slides/slide.py
Outdated
@@ -53,6 +53,7 @@ def __init__( | |||
self.__current_animation = 0 | |||
self.__loop_start_animation: Optional[int] = None | |||
self.__pause_start_animation = 0 | |||
self.__background_color = config["background_color"].hex |
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.
This does not work because the background_color
attribute is not placed in config
with ManimGL. So you need to a separate implementation, as with __resolution
:
manim-slides/manim_slides/slide.py
Lines 57 to 63 in 2a327c4
@property | |
def __resolution(self) -> Tuple[int, int]: | |
"""Returns the scene's resolution used during rendering.""" | |
if MANIMGL: | |
return self.camera_config["pixel_width"], self.camera_config["pixel_height"] | |
else: | |
return config["pixel_width"], config["pixel_height"] |
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.
Oh, I Didn't know, understood!
if background_color is not None: | ||
for presentation_config in presentation_configs: | ||
presentation_config.background_color = background_color | ||
|
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 think you need to remove the background_color
option from App
:-)
Of course, of course. Sorry for the potential mistakes. It is a simple issue but I am still new contributing to other projects. I agree with all the changes. Do I have to accept them? |
No problem, first contributions are always hard! In general, you can approve them, yes. But here, some codes changes are still needed beyond those I proposed. For example, you need to import the Color from pydantic first :) |
Ohhhh, true true true. So, what's the process now? Should I add a different PR? Add new commits? Can I change this PR for another commit? |
You can just push new commits :) |
Added some changes! I think that's fine now! |
Nice work! A few last changes before merging this were requested. You can see that You can just approve the changes if you agree with them. |
Another commit for those details. By the way. The github pages thing is my issue, right? |
You don't have to mind about that :-) |
Goodness, too many new things xDDD. That is already changed, right? I pulled from git and it is already changed. |
Yep sorry, I didn't want to bother you, so I committed the changes directly ^^ Looks good to me, I will merge this and soon release this :-) Probably as part of 4.12 |
Understood, thank you! Again, thanks a lot for your patience. Probably, it would be much more shorter and easier if you did that on your own, so I appreciate the patience while I learn all these things! |
No problem, it was a pleasure :-) I've been there too! |
Fixes Issue
Closes #130
Check List (Check all the applicable boxes)
Note to reviewers
Please review the code, just in case ^^