Commit graph

14 commits

Author SHA1 Message Date
Henrik Skov Midtiby
357bb3fbba
Rewrite MathTex to make it more robust regarding splitting (#4515)
* Extracted the method get_mob_from_shape_element

* Moved more functionality to get_mob_from_shape_element

* More cleanup

* Parse the svg file while maintaining the group structure.

* Make the svg groups available

* Handle PERF401 issue

* [pre-commit.ci] pre-commit autoupdate (#4506)

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.14.7 → v0.14.8](https://github.com/astral-sh/ruff-pre-commit/compare/v0.14.7...v0.14.8)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Added an example of the issue

* Experimenting with coloring elements from the latex equation

* ...

* Regular expression can now match more than one object

* Process the string by applying the substrings in the order they match

* Code refactoring and added type annotations

* ...

* Added a lot of test cases

* More examples

* More examples

* Use matched_strings_and_ids to simplify existing methods

* Remove unused code

* Update get_part_by_tex to use matched_strings_and_ids

* This is required for test_MathTable to pass

* Ensure that self.texstring is set.

* Added more examples from exising issues in the github repo

* Ensure that latex groups are maintained by adding an additional pair of curly braces around the extracted part

* ExampleScene -> Scene

* Added comment

* _break_up_by_substrings

* Refactor code

* Added comment to example

* Handle integer inputs well.

* Expose the original tex_string

* Do not treat the content of substrings_to_isolate as regular expressions.

* Updated examples

* Update examples

* Fix SVMobject caching issue.

* Remove traces from brace_notation_split_occurred

* Simplify MathTex::_break_up_by_substrings

* Fix small issue in tex that in some cases moved elements a tiny bit around

* No use of regular expressions for locate substrings.

* Updated notes to the set of test cases

* Handle issues with the center environment.

* Add example

* Fix issue with rectangles (e.g. from sqrt)

* ConvertToOpenGL

* Reduce the number of nesting levels.

* Use the specified arg_seperator

* Deal with the double curly brace markup

* Code cleanup

* Code cleanup

* Rollback a few changes

* Code cleanup

* Adjust paths the generated artefacts in tests that rely on MathTex

* Added a remark to the using text guide on enclosing snippets in curly braces for substrings_to_isolate to work

* Added space around the numerator argument to frac to avoid having double curly braces in the example.

This would otherwise trigger MathTex to split the string at that location.

* Log errors properly and display some information about the errors and their context.

* Code refactoring as suggested by Benjamin

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2026-02-16 14:22:56 +01:00
Viicos
68bd79093e
Refactor TexTemplate (#3520)
* Refactor `TexTemplate`

* Add tests, refactor some things

* Fixed Some tests

* Move typing imports

* Fix remaining tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: JasonGrace2282 <aarush.deshpande@gmail.com>
Co-authored-by: Jason Grace <110117391+JasonGrace2282@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-01-15 18:39:03 +00:00
ad_chaos
bcfa9ac5ad
Fix bug introduced in Tex rendering via #2574 (#2587)
* Bugfix

* Changes to log data

* Add test

* Seperate test
2022-03-05 22:28:01 +00:00
ad_chaos
5b11a0e48b
Improved Error in :mod:.utils.tex_file_writing (#2574)
* Better Error and insight

* Do not use keywords as identifiers

* add_tests

* Nasty comma

* Windows does its own thing

* Use os.path.join for windows

* Do not log path

* Include Insights

* Full stop.

Co-authored-by: Darylgolden <darylgolden@gmail.com>

* Full stop to test data.

Co-authored-by: Darylgolden <darylgolden@gmail.com>
2022-02-26 20:50:11 +01:00
Christopher Besch
3ce4c133dd
Introduced API for scene sections via :meth:.Scene.next_section (#2152)
* feat: added section class

* fix: fixed imports in scene.py

* feat: added section class

* fix: fixed imports in scene.py

* feat: scene file writer update; needs testing

* broken test

* fixed wrong partial movie files

* feat: added animation concatenation for sections

* fix: sections can contains None as partial movie file

* fix: correct section output file names

* fix: removed media folder

* feat: section output able to extract type

* feat: added guarantee_existence tests

* fix: touch file on windows

* fix: touch file on windows

* feat: automatically create control data with --set_test flag

* feat: added tests for sections output folder

* feat: added flag to enable sections

* feat: testing section metadata file

* feat: finished metadata tests; changed enums to be extendable

* fix: removed testing files

* fix: fixed section types

* fix: fixed outdated control data

* fix: fixed simple_scenes.py

* fix: fixed section type documentation example

* feat: added section video metadata to API

* fix: isort should stop destroying the import order for commands.py

* fix: fixed types of section metadata output

* fix: better comments

* ?

* feat: added elaborate test; switched name and type in next_section call

* feat: changed testing terminology: "config" got renamed to "movie metadata"

* fix: removed unicode lambda :<

* fix: fixed control data

* fix: removed test setter

* feat: added tutorial in the documentation

* fix: updated test control data

* fix: fixed double '.' in video tests

* fix: fixed some documentation

* fix: fixed missign JSON file in docs

* fix: implemented proposed changes

* fix: better --save_sections help

* fix: better docstrings

* fix: fixed last docstring...hopefully :>

* feat: custom section output supported

* fix: removed resolved todos

* fix: added debug for movie concatenation back

* fix: removed implemented TODO

* fix: removed doubled log

* fix: changed debug to info log

* fix: fixed log test data
2021-10-20 10:36:24 +02:00
Hugues Devimeux
fc6159b45d
Refactored play logic (#1019)
* refactored play logic

* fixed tests (and minor improvement)

* moved time progression generation

* fixed typo :/

* added tests

* fixed tests

* fixed imports

* fixed tests

* black

* fixed tests in  python 3.7

* fixed tests for python 3.7

* Update manim/renderer/cairo_renderer.py

* removed is_cached variable

* updated webgl renderer and removed redondent code

* Update manim/scene/scene.py

* Add self.duration back into compile_animation_data

* Fixed openGL ?

* black

* fixed merge conflict by adding fixture marker

* Called begin_animation to fix OpenGL

* Fixed original_skippingstatu sname for opengl renderer

* Update manim/utils/caching.py

Co-authored-by: Devin Neal <devin@eulertour.com>

Co-authored-by: Hugues Devimeux <hugues.devimeux@gmail.com>
Co-authored-by: Jason G. Villanueva <a@jsonvillanueva.com>
Co-authored-by: Devin Neal <devin@eulertour.com>
2021-03-23 09:58:49 +01:00
Leo Torres
d0e04f8cc6
Document config system (#659)
* rename config subpkg to _config for the time being
* Revamp documentation for configuration system modules and classes.  Revamp tutorial.  Update changelog
* use as_posix so that doctests will pass on Windows
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
Co-authored-by: kolibril13 <44469195+kolibril13@users.noreply.github.com>
2020-11-06 21:56:12 -05:00
leotrs
12e1e528eb merge master 2020-10-26 17:46:00 -04:00
leotrs
6e0ba47a1e change every mention of file_writer_config to config. Also some tweaks to ManimConfig 2020-10-14 22:08:00 -04:00
leotrs
439e1fb4a6 Merge branch 'master' into refactor-config-subpkg 2020-10-13 16:22:13 -04:00
leotrs
504ac73859 refactor config system so that all the global variables are defined in manim/config/__init__.py. All other files inside manim/config/ just contain utils that are used by either manim/config/__init__.py or directly by manim/__main__.py 2020-10-13 16:21:35 -04:00
Hugues Devimeux
dde22286a5
FIX : 472 / Small refactor of partial-movie-files handling (#489)
* fix #460 by enabling skipping wait statements.

* added tests

* refactored partialmovie files handling

* improved berobosity of hashing

* fixed tests

* fixed black

* fixed file name

* change format to f string

* fixed comment

* fixed comment

* Update manim/scene/scene.py

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>

* fix test output (caused by 3fff83e8)

Co-authored-by: Hugues Devimeux <hugues.devimeux@gmail.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2020-10-09 16:55:49 +02:00
charlie4fun
9b61e3d0b7 Fix #453: log files naming, when scene is not specified, is fixed 2020-10-07 08:25:37 +02:00
Hugues Devimeux
50c504f094
Refactored logs and added log-to-json feature (removed the old log-to-file feature), added logging test utils. (#403)
* refactored logging, and logging to file feature.

* cleaned up old tests

* Update tests/test_logging/test_logging.py

Co-authored-by: Hugues Devimeux <hugues.devimeux@gmail.com>
Co-authored-by: Pg Biel <9021226+PgBiel@users.noreply.github.com>
Co-authored-by: Leo Torres <dleonardotn@gmail.com>
2020-09-12 15:45:27 -04:00