org babel: manim progress?
This commit is contained in:
@@ -76,10 +76,13 @@
|
|||||||
(require 'ob-ref)
|
(require 'ob-ref)
|
||||||
(require 'ob-comint)
|
(require 'ob-comint)
|
||||||
(require 'ob-eval)
|
(require 'ob-eval)
|
||||||
|
(require 'python)
|
||||||
;; possibly require modes required for your language
|
;; possibly require modes required for your language
|
||||||
|
|
||||||
;; optionally define a file extension for this language
|
;; optionally define a file extension for this language
|
||||||
(add-to-list 'org-babel-tangle-lang-exts '("manim" . "tmp"))
|
(add-to-list 'org-babel-tangle-lang-exts '("manim" . "py"))
|
||||||
|
|
||||||
|
(add-to-list 'org-src-lang-modes '("manim" . python))
|
||||||
|
|
||||||
;; optionally declare default header arguments for this language
|
;; optionally declare default header arguments for this language
|
||||||
(defvar org-babel-default-header-args:manim '())
|
(defvar org-babel-default-header-args:manim '())
|
||||||
@@ -125,11 +128,6 @@
|
|||||||
This function is called by `org-babel-execute-src-block'"
|
This function is called by `org-babel-execute-src-block'"
|
||||||
(message "executing Manim source code block")
|
(message "executing Manim source code block")
|
||||||
(let* ((processed-params (org-babel-process-params params))
|
(let* ((processed-params (org-babel-process-params params))
|
||||||
;; set the session if the value of the session keyword is not the
|
|
||||||
;; string `none'
|
|
||||||
(session (unless (string= value "none")
|
|
||||||
(org-babel-manim-initiate-session
|
|
||||||
(cdr (assq :session processed-params)))))
|
|
||||||
;; variables assigned for use in the block
|
;; variables assigned for use in the block
|
||||||
(vars (org-babel--get-vars processed-params))
|
(vars (org-babel--get-vars processed-params))
|
||||||
(result-params (assq :result-params processed-params))
|
(result-params (assq :result-params processed-params))
|
||||||
@@ -137,7 +135,11 @@ This function is called by `org-babel-execute-src-block'"
|
|||||||
(result-type (assq :result-type processed-params))
|
(result-type (assq :result-type processed-params))
|
||||||
;; expand the body with `org-babel-expand-body:manim'
|
;; expand the body with `org-babel-expand-body:manim'
|
||||||
(full-body (org-babel-expand-body:manim
|
(full-body (org-babel-expand-body:manim
|
||||||
body params processed-params)))
|
body params processed-params))
|
||||||
|
(result (let ((script-file (org-babel-temp-file "org-babel-manim-" ".py")))
|
||||||
|
(with-temp-file script-file
|
||||||
|
(insert full-body))
|
||||||
|
(org-babel-eval (format "manim --progress_bar none %s" (org-babel-process-file-name script-file)) "")))))
|
||||||
;; actually execute the source-code block either in a session or
|
;; actually execute the source-code block either in a session or
|
||||||
;; possibly by dropping it to a temporary file and evaluating the
|
;; possibly by dropping it to a temporary file and evaluating the
|
||||||
;; file.
|
;; file.
|
||||||
@@ -152,7 +154,7 @@ This function is called by `org-babel-execute-src-block'"
|
|||||||
;; other language, please preprocess any file names involved with
|
;; other language, please preprocess any file names involved with
|
||||||
;; the function `org-babel-process-file-name'. (See the way that
|
;; the function `org-babel-process-file-name'. (See the way that
|
||||||
;; function is used in the language files)
|
;; function is used in the language files)
|
||||||
))
|
(format "./media/%s/%s/%s/%s" ("image" "video") (filename) ("1080p60" or ".") ("OutputFile")))
|
||||||
|
|
||||||
;; This function should be used to assign any variables in params in
|
;; This function should be used to assign any variables in params in
|
||||||
;; the context of the session environment.
|
;; the context of the session environment.
|
||||||
|
|||||||
Reference in New Issue
Block a user