def _selectItemByClass(self, item, className): if not item.node.isRoot(): data = item.node.pointer.get() self.toogleItemSelection(item, isinstance(data, getObjects()[className]))
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)
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)
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
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
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)