... | ... |
@@ -28,6 +28,7 @@ import math |
28 | 28 |
import colorsys |
29 | 29 |
import time |
30 | 30 |
import re |
31 |
+import optparse |
|
31 | 32 |
|
32 | 33 |
import gobject |
33 | 34 |
import gtk |
... | ... |
@@ -2017,11 +2018,32 @@ class DotWindow(gtk.Window): |
2017 | 2018 |
self.widget.reload() |
2018 | 2019 |
|
2019 | 2020 |
|
2021 |
+class OptionParser(optparse.OptionParser): |
|
2022 |
+ |
|
2023 |
+ def format_epilog(self, formatter): |
|
2024 |
+ # Prevent stripping the newlines in epilog message |
|
2025 |
+ # http://stackoverflow.com/questions/1857346/python-optparse-how-to-include-additional-info-in-usage-output |
|
2026 |
+ return self.epilog |
|
2027 |
+ |
|
2028 |
+ |
|
2020 | 2029 |
def main(): |
2021 |
- import optparse |
|
2022 | 2030 |
|
2023 |
- parser = optparse.OptionParser( |
|
2024 |
- usage='\n\t%prog [file]') |
|
2031 |
+ parser = OptionParser( |
|
2032 |
+ usage='\n\t%prog [file]', |
|
2033 |
+ epilog=''' |
|
2034 |
+Shortcuts: |
|
2035 |
+ Up, Down, Left, Right scroll |
|
2036 |
+ PageUp, +, = zoom in |
|
2037 |
+ PageDown, - zoom out |
|
2038 |
+ R reload dot file |
|
2039 |
+ F find |
|
2040 |
+ Q quit |
|
2041 |
+ P print |
|
2042 |
+ Escape halt animation |
|
2043 |
+ Ctrl-drag zoom in/out |
|
2044 |
+ Shift-drag zooms an area |
|
2045 |
+''' |
|
2046 |
+ ) |
|
2025 | 2047 |
parser.add_option( |
2026 | 2048 |
'-f', '--filter', |
2027 | 2049 |
type='choice', choices=('dot', 'neato', 'twopi', 'circo', 'fdp'), |