Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Use relative frame path in HTMLWriter #24482

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

Merged
merged 1 commit into from
Nov 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions lib/matplotlib/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,10 +686,9 @@ class ImageMagickFileWriter(ImageMagickBase, FileMovieWriter):

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


Expand Down Expand Up @@ -783,11 +782,13 @@ def finish(self):
if self.embed_frames:
fill_frames = _embedded_frames(self._saved_frames,
self.frame_format)
Nframes = len(self._saved_frames)
frame_count = len(self._saved_frames)
else:
# temp names is filled by FileMovieWriter
fill_frames = _included_frames(self._temp_paths, self.frame_format)
Nframes = len(self._temp_paths)
frame_count = len(self._temp_paths)
fill_frames = _included_frames(
frame_count, self.frame_format,
self._temp_paths[0].parent.relative_to(self.outfile.parent))
mode_dict = dict(once_checked='',
loop_checked='',
reflect_checked='')
Expand All @@ -798,7 +799,7 @@ def finish(self):
with open(self.outfile, 'w') as of:
of.write(JS_INCLUDE + STYLE_INCLUDE)
of.write(DISPLAY_TEMPLATE.format(id=uuid.uuid4().hex,
Nframes=Nframes,
Nframes=frame_count,
fill_frames=fill_frames,
interval=interval,
**mode_dict))
Expand Down