mirror of
https://github.com/3b1b/manim.git
synced 2025-04-13 09:47:07 +00:00
Make sure keyboard interrupted renders don't overwrite pre-existing video files
This commit is contained in:
parent
11d19b6d57
commit
f741217c34
2 changed files with 7 additions and 2 deletions
|
@ -124,6 +124,7 @@ class Scene(object):
|
|||
except KeyboardInterrupt:
|
||||
# Get rid keyboard interupt symbols
|
||||
print("", end="\r")
|
||||
self.file_writer.ended_with_interrupt = True
|
||||
self.tear_down()
|
||||
|
||||
def setup(self) -> None:
|
||||
|
@ -190,7 +191,6 @@ class Scene(object):
|
|||
# As long as the copied selection starts with a comment,
|
||||
# this will revert to the state of the scene at the first
|
||||
# point of running.
|
||||
def checkpoint_paste(skip=False, show_progress=False):
|
||||
def checkpoint_paste(skip=False, show_progress=True):
|
||||
pasted = pyperclip.paste()
|
||||
line0 = pasted.lstrip().split("\n")[0]
|
||||
|
|
|
@ -54,6 +54,7 @@ class SceneFileWriter(object):
|
|||
self.scene: Scene = scene
|
||||
self.writing_process: sp.Popen | None = None
|
||||
self.has_progress_display: bool = False
|
||||
self.ended_with_interrupt: bool = False
|
||||
self.init_output_directories()
|
||||
self.init_audio()
|
||||
|
||||
|
@ -297,7 +298,11 @@ class SceneFileWriter(object):
|
|||
self.writing_process.terminate()
|
||||
if self.has_progress_display:
|
||||
self.progress_display.close()
|
||||
shutil.move(self.temp_file_path, self.final_file_path)
|
||||
|
||||
if not self.ended_with_interrupt:
|
||||
shutil.move(self.temp_file_path, self.final_file_path)
|
||||
else:
|
||||
self.movie_file_path = self.temp_file_path
|
||||
|
||||
def combine_movie_files(self) -> None:
|
||||
kwargs = {
|
||||
|
|
Loading…
Add table
Reference in a new issue