Skip to content

Commit 0abb13d

Browse files
authored
Merge pull request #24505 from meeseeksmachine/auto-backport-of-pr-24482-on-v3.6.x
Backport PR #24482 on branch v3.6.x (Use relative frame path in HTMLWriter)
2 parents 49d65a8 + cd4cdb8 commit 0abb13d

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lib/matplotlib/animation.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -686,10 +686,9 @@ class ImageMagickFileWriter(ImageMagickBase, FileMovieWriter):
686686

687687
# Taken directly from jakevdp's JSAnimation package at
688688
# http://github.com/jakevdp/JSAnimation
689-
def _included_frames(paths, frame_format):
690-
"""paths should be a list of Paths"""
691-
return INCLUDED_FRAMES.format(Nframes=len(paths),
692-
frame_dir=paths[0].parent,
689+
def _included_frames(frame_count, frame_format, frame_dir):
690+
return INCLUDED_FRAMES.format(Nframes=frame_count,
691+
frame_dir=frame_dir,
693692
frame_format=frame_format)
694693

695694

@@ -783,11 +782,13 @@ def finish(self):
783782
if self.embed_frames:
784783
fill_frames = _embedded_frames(self._saved_frames,
785784
self.frame_format)
786-
Nframes = len(self._saved_frames)
785+
frame_count = len(self._saved_frames)
787786
else:
788787
# temp names is filled by FileMovieWriter
789-
fill_frames = _included_frames(self._temp_paths, self.frame_format)
790-
Nframes = len(self._temp_paths)
788+
frame_count = len(self._temp_paths)
789+
fill_frames = _included_frames(
790+
frame_count, self.frame_format,
791+
self._temp_paths[0].parent.relative_to(self.outfile.parent))
791792
mode_dict = dict(once_checked='',
792793
loop_checked='',
793794
reflect_checked='')
@@ -798,7 +799,7 @@ def finish(self):
798799
with open(self.outfile, 'w') as of:
799800
of.write(JS_INCLUDE + STYLE_INCLUDE)
800801
of.write(DISPLAY_TEMPLATE.format(id=uuid.uuid4().hex,
801-
Nframes=Nframes,
802+
Nframes=frame_count,
802803
fill_frames=fill_frames,
803804
interval=interval,
804805
**mode_dict))

0 commit comments

Comments
 (0)