Added support for externally sourced apps

This commit is contained in:
Andreas Völker 2019-01-01 12:36:45 +01:00
parent cc732a519d
commit 50f8dd29f7
3 changed files with 15 additions and 8 deletions

View File

@ -30,12 +30,6 @@ Apps = [
{"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},
{"guiname": "Dual Moodlight", "name": "bimood", "cmd": "apps/bimood", "persistent": False}, {"guiname": "Dual Moodlight", "name": "bimood", "cmd": "apps/bimood", "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
View File

View 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"