Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

fix: move config.file_writer_config["gif_file_extension"] to constants.GIF_FILE_EXTENSION

leotrsd5bf02c24809
diff --git a/manim/config.py b/manim/config.py
index d05c27f24..7e27534f3 100644
--- a/manim/config.py
+++ b/manim/config.py
@@ -107,10 +107,6 @@ def _parse_file_writer_config(config_parser, args):
if args.scene_names is not None else [])
config['output_file'] = args.output_file
- # Read some options that cannot be overriden by CLI arguments
- for opt in ['gif_file_extension']:
- config[opt] = default[opt]
-
# Handle all options that are directly overridden by CLI
# arguments. Note ConfigParser options are all strings and each
# needs to be converted to the appropriate type. Thus, we do this
diff --git a/manim/constants.py b/manim/constants.py
index 45fe51bfe..e8acf30e6 100644
--- a/manim/constants.py
+++ b/manim/constants.py
@@ -79,6 +79,9 @@ DEGREES = TAU / 360
# ffmpeg stuff
FFMPEG_BIN = "ffmpeg"
+# gif stuff
+GIF_FILE_EXTENSION = '.gif'
+
# Colors
COLOR_MAP = {
"DARK_BLUE": "#236B8E",
diff --git a/manim/default.cfg b/manim/default.cfg
index 68996ad61..c36991087 100644
--- a/manim/default.cfg
+++ b/manim/default.cfg
@@ -75,9 +75,6 @@ tex_dir = %(MEDIA_DIR)s/Tex
# --text_dir
text_dir = %(MEDIA_DIR)s/texts
-# This value cannot be changed through CLI
-gif_file_extension = .gif
-
# If the -t (--transparent) flag is used, these will be replaced with the
# values specified in the [TRANSPARENT] section later in this file.
png_mode = RGB
diff --git a/manim/scene/scene_file_writer.py b/manim/scene/scene_file_writer.py
index 1d67995d3..61737e09d 100644
--- a/manim/scene/scene_file_writer.py
+++ b/manim/scene/scene_file_writer.py
@@ -8,7 +8,7 @@ from time import sleep
import datetime
from PIL import Image
-from ..constants import FFMPEG_BIN
+from ..constants import FFMPEG_BIN, GIF_FILE_EXTENSION
from ..config import file_writer_config
from ..logger import logger
from ..utils.config_ops import digest_config
@@ -80,7 +80,7 @@ class SceneFileWriter(object):
self.gif_file_path = os.path.join(
movie_dir,
add_extension_if_not_present(
- scene_name, file_writer_config['gif_file_extension']
+ scene_name, GIF_FILE_EXTENSION
)
)
self.partial_movie_directory = guarantee_existence(os.path.join(