示例#1
0
def loadSetFromDb(dbName, dbPrefix=''):
    from pwem import Domain
    from pyworkflow.mapper.sqlite import SqliteFlatDb
    db = SqliteFlatDb(dbName=dbName, tablePrefix=dbPrefix)
    setClassName = db.getProperty('self')  # get the set class name
    setObj = Domain.getObjects()[setClassName](filename=dbName,
                                               prefix=dbPrefix)
    return setObj
示例#2
0
    def _loadSet(self, dbName, dbPreffix):
        from pyworkflow.mapper.sqlite import SqliteFlatDb
        db = SqliteFlatDb(dbName=dbName, tablePrefix=dbPreffix)
        if dbPreffix:
            setClassName = "SetOf%ss" % db.getSelfClassName()
        else:
            setClassName = db.getProperty('self')  # get the set class name

        # FIXME: Check why the import is here
        from pwem import Domain
        setObj = Domain.getObjects()[setClassName](filename=dbName, prefix=dbPreffix)
        return setObj
示例#3
0
    def test_plugin(self):
        # Really stupid test to check that tomo plugin is defined
        tomo = Domain.getPlugin('tomo')

        self.assertFalse(tomo is None)
        self.assertTrue(hasattr(tomo, 'Plugin'))

        # Check that defined objects here are found
        objects = Domain.getObjects()

        expected = [
            'TiltImage', 'TiltSeries', 'SetOfTiltSeries', 'TiltImageM',
            'TiltSeriesM', 'SetOfTiltSeriesM'
        ]
        for e in expected:
            self.assertTrue(e in objects,
                            "%s should be in Domain.getObjects" % e)
示例#4
0
    return ''


n = len(sys.argv)

if n > 4:
    usage("Incorrect number of input parameters")

if n == 1:  # List all plugins
    plugins = Domain.getPlugins()
    print("Plugins:")
    for k, v in iteritems(plugins):
        print("-", k)

    print("Objects")
    pwutils.prettyDict(Domain.getObjects())

    print("Protocols")
    pwutils.prettyDict(Domain.getProtocols())

    print("Viewers")
    pwutils.prettyDict(Domain.getViewers())

elif n == 2:
    if sys.argv[1] in ['-h', '--help', 'help']:
        usage()

    pluginName = sys.argv[1]
    plugin = Domain.getPlugin(pluginName)
    print("Plugin: %s" % pluginName)
    for subName in [