Exemplo n.º 1
0
    def _selectItemByClass(self, item, className):

        if not item.node.isRoot():

            data = item.node.pointer.get()
            self.toogleItemSelection(item,
                                     isinstance(data,
                                                getObjects()[className]))
Exemplo n.º 2
0
 def createMapper(self, sqliteFn):
     """ Create a new SqliteMapper object and pass as classes dict
     all globas and update with data and protocols from em.
     """
     classesDict = pwobj.Dict(default=pwprot.LegacyProtocol)
     classesDict.update(pwobj.__dict__)
     classesDict.update(em.getProtocols())
     classesDict.update(em.getObjects())
     return SqliteMapper(sqliteFn, classesDict)
Exemplo n.º 3
0
 def createMapper(self, sqliteFn):
     """ Create a new SqliteMapper object and pass as classes dict
     all globas and update with data and protocols from em.
     """
     #TODO: REMOVE THE USE OF globals() here
     classesDict = dict(pwobj.__dict__)
     classesDict.update(em.getProtocols())
     classesDict.update(em.getObjects())
     return SqliteMapper(sqliteFn, classesDict)
Exemplo n.º 4
0
 def createMapper(self, sqliteFn):
     """ Create a new SqliteMapper object and pass as classes dict
     all globas and update with data and protocols from em.
     """
     #TODO: REMOVE THE USE OF globals() here
     classesDict = dict(pwobj.__dict__)
     classesDict.update(em.getProtocols())
     classesDict.update(em.getObjects())
     return SqliteMapper(sqliteFn, classesDict)
Exemplo n.º 5
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

        from pyworkflow.em import getObjects
        setObj = getObjects()[setClassName](filename=dbName, prefix=dbPreffix)
        return setObj
Exemplo n.º 6
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

        from pyworkflow.em import getObjects
        setObj = getObjects()[setClassName](filename=dbName, prefix=dbPreffix)
        return setObj
Exemplo n.º 7
0
 def createMapper(self, sqliteFn):
     """ Create a new SqliteMapper object and pass as classes dict
     all globas and update with data and protocols from em.
     """
     classesDict = dict(pwobj.__dict__)
     classesDict.update(em.getProtocols())
     classesDict.update(em.getObjects())
     mapper = SqliteMapper(sqliteFn, classesDict)
     if not self.chdir:
         mapper.setWorkingDir(self.path)
     return mapper
Exemplo n.º 8
0
    def evalParamCondition(self, paramName):
        """Evaluate if a condition is True for a give param
        with the values of a particular Protocol"""
        param = self.getParam(paramName)

        if not param.hasCondition():
            return True
        condStr = param.condition.get()
        localDict = {}
        globalDict = dict(globals())
        from pyworkflow.em import getObjects
        globalDict.update(getObjects())

        for t in param._conditionParams:
            if self.hasParam(t) or self._protocol.hasAttribute(t):
                localDict[t] = self._protocol.getAttributeValue(t)

        return eval(condStr, globalDict, localDict)
Exemplo n.º 9
0
    def evalParamCondition(self, paramName):
        """Evaluate if a condition is True for a give param
        with the values of a particular Protocol"""
        param = self.getParam(paramName)

        if not param.hasCondition():
            return True
        condStr = param.condition.get()
        localDict = {}
        globalDict = dict(globals())
        from pyworkflow.em import getObjects
        globalDict.update(getObjects())

        for t in param._conditionParams:
            if self.hasParam(t) or self._protocol.hasAttribute(t):
                localDict[t] = self._protocol.getAttributeValue(t)

        return eval(condStr, globalDict, localDict)
Exemplo n.º 10
0
    def _selectItemByClass(self, item, className):

        if not item.node.isRoot():

            data = item.node.pointer.get()
            self.toogleItemSelection(item, isinstance(data, getObjects()[className]))