Browse code

Allow to specify the graphviz filter.

Jose.R.Fonseca authored on 27/07/2008 04:48:25
Showing 1 changed files

  • xdot.py index f0d250b..8140218 100755
... ...
@@ -887,7 +887,7 @@ class DotWidget(gtk.DrawingArea):
887 887
 
888 888
     def set_dotcode(self, dotcode, filename='<stdin>'):
889 889
         p = subprocess.Popen(
890
-            ['dot', '-Txdot'],
890
+            [options.filter, '-Txdot'],
891 891
             stdin=subprocess.PIPE,
892 892
             stdout=subprocess.PIPE,
893 893
             shell=False,
... ...
@@ -1232,10 +1232,16 @@ class DotWindow(gtk.Window):
1232 1232
 
1233 1233
 def main():
1234 1234
     import optparse
1235
+    global options
1235 1236
 
1236 1237
     parser = optparse.OptionParser(
1237
-        usage="\n\t%prog [file]",
1238
-        version="%%prog %s" % __version__)
1238
+        usage='\n\t%prog [file]',
1239
+        version='%%prog %s' % __version__)
1240
+    parser.add_option(
1241
+        '-f', '--filter',
1242
+        type='choice', choices=('dot', 'neato', 'twopi', 'circo', 'fdp'),
1243
+        dest='filter', default='dot',
1244
+        help='graphviz filter: dot, neato, twopi, circo, or fdp [default: %default]')
1239 1245
 
1240 1246
     (options, args) = parser.parse_args(sys.argv[1:])
1241 1247
     if len(args) > 1: