Changeset a9ed7d7
- Timestamp:
- Jun 18, 2009 11:15:54 AM (16 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
- Children:
- 8bbc504
- Parents:
- c7910ac
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/fedd_client.py
rc7910ac ra9ed7d7 164 164 help="Program compatible with dot (from graphviz) used to " + \ 165 165 "render image") 166 self.add_option('-L', "--labels", dest='labels', action='store_true', 167 default=True, help='Label nodes and edges') 168 self.add_option('-A', "--no_labels", dest='labels', 169 default=True, action='store_false', 170 help='Label nodes and edges') 166 171 167 172 class fedd_ns_image_opts(fedd_split_opts): … … 179 184 help="Program compatible with dot (from graphviz) used to " + \ 180 185 "render image") 186 self.add_option('-L', "--labels", dest='labels', action='store_true', 187 default=True, help='Label nodes and edges') 188 self.add_option('-A', "--no_labels", dest='labels', 189 default=True, action='store_false', 190 help='Label nodes and edges') 181 191 182 192 def exit_with_fault(dict, out=sys.stderr): … … 423 433 fedd_rpc.__init__(self, op) 424 434 425 def gen_image(self, d, file, fmt, neato ):435 def gen_image(self, d, file, fmt, neato, labels): 426 436 427 437 # Open up a temporary file for dot to turn into a visualization … … 457 467 print >>dotfile, "graph G {" 458 468 print >>dotfile, '\tgraph [size="%i,%i", ratio=fill];' % (size, size) 459 print >>dotfile, '\tnode [fontname=arial,fontsize=9,label="\N"];' 460 print >>dotfile, '\tedge [fontname=arial,fontsize=9];\n' 469 if labels: 470 print >>dotfile, '\tnode [fontname=arial,fontsize=9,label="\N"];' 471 print >>dotfile, '\tedge [fontname=arial,fontsize=9];\n' 472 else: 473 print >>dotfile, '\tnode [label=""];' 461 474 462 475 for n in d.get('node', []): … … 490 503 print >>dotfile,'\t\tcolor=black,fillcolor="#80c0f8",regular=1]' 491 504 for n in lans[l]: 492 print >>dotfile, '\t%s -- %s [headlabel="%s"]' % (l, n[0], n[1]) 505 if labels: 506 print >>dotfile, '\t%s -- %s [headlabel="%s"]' % \ 507 (l, n[0], n[1]) 508 else: 509 print >>dotfile, '\t%s -- %s' % (l, n[0]) 493 510 494 511 for k, l in links.items(): 495 512 if len(l) == 2: 496 print >>dotfile, \ 497 ('\t%s -- %s [label="%s",taillabel="%s",' + \ 498 'headlabel="%s"]') % \ 499 (l[0][0], l[1][0], k, l[0][1], l[1][1]) 513 if labels: 514 print >>dotfile, \ 515 ('\t%s -- %s [label="%s",taillabel="%s",' + \ 516 'headlabel="%s"]') % \ 517 (l[0][0], l[1][0], k, l[0][1], l[1][1]) 518 else: 519 print >>dotfile, '\t%s -- %s ' % (l[0][0], l[1][0]) 500 520 501 521 print >>dotfile, "}" … … 581 601 582 602 if resp_dict.has_key('vtopo'): 583 self.gen_image(resp_dict['vtopo'], file, fmt, opts.neato) 603 self.gen_image(resp_dict['vtopo'], file, fmt, opts.neato, 604 opts.labels) 584 605 else: 585 606 sys.exit("Bad response. %s" % e.message) … … 739 760 sys.exit("Bad response: could not split") 740 761 topo = self.generate_topo_dict(resp_dict['output']) 741 self.gen_image(topo, file, fmt, opts.neato )762 self.gen_image(topo, file, fmt, opts.neato, opts.labels) 742 763 else: 743 764 sys.exit("Bad response. %s" % e.message)
Note: See TracChangeset
for help on using the changeset viewer.