예제 #1
0
def loadLibrary(reloadLibs=False, libPath=None):
    """Import all Node subclasses found within files in the library module."""

    global NODE_LIST, NODE_TREE
    #if libPath is None:
    #libPath = os.path.dirname(os.path.abspath(__file__))

    if reloadLibs:
        reload.reloadAll(libPath)

    mods = importModules('', globals(), locals())
    #for f in frozenSupport.listdir(libPath):
    #pathName, ext = os.path.splitext(f)
    #if ext not in ('.py', '.pyc') or '__init__' in pathName or '__pycache__' in pathName:
    #continue
    #try:
    ##print "importing from", f
    #mod = __import__(pathName, globals(), locals())
    #except:
    #printExc("Error loading flowchart library %s:" % pathName)
    #continue

    for name, mod in mods.items():
        nodes = []
        for n in dir(mod):
            o = getattr(mod, n)
            if isNodeClass(o):
                #print "  ", str(o)
                registerNodeType(o, [(name, )], override=reloadLibs)
예제 #2
0
def loadLibrary(reloadLibs=False, libPath=None):
    """Import all Node subclasses found within files in the library module."""

    global NODE_LIST, NODE_TREE
    #if libPath is None:
        #libPath = os.path.dirname(os.path.abspath(__file__))
    
    if reloadLibs:
        reload.reloadAll(libPath)
        
    mods = importModules('', globals(), locals())
    #for f in frozenSupport.listdir(libPath):
        #pathName, ext = os.path.splitext(f)
        #if ext not in ('.py', '.pyc') or '__init__' in pathName or '__pycache__' in pathName:
            #continue
        #try:
            ##print "importing from", f
            #mod = __import__(pathName, globals(), locals())
        #except:
            #printExc("Error loading flowchart library %s:" % pathName)
            #continue
        
    for name, mod in mods.items():
        nodes = []
        for n in dir(mod):
            o = getattr(mod, n)
            if isNodeClass(o):
                #print "  ", str(o)
                registerNodeType(o, [(name,)], override=reloadLibs)
예제 #3
0
Exporters = []
from pyqtgraph import importModules
#from .. import frozenSupport
import os
d = os.path.split(__file__)[0]
#files = []
#for f in frozenSupport.listdir(d):
    #if frozenSupport.isdir(os.path.join(d, f)) and f != '__pycache__':
        #files.append(f)
    #elif f[-3:] == '.py' and f not in ['__init__.py', 'Exporter.py']:
        #files.append(f[:-3])
    
#for modName in files:
    #mod = __import__(modName, globals(), locals(), fromlist=['*'])
for mod in importModules('', globals(), locals(), excludes=['Exporter']).values():
    if hasattr(mod, '__all__'):
        names = mod.__all__
    else:
        names = [n for n in dir(mod) if n[0] != '_']
    for k in names:
        if hasattr(mod, k):
            Exporters.append(getattr(mod, k))


def listExporters():
    return Exporters[:]