me.fier.window-cg/window-cg

46 lines
966 B
Python
Executable File

#!/usr/bin/env python3
import sys
import os
p = os.path.join
pUp = os.path.dirname
s = False
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
s = os.path.realpath(sys.executable)
else:
s = os.path.realpath(__file__)
sp = pUp(s)
import munch
_g = munch.Munch()
_g.modules = []
def loadModules():
moduleID = 0
moduleText = open(p(sp,"modules.txt")).read()
moduleText = moduleText.replace("\r","")
moduleText = moduleText.strip("\n")
moduleText = moduleText.split("\n")
for line in moduleText:
line = line.split("#",1)[0]
line = line.strip(" \t")
if line == "": continue
g = munch.Munch()
g._g = _g
_g.modules.append(g)
code = compile(
open(p(sp,"modules",line + ".py")).read(),
p(sp,"modules",line + ".py"),
"exec"
)
exec(code,_g.modules[moduleID])
if not "windowChanged" in _g.modules[moduleID]:
del _g.modules[moduleID]
continue
moduleID += 1
def main():
loadModules()
_g.windowSystem.init()
main()