root/gaphor/tags/gaphor-0.12.1/utils/browseUML.py

Revision 2037, 0.6 kB (checked in by arj..@yirdis.nl, 1 year ago)

cleanup of utils directory

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1 #!/usr/bin/env python
2 #
3 # Print all attributes of a specific class.
4 #
5 # Usage: browseUML.py <Classname>
6 # E.g. browseUML.py Class
7 #
8 # Arjan Molenaar.
9
10 import sys
11
12 sys.path.append("..")
13
14 from gaphor.UML import *
15
16 done = [ object ]
17 def print_vars(cls):
18     global done
19     done.append(cls)
20     print cls.__name__ + ":"
21     dict = cls.__dict__
22     for key in dict.keys():
23         print "\t" + key + ":", str(dict[key])
24     for base in cls.__bases__:
25         if base not in done:
26             print_vars(base)
27
28 args = sys.argv[1:]
29
30 if args:
31     cls = eval(args[0])
32     print_vars(cls)
33 else:
34     print "Usage: " + sys.argv[0] + " <UML class name>"
35     sys.exit(1)
Note: See TracBrowser for help on using the browser.