def drawGraph(self, function): outputFile = RELATIVE_LOCATION + self.dbFile[:self.dbFile.find(".")] + "/" + function + ".png" if not os.path.exists("./" + outputFile) or True: buf = createTree(self.db, function) path = DATABASES_PATH + self.dbFile[:self.dbFile.find(".")] + "/" try: os.mkdir(path) except: pass # Ignore the possible exception dotFile = path + function + ".dot" f = file(dotFile, "w") f.write(buf) f.close() os.system("dot -Tpng %s > %s" % (dotFile, dotFile.replace(".dot", ".png"))) print getImageJavascript() #print """<img id='idImage' src='%s' alt='%s' width='100%%' onclick='javascript:toggleShowHide("divImage", "idImage")'/>""" % (outputFile, function) #print """<img id='divImage' style='display:none;visibility:hidden' src='%s' alt='%s' # onclick='javascript:toggleShowHide("idImage", "divImage")' />""" % (outputFile, function) #print """</a>""" print """<iframe id='idImage' src="%s" width="100%%" height="100%%"></iframe>""" % (outputFile) print """<script>adjustMe('idImage');</script>"""
def drawGraph(self, function): outputFile = RELATIVE_LOCATION + self.dbFile[:self.dbFile.find( ".")] + "/" + function + ".png" if not os.path.exists("./" + outputFile) or True: buf = createTree(self.db, function) path = DATABASES_PATH + self.dbFile[:self.dbFile.find(".")] + "/" try: os.mkdir(path) except: pass # Ignore the possible exception dotFile = path + function + ".dot" f = file(dotFile, "w") f.write(buf) f.close() os.system("dot -Tpng %s > %s" % (dotFile, dotFile.replace(".dot", ".png"))) print getImageJavascript() #print """<img id='idImage' src='%s' alt='%s' width='100%%' onclick='javascript:toggleShowHide("divImage", "idImage")'/>""" % (outputFile, function) #print """<img id='divImage' style='display:none;visibility:hidden' src='%s' alt='%s' # onclick='javascript:toggleShowHide("idImage", "divImage")' />""" % (outputFile, function) #print """</a>""" print """<iframe id='idImage' src="%s" width="100%%" height="100%%"></iframe>""" % ( outputFile) print """<script>adjustMe('idImage');</script>"""
def drawCC(self, function): buf = createTree(self.db, function, False) print "<table width='100%%'><tr><td>Number of edges: <b>%d</b></td></tr>" % len( buf.connections) print "<tr><td>Number of nodes: <b>%d</b></td></tr>" % len(buf.edges) print "<tr><td>Cyclomatic Complexity: <b>%d</b></td>" % ( len(buf.connections) - len(buf.edges) + 2) print "</table>"
def drawCC(self, function): buf = createTree(self.db, function, False) print "<table width='100%%'><tr><td>Number of edges: <b>%d</b></td></tr>" % len(buf.connections) print "<tr><td>Number of nodes: <b>%d</b></td></tr>" % len(buf.edges) print "<tr><td>Cyclomatic Complexity: <b>%d</b></td>" % (len(buf.connections) - len(buf.edges) + 2) print "</table>"