45 lines
1.3 KiB
Python
Executable File
45 lines
1.3 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
def init(): pass
|
|
def main():
|
|
mfp.setProgramName("me.fier.gawk") # Your domain/username and the name of your program
|
|
|
|
mfp.paths = [mfp.p(mfp.sd,"module","browser")] + mfp.paths
|
|
browser = mfp.require("browser")
|
|
config = mfp.require("config")
|
|
eig = mfp.require("exception").ignore
|
|
|
|
print("Loading addons ...")
|
|
for addonName in config.readList(config.find(mfp.p("addon","addons.txt"))):
|
|
print("> " +addonName)
|
|
try:
|
|
addonFile = config.find(mfp.p("addon",addonName,"_main.py"))
|
|
except Exception as e:
|
|
print("Could not find " +addonName+ ": " +str(e))
|
|
continue
|
|
|
|
addon = mfp.dofile(addonFile) # Add exception handling
|
|
browser.addon.add(addonName,addon)
|
|
|
|
browser.init()
|
|
print("Done, starting browser.")
|
|
browser.start()
|
|
|
|
def bootstrap(name,modName):
|
|
if name in globals(): return
|
|
import sys, os, importlib
|
|
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
|
|
s = os.path.realpath(sys.executable)
|
|
else:
|
|
s = os.path.realpath(__file__)
|
|
|
|
if not os.path.join(os.path.dirname(s),"module","py") in sys.path:
|
|
sys.path = [os.path.join(os.path.dirname(s),"module","py")] + sys.path
|
|
|
|
mod = importlib.import_module(modName); modl = mod.Bunch()
|
|
mod.init(mod,modl,s,name)
|
|
globals()[name] = mod; globals()[name + "l"] = modl
|
|
|
|
bootstrap("mfp","me.fier.python")
|
|
init()
|
|
if __name__ == '__main__':
|
|
main() |