Commit c7ce7c19 authored by eric pellegrini's avatar eric pellegrini
Browse files

small refactoring of MDANSE __init__

parent ea9bedb9
from MDANSE.Framework.Configurators import * import os
from MDANSE.Framework.Formats import *
from MDANSE.Framework.Handlers import * from MDANSE import PLATFORM, REGISTRY
from MDANSE.Framework.InputData import *
from MDANSE.Framework.InstrumentResolutions import * REGISTRY.update(os.path.join(os.path.dirname(__file__),"*"))
from MDANSE.Framework.Jobs import *
from MDANSE.Framework.OutputVariables import * macrosDirectories = sorted([x[0] for x in os.walk(PLATFORM.macros_directory())][0:])
from MDANSE.Framework.Projectors import * for d in macrosDirectories:
from MDANSE.Framework.QVectors import * REGISTRY.update(d)
from MDANSE.Framework.Selectors import *
...@@ -8,18 +8,13 @@ from MDANSE.Externals.pubsub import pub as PUBLISHER ...@@ -8,18 +8,13 @@ from MDANSE.Externals.pubsub import pub as PUBLISHER
if platform.dist()[0].lower() == "ubuntu": if platform.dist()[0].lower() == "ubuntu":
os.environ["UBUNTU_MENUPROXY"] = "0" os.environ["UBUNTU_MENUPROXY"] = "0"
from MDANSE import PLATFORM, REGISTRY from MDANSE import REGISTRY
from MDANSE.GUI.Plugins.DataPlugin import DataPlugin from MDANSE.GUI.Plugins.DataPlugin import DataPlugin
from MDANSE.GUI.Plugins.JobPlugin import JobPlugin from MDANSE.GUI.Plugins.JobPlugin import JobPlugin
from MDANSE.GUI.Handlers import * REGISTRY.update(os.path.join(os.path.dirname(__file__),"Handlers"))
from MDANSE.GUI.Plugins import * REGISTRY.update(os.path.join(os.path.dirname(__file__),"Plugins"))
from MDANSE.GUI.Widgets import * REGISTRY.update(os.path.join(os.path.dirname(__file__),"Widgets"))
macrosDirectories = sorted([x[0] for x in os.walk(PLATFORM.macros_directory())][0:])
for d in macrosDirectories:
REGISTRY.update(d)
for job in REGISTRY["job"].values(): for job in REGISTRY["job"].values():
...@@ -30,7 +25,7 @@ for job in REGISTRY["job"].values(): ...@@ -30,7 +25,7 @@ for job in REGISTRY["job"].values():
"ancestor" : getattr(job,'ancestor',job.ancestor), "ancestor" : getattr(job,'ancestor',job.ancestor),
"category" : getattr(job, "category", ("Miscellaneous",)), "category" : getattr(job, "category", ("Miscellaneous",)),
"label" : getattr(job, "label", job.__name__)} "label" : getattr(job, "label", job.__name__)}
kls = type("%sPlugin" % job.__name__, (JobPlugin,), attrs) kls = type("%sPlugin" % job.__name__, (JobPlugin,), attrs)
REGISTRY[job._type] = kls REGISTRY[job._type] = kls
......
...@@ -52,8 +52,3 @@ from MMTK import Database ...@@ -52,8 +52,3 @@ from MMTK import Database
# The default database is still the MMTK one # The default database is still the MMTK one
Database.path.append(os.path.join(PLATFORM.package_directory(), 'Data')) Database.path.append(os.path.join(PLATFORM.package_directory(), 'Data'))
macrosDirectories = sorted([x[0] for x in os.walk(PLATFORM.macros_directory())][0:])
for d in macrosDirectories:
REGISTRY.update(d)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment