mirror of
https://github.com/jeertmans/manim-slides.git
synced 2025-09-19 12:44:11 +08:00
chore(lib): Remove old validation check preventing loop=True
with auto_next=True
(#445)
* remove old validation check * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update CHANGELOG.md --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -18,6 +18,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Fixed whitespace issue in default RevealJS template.
|
- Fixed whitespace issue in default RevealJS template.
|
||||||
[#442](https://github.com/jeertmans/manim-slides/pull/442)
|
[#442](https://github.com/jeertmans/manim-slides/pull/442)
|
||||||
|
|
||||||
|
(unreleased-chore)=
|
||||||
|
### Chore
|
||||||
|
|
||||||
|
- Removed an old validation check that prevented setting `loop=True` with
|
||||||
|
`auto_next=True` on `next_slide()`
|
||||||
|
[#445](https://github.com/jeertmans/manim-slides/pull/445)
|
||||||
|
|
||||||
(v5.1.7)=
|
(v5.1.7)=
|
||||||
## [v5.1.7](https://github.com/jeertmans/manim-slides/compare/v5.1.6...v5.1.7)
|
## [v5.1.7](https://github.com/jeertmans/manim-slides/compare/v5.1.6...v5.1.7)
|
||||||
|
|
||||||
|
@ -262,21 +262,6 @@ class PreSlideConfig(BaseSlideConfig):
|
|||||||
|
|
||||||
return pre_slide_config
|
return pre_slide_config
|
||||||
|
|
||||||
@model_validator(mode="after")
|
|
||||||
@classmethod
|
|
||||||
def loop_and_auto_next_disallowed(
|
|
||||||
cls, pre_slide_config: "PreSlideConfig"
|
|
||||||
) -> "PreSlideConfig":
|
|
||||||
if pre_slide_config.loop and pre_slide_config.auto_next:
|
|
||||||
raise ValueError(
|
|
||||||
"You cannot have both `loop=True` and `auto_next=True`, "
|
|
||||||
"because a looping slide has no ending. "
|
|
||||||
"This may be supported in the future if "
|
|
||||||
"https://github.com/jeertmans/manim-slides/pull/299 gets merged."
|
|
||||||
)
|
|
||||||
|
|
||||||
return pre_slide_config
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def slides_slice(self) -> slice:
|
def slides_slice(self) -> slice:
|
||||||
return slice(self.start_animation, self.end_animation)
|
return slice(self.start_animation, self.end_animation)
|
||||||
|
@ -22,7 +22,6 @@ from manim import (
|
|||||||
Text,
|
Text,
|
||||||
)
|
)
|
||||||
from packaging import version
|
from packaging import version
|
||||||
from pydantic import ValidationError
|
|
||||||
|
|
||||||
from manim_slides.config import PresentationConfig
|
from manim_slides.config import PresentationConfig
|
||||||
from manim_slides.defaults import FOLDER_PATH
|
from manim_slides.defaults import FOLDER_PATH
|
||||||
@ -193,7 +192,7 @@ class TestSlide:
|
|||||||
assert not self._base_slide_config.auto_next
|
assert not self._base_slide_config.auto_next
|
||||||
|
|
||||||
@assert_constructs
|
@assert_constructs
|
||||||
class TestLoopAndAutoNextFails(Slide):
|
class TestLoopAndAutoNextSucceeds(Slide):
|
||||||
def construct(self) -> None:
|
def construct(self) -> None:
|
||||||
text = Text("Some text")
|
text = Text("Some text")
|
||||||
|
|
||||||
@ -202,8 +201,7 @@ class TestSlide:
|
|||||||
self.next_slide(loop=True, auto_next=True)
|
self.next_slide(loop=True, auto_next=True)
|
||||||
self.play(text.animate.scale(2))
|
self.play(text.animate.scale(2))
|
||||||
|
|
||||||
with pytest.raises(ValidationError):
|
self.next_slide()
|
||||||
self.next_slide()
|
|
||||||
|
|
||||||
@assert_constructs
|
@assert_constructs
|
||||||
class TestPlaybackRate(Slide):
|
class TestPlaybackRate(Slide):
|
||||||
|
Reference in New Issue
Block a user