HatchLing-TuneBox / hatchling.py
taellinglin's picture
HatchLing-TuneBox with America, Korea and Ling Country themes
581203a verified
Raw History Blame Contribute Delete
1.12 kB
#!/usr/bin/env python3
"""HatchLing-TuneBox: one way in to every tool.
python hatchling.py the app (Gradio), on http://127.0.0.1:7860
python hatchling.py hatch photo.jpg a picture as an outline-and-crosshatch sheet
python hatchling.py tiles photo.jpg a picture as packed tiles and text rings
python hatchling.py map project.zip a Ling program as a functional map; map.svg back to its program
python hatchling.py globe photo.jpg a globe to spin, driven by a tune
python hatchling.py musicbox photo.jpg an animated SVG sheet that plays a tune
Each tool takes --help.
"""
import runpy, sys
TOOLS = {'hatch': 'ling_hatch', 'tiles': 'ling_tiles', 'map': 'ling_map', 'globe': 'ling_globe', 'musicbox': 'ling_musicbox', 'app': 'app'}
if __name__ == '__main__':
tool = sys.argv[1] if len(sys.argv) > 1 else 'app'
if tool in ('-h', '--help') or tool not in TOOLS:
print(__doc__); sys.exit(0 if tool in ('-h', '--help') else 2)
sys.argv = [TOOLS[tool] + '.py'] + sys.argv[2:]
runpy.run_module(TOOLS[tool], run_name='__main__')