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

Refactor TexTemplate #3520

Merged
merged 10 commits into from
Jan 15, 2024
12 changes: 6 additions & 6 deletions manim/_config/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from manim import constants
from manim.constants import RendererType
from manim.utils.color import ManimColor
from manim.utils.tex import TexTemplate, TexTemplateFromFile
from manim.utils.tex import TexTemplate

if TYPE_CHECKING:
from enum import EnumMeta
Expand Down Expand Up @@ -833,7 +833,7 @@ def digest_args(self, args: argparse.Namespace) -> Self:

# Handle --tex_template
if args.tex_template:
self.tex_template = TexTemplateFromFile(tex_filename=args.tex_template)
self.tex_template = TexTemplate.from_file(args.tex_template)

if (
self.renderer == RendererType.OPENGL
Expand Down Expand Up @@ -1756,19 +1756,19 @@ def tex_template(self) -> TexTemplate:
if not hasattr(self, "_tex_template") or not self._tex_template:
fn = self._d["tex_template_file"]
if fn:
self._tex_template = TexTemplateFromFile(tex_filename=fn)
self._tex_template = TexTemplate.from_file(fn)
else:
self._tex_template = TexTemplate()
return self._tex_template

@tex_template.setter
def tex_template(self, val: TexTemplateFromFile | TexTemplate) -> None:
if isinstance(val, (TexTemplateFromFile, TexTemplate)):
def tex_template(self, val: TexTemplate) -> None:
if isinstance(val, TexTemplate):
self._tex_template = val

@property
def tex_template_file(self) -> Path:
"""File to read Tex template from (no flag). See :class:`.TexTemplateFromFile`."""
"""File to read Tex template from (no flag). See :class:`.TexTemplate`."""
return self._d["tex_template_file"]

@tex_template_file.setter
Expand Down
Loading
Loading