mirror of
				https://github.com/buzz-lightsnack-2007/BlendererOnline.git
				synced 2024-08-14 23:57:22 +00:00 
			
		
		
		
	Removed blender file file name reference in the picture viewer + added video viewer utility.
This commit is contained in:
		
							parent
							
								
									79a9a774ad
								
							
						
					
					
						commit
						4c59824e5d
					
				
					 1 changed files with 47 additions and 1 deletions
				
			
		|  | @ -271,7 +271,7 @@ | ||||||
|         "\n", |         "\n", | ||||||
|         "def fixFormatImage(): \n", |         "def fixFormatImage(): \n", | ||||||
|         "    ## Give file format of png if the user didn't give any. Of course they should put it. \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", |         "\n", | ||||||
|         "def preview(): \n", |         "def preview(): \n", | ||||||
|         "    clear()\n", |         "    clear()\n", | ||||||
|  | @ -287,6 +287,52 @@ | ||||||
|         "main()" |         "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", |       "cell_type": "code", | ||||||
|       "execution_count": null, |       "execution_count": null, | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue