Code cleanup
This commit is contained in:
128
config.py
128
config.py
@@ -1,8 +1,25 @@
|
||||
import logging
|
||||
from dataclasses import dataclass
|
||||
from typing import Union, List
|
||||
|
||||
#width
|
||||
|
||||
@dataclass
|
||||
class AppConfig:
|
||||
guiname: str
|
||||
name: str
|
||||
cmd: Union[List[str], str]
|
||||
path: str = "./apps/"
|
||||
persistent: bool = False
|
||||
white: bool = False
|
||||
|
||||
def __post_init__(self):
|
||||
if not isinstance(self.cmd, list):
|
||||
self.cmd = [self.cmd]
|
||||
|
||||
|
||||
# width
|
||||
ScreenX = 80
|
||||
#height
|
||||
# height
|
||||
ScreenY = 40
|
||||
|
||||
DefaultBrightness = 0.6
|
||||
@@ -14,81 +31,66 @@ NoDataTimeout = 40
|
||||
|
||||
LogLevel = logging.DEBUG
|
||||
|
||||
UseGui = True
|
||||
UseGui = False
|
||||
GuiFPS = 20
|
||||
GuiScaleFactor = 15
|
||||
|
||||
WebHost = "0.0.0.0"
|
||||
WebPort = 8000
|
||||
|
||||
# first app is always running as default
|
||||
Apps = [
|
||||
# first app is always running as default
|
||||
AppConfig(guiname="Backlight", name="backlight", cmd="./backlight.py", white=True),
|
||||
|
||||
{"name": "backlight", "cmd": "apps/backlight.py", "white": True},
|
||||
|
||||
{"guiname": "Lines", "name": "lines", "cmd": "./lines.py", "persistent": False, "path": "./apps/"},
|
||||
{"guiname": "Wolfram", "name": "wolfram", "cmd": "./wolfram.py", "persistent": False, "path": "./apps/"},
|
||||
{"guiname": "Digi Clock", "name": "digiclock", "cmd": "./digi_clock.py", "persistent": False, "path": "./apps/"},
|
||||
{"guiname": "Text Scroller MQTT", "name": "textscroll", "cmd": "./textscroll.py", "persistent": False, "path": "./apps/"},
|
||||
{"guiname": "Flicker", "name": "flicker", "cmd": "apps/flicker"},
|
||||
|
||||
{"guiname": "Pixelflut", "name": "pixelflut", "cmd": "apps/pixelflut", "persistent": True},
|
||||
# {"guiname": "Pong", "name": "pong", "cmd": "apps/pong.py"},
|
||||
{"guiname": "YoutubeDL", "name": "youtubedl", "cmd": "apps/youtubedl.sh", "persistent": False},
|
||||
# {"guiname": "Show Framebuffer", "name": "fbcp", "cmd": ["apps/fbcp", "/dev/fb0"]},
|
||||
{"guiname": "Strobo", "name": "strobo", "cmd": "apps/strobo.py"},
|
||||
# {"guiname": "Beispiel", "name": "example", "cmd": "apps/example.py"},
|
||||
# {"guiname": "Beispiel2", "name": "example2", "cmd": "apps/example2.py", "white": True},
|
||||
{"guiname": "Fibonacci Clock", "name": "fibonacci-clock", "cmd": "apps/fibonacci-clock.py"},
|
||||
{"guiname": "Wget Video/Gif/Images", "name": "wget", "cmd": "apps/wget.sh", "persistent": False},
|
||||
AppConfig(guiname="Lines", name="lines", cmd="./lines.py"),
|
||||
AppConfig(guiname="Wolfram", name="wolfram", cmd="./wolfram.py"),
|
||||
AppConfig(guiname="Digi Clock", name="digiclock", cmd="./digi_clock.py"),
|
||||
AppConfig(guiname="Text Scroller MQTT", name="textscroll", cmd="./textscroll.py"),
|
||||
AppConfig(guiname="Flicker", name="flicker", cmd="./flicker"),
|
||||
|
||||
AppConfig(guiname="Pixelflut", name="pixelflut", cmd="./pixelflut", persistent=True),
|
||||
# App(guiname="Pong", name="pong", cmd="pong.py"),
|
||||
AppConfig(guiname="YoutubeDL", name="youtubedl", cmd="./youtubedl.sh"),
|
||||
# App(guiname="Show Framebuffer", name="fbcp", cmd=["fbcp", "/dev/fb0"]),
|
||||
AppConfig(guiname="Strobo", name="strobo", cmd="./strobo.py"),
|
||||
# App(guiname="Beispiel", name="example", cmd="example.py"),
|
||||
# App(guiname="Beispiel2", name="example2", cmd="example2.py", white=True),
|
||||
AppConfig(guiname="Fibonacci Clock", name="fibonacci-clock", cmd="./fibonacci-clock.py"),
|
||||
AppConfig(guiname="Wget Video/Gif/Images", name="wget", cmd="./wget.sh"),
|
||||
|
||||
# juergen/pixelfoo
|
||||
{"guiname": "Congress noise", "name": "cnoise", "cmd": "pixelfoo/target/release/cnoise", "persistent": False},
|
||||
{"guiname": "Game of Life", "name": "life", "cmd": "pixelfoo/target/release/life", "persistent": False},
|
||||
{"guiname": "Matrix Code", "name": "matrix-code", "cmd": "pixelfoo/target/release/matrix-code", "persistent": False},
|
||||
{"guiname": "Lorenz Attractor", "name": "lorenz", "cmd": "pixelfoo/target/release/lorenz", "persistent": False},
|
||||
{"guiname": "Dual Moodlight", "name": "bimood", "cmd": "pixelfoo/target/release/bimood", "persistent": False},
|
||||
{"guiname": "Maze", "name": "maze", "cmd": "pixelfoo/target/release/maze", "persistent": False},
|
||||
{"guiname": "Dual Maze", "name": "dualmaze", "cmd": "pixelfoo/target/release/dualmaze", "persistent": False, "persistent": False},
|
||||
{"guiname": "Predator & Prey", "name": "predprey", "cmd": "pixelfoo/target/release/predprey", "persistent": False},
|
||||
AppConfig(guiname="Congress noise", name="cnoise", cmd="./cnoise", path="pixelfoo/target/release/"),
|
||||
AppConfig(guiname="Game of Life", name="life", cmd="./life", path="pixelfoo/target/release/"),
|
||||
AppConfig(guiname="Matrix Code", name="matrix-code", cmd="./matrix-code", path="pixelfoo/target/release/"),
|
||||
AppConfig(guiname="Lorenz Attractor", name="lorenz", cmd="./lorenz", path="pixelfoo/target/release/"),
|
||||
AppConfig(guiname="Dual Moodlight", name="bimood", cmd="./bimood", path="pixelfoo/target/release/"),
|
||||
AppConfig(guiname="Maze", name="maze", cmd="./maze", path="pixelfoo/target/release/"),
|
||||
AppConfig(guiname="Dual Maze", name="dualmaze", cmd="./dualmaze", path="pixelfoo/target/release/"),
|
||||
AppConfig(guiname="Predator & Prey", name="predprey", cmd="./predprey", path="pixelfoo/target/release/"),
|
||||
|
||||
# { "guiname": "Beat Saber Ceiling", "name": "beatsaberceiling", "cmd": "./beatsaberceiling.py", "path": "apps/beatsaberceiling" },
|
||||
# App(guiname="Beat Saber Ceiling", name="beatsaberceiling", cmd="./beatsaberceiling.py", path="beatsaberceiling"),
|
||||
|
||||
# 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"},
|
||||
{"guiname": "Sinic", "name": "sinic", "cmd": "apps/sinic.py"},
|
||||
{"guiname": "Sinic 2", "name": "sinic2", "cmd": "apps/sinic2.py"},
|
||||
AppConfig(guiname="Structure formation", name="swifthohenberg", cmd="./swifthohenberg.py"),
|
||||
AppConfig(guiname="Quadratisch", name="quadratic", cmd="./quadratic.py"),
|
||||
AppConfig(guiname="Pendel", name="pendulum", cmd="./pendlum.py"),
|
||||
AppConfig(guiname="Konvergenz", name="convergence", cmd="./convergence.py"),
|
||||
AppConfig(guiname="Sinic", name="sinic", cmd="./sinic.py"),
|
||||
AppConfig(guiname="Sinic 2", name="sinic2", cmd="./sinic2.py"),
|
||||
|
||||
# pixelthud
|
||||
{"guiname": "Fading Pixels", "name": "fadingpxls", "cmd": "apps/fading_pixels.py", "persistent": False},
|
||||
{"guiname": "Plane Wave", "name": "planewave", "cmd": "apps/plane_wave.py", "persistent": False},
|
||||
{"guiname": "Rock-paper-scissors-spock-lizard", "name": "rps", "cmd": "apps/rps.py", "persistent": False},
|
||||
{"guiname": "Doom Fire", "name": "doomfire", "cmd": "apps/doom_fire_psx2.py", "persistent": False},
|
||||
# {"guiname": "Maxwell FDTD", "name": "fdtd", "cmd": "apps/fdtd.py", "persistent": False},
|
||||
AppConfig(guiname="Fading Pixels", name="fadingpxls", cmd="./fading_pixels.py"),
|
||||
AppConfig(guiname="Plane Wave", name="planewave", cmd="./plane_wave.py"),
|
||||
AppConfig(guiname="Rock-paper-scissors-spock-lizard", name="rps", cmd="./rps.py"),
|
||||
AppConfig(guiname="Doom Fire", name="doomfire", cmd="./doom_fire_psx2.py"),
|
||||
# App(guiname="Maxwell FDTD", name="fdtd", cmd="./fdtd.py"),
|
||||
|
||||
#{"guiname": "Stream", "name": "stream", "cmd": "apps/stream.sh", "persistent": False},
|
||||
#{"guiname": "Wget Video/Gif/Images", "name": "wget", "cmd": "apps/wget.sh", "persistent": False},
|
||||
#{"guiname": "Tetris", "name": "tetris", "cmd": "apps/deckentetris/deckentetris.py", "persistent": False},
|
||||
#{"guiname": "SkyScrapper", "name": "sky", "cmd": "apps/weather/main.py"},
|
||||
#{"guiname": "Strobo", "name": "strobo", "cmd": "apps/strobo.py", "persistent": False},
|
||||
#{"guiname": "Snake", "name": "snake", "cmd": "apps/snake.py", "persistent": False},
|
||||
#{"name": "gif", "cmd": "apps/gif.sh"},
|
||||
#{"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
|
||||
# App(guiname="Stream", name="stream", cmd="./stream.sh"),
|
||||
# App(guiname="Wget Video/Gif/Images", name="wget", cmd="./wget.sh"),
|
||||
# App(guiname="Tetris", name="tetris", cmd="./deckentetris/deckentetris.py"),
|
||||
# App(guiname="SkyScrapper", name="sky", cmd="./weather/main.py"),
|
||||
# App(guiname="Strobo", name="strobo", cmd="./strobo.py"),
|
||||
# App(guiname="Snake", name="snake", cmd="./snake.py"),
|
||||
# App(name="gif", cmd="./gif.sh"),
|
||||
# App(name="colormap", cmd="./colormap.py"),
|
||||
]
|
||||
|
Reference in New Issue
Block a user