Removed blender file file name reference in the picture viewer + added video viewer utility.

This commit is contained in:
Hansly Saw 2022-05-08 21:08:26 +08:00 committed by GitHub
parent 79a9a774ad
commit 4c59824e5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -271,7 +271,7 @@
"\n",
"def fixFormatImage(): \n",
" ## Give file format of png if the user didn't give any. Of course they should put it. \n",
" if getExtension(fileViewer.image_fileName) == None: blend_fileName = (str(blend_fileName) + '.png')\n",
" if getExtension(fileViewer.image_fileName) == None: fileViewer.image_fileName = (str(fileViewer.image_fileName) + '.png')\n",
"\n",
"def preview(): \n",
" clear()\n",
@ -287,6 +287,52 @@
"main()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#@title Video Viewer\n",
"#@title Configuration\n",
"class formatting:\n",
" clear = '\\033[0m'\n",
" class color: \n",
" purple = '\\033[95m'\n",
" cyan = '\\033[96m'\n",
" cyan_dark = '\\033[36m'\n",
" blue = '\\033[94m'\n",
" green = '\\033[92m'\n",
" yellow = '\\033[93m'\n",
" red = '\\033[91m'\n",
" class font:\n",
" bold = '\\033[1m'\n",
" underline = '\\033[4m'\n",
"\n",
"## Define screen functions. \n",
"def clear(): from IPython.display import clear_output; return clear_output()\n",
"\n",
"class fileViewer: \n",
" video_fileName = '' #@param {type: \"string\"}\n",
"\n",
"def fixFormatVideo(): \n",
" ## Give file format of png if the user didn't give any. Of course they should put it. \n",
" if (getExtension(fileViewer.video_fileName) == None or getExtension(fileViewer.video_fileName) == ''): fileViewer.video_fileName = (str(fileViewer.video_fileName) + '.avi')\n",
"\n",
"def preview(): \n",
" clear()\n",
" try: \n",
" from IPython.display import Video\n",
" Video(fileViewer.video_fileName, embed=True)\n",
" except:\n",
" info.err(formatting.font.bold + 'Could not preview the video. ' + formatting.clear + 'Make sure that the file is present and that the file format is correct.')\n",
"\n",
"def main(): \n",
" fixFormatVideo(); preview()\n",
"\n",
"main()"
]
},
{
"cell_type": "code",
"execution_count": null,