def setPeakFindParams(project, params): analysisProject = getAnalysisProject(project) for key in params.keys(): keyword = keywordPrefix + upperFirst(key) value = params[key] setattr(analysisProject, keyword, value)
def unsetLink(self, role): if (self.editMode): try: func = getattr(self.object, 'set%s' % upperFirst(role.baseName)) func(None) except Implementation.ApiError, e: showError('Unsetting link', e.error_msg, parent=self)
def getPeakFindParams(project): params = {} analysisProject = getAnalysisProject(project) for key in peakFindKeys: keyword = keywordPrefix + upperFirst(key) value = getattr(analysisProject, keyword) params[key] = value return params
def removeLink(self, table, role): selected = table.currentObject if (selected): if (self.editMode): try: func = getattr(self.object, 'remove%s' % upperFirst(role.baseName)) func(selected) except Implementation.ApiError, e: showError('Removing link', e.error_msg, parent=self) else: self.creatorMap[role].remove(selected) self.setRoleValue(role)
def getAllObjects(top, metaclass): topClass = top.metaclass if (metaclass is topClass): return [top] clazz = metaclass while (clazz.parentRole.otherClass is not topClass): clazz = clazz.parentRole.otherClass func = getattr(top, 'findAll%s' % upperFirst(clazz.parentRole.otherRole.name)) objs = func() allObjs = [] for obj in objs: allObjs.extend(getAllObjects(obj, metaclass)) return allObjs
def addLink(self, role, clazz): if (self.editMode): root = self.object.root else: root = self.objParent.root popup = ObjectTablePopup(self, root, clazz, modal=True) selected = popup.selected popup.destroy() if (selected): if (self.editMode): try: func = getattr(self.object, 'add%s' % upperFirst(role.baseName)) func(selected) except Implementation.ApiError, e: showError('Adding link', e.error_msg, parent=self) else: self.creatorMap[role.name].append(selected) self.setRoleValue(role)