Changeset 67c0e15


Ignore:
Timestamp:
Jul 14, 2009 6:49:41 PM (15 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
Children:
8780cbec
Parents:
7a1918e
Message:

Add --pixels to specify the image size in pixels (they're square)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/fedd_client.py

    r7a1918e r67c0e15  
    169169                default=True, action='store_false',
    170170                help='Label nodes and edges')
     171        self.add_option('-j','--pixels', dest="pixels", default=None,
     172                type="int",
     173                help="Size of output in pixels (diagrams are square")
    171174
    172175class fedd_ns_image_opts(fedd_split_opts):
     
    189192                default=True, action='store_false',
    190193                help='Label nodes and edges')
     194        self.add_option('-j','--pixels', dest="pixels", default=None,
     195                type="int",
     196                help="Size of output in pixels (diagrams are square")
    191197
    192198def exit_with_fault(dict, out=sys.stderr):
     
    517523        fedd_rpc.__init__(self, op)
    518524
    519     def gen_image(self, d, file, fmt, neato, labels):
     525    def gen_image(self, d, file, fmt, neato, labels, pix=None):
    520526
    521527        # Open up a temporary file for dot to turn into a visualization
     
    549555        else: size = 18
    550556
     557        if pix:
     558            dpi = pix / size
     559        else:
     560            dpi = None
     561
     562
    551563        print >>dotfile, "graph G {"
    552         print >>dotfile, '\tgraph [size="%i,%i", ratio=fill];' % (size, size)
     564        if dpi:
     565            print >>dotfile, '\tgraph [size="%i,%i", dpi="%i", ratio=fill];' \
     566                    % (size, size, dpi)
     567        else:
     568            print >>dotfile, '\tgraph [size="%i,%i", ratio=fill];' \
     569                    % (size, size)
     570
    553571        if labels:
    554572            print >>dotfile, '\tnode [fontname=arial,fontsize=9,label="\N"];'
     
    686704        if resp_dict.has_key('vtopo'):
    687705            self.gen_image(resp_dict['vtopo'], file, fmt, opts.neato,
    688                     opts.labels)
     706                    opts.labels, opts.pixels)
    689707        else:
    690708            sys.exit("Bad response. %s" % e.message)
     
    844862                sys.exit("Bad response: could not split")
    845863            topo = self.generate_topo_dict(resp_dict['output'])
    846             self.gen_image(topo, file, fmt, opts.neato, opts.labels)
     864            self.gen_image(topo, file, fmt, opts.neato, opts.labels,
     865                    opts.pixels)
    847866        else:
    848867            sys.exit("Bad response. %s" % e.message)
Note: See TracChangeset for help on using the changeset viewer.