Only display writing message when a new tex file is actually being written

This commit is contained in:
Grant Sanderson 2021-01-30 22:12:44 -08:00
parent 53cfbacab4
commit 3c0f8abe5f

View file

@ -37,18 +37,18 @@ class SingleStringTex(VMobject):
assert(isinstance(tex_string, str)) assert(isinstance(tex_string, str))
self.tex_string = tex_string self.tex_string = tex_string
if tex_string not in tex_string_to_mob_map: if tex_string not in tex_string_to_mob_map:
full_tex = self.get_tex_file_body(tex_string) with display_during_execution(f" Writing \"{tex_string}\""):
filename = tex_to_svg_file(full_tex) full_tex = self.get_tex_file_body(tex_string)
svg_mob = SVGMobject( filename = tex_to_svg_file(full_tex)
filename, svg_mob = SVGMobject(
height=None, filename,
path_string_config={ height=None,
"should_subdivide_sharp_curves": True, path_string_config={
"should_remove_null_curves": True, "should_subdivide_sharp_curves": True,
} "should_remove_null_curves": True,
) }
tex_string_to_mob_map[tex_string] = svg_mob )
tex_string_to_mob_map[tex_string] = svg_mob
self.add(*( self.add(*(
sm.copy() sm.copy()
for sm in tex_string_to_mob_map[tex_string] for sm in tex_string_to_mob_map[tex_string]
@ -164,13 +164,12 @@ class Tex(SingleStringTex):
digest_config(self, kwargs) digest_config(self, kwargs)
self.tex_strings = self.break_up_tex_strings(tex_strings) self.tex_strings = self.break_up_tex_strings(tex_strings)
full_string = self.arg_separator.join(self.tex_strings) full_string = self.arg_separator.join(self.tex_strings)
with display_during_execution(f" Writing \"{full_string}\""): super().__init__(full_string, **kwargs)
super().__init__(full_string, **kwargs) self.break_up_by_substrings()
self.break_up_by_substrings() self.set_color_by_tex_to_color_map(self.tex_to_color_map)
self.set_color_by_tex_to_color_map(self.tex_to_color_map)
if self.organize_left_to_right: if self.organize_left_to_right:
self.organize_submobjects_left_to_right() self.organize_submobjects_left_to_right()
def break_up_tex_strings(self, tex_strings): def break_up_tex_strings(self, tex_strings):
# Separate out anything surrounded in double braces # Separate out anything surrounded in double braces