__init__.py 1.12 KB
Newer Older
1
import glob
2 3 4 5 6 7 8 9
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 import REGISTRY
10 11 12 13 14 15 16
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
17
                    
18
    attrs = {"type"      : job.type,
19 20
             "ancestor"  : getattr(job,'ancestor',job.ancestor),
             "category"  : getattr(job, "category", ("Miscellaneous",)),
21 22 23 24 25
             "label"     : getattr(job, "label", job.__name__)}
            
    kls = type("%sPlugin" % job.__name__, (JobPlugin,), attrs)

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

27 28
    if not hasattr(data, "type"):
        continue
29

30 31
    attrs = {"type"     : data.type, 
             "label"    : " ".join("".split("_")).capitalize(),
32
             "ancestor" : ['empty_data']}
33
    kls = type("%sPlugin" % data.__name__, (DataPlugin,), attrs)