33import sys
44import traceback
55
6- from manim import constants , logger , console , config , file_writer_config
6+ from manim import constants , logger , console , config
77from manim import Scene
88from manim .utils .module_ops import (
99 get_module ,
1212)
1313from manim .utils .file_ops import open_file as open_media_file
1414from manim .grpc .impl import frame_server_impl
15+ from manim .config .utils import init_dirs
1516from manim .config .main_utils import *
1617
1718
1819def open_file_if_needed (file_writer ):
19- if file_writer_config ["verbosity" ] != "DEBUG" :
20+ if config ["verbosity" ] != "DEBUG" :
2021 curr_stdout = sys .stdout
2122 sys .stdout = open (os .devnull , "w" )
2223
23- open_file = any (
24- [file_writer_config ["preview" ], file_writer_config ["show_in_file_browser" ]]
25- )
24+ open_file = any ([config ["preview" ], config ["show_in_file_browser" ]])
25+
2626 if open_file :
2727 current_os = platform .system ()
2828 file_paths = []
2929
30- if file_writer_config ["save_last_frame" ]:
30+ if config ["save_last_frame" ]:
3131 file_paths .append (file_writer .get_image_file_path ())
32- if (
33- file_writer_config ["write_to_movie" ]
34- and not file_writer_config ["save_as_gif" ]
35- ):
32+ if config ["write_to_movie" ] and not config ["save_as_gif" ]:
3633 file_paths .append (file_writer .get_movie_file_path ())
37- if file_writer_config ["save_as_gif" ]:
34+ if config ["save_as_gif" ]:
3835 file_paths .append (file_writer .gif_file_path )
3936
4037 for file_path in file_paths :
41- if file_writer_config ["show_in_file_browser" ]:
38+ if config ["show_in_file_browser" ]:
4239 open_media_file (file_path , True )
43- if file_writer_config ["preview" ]:
40+ if config ["preview" ]:
4441 open_media_file (file_path , False )
4542
46- if file_writer_config ["verbosity" ] != "DEBUG" :
43+ if config ["verbosity" ] != "DEBUG" :
4744 sys .stdout .close ()
4845 sys .stdout = curr_stdout
4946
@@ -69,13 +66,10 @@ def main():
6966 # something_else_here()
7067
7168 else :
72- update_config_with_cli (args )
73- init_dirs (file_writer_config )
74-
75- if file_writer_config ["log_to_file" ]:
76- set_file_logger ()
69+ config .digest_args (args )
70+ init_dirs (config )
7771
78- module = get_module (file_writer_config ["input_file" ])
72+ module = get_module (config ["input_file" ])
7973 all_scene_classes = get_scene_classes_from_module (module )
8074 scene_classes_to_render = get_scenes_to_render (all_scene_classes )
8175 for SceneClass in scene_classes_to_render :
0 commit comments