Added support for externally sourced apps
This commit is contained in:
		
							
								
								
									
										19
									
								
								config.py
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								config.py
									
									
									
									
									
								
							| @@ -29,12 +29,6 @@ Apps = [ | |||||||
|     {"guiname": "Show Framebuffer", "name": "fbcp", "cmd": ["apps/fbcp", "/dev/fb0"]}, |     {"guiname": "Show Framebuffer", "name": "fbcp", "cmd": ["apps/fbcp", "/dev/fb0"]}, | ||||||
|     {"guiname": "Strobo", "name": "strobo", "cmd": "apps/strobo.py"}, |     {"guiname": "Strobo", "name": "strobo", "cmd": "apps/strobo.py"}, | ||||||
|     {"guiname": "Beispiel", "name": "example", "cmd": "apps/example.py"}, |     {"guiname": "Beispiel", "name": "example", "cmd": "apps/example.py"}, | ||||||
|      |  | ||||||
|     # mathpixel |  | ||||||
|     {"guiname": "Structure formation", "name": "swifthohenberg", "cmd": "apps/swifthohenberg.py", "persistent": False}, |  | ||||||
|     {"guiname": "Quadratisch", "name": "quadratic", "cmd": "apps/quadratic.py"}, |  | ||||||
|     {"guiname": "Pendel", "name": "pendulum", "cmd": "apps/pendlum.py"}, |  | ||||||
|     {"guiname": "Konvergenz", "name": "convergence", "cmd": "apps/convergence.py"}, |  | ||||||
|  |  | ||||||
|     # juergen/pixelfoo |     # juergen/pixelfoo | ||||||
|     {"guiname": "Colored noise", "name": "cnoise", "cmd": "apps/cnoise", "persistent": False}, |     {"guiname": "Colored noise", "name": "cnoise", "cmd": "apps/cnoise", "persistent": False}, | ||||||
| @@ -55,3 +49,16 @@ Apps = [ | |||||||
|     #{"name": "gif", "cmd": "apps/gif.sh"}, |     #{"name": "gif", "cmd": "apps/gif.sh"}, | ||||||
|     #{"name": "colormap", "cmd": "apps/colormap.py"}, |     #{"name": "colormap", "cmd": "apps/colormap.py"}, | ||||||
| ]    | ]    | ||||||
|  |  | ||||||
|  | # load additional apps from config/ | ||||||
|  | import os | ||||||
|  | import os.path | ||||||
|  | configs = os.listdir("configs/") | ||||||
|  | import importlib | ||||||
|  | for config in configs: | ||||||
|  |     file, ext = os.path.splitext(os.path.basename(config)) | ||||||
|  |     if ext != ".py" or file[0] == "_": | ||||||
|  |         continue | ||||||
|  |     modname = "configs."+file | ||||||
|  |     lib = importlib.import_module(modname) | ||||||
|  |     Apps += lib.Apps | ||||||
							
								
								
									
										0
									
								
								configs/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								configs/__init__.py
									
									
									
									
									
										Normal file
									
								
							| @@ -1,6 +1,5 @@ | |||||||
| #!/bin/bash -e | #!/bin/bash -e | ||||||
|  |  | ||||||
|  |  | ||||||
| echo "Setting Attributes for script" | echo "Setting Attributes for script" | ||||||
| chmod +x apps/pong.py | chmod +x apps/pong.py | ||||||
| chmod +x apps/strobo.py | chmod +x apps/strobo.py | ||||||
| @@ -46,7 +45,7 @@ pushd external | |||||||
| if [ ! -d "mathpixel" ]; then | if [ ! -d "mathpixel" ]; then | ||||||
|     git clone https://git.chaospott.de/andreas/mathpixel.git |     git clone https://git.chaospott.de/andreas/mathpixel.git | ||||||
| fi | fi | ||||||
| pushd pixelfoo | pushd mathpixel | ||||||
| git pull | git pull | ||||||
| popd | popd | ||||||
| popd | popd | ||||||
| @@ -58,5 +57,6 @@ chmod +x apps/quadratic.py | |||||||
| chmod +x apps/pendlum.py | chmod +x apps/pendlum.py | ||||||
| chmod +x apps/convergence.py | chmod +x apps/convergence.py | ||||||
| chmod +x apps/swifthohenberg.py | chmod +x apps/swifthohenberg.py | ||||||
|  | cp -f external/mathpixel/mathpixelconf.py configs/ | ||||||
|  |  | ||||||
| echo "Setup done" | echo "Setup done" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Andreas Völker
					Andreas Völker