def getHealth(item, formatter): """State Icon of Object""" if IComponent.providedBy(item): try: return u"%3.0f %%" % (100.0 * item.get_health()) except TypeError: return u"-"
def objs(self): """List of Content objects""" retList = [] uidutil = getUtility(IIntIds) for (myid, myobj) in uidutil.items(): if IComponent.providedBy(myobj.object): tmp_health = myobj.object.get_health() if tmp_health is not None and \ tmp_health < 0.9: retList.append(myobj.object) return retList
def objs(self): #import pdb #pdb.set_trace() retList = [] uidutil = getUtility(IIntIds) for (myid, myobj) in uidutil.items(): if IComponent.providedBy(myobj.object): base_reqs = getEvaluationsTodo(myobj.object) for req in base_reqs: retList.append({'obj': req, 'component': myobj.object}) #retList.append((req, myobj.object)) return retList
def _getAllExportData_Step2(self): """return a list of relation-tuples by lovely.relation in form of [ (('obj1Id'. 'obj1AttrName'), ('obj2Id'. 'obj2AttrName')), ] """ retList = [] refAttributeNames = self.getRefAttributeNames() for attr_name in refAttributeNames: if hasattr(self, attr_name): objList = getattr(self, attr_name) if type(objList) != type([]): objList = [objList] for obj in objList: if IComponent.providedBy(obj): rel_manager = getattr(self.__class__, attr_name)._manager retList.append(((self.objectID, attr_name), (obj.objectID, rel_manager.relType))) return retList
def fillDotFile(self, dotFile, mode=None): """generate the dot file """ my_catalog = zapi.getUtility(ICatalog) objIdSet = set() objSet = set() eventSet = set() for (oid, oobj) in self.items(): objIdSet.add(oid) for objId in self.inpEQueues: objIdSet.add(objId) for objId in self.outEQueues: objIdSet.add(objId) for objId in objIdSet: for result in my_catalog.searchResults(oid_index=objId): if IAdmUtilEvent.providedBy(result): eventSet.add(result) elif IEventLogic.providedBy(result): objSet.add(result) elif IEventLogic.providedBy(result): objSet.add(result) elif IComponent.providedBy(result): if result.isConnectedToEvent(): objSet.add(result) else: pass print >> dotFile, '// GraphViz DOT-File' print >> dotFile, 'digraph "%s" {' % (zapi.getRoot(self).__name__) if mode and mode.lower() == "fview": print >> dotFile, '\tgraph [bgcolor="#E5FFF9", dpi="100.0"];' else: print >> dotFile, '\tgraph [bgcolor="#E5FFF9", size="6.2,5.2",' +\ ' splines="true", ratio = "auto", dpi="100.0"];' print >> dotFile, '\tnode [fontname = "Helvetica",fontsize = 10];' print >> dotFile, '\tedge [style = "setlinewidth(2)", color = black];' print >> dotFile, '\trankdir = LR;' print >> dotFile, '\t// objects ----------------------------------' for obj in objSet: objGraphvizDot = IGenGraphvizDot(obj) objGraphvizDot.traverse4DotGenerator(dotFile, level=1, comments=True, signalsOutput=True, recursive=False) #print "-" * 80 #uidutil = zapi.getUtility(IIntIds) #print >> dotFile, '\t// locations ----------------------------------' #for (oid, oobj) in uidutil.items(): #if ILocation.providedBy(oobj.object): #print "Location: ", oobj.object.ikName #print >> dotFile, \ #'\tsubgraph "cluster_location" { color=blue; label="location"};' ##elif IRoom.providedBy(oobj.object): ##print "Room: ", oobj.object.ikName ##elif ILocation.providedBy(oobj.object): ##print "Location: ", oobj.object.ikName #print "-" * 80 print >> dotFile, '\t// events ----------------------------------' for event in eventSet: eventGraphvizDot = IGenGraphvizDot(event) eventGraphvizDot.traverse4DotGenerator(dotFile, level=1, comments=True) for obj in objSet: allInpNamesDict = obj.getAllInpEventNames() allOutNamesDict = obj.getAllOutEventNames() for inpName in allInpNamesDict.keys(): for iObj in allInpNamesDict[inpName]: print >> dotFile, '\t "%s"-> "%s":"%s"' % ( iObj, obj.objectID, inpName) for outName in allOutNamesDict.keys(): for iObj in allOutNamesDict[outName]: print >> dotFile, '\t "%s":"%s"-> "%s"' % (obj.objectID, outName, iObj) print >> dotFile, '}' dotFile.flush()