A community-maintained Python framework for creating mathematical animations.
Add cfg entry to choose presence of timestamps.
Aathishd87172f87c6f
diff --git a/manim/default.cfg b/manim/default.cfgindex c642acd38..0a4cae0f4 100644--- a/manim/default.cfg+++ b/manim/default.cfg@@ -160,4 +160,5 @@ log_time = cyan dimlog_message =log_path = dimlog_width = -1-log_height = -1\ No newline at end of file+log_height = -1+log_timestamps = True\ No newline at end of filediff --git a/manim/logger.py b/manim/logger.pyindex a8f83ca83..8c7636b21 100644--- a/manim/logger.py+++ b/manim/logger.py@@ -30,9 +30,14 @@ def parse_theme(fp):theme["log.height"] = (None if theme["log.height"] == "-1" else int(theme["log.height"]))+ theme["log.timestamps"] = False if theme["log.timestamps"] == "False" else Truetry:customTheme = Theme(- {k: v for k, v in theme.items() if k not in ["log.width", "log.height"]}+ {+ k: v+ for k, v in theme.items()+ if k not in ["log.width", "log.height", "log.timestamps"]+ })except (color.ColorParseError, errors.StyleSyntaxError):customTheme = None@@ -80,7 +85,7 @@ logging.basicConfig(level="NOTSET",format="%(message)s",datefmt="[%X]",- handlers=[RichHandler(console=console)],+ handlers=[RichHandler(console=console,show_time=themedict["log.timestamps"])],)logger = logging.getLogger("rich")diff --git a/manim/utils/cfg_subcmds.py b/manim/utils/cfg_subcmds.pyindex 94dd5a065..8f14df25b 100644--- a/manim/utils/cfg_subcmds.py+++ b/manim/utils/cfg_subcmds.py@@ -22,7 +22,7 @@ __all__ = ["write", "show", "export"]RICH_COLOUR_INSTRUCTIONS = """[red]The default colour is used by the input statement.If left empty, the default colour will be used.[/red][magenta] For a full list of styles, visit[/magenta] [green]https://rich.readthedocs.io/en/latest/style.html[/green]"""-+RICH_NON_STYLE_ENTRIES = ["log.width", "log.height","log.timestamps"]console = Console()@@ -106,7 +106,6 @@ To save your config please save that file and place it in your current working dif not openfile:action = "save this as"-for category in config:console.print(f"{category}", style="bold green underline")default = config[category]@@ -116,8 +115,8 @@ To save your config please save that file and place it in your current working dfor key in default:# All the cfg entries for logger need to be validated as styles,- # as long as they arent for setting the log width or height etc- if category == "logger" and key not in ["log.width", "log.height"]:+ # as long as they arent setting the log width or height etc+ if category == "logger" and key not in RICH_NON_STYLE_ENTRIES:desc = "style"style = default[key]else:@@ -125,7 +124,7 @@ To save your config please save that file and place it in your current working dstyle = Noneconsole.print(f"Enter the {desc} for {key} ", style=style, end="")- if category != "logger" or key in ["log.width", "log.height"]:+ if category != "logger" or key in RICH_NON_STYLE_ENTRIES:defaultval = (repr(default[key])if isinstance(value_from_string(default[key]), str)@@ -183,10 +182,11 @@ To save your config please save that file and place it in your current working ddef show():current_config = finalized_configs_dict()+ rich_non_style_entries = [a.replace(".","_") for a in RICH_NON_STYLE_ENTRIES]for category in current_config:console.print(f"{category}", style="bold green underline")for entry in current_config[category]:- if category == "logger" and entry not in ["log_width", "log_height"]:+ if category == "logger" and entry not in rich_non_style_entries:console.print(f"{entry} :", end="")console.print(f" {current_config[category][entry]}",diff --git a/tests/test_cli/write_cfg_sbcmd_input.txt b/tests/test_cli/write_cfg_sbcmd_input.txtindex 81a8457c4..984eea70f 100644--- a/tests/test_cli/write_cfg_sbcmd_input.txt+++ b/tests/test_cli/write_cfg_sbcmd_input.txt@@ -60,5 +60,6 @@ False+