... | ... |
@@ -860,6 +860,8 @@ class DotWidget(gtk.DrawingArea): |
860 | 860 |
'clicked' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_STRING, gtk.gdk.Event)) |
861 | 861 |
} |
862 | 862 |
|
863 |
+ filter = 'dot' |
|
864 |
+ |
|
863 | 865 |
def __init__(self): |
864 | 866 |
gtk.DrawingArea.__init__(self) |
865 | 867 |
|
... | ... |
@@ -885,9 +887,12 @@ class DotWidget(gtk.DrawingArea): |
885 | 887 |
self.presstime = None |
886 | 888 |
self.highlight = None |
887 | 889 |
|
890 |
+ def set_filter(self, filter): |
|
891 |
+ self.filter = filter |
|
892 |
+ |
|
888 | 893 |
def set_dotcode(self, dotcode, filename='<stdin>'): |
889 | 894 |
p = subprocess.Popen( |
890 |
- [options.filter, '-Txdot'], |
|
895 |
+ [self.filter, '-Txdot'], |
|
891 | 896 |
stdin=subprocess.PIPE, |
892 | 897 |
stdout=subprocess.PIPE, |
893 | 898 |
shell=False, |
... | ... |
@@ -1192,6 +1197,9 @@ class DotWindow(gtk.Window): |
1192 | 1197 |
|
1193 | 1198 |
self.show_all() |
1194 | 1199 |
|
1200 |
+ def set_filter(self, filter): |
|
1201 |
+ self.widget.set_filter(filter) |
|
1202 |
+ |
|
1195 | 1203 |
def set_dotcode(self, dotcode, filename='<stdin>'): |
1196 | 1204 |
if self.widget.set_dotcode(dotcode, filename): |
1197 | 1205 |
self.set_title(os.path.basename(filename) + ' - Dot Viewer') |
... | ... |
@@ -1232,7 +1240,6 @@ class DotWindow(gtk.Window): |
1232 | 1240 |
|
1233 | 1241 |
def main(): |
1234 | 1242 |
import optparse |
1235 |
- global options |
|
1236 | 1243 |
|
1237 | 1244 |
parser = optparse.OptionParser( |
1238 | 1245 |
usage='\n\t%prog [file]', |
... | ... |
@@ -1249,6 +1256,7 @@ def main(): |
1249 | 1256 |
|
1250 | 1257 |
win = DotWindow() |
1251 | 1258 |
win.connect('destroy', gtk.main_quit) |
1259 |
+ win.set_filter(options.filter) |
|
1252 | 1260 |
if len(args) >= 1: |
1253 | 1261 |
if args[0] == '-': |
1254 | 1262 |
win.set_dotcode(sys.stdin.read()) |