def printCalculables(self, selectImperfect) : text = r.TText() text.SetNDC() text.SetTextFont(102) text.SetTextSize(0.45*text.GetTextSize()) allCalcs = sum([s.keys() for s in self.someOrganizer.calculables], []) genuine = ((name,more,"") for name,more,cat in sorted(set(allCalcs)) if more and cat is "calc") def third(c) : return c[2] groups = dict((cat,[name for name,more,_ in group]) for cat,group in itertools.groupby(sorted(allCalcs, key=third) , key=third)) cats = groups.keys() fake = configuration.fakeString() imperfect = ( ( name, more.replace(fake,""), ' '.join("%4d"%groups[key].count(name) for key in cats)) for name,more,cat in set(allCalcs) if cat is 'fake' or cat is "calc" and not (bool(groups["leaf"].count(name))^bool(groups["calc"].count(name))) ) calcs = (([("Calculables",'(imperfect)',' '.join(cats)), ('','','')] + max( list(imperfect), [('','NONE','')])) if selectImperfect else \ ([("Calculables",'',''), ('','','')] + max( list(genuine), [('','NONE','')])) ) maxName,maxMore = map(max, zip(*((len(name),len(more)) for name,more,cat in calcs))) [text.DrawTextNDC(0.02, 0.98 - 0.4*(iLine+0.5)/self.nLinesMax, line) for iLine,line in enumerate("%s %s %s"%(name.rjust(maxName+2), more.ljust(maxMore+2), cat) for name,more,cat in calcs) ] return text
def category(title) : return ("sltr" if dirName=="Master" else "leaf" if dirName=="Leaves" else "fake" if title.count(configuration.fakeString()) else "calc" )
def calcTitle(key) : return "%s%s%s"%(calcs[key].moreName, calcs[key].moreName2, configuration.fakeString() if calcs[key].isFake() else "") self.calculablesUsed = set([ (key,calcTitle(key)) for key,isLeaf,keyType in activeKeys if not isLeaf ])