Skip to content

Commit

Permalink
Document shortcuts (issue 78).
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfonseca committed May 12, 2013
1 parent a88b4ff commit d4f8691
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions xdot.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import colorsys
import time
import re
import optparse

import gobject
import gtk
Expand Down Expand Up @@ -2017,11 +2018,32 @@ def on_reload(self, action):
self.widget.reload()


class OptionParser(optparse.OptionParser):

def format_epilog(self, formatter):
# Prevent stripping the newlines in epilog message
# https://stackoverflow.com/questions/1857346/python-optparse-how-to-include-additional-info-in-usage-output
return self.epilog


def main():
import optparse

parser = optparse.OptionParser(
usage='\n\t%prog [file]')
parser = OptionParser(
usage='\n\t%prog [file]',
epilog='''
Shortcuts:
Up, Down, Left, Right scroll
PageUp, +, = zoom in
PageDown, - zoom out
R reload dot file
F find
Q quit
P print
Escape halt animation
Ctrl-drag zoom in/out
Shift-drag zooms an area
'''
)
parser.add_option(
'-f', '--filter',
type='choice', choices=('dot', 'neato', 'twopi', 'circo', 'fdp'),
Expand Down

0 comments on commit d4f8691

Please sign in to comment.