Browse code

Add README.

Based of wiki.

José Fonseca authored on 12/05/2013 10:40:36
Showing 1 changed files

1 1
new file mode 100644
... ...
@@ -0,0 +1,206 @@
1
+About **xdot.py**
2
+=================
3
+
4
+xdot.py is an interactive viewer for graphs written in [Graphviz](http://www.graphviz.org/)'s [dot language](http://www.graphviz.org/doc/info/lang.html).
5
+
6
+It uses internally the graphviz's [xdot output format](http://www.graphviz.org/doc/info/output.html#d:xdot) as an intermediate format, and [PyGTK](http://www.pygtk.org/) and [Cairo](http://cairographics.org/) for rendering.
7
+
8
+xdot.py can be used either as a standalone application from command line, or as a library embedded in your python application.
9
+
10
+Status
11
+======
12
+
13
+xdot.py script became much more popular than I ever anticipated, and it there is potential for further enhancements.  However xdot.py already meets my own needs as it is now, and unfortunately I don't have much time for maintain it myself.
14
+
15
+If this version of xdot.py does not meet your needs then take a look at the [outstanding issues](https://code.google.com/p/jrfonseca/issues/list?q=xdot) or the comments below, for patches and links for other forks.  xdot.py is small and self contained, so feel free to include it in your own projects.
16
+
17
+Features
18
+========
19
+
20
+ * Since it doesn't use bitmaps it is fast and has a small memory footprint.
21
+ * Arbitrary zoom.
22
+ * Keyboard/mouse navigation.
23
+ * Supports events on the nodes with URLs.
24
+ * Animated jumping between nodes.
25
+ * Highlights node/edge under mouse.
26
+
27
+Changelog
28
+=========
29
+
30
+ * **2013-05-12**: Text based node search (by Salva and ludw1g.m3i3r, issue 68)
31
+
32
+ * **2012-11-24**: Printing support (by ludw1g.m3i3r, issue 74)
33
+
34
+ * **2011-09-01**: Fix forward slash escaping (issue 61)
35
+
36
+ * **2011-02-13**: Show dotted lines in xdot (by djs52uk, issue 50)
37
+
38
+ * **2010-12-12**: Support images (thanks to Alberto Rodríguez)
39
+
40
+ * **2010-01-32**: Add Quit key binding (from sk, issue #30)
41
+
42
+ * **2009-09-30**: Add a reload button (fixes issue #22)
43
+
44
+ * **2009-09-30**: Properly handle motion-notify-event (from lodatom, issue #24)
45
+
46
+ * **2009-09-20**: Automatically reloads open file when it changes (from Robert Meerman, issue #21)
47
+
48
+ * **2009-09-20**: Add support for [ColorBrewer Color Schemes](http://colorbrewer.org/)(from to michael.hliao, issue #23).
49
+
50
+ * **2009-08-09**: Upload to [PyPi](http://pypi.python.org/pypi/xdot)(thanks to Marius Gedminas, issue #19)
51
+
52
+ * **2009-05-24**: Reloads the file on the 'r' key (from peterbjorgensen).
53
+
54
+ * **2009-04-09**: Render subgraphs correctly.
55
+
56
+ * **2009-03-04**: Support filled bezier shapes.
57
+
58
+ * **2009-01-29**: Check for unicode input; check subprocess returncode (from Jaap Karssenberg).
59
+
60
+ * **2008-10-27**: Replace pydot and pyparsing by a much faster hand written lexer and parser (issue #9).
61
+
62
+ * **2008-09-02**: Make mouse wheel zoom around the mouse cursor rather than center of window (from Marius Gedminas).
63
+
64
+ * **2008-09-02**: Handle polylines. Handle ports in node names.
65
+
66
+ * **2008-07-27**: Allow to specify the graphviz filter to use.
67
+
68
+ * **2008-07-13**: Commit several enhancements done by [Marius Gedminas](http://mg.pov.lt/blog/europython2008-sprints-day-2.html), such as, animated jumping between nodes, highlighted node/edge under mouse, and support to more xdot language features.
69
+
70
+Known Issues
71
+============
72
+
73
+ * Not all xdot attributes are supported or correctly rendered yet. It works well for my applications but YMMV.
74
+
75
+ * Text doesn't scale properly to large sizes if font hinting is enabled. I haven't find a reliable way to disable font hinting during rendering yet.
76
+
77
+See also the [googlecode issue tracker](https://code.google.com/p/jrfonseca/issues/list?q=xdot).
78
+
79
+Screenshots
80
+===========
81
+
82
+[![Screenshot 1](http://wiki.jrfonseca.googlecode.com/git/xdot-profile1_small.png)](http://wiki.jrfonseca.googlecode.com/git/xdot-profile1.png)
83
+[![Screenshot 2](http://wiki.jrfonseca.googlecode.com/git/xdot-profile2_small.png)](http://wiki.jrfonseca.googlecode.com/git/xdot-profile2.png)
84
+[![Screenshot 3](http://wiki.jrfonseca.googlecode.com/git/xdot-cfg_small.png)](http://wiki.jrfonseca.googlecode.com/git/xdot-cfg.png)
85
+
86
+Requirements
87
+============
88
+
89
+ * [Python](http://www.python.org/download/) (2.4 or greater)
90
+
91
+ * [PyGTK](http://www.pygtk.org/downloads.html) (2.10 or greater)
92
+
93
+ * [Graphviz](http://www.graphviz.org/Download.php)
94
+
95
+Windows users
96
+-------------
97
+
98
+Download and install:
99
+
100
+ * [Python for Windows](http://www.python.org/download/)
101
+
102
+ * [GTK+ Runtime for Windows](http://www.gtk.org/download/win32.php)
103
+
104
+ * [PyCairo, PyGobject, and PyGTK for Windows](http://www.pygtk.org/downloads.html)
105
+
106
+ * [Graphviz for Windows](http://www.graphviz.org/Download_windows.php)
107
+
108
+Debian/Ubuntu users
109
+-------------------
110
+
111
+Run:
112
+
113
+    apt-get install python-gtk2 graphviz
114
+
115
+Usage
116
+=====
117
+
118
+Command Line
119
+------------
120
+
121
+    Usage: 
122
+    	xdot.py [file]
123
+    
124
+    Options:
125
+      -h, --help            show this help message and exit
126
+      -f FILTER, --filter=FILTER
127
+                            graphviz filter: dot, neato, twopi, circo, or fdp
128
+                            [default: dot]
129
+      -n, --no-filter       assume input is already filtered into xdot format (use
130
+                            e.g. dot -Txdot)
131
+    
132
+    Shortcuts:
133
+      Up, Down, Left, Right     scroll
134
+      PageUp, +, =              zoom in
135
+      PageDown, -               zoom out
136
+      R                         reload dot file
137
+      F                         find
138
+      Q                         quit
139
+      P                         print
140
+      Escape                    halt animation
141
+      Ctrl-drag                 zoom in/out
142
+      Shift-drag                zooms an area
143
+
144
+If no input file is given then it will read the dot graph from the standard input.
145
+
146
+Embedding
147
+---------
148
+
149
+    #!/usr/bin/env python
150
+    
151
+    import gtk
152
+    import gtk.gdk
153
+    
154
+    import xdot
155
+    
156
+    class MyDotWindow(xdot.DotWindow):
157
+    
158
+        def __init__(self):
159
+            xdot.DotWindow.__init__(self)
160
+            self.widget.connect('clicked', self.on_url_clicked)
161
+    
162
+        def on_url_clicked(self, widget, url, event):
163
+            dialog = gtk.MessageDialog(
164
+                    parent = self, 
165
+                    buttons = gtk.BUTTONS_OK,
166
+                    message_format="%s clicked" % url)
167
+            dialog.connect('response', lambda dialog, response: dialog.destroy())
168
+            dialog.run()
169
+            return True
170
+    
171
+    dotcode = """
172
+    digraph G {
173
+      Hello [URL="http://en.wikipedia.org/wiki/Hello"]
174
+      World [URL="http://en.wikipedia.org/wiki/World"]
175
+        Hello -> World
176
+    }
177
+    """
178
+    
179
+    def main():
180
+        window = MyDotWindow()
181
+        window.set_dotcode(dotcode)
182
+        window.connect('destroy', gtk.main_quit)
183
+        gtk.main()
184
+    
185
+    if __name__ == '__main__':
186
+        main()
187
+
188
+[![Screenshot](http://wiki.jrfonseca.googlecode.com/git/xdot-sample_small.png)](http://wiki.jrfonseca.googlecode.com/git/xdot-sample.png)
189
+
190
+Download
191
+========
192
+
193
+  * https://pypi.python.org/pypi/xdot
194
+
195
+  * https://github.com/jrfonseca/xdot.py
196
+
197
+Links
198
+=====
199
+
200
+ * [Graphviz homepage](http://www.graphviz.org/)
201
+
202
+ * [ZGRViewer](http://zvtm.sourceforge.net/zgrviewer.html) -- another superb graphviz/dot viewer
203
+
204
+ * [dot2tex](http://code.google.com/p/dot2tex/) -- python script to convert xdot output from Graphviz to a series of PSTricks or PGF/TikZ commands.
205
+
206
+ * The [pypy project](http://codespeak.net/pypy/) also includes an [interactive dot viewer based on graphviz's plain format and the pygame library](http://morepypy.blogspot.com/2008/01/visualizing-python-tokenizer.html).