$search
00001 #!/usr/bin/env python 00002 00003 # Copyright (c) 2010, Willow Garage, Inc. 00004 # All rights reserved. 00005 # 00006 # Redistribution and use in source and binary forms, with or without 00007 # modification, are permitted provided that the following conditions are met: 00008 # 00009 # * Redistributions of source code must retain the above copyright 00010 # notice, this list of conditions and the following disclaimer. 00011 # * Redistributions in binary form must reproduce the above copyright 00012 # notice, this list of conditions and the following disclaimer in the 00013 # documentation and/or other materials provided with the distribution. 00014 # * Neither the name of the Willow Garage, Inc. nor the names of its 00015 # contributors may be used to endorse or promote products derived from 00016 # this software without specific prior written permission. 00017 # 00018 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00019 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00020 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00021 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00022 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00023 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00024 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00025 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00026 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00027 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00028 # POSSIBILITY OF SUCH DAMAGE. 00029 # 00030 # Author: Jonathan Bohren 00031 00032 import roslib; roslib.load_manifest('xdot') 00033 00034 import sys 00035 import xdot 00036 import wx 00037 00038 def main(): 00039 import optparse 00040 00041 parser = optparse.OptionParser( 00042 usage='\n\t%prog [file]') 00043 parser.add_option( 00044 '-f', '--filter', 00045 type='choice', choices=('dot', 'neato', 'twopi', 'circo', 'fdp'), 00046 dest='filter', default='dot', 00047 help='graphviz filter: dot, neato, twopi, circo, or fdp [default: %default]') 00048 00049 (options, args) = parser.parse_args(sys.argv[1:]) 00050 if len(args) > 1: 00051 parser.error('incorrect number of arguments') 00052 00053 app = wx.App() 00054 00055 frame = xdot.wxxdot.WxDotFrame() 00056 frame.set_filter(options.filter) 00057 00058 """Sample mouse event.""" 00059 #def print_cb(item,event): 00060 # print "MOUSE_EVENT: "+str(item) 00061 #frame.widget.register_select_callback(print_cb) 00062 00063 frame.Show() 00064 if len(args) >= 1: 00065 if args[0] == '-': 00066 frame.set_dotcode(sys.stdin.read()) 00067 else: 00068 frame.open_file(args[0]) 00069 00070 app.MainLoop() 00071 00072 if __name__ == '__main__': 00073 main()