__init__.py 1.16 KB
Newer Older
1
import glob
2 3 4 5 6 7 8 9 10
import os
import platform

# Hack for the (in)famous "(python:865): LIBDBUSMENU-GLIB-WARNING **: Trying to remove a child that doesn't believe we're it's parent."
if platform.dist()[0].lower() == "ubuntu":
    os.environ["UBUNTU_MENUPROXY"] = "0" 
        
from MDANSE.GUI.DataController import DATA_CONTROLLER

11

12
from MDANSE import REGISTRY
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
from MDANSE.Framework.Plugins.DataPlugin import DataPlugin 
from MDANSE.Framework.Plugins.JobPlugin import JobPlugin

for job in REGISTRY["job"].values():

    if not hasattr(job, "type"):
        continue
                
    attrs = {"type"      : job.type,
             "ancestor"  : getattr(job,"ancestor",""),
             "category"  : ('Analysis',) + getattr(job, "category", ("Miscellaneous",)),
             "label"     : getattr(job, "label", job.__name__)}
            
    kls = type("%sPlugin" % job.__name__, (JobPlugin,), attrs)

for data in REGISTRY["input_data"].values():
29

30 31
    if not hasattr(data, "type"):
        continue
32

33 34 35 36
    attrs = {"type"     : data.type, 
             "label"    : " ".join("".split("_")).capitalize(),
             "ancestor" : ""}
    kls = type("%sPlugin" % data.__name__, (DataPlugin,), attrs)