mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
[PREVIEW] If one is under Linux, use the command 'xdg-open' to open the generated video.
This commit is contained in:
parent
f19a50784b
commit
dae3b63fd5
1 changed files with 8 additions and 2 deletions
|
@ -129,6 +129,7 @@ def get_configuration():
|
||||||
return config
|
return config
|
||||||
|
|
||||||
def handle_scene(scene, **config):
|
def handle_scene(scene, **config):
|
||||||
|
import platform
|
||||||
if config["quiet"]:
|
if config["quiet"]:
|
||||||
curr_stdout = sys.stdout
|
curr_stdout = sys.stdout
|
||||||
sys.stdout = open(os.devnull, "w")
|
sys.stdout = open(os.devnull, "w")
|
||||||
|
@ -142,6 +143,9 @@ def handle_scene(scene, **config):
|
||||||
])
|
])
|
||||||
if open_file:
|
if open_file:
|
||||||
commands = ["open"]
|
commands = ["open"]
|
||||||
|
if (platform.system() == "Linux"):
|
||||||
|
commands = ["xdg-open"]
|
||||||
|
|
||||||
if config["show_file_in_finder"]:
|
if config["show_file_in_finder"]:
|
||||||
commands.append("-R")
|
commands.append("-R")
|
||||||
#
|
#
|
||||||
|
@ -149,7 +153,9 @@ def handle_scene(scene, **config):
|
||||||
commands.append(scene.get_image_file_path())
|
commands.append(scene.get_image_file_path())
|
||||||
else:
|
else:
|
||||||
commands.append(scene.get_movie_file_path())
|
commands.append(scene.get_movie_file_path())
|
||||||
sp.call(commands)
|
FNULL = open(os.devnull, 'w')
|
||||||
|
sp.call(commands, stdout=FNULL, stderr=sp.STDOUT)
|
||||||
|
FNULL.close()
|
||||||
|
|
||||||
if config["quiet"]:
|
if config["quiet"]:
|
||||||
sys.stdout.close()
|
sys.stdout.close()
|
||||||
|
|
Loading…
Add table
Reference in a new issue