Move display_during_exection associated with Latex rendering

Only have it display when a new SVG is being written
This commit is contained in:
Grant Sanderson 2022-12-19 16:19:43 -08:00
parent 71c9144952
commit ab470c3ee5
3 changed files with 8 additions and 11 deletions

View file

@ -3,7 +3,6 @@ from __future__ import annotations
import re import re
from manimlib.mobject.svg.string_mobject import StringMobject from manimlib.mobject.svg.string_mobject import StringMobject
from manimlib.utils.tex_file_writing import display_during_execution
from manimlib.utils.tex_file_writing import tex_content_to_svg_file from manimlib.utils.tex_file_writing import tex_content_to_svg_file
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
@ -79,10 +78,9 @@ class MTex(StringMobject):
) )
def get_file_path_by_content(self, content: str) -> str: def get_file_path_by_content(self, content: str) -> str:
with display_during_execution(f"Writing \"{self.tex_string}\""): file_path = tex_content_to_svg_file(
file_path = tex_content_to_svg_file( content, self.template, self.additional_preamble
content, self.template, self.additional_preamble )
)
return file_path return file_path
# Parsing # Parsing

View file

@ -11,7 +11,6 @@ from manimlib.constants import MED_LARGE_BUFF, SMALL_BUFF
from manimlib.mobject.geometry import Line from manimlib.mobject.geometry import Line
from manimlib.mobject.svg.svg_mobject import SVGMobject from manimlib.mobject.svg.svg_mobject import SVGMobject
from manimlib.mobject.types.vectorized_mobject import VGroup from manimlib.mobject.types.vectorized_mobject import VGroup
from manimlib.utils.tex_file_writing import display_during_execution
from manimlib.utils.tex_file_writing import tex_content_to_svg_file from manimlib.utils.tex_file_writing import tex_content_to_svg_file
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
@ -86,10 +85,9 @@ class SingleStringTex(SVGMobject):
def get_file_path(self) -> str: def get_file_path(self) -> str:
content = self.get_tex_file_body(self.tex_string) content = self.get_tex_file_body(self.tex_string)
with display_during_execution(f"Writing \"{self.tex_string}\""): file_path = tex_content_to_svg_file(
file_path = tex_content_to_svg_file( content, self.template, self.additional_preamble
content, self.template, self.additional_preamble )
)
return file_path return file_path
def get_tex_file_body(self, tex_string: str) -> str: def get_tex_file_body(self, tex_string: str) -> str:

View file

@ -78,7 +78,8 @@ def tex_content_to_svg_file(
) )
if not os.path.exists(svg_file): if not os.path.exists(svg_file):
# If svg doesn't exist, create it # If svg doesn't exist, create it
create_tex_svg(full_tex, svg_file, compiler) with display_during_execution(f"Writing \"{content}\""):
create_tex_svg(full_tex, svg_file, compiler)
return svg_file return svg_file