Synopsis - Synopsis/Formatters/HTML/Fragments/ClassHierarchySimple.py

File: Synopsis/Formatters/HTML/Fragments/ClassHierarchySimple.py

     1#
     2# Copyright (C) 2000 Stephen Davies
     3# Copyright (C) 2000 Stefan Seefeld
     4# All rights reserved.
     5# Licensed to the public under the terms of the GNU LGPL (>= 2),
     6# see the file COPYING for details.
     7#
     8
     9from Synopsis.Formatters.HTML.Tags import *
    10from Synopsis.Formatters.HTML.Fragment import Fragment
    11
    12class ClassHierarchySimple(Fragment):
    13   "Prints a simple text hierarchy for classes"
    14
    15   def format_inheritance(self, inheritance):
    16
    17      return '%s %s'%(self.format_modifiers(inheritance.attributes),
    18                      self.format_type(inheritance.parent))
    19
    20   def format_class(self, class_):
    21
    22      # Print out a list of the parents
    23      super = sub = ''
    24      if class_.parents:
    25         parents = [self.format_inheritance(i) for i in class_.parents]
    26         super = ', '.join(parents)
    27         super = div('superclasses', "Superclasses: "+super)
    28
    29      # Print subclasses
    30      subs = self.processor.class_tree.subclasses(class_.name)
    31      if subs:
    32         sub = ', '.join([self.reference(s) for s in subs])
    33         sub = div('subclasses', "Known subclasses: "+sub)
    34
    35      return super + sub
    36
    37   format_class_template = format_class
    38

Generated on Thu Apr 16 16:27:16 2009 by
synopsis (version devel)