1. pygame
  2. Untitled project
  3. pygame

Commits

marcus  committed 73067bf

Moved documentation system to sphinx
bundle_docs.py now includes the examples.
release target creates both, docs dist and source dist now.
Removed doc/create_htmlref.py - it's handled by sphinx now.
Added doc/create_rstref.py to create RST files from the XML sources.

  • Participants
  • Parent commits 4dbd3e1
  • Branches pgreloaded

Comments (0)

Files changed (46)

File MANIFEST.in

View file
  • Ignore whitespace
 include *.txt *.py Makefile
+include doc/LGPL doc/Makefile
 recursive-include config *.py *.cfg
-recursive-include doc *.py *.xml *.txt LGPL
+recursive-include doc *.py *.html *.rst *.xml *.txt
+recursive-include doc/sphinx *
 recursive-include examples *
 recursive-include lib *
 recursive-include src *

File Makefile

View file
  • Ignore whitespace
-PYTHON = python3.0
+PYTHON = python
 top_srcdir = `pwd`
 SUBDIRS = \
 	$(top_srcdir)/config \
 
 all: clean build
 
-dist: clean
+dist: clean docs
 	@echo "Creating dist..."
 	@$(PYTHON) setup.py sdist
 
-bdist: clean
+bdist: clean docs
 	@echo "Creating bdist..."
 	@$(PYTHON) setup.py bdist
 
 	@echo "Cleaning up in $(top_srcdir)/ ..."
 	@rm -f *.cache *.core *~ MANIFEST *.pyc
 	@rm -rf src/doc
-	@rm -rf doc/ref
 	@rm -rf build dist
 
 	@for dir in $(SUBDIRS); do \
 
 docs:
 	@echo "Creating docs package"
+	@cd doc && make html
+	@mv doc/sphinx/build/html doc/html
+	@rm -rf doc/sphinx/build
+
+release: dist
 	@$(PYTHON) config/bundle_docs.py
 
-release: clean dist
-
 # Do not run these in production environments! They are for testing
 # only!
 

File TODO.txt

View file
  • Ignore whitespace
 * use copy.copy and copy.deepcopy for consistent object copies
 * make use of PointFromObject and SizeFromObject where necessary
 * Merge transform smooth scale changes in rev. 1715:1717
+* Merge convolve from rev. 1796
 
 Things to ADD:
 ==============
 * (re)add tests
 * add examples
 * reorganise and add camera module
+* Subsurfaces via surface[x:y,a:b]? Brought up by ctgPi via IRC
 
 Things to FIX:
 ==============

File config/bundle_docs.py

View file
  • Ignore whitespace
 sys.path.append (os.path.pardir)
 
 # Exclude list that cannot be easily regexp'd.
-excludes = [ "create_cref.py", "create_htmlref.py", "create_doc.py" ]
+excludes = [ "create_cref.py", "create_rstref.py", "create_doc.py",
+             "conf.py", "Makefile" ]
 
 def add_files (bundle, root, alias, file_names):
     for file_name in file_names:
         bundle.add (os.path.join (root, file_name), file_alias)
 
 def add_directory (bundle, root, alias):
-    reject_dirs = re.compile (r'(src)|(.svn)$')
+    reject_dirs = re.compile (r'(sphinx)|(src)|(.svn)$')
 
     # Since it is the file extension that is of interest the reversed
     # file name is checked.
-    reject_files_reversed = re.compile(r'((~.*)|(cyp\..*)|(lmx\..*))')
+    reject_files_reversed = re.compile(r'((~.*)|(cyp\..*)|(lmx\..*)|(tsr\..*))')
     for sub_root, directories, files in os.walk (root):
         directories[:] = [d for d in directories if reject_dirs.match(d) is None]
         files[:] = [f for f in files \
         add_files (bundle, root, alias, ['README.txt', ])
         add_directory (bundle, os.path.join(root, 'doc'),
                        os.path.join(alias, 'doc'))
+        add_directory (bundle, os.path.join(root, 'examples'),
+                       os.path.join(alias, 'examples'))
         print ("\nFinished: %s" % bundle_name)
     finally:
         bundle.close()

File doc/Makefile

View file
  • Ignore whitespace
+# You can set these variables from the command line.
+PYTHON        = python
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+PAPER         =
+
+# Internal variables.
+PAPEROPT_a4     = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d sphinx/build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: rst help clean html web pickle htmlhelp latex changes linkcheck
+
+rst: clean
+	@$(PYTHON) create_rstref.py
+
+help:
+	@echo "Please use \`make <target>' where <target> is one of"
+	@echo "  html      to make standalone HTML files"
+	@echo "  pickle    to make pickle files"
+	@echo "  json      to make JSON files"
+	@echo "  htmlhelp  to make HTML files and a HTML help project"
+	@echo "  latex     to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+	@echo "  changes   to make an overview over all changed/added/deprecated items"
+	@echo "  linkcheck to check all external links for integrity"
+
+clean:
+	-rm -rf sphinx/build *~ *.pyc ref html
+
+html: rst
+	mkdir -p sphinx/build/html sphinx/build/doctrees
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) sphinx/build/html
+	@echo
+	@echo "Build finished. The HTML pages are in sphinx/build/html."
+
+pickle: rst
+	mkdir -p sphinx/build/pickle sphinx/build/doctrees
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) sphinx/build/pickle
+	@echo
+	@echo "Build finished; now you can process the pickle files."
+
+web: pickle
+
+json: rst
+	mkdir -p sphinx/build/json sphinx/build/doctrees
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) sphinx/build/json
+	@echo
+	@echo "Build finished; now you can process the JSON files."
+
+htmlhelp: rst
+	mkdir -p sphinx/build/htmlhelp sphinx/build/doctrees
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) sphinx/build/htmlhelp
+	@echo
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
+	      ".hhp project file in sphinx/build/htmlhelp."
+
+latex: rst
+	mkdir -p sphinx/build/latex sphinx/build/doctrees
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) sphinx/build/latex
+	@echo
+	@echo "Build finished; the LaTeX files are in sphinx/build/latex."
+	@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
+	      "run these through (pdf)latex."
+
+changes: rst
+	mkdir -p sphinx/build/changes sphinx/build/doctrees
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) sphinx/build/changes
+	@echo
+	@echo "The overview file is in sphinx/build/changes."
+
+linkcheck: rst
+	mkdir -p sphinx/build/linkcheck sphinx/build/doctrees
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) sphinx/build/linkcheck
+	@echo
+	@echo "Link check complete; look for any errors in the above output " \
+	      "or in sphinx/build/linkcheck/output.txt."

File doc/api_template.xml

View file
  • Ignore whitespace
 <!ATTLIST module name CDATA #REQUIRED>
 
 <!ELEMENT desc (#PCDATA)>
+<!ELEMENT call (#PCDATA)>
 
-<!ELEMENT func (desc)>
+<!ELEMENT func (call, desc)>
 <!ATTLIST func name CDATA #REQUIRED>
 
 <!ELEMENT class (constructor, desc, (attr | method)*)>
 <!ELEMENT constructor (#PCDATA)>
 <!ELEMENT attr (#PCDATA)>
 <!ATTLIST attr name CDATA #REQUIRED>
-<!ELEMENT method (desc)>
+<!ELEMENT method (call, desc)>
 <!ATTLIST method name CDATA #REQUIRED>
 
 ]>
 
 <!-- 
      Pygame C API template for generating the C code doc strings and 
-     HTML documentation.
+     RST/HTML documentation.
 -->
 <module name="NAME">
   <desc>DESCRIPTION</desc>
   
     <func name="METHODNAME">
+      <call>FUNC()</call>
       <desc>DESCRIPTION</desc>
     </func>
     
     <class name="CLASSNAME">
+      <cosntructor>CLASS()</cosntructor>
       <desc>DESCRIPTION</desc>
       <attr name="NAME">DESCRIPTION</attr>
       <method name="METHODNAME">
+        <call>METHOD()</call>
         <desc>DESCRIPTION</desc>
       </method>
     </class>

File doc/conf.py

View file
  • Ignore whitespace
+# -*- coding: utf-8 -*-
+#
+# Pygame2 documentation build configuration file, created by
+# sphinx-quickstart on Wed Jan 21 09:06:25 2009.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# The contents of this file are pickled, so don't put values in the namespace
+# that aren't pickleable (module imports are okay, they're removed automatically).
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If your extensions are in another directory, add it here. If the directory
+# is relative to the documentation root, use os.path.abspath to make it
+# absolute, like shown here.
+#sys.path.append(os.path.abspath('.'))
+
+# General configuration
+# ---------------------
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = []
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['sphinx/templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'Pygame2'
+copyright = u'2009, The Pygame development team'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '2.0.0'
+# The full version, including alpha/beta/rc tags.
+release = '2.0.0'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of documents that shouldn't be included in the build.
+#unused_docs = []
+
+# List of directories, relative to source directory, that shouldn't be searched
+# for source files.
+exclude_trees = ['sphinx/build']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+
+# Options for HTML output
+# -----------------------
+
+# The style sheet to use for HTML and HTML Help pages. A file of that name
+# must exist either in Sphinx' static/ path, or in one of the custom paths
+# given in html_static_path.
+html_style = 'default.css'
+
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['sphinx/static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_use_modindex = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, the reST sources are included in the HTML build as _sources/<name>.
+#html_copy_source = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = ''
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'Pygame2doc'
+
+
+# Options for LaTeX output
+# ------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, document class [howto/manual]).
+latex_documents = [
+  ('index', 'Pygame2.tex', ur'Pygame2 Documentation',
+   ur'The Pygame development team', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_use_modindex = True

File doc/create_cref.py

View file
  • Ignore whitespace
     tmp = modname.split (".")[-1]
     headname = tmp.upper()
     docprefix = "DOC_%s_" % headname
-    desc = module.getElementsByTagName ("desc")[0].firstChild.nodeValue
-    desc = prepare_text (desc)
+    desc = ""
+    node = module.getElementsByTagName ("desc")
+    if node and node[0].firstChild:
+        desc = node[0].firstChild.nodeValue
+        desc = prepare_text (desc)
     
     buf.write ("#ifndef _PYGAME2_DOC%s_H_\n" % headname)
     buf.write ("#define _PYGAME2_DOC%s_H_\n\n" % headname)
     funcs = module.getElementsByTagName ("func")
     for func in funcs:
         name = func.getAttribute ("name").upper ()
-        desc = func.getElementsByTagName ("desc")[0].firstChild.nodeValue
+        call = func.getAttribute ("call") + "\n"
+        node = func.getElementsByTagName ("desc")
+        desc = call
+        if node and node[0].firstChild:
+            desc += node[0].firstChild.nodeValue
         desc = prepare_text (desc)
         buf.write ("#define %s \"%s\"\n" % (docprefix + name, desc))
     
     classes = module.getElementsByTagName ("class")
     for cls in classes:
         name = cls.getAttribute ("name").upper ()
-        desc = cls.getElementsByTagName ("desc")[0].firstChild.nodeValue
+        constructor = cls.getElementsByTagName \
+                      ("constructor")[0].firstChild.nodeValue + "\n"
+        desc = constructor
+        node = cls.getElementsByTagName ("desc")
+        if node and node[0].firstChild:
+            desc += node[0].firstChild.nodeValue
         desc = prepare_text (desc)
         buf.write ("#define %s \"%s\"\n" % (docprefix + name, desc))
 
 
 def create_attr_ref (attr, prefix, buf):
     name = attr.getAttribute ("name").upper ()
-    desc = attr.firstChild.nodeValue
-    desc = prepare_text (desc)
+    desc = ""
+    if attr.firstChild:
+        desc = attr.firstChild.nodeValue
+        desc = prepare_text (desc)
     buf.write ("#define %s \"%s\"\n" % (prefix + name, desc))
     
 def create_method_ref (method, prefix, buf):
     name = method.getAttribute ("name").upper ()
-    desc = method.getElementsByTagName ("desc")[0].firstChild.nodeValue
+    call = ""
+    desc = ""
+    node = method.getElementsByTagName ("call")
+    if node and node[0].firstChild:
+        call = node[0].firstChild.nodeValue + "\n"
+        desc = call
+    node = method.getElementsByTagName ("desc")
+    if node and node[0].firstChild:
+        desc += node[0].firstChild.nodeValue
     desc = prepare_text (desc)
     buf.write ("#define %s \"%s\"\n" % (prefix + name, desc))
 
         f.flush ()
         f.close ()
     except Exception:
-        print (sys.exc_info()[1])
+        raise
+        #print (sys.exc_info()[1])
     
     
 if __name__ == "__main__":

File doc/create_doc.py

View file
  • Ignore whitespace
     buf.write ("<!ELEMENT module (desc, (func|class)*)>\n")
     buf.write ("<!ATTLIST module name CDATA #REQUIRED>\n")
     buf.write ("<!ELEMENT desc (#PCDATA)>\n")
-    buf.write ("<!ELEMENT func (desc)>\n")
+    buf.write ("<!ELEMENT call (#PCDATA)>\n")
+    buf.write ("<!ELEMENT func (call, desc)>\n")
     buf.write ("<!ATTLIST func name CDATA #REQUIRED>\n")
     buf.write ("<!ELEMENT class (constructor, desc, (attr|method)*)>\n")
     buf.write ("<!ATTLIST class name CDATA #REQUIRED>\n")
     buf.write ("<!ELEMENT constructor (#PCDATA)>\n")
     buf.write ("<!ELEMENT attr (#PCDATA)>\n")
     buf.write ("<!ATTLIST attr name CDATA #REQUIRED>\n")
-    buf.write ("<!ELEMENT method (desc)>\n")
+    buf.write ("<!ELEMENT method (call, desc)>\n")
     buf.write ("<!ATTLIST method name CDATA #REQUIRED>\n")
     buf.write ("]>\n\n")
 
 def document_func (func, buf, indent):
     iindent = indent + 2
     buf.write (" " * indent + "<func name=\"%s\">\n" % func.__name__)
-    buf.write (" " * iindent + "<desc>%s</desc>\n" % func.__doc__)
+    buf.write (" " * iindent + "<call>%s</call>\n" % get_call_line (func))
+    buf.write (" " * iindent + "<desc>%s</desc>\n" % get_desc_wo_call (func))
     buf.write (" " * indent + "</func>\n")
 
 def document_method (method, buf, indent):
     iindent = indent + 2
     buf.write (" " * indent + "<method name=\"%s\">\n" % method.__name__)
-    buf.write (" " * iindent + "<desc>%s</desc>\n" % method.__doc__)
+    buf.write (" " * iindent + "<call>%s</call>\n" % get_call_line (method))
+    buf.write (" " * iindent + "<desc>%s</desc>\n" % get_desc_wo_call (method))
     buf.write (" " * indent + "</method>\n")
 
+def get_call_line (obj):
+    data = obj.__doc__
+    call = ""
+    if not data:
+        return call
+    lines = data.split ("\n")
+    for l in lines:
+        l = l.strip ()
+        if len (l) == 0:
+            continue
+        call = l.strip ()
+        break
+    return call
+
+def get_desc_wo_call (obj):
+    data = obj.__doc__
+    desc = ""
+    callf = False
+    if not data:
+        return desc
+    lines = data.split ("\n")
+    for l in lines:
+        l = l.strip ()
+        if len (l) == 0:
+            if not callf:
+                continue
+        if not callf:
+            callf = True
+            continue
+        if callf:
+            desc += l + '\n'
+    return desc
+    
 def document_module (module, buf):
 
     # Module header.

File doc/create_htmlref.py

  • Ignore whitespace
-from xml.dom.minidom import parse
-import os, glob, sys
-
-HTML_HEADER = """
-<html>
-<head>
-<title>%s</title>
-</head>
-<body>
-"""
-
-HTML_FOOTER = """
-</body>
-</html>
-"""
-
-class DocClass (object):
-    def __init__ (self, name, description):
-        self.name = name
-        self.description = description
-        self.attributes = []
-        self.methods = []
-    
-    def __repr__ (self):
-        return "<DocClass '%s'>" % self.name
-
-class DocAttribute (object):
-    def __init__ (self, name, description):
-        self.name = name
-        self.description = description
-
-    def __repr__ (self):
-        return "<DocAttribute '%s'>" % self.name
-
-class DocMethod (object):
-    def __init__ (self, cls, name, description):
-        self.name = name
-        self.cls = cls
-        self.description = description
-
-    def __repr__ (self):
-        if self.cls:
-            return "<DocMethod '%s.%s'>" % (self.cls, self.name)
-        return "<DocMethod '%s'>" % (self.name)
-
-class Doc(object):
-    def __init__ (self, filename):
-        self.filename = filename
-        self.modulename = None
-        self.description = ""
-        self.classes = []
-        self.functions = []
-    
-    def parse_content (self):
-        dom = parse (self.filename)
-        module = self.get_module_docs (dom)
-        self.get_module_funcs (module)
-        self.get_class_refs (module)
-    
-    def get_module_docs (self, dom):
-        module = dom.getElementsByTagName ("module")[0]
-        self.modulename = module.getAttribute ("name")
-        node = module.getElementsByTagName ("desc")[0]
-        if node.firstChild:
-            self.description = node.firstChild.nodeValue
-        return module
-    
-    def get_module_funcs (self, module):
-        functions = module.getElementsByTagName ("func")
-        for func in functions:
-            name = func.getAttribute ("name")
-            node = func.getElementsByTagName ("desc")[0]
-            if node.firstChild:
-                desc = node.firstChild.nodeValue
-            else:
-                desc = ""
-            self.functions.append (DocMethod (None, name, desc))
-
-    def get_class_refs (self, module):
-        classes = module.getElementsByTagName ("class")
-        for cls in classes:
-            name = cls.getAttribute ("name")
-            node = cls.getElementsByTagName ("desc")[0]
-            if node.firstChild:
-                desc = node.firstChild.nodeValue
-            else:
-                desc = ""
-            clsdoc = DocClass (name, desc)
-
-            attrs = cls.getElementsByTagName ("attr")
-            for attr in attrs:
-                self.create_attr_ref (clsdoc, attr)
-
-            methods = cls.getElementsByTagName ("method")
-            for method in methods:
-                self.create_method_ref (clsdoc, method)
-            
-            self.classes.append (clsdoc)
-
-    def create_attr_ref (self, doccls, attr):
-        name = attr.getAttribute ("name")
-        if attr.firstChild:
-            desc = attr.firstChild.nodeValue
-        else:
-            desc = ""
-        doccls.attributes.append (DocAttribute (name, desc))
-
-    def create_method_ref (self, doccls, method):
-        name = method.getAttribute ("name")
-        node = method.getElementsByTagName ("desc")[0]
-        if node.firstChild:
-            desc = node.firstChild.nodeValue
-        else:
-            desc = ""
-        doccls.methods.append (DocMethod (doccls, name, desc))
-
-    def create_desc_html (self, desc, refcache):
-        written = 0
-        blocks = 0
-        data = '<p>'
-        for line in desc.split ('\n'):
-            line = line.strip ()
-            if written > 0 and line == '':
-                data += '</p><p>'
-                blocks += 1
-            elif line != '':
-                # TODO: replace pygame2.XXX references with links.
-                data += ' ' + line
-                written += 1
-        if blocks > 0:
-            data += '</p>'
-        if written == 0:
-            return ''
-        return data
-    
-    def create_func_html (self, func, refcache):
-        data = '    <dt class="functions"><a name="%s">%s</a></dt>\n' % \
-               (func.name, func.name)
-        data += '    <dd class="functions">%s</dd>\n' % \
-                self.create_desc_html (func.description, refcache)
-        return data
-    
-    def create_html (self, refcache):
-        fname = os.path.join ("ref", "%s.html")
-        fp = open (fname % self.modulename.replace (".", "_"), "w")
-        fp.write (HTML_HEADER % self.modulename)
-        
-        fp.write ('<h1 class="module">%s</h1>\n' % self.modulename)
-        fp.write ('<div class="module">\n%s</div>\n' % self.description)
-        fp.write ('<div class="moddefs">\n')
-        
-        if len (self.functions) > 0:
-            fp.write ('  <dl class="functions">\n')
-            for func in self.functions:
-                fp.write (self.create_func_html (func, refcache))
-            fp.write ("  </dl>\n")
-
-        if len (self.classes) > 0:
-            for cls in self.classes:
-                fp.write (cls.name)
-                fp.write (cls.description)
-                for attr in cls.attributes:
-                    fp.write (attr.name)
-                    fp.write (attr.description)
-                for method in cls.methods:
-                    fp.write (method.name)
-                    fp.write (method.description)
-        fp.write ('</div>\n')
-        fp.write (HTML_FOOTER)
-        fp.close ()
-        
-def create_html (docs):
-    refcache = {}
-    if not os.path.exists ("ref"):
-        os.mkdir ("ref")
-
-    for doc in docs:
-        for cls in doc.classes:
-            refcache[cls.name] = doc.filename
-        for func in doc.functions:
-            refcache[func.name] = doc.filename
-    for doc in docs:
-        print ("Now writing HTML for %s...." % doc.modulename)
-        doc.create_html (refcache)
-
-def get_doc_files ():
-    docs = []
-    files = glob.glob (os.path.join ("src", "*.xml"))
-    for fname in files:
-        docs.append (Doc (fname))
-    return docs
-
-if __name__ == "__main__":
-    docs = get_doc_files ()
-    for doc in docs:
-        print ("Parsing file %s..." % doc.filename)
-        doc.parse_content ()
-    create_html (docs)

File doc/create_rstref.py

View file
  • Ignore whitespace
+from xml.dom.minidom import parse
+import os, glob, sys
+
+RST_HEADER = """"""
+
+RST_FOOTER = """"""
+
+class DocClass (object):
+    def __init__ (self, name, constructor, description):
+        self.name = name
+        self.constructor = constructor
+        self.description = description
+        self.attributes = []
+        self.methods = []
+    
+    def __repr__ (self):
+        return "<DocClass '%s'>" % self.name
+
+class DocAttribute (object):
+    def __init__ (self, name, description):
+        self.name = name
+        self.description = description
+
+    def __repr__ (self):
+        return "<DocAttribute '%s'>" % self.name
+
+class DocMethod (object):
+    def __init__ (self, cls, name, call, description):
+        self.name = name
+        self.call = call
+        self.cls = cls
+        self.description = description
+
+    def __repr__ (self):
+        if self.cls:
+            return "<DocMethod '%s.%s'>" % (self.cls, self.name)
+        return "<DocMethod '%s'>" % (self.name)
+
+class Doc(object):
+    def __init__ (self, filename):
+        self.filename = filename
+        self.modulename = None
+        self.description = ""
+        self.classes = []
+        self.functions = []
+    
+    def parse_content (self):
+        dom = parse (self.filename)
+        module = self.get_module_docs (dom)
+        self.get_module_funcs (module)
+        self.get_class_refs (module)
+    
+    def get_module_docs (self, dom):
+        module = dom.getElementsByTagName ("module")[0]
+        self.modulename = module.getAttribute ("name")
+        node = module.getElementsByTagName ("desc")[0]
+        if node.firstChild:
+            self.description = node.firstChild.nodeValue
+        return module
+    
+    def get_module_funcs (self, module):
+        functions = module.getElementsByTagName ("func")
+        for func in functions:
+            name = func.getAttribute ("name")
+            node = func.getElementsByTagName ("call")[0]
+            if node.firstChild:
+                call = node.firstChild.nodeValue
+            else:
+                call = ""
+            node = func.getElementsByTagName ("desc")[0]
+            if node.firstChild:
+                desc = node.firstChild.nodeValue
+            else:
+                desc = ""
+            self.functions.append (DocMethod (None, name, call, desc))
+
+    def get_class_refs (self, module):
+        classes = module.getElementsByTagName ("class")
+        for cls in classes:
+            name = cls.getAttribute ("name")
+            node = cls.getElementsByTagName ("constructor")[0]
+            if node.firstChild:
+                const = node.firstChild.nodeValue
+            else:
+                const = ""
+            node = cls.getElementsByTagName ("desc")[0]
+            if node.firstChild:
+                desc = node.firstChild.nodeValue
+            else:
+                desc = ""
+            clsdoc = DocClass (name, const, desc)
+
+            attrs = cls.getElementsByTagName ("attr")
+            for attr in attrs:
+                self.create_attr_ref (clsdoc, attr)
+
+            methods = cls.getElementsByTagName ("method")
+            for method in methods:
+                self.create_method_ref (clsdoc, method)
+            
+            self.classes.append (clsdoc)
+
+    def create_attr_ref (self, doccls, attr):
+        name = attr.getAttribute ("name")
+        if attr.firstChild:
+            desc = attr.firstChild.nodeValue
+        else:
+            desc = ""
+        doccls.attributes.append (DocAttribute (name, desc))
+
+    def create_method_ref (self, doccls, method):
+        name = method.getAttribute ("name")
+        node = method.getElementsByTagName ("call")[0]
+        if node.firstChild:
+            call = node.firstChild.nodeValue
+        else:
+            call = ""
+        node = method.getElementsByTagName ("desc")[0]
+        if node.firstChild:
+            desc = node.firstChild.nodeValue
+        else:
+            desc = ""
+        doccls.methods.append (DocMethod (doccls, name, call, desc))
+
+    def create_desc_rst (self, desc, refcache):
+        written = 0
+        blocks = 0
+        data = ""
+        
+        for line in desc.split ("\n"):
+            line = line.strip ()
+            if written > 0 and line == "":
+                blocks += 1
+            elif line != "":
+                data += "\n" + line
+                written += 1
+        if written == 0:
+            return ""
+        return data + "\n\n"
+    
+    def create_func_rst (self, func, refcache):
+        data = "%s - %s\n" % (func.name, func.name)
+        data += "%s\n" % self.create_desc_rst (func.description, refcache)
+        return data
+    
+    def create_rst (self, refcache):
+        fname = os.path.join ("ref", "%s.rst")
+        fp = open (fname % self.modulename.replace (".", "_"), "w")
+        fp.write (RST_HEADER)
+        
+        fp.write ("%s\n" % self.modulename)
+        fp.write ("=" * len (self.modulename) + "\n")
+        fp.write ("%s\n\n" % self.create_desc_rst (self.description, refcache))
+        
+        if len (self.functions) > 0:
+            fp.write ("\n")
+            fp.write ("Module functions\n")
+            fp.write ("----------------\n")
+            for func in self.functions:
+                fp.write (self.create_func_rst (func, refcache))
+
+        if len (self.classes) > 0:
+            for cls in self.classes:
+                fp.write (cls.name + "\n")
+                fp.write ("-" * len (cls.name) + "\n")
+                fp.write ("*" + cls.constructor + "*\n")
+                fp.write (self.create_desc_rst (cls.description, refcache))
+                if len (cls.attributes) > 0:
+                        fp.write ("Attributes\n")
+                        fp.write ("^^^^^^^^^^\n")
+                        for attr in cls.attributes:
+                            fp.write ("**" + attr.name + "**")
+                            fp.write (self.create_desc_rst (attr.description,
+                                                            refcache))
+                if len (cls.methods) > 0:
+                    fp.write ("Methods\n")
+                    fp.write ("^^^^^^^\n")
+                    for method in cls.methods:
+                        fp.write ("**" + method.name + "**\n")
+                        fp.write ("*" + method.call + "*\n")
+                        fp.write (self.create_desc_rst (method.description,
+                                                        refcache))
+        fp.write ("\n")
+        fp.write (RST_FOOTER)
+        fp.close ()
+        
+def create_rst (docs):
+    refcache = {}
+    if not os.path.exists ("ref"):
+        os.mkdir ("ref")
+
+    for doc in docs:
+        for cls in doc.classes:
+            refcache[cls.name] = doc.filename
+        for func in doc.functions:
+            refcache[func.name] = doc.filename
+    for doc in docs:
+        print ("Now writing RST for %s...." % doc.modulename)
+        doc.create_rst (refcache)
+
+def get_doc_files ():
+    docs = []
+    files = glob.glob (os.path.join ("src", "*.xml"))
+    for fname in files:
+        docs.append (Doc (fname))
+    return docs
+
+if __name__ == "__main__":
+    docs = get_doc_files ()
+    for doc in docs:
+        print ("Parsing file %s..." % doc.filename)
+        doc.parse_content ()
+    create_rst (docs)

File doc/index.rst

View file
  • Ignore whitespace
+###################################
+Welcome to Pygame2's documentation!
+###################################
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
+
+   modules.rst
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+

File doc/modules.rst

View file
  • Ignore whitespace
+===============
+Pygame2 modules
+===============
+
+Modules:
+
+.. toctree::
+
+   ref/pygame2_base
+   ref/pygame2_mask
+   ref/pygame2_physics
+   ref/pygame2_sdl_audio
+   ref/pygame2_sdl_base
+   ref/pygame2_sdl_cdrom
+   ref/pygame2_sdl_event
+   ref/pygame2_sdl_gl
+   ref/pygame2_sdl_joystick
+   ref/pygame2_sdl_keyboard
+   ref/pygame2_sdl_mouse
+   ref/pygame2_sdl_rwops
+   ref/pygame2_sdl_time
+   ref/pygame2_sdl_video
+   ref/pygame2_sdl_wm
+   ref/pygame2_sdlext_base
+   ref/pygame2_sdlext_draw
+   ref/pygame2_sdlext_fastevent
+   ref/pygame2_sdlext_numericsurfarray
+   ref/pygame2_sdlext_scrap
+   ref/pygame2_sdlext_transform
+   ref/pygame2_sdlgfx_base
+   ref/pygame2_sdlgfx_primitives
+   ref/pygame2_sdlgfx_rotozoom
+   ref/pygame2_sdlimage
+   ref/pygame2_sdlimage_base
+   ref/pygame2_sdlmixer_base
+   ref/pygame2_sdlmixer_channel
+   ref/pygame2_sdlmixer_music
+   ref/pygame2_sdlmixer_numericsndarray
+   ref/pygame2_sdlttf_base

File doc/sphinx/static/_KEEPME

  • Ignore whitespace
Empty file added.

File doc/sphinx/templates/_KEEPME

  • Ignore whitespace
Empty file added.

File doc/src/base.xml

View file
  • Ignore whitespace
 <?xml version="1.0" encoding="utf-8"?>
-
 <!DOCTYPE module [
-<!ELEMENT module (desc, (func | class)*)>
+<!ELEMENT module (desc, (func|class)*)>
 <!ATTLIST module name CDATA #REQUIRED>
-
 <!ELEMENT desc (#PCDATA)>
-
-<!ELEMENT func (desc)>
+<!ELEMENT call (#PCDATA)>
+<!ELEMENT func (call, desc)>
 <!ATTLIST func name CDATA #REQUIRED>
-
-<!ELEMENT class (constructor, desc, (attr | method)*)>
+<!ELEMENT class (constructor, desc, (attr|method)*)>
 <!ATTLIST class name CDATA #REQUIRED>
 <!ELEMENT constructor (#PCDATA)>
 <!ELEMENT attr (#PCDATA)>
 <!ATTLIST attr name CDATA #REQUIRED>
-<!ELEMENT method (desc)>
+<!ELEMENT method (call, desc)>
 <!ATTLIST method name CDATA #REQUIRED>
-
 ]>
 
 <module name="pygame2.base">
-  <desc>
-    Base module for pygame2 that contains features shared and used
-    throughout the whole pygame2 package.
-  </desc>
+  <desc>Base module for pygame2 that contains features shared and used
+  throughout the whole pygame2 package.</desc>
 
   <class name="BufferProxy">
-    <constructor>
-      BufferProxy () -> BufferProxy
-    </constructor>
-    <desc>
-      BufferProxy () -> BufferProxy
+    <constructor>BufferProxy () -> BufferProxy</constructor>
+    <desc>Creates a new, empty BufferProxy.
 
-      Creates a new, empty BufferProxy.
+    A buffer interface object that acts as a proxy on classes and attributes
+    not featuring the buffer interface. A BufferProxy usually should be
+    constructed from C code, not Python.</desc>
+    <attr name="length">Gets the size of the buffer data in bytes.</attr>
+    <attr name="raw">Gets the raw buffer data as string. The string may contain NUL bytes.</attr>
+    <method name="write">
+      <call>B.write (bufferproxy, buffer, offset) -> None</call>
+      <desc>
+        Writes raw data to the BufferProxy.
 
-      A buffer interface object that acts as a proxy on classes and attributes
-      not featuring the buffer interface. A BufferProxy usually should be
-      constructed from C code, not Python.
-    </desc>
-
-    <attr name="length">Gets the size of the buffer data in bytes.</attr>
-    <attr name="raw">
-      Gets the raw buffer data as string. The string may contain NUL bytes.
-    </attr>
-
-    <method name="write">
-      <desc>
-        B.write (bufferproxy, buffer, offset) -> None
-
-        Writes raw data to the BufferProxy.
-        
         Writes the raw data from buffer to the BufferProxy object, starting at
         the specified offset within the BufferProxy.  If the length of the
         passed buffer exceeds the length of the BufferProxy (reduced by the
   </class>
 
   <class name="Color">
-    <constructor>
-      Color (name)
-      Color (r, g, b, a)
-      Color (rgbvalue)
-    </constructor>
-    <desc>
-      Color (...) -> Color
-      
-      Creates a new Color object.
+    <constructor>Color (...) -> Color</constructor>
+    <desc>Creates a new Color object.
 
-      The Color class represents RGBA color values using a value range of
-      0-255. It allows basic arithmetic operations to create new colors,
-      supports conversions to other color spaces such as HSV or HSL and lets
-      you adjust single color channels.
-    </desc>
-    <attr name="a">
-      Gets or sets the alpha value of the Color.
-    </attr>
-    <attr name="b">
-      Gets or sets the blue value of the Color.
-    </attr>
-    <attr name="cmy">
-      The CMY representation of the Color. The CMY components are in the
-      ranges C = [0, 1], M = [0, 1], Y = [0, 1]. Note that this will not
-      return the absolutely exact CMY values for the set RGB values in all
-      cases. Due to the RGB mapping from 0-255 and the CMY mapping from 0-1
-      rounding errors may cause the CMY values to differ slightly from what
-      you might expect.
-    </attr>
+    The Color class represents RGBA color values using a value range of
+    0-255. It allows basic arithmetic operations to create new colors,
+    supports conversions to other color spaces such as HSV or HSL and lets
+    you adjust single color channels.</desc>
+    <attr name="a">Gets or sets the alpha value of the Color.</attr>
+    <attr name="b">Gets or sets the blue value of the Color.</attr>
+    <attr name="cmy">The CMY representation of the Color. The CMY components are in the
+    ranges C = [0, 1], M = [0, 1], Y = [0, 1]. Note that this will not
+    return the absolutely exact CMY values for the set RGB values in all
+    cases. Due to the RGB mapping from 0-255 and the CMY mapping from 0-1
+    rounding errors may cause the CMY values to differ slightly from what
+    you might expect.</attr>
     <method name="correct_gamma">
+      <call>Color.correct_gamma (gamma) -> Color</call>
       <desc>
-        Color.correct_gamma (gamma) -> Color
-        
         Applies a certain gamma value to the Color.
-        
+
         Applies a certain gamma value to the Color and returns a new Color with
         the adjusted RGBA values.
       </desc>
     </method>
-    
     <attr name="g">Gets or sets the green value of the Color.</attr>
-    <attr name="hsla">
-      The HSLA representation of the Color. The HSLA components are in the
-      ranges H = [0, 360], S = [0, 100], L = [0, 100], A = [0, 100]. Note that
-      this will not return the absolutely exact HSL values for the set RGB
-      values in all cases. Due to the RGB mapping from 0-255 and the HSL
-      mapping from 0-100 and 0-360 rounding errors may cause the HSL values to
-      differ slightly from what you might expect.
-    </attr>
-    <attr name="hsva">
-      The HSVA representation of the Color. The HSVA components are in the
-      ranges H = [0, 360], S = [0, 100], V = [0, 100], A = [0, 100]. Note that
-      this will not return the absolutely exact HSV values for the set RGB
-      values in all cases. Due to the RGB mapping from 0-255 and the HSV
-      mapping from 0-100 and 0-360 rounding errors may cause the HSV values to
-      differ slightly from what you might expect.
-    </attr>
-    <attr name="i1i2i3">
-      The I1I2I3 representation of the Color. The I1I2I3 components are in the
-      ranges I1 = [0, 1], I2 = [-0.5, 0.5], I3 = [-0.5, 0.5]. Note that this
-      will not return the absolutely exact I1I2I3 values for the set RGB
-      values in all cases. Due to the RGB mapping from 0-255 and the I1I2I3
-      mapping from 0-1 rounding errors may cause the I1I2I3 values to differ
-      slightly from what you might expect.
-    </attr>
+    <attr name="hsla">The HSLA representation of the Color. The HSLA components are in the
+    ranges H = [0, 360], S = [0, 100], L = [0, 100], A = [0, 100]. Note that
+    this will not return the absolutely exact HSL values for the set RGB
+    values in all cases. Due to the RGB mapping from 0-255 and the HSL
+    mapping from 0-100 and 0-360 rounding errors may cause the HSL values to
+    differ slightly from what you might expect.</attr>
+    <attr name="hsva">The HSVA representation of the Color. The HSVA components are in the
+    ranges H = [0, 360], S = [0, 100], V = [0, 100], A = [0, 100]. Note that
+    this will not return the absolutely exact HSV values for the set RGB
+    values in all cases. Due to the RGB mapping from 0-255 and the HSV
+    mapping from 0-100 and 0-360 rounding errors may cause the HSV values to
+    differ slightly from what you might expect.</attr>
+    <attr name="i1i2i3">The I1I2I3 representation of the Color. The I1I2I3 components are in the
+    ranges I1 = [0, 1], I2 = [-0.5, 0.5], I3 = [-0.5, 0.5]. Note that this
+    will not return the absolutely exact I1I2I3 values for the set RGB
+    values in all cases. Due to the RGB mapping from 0-255 and the I1I2I3
+    mapping from 0-1 rounding errors may cause the I1I2I3 values to differ
+    slightly from what you might expect.</attr>
     <method name="normalize">
+      <call>Color.normalize() -> tuple</call>
       <desc>
-        Color.normalize() -> tuple
-
         Returns the normalized RGBA values of the Color.
 
         Returns the normalized RGBA values of the Color as floating point
         values.
       </desc>
     </method>
-    <attr name="r">
-      Gets or sets the red value of the Color.
-    </attr>
+    <attr name="r">Gets or sets the red value of the Color.</attr>
   </class>
 
   <class name="Error">
-    <constructor>Error (...) -> Error</constructor>
-    <desc>The typical pygame2 exception.</desc>
+    <constructor>TODO</constructor>
+    <desc>None</desc>
+  </class>
+
+  <class name="FRect">
+    <constructor>FRect (...) -> FRect</constructor>
+    <desc>A class for storing rectangular coordinates.
+
+    A FRect is used to store and manipulate rectangular coordinates.  TODO</desc>
+    <attr name="bottom">Gets or sets the bottom edge position of the FRect.</attr>
+    <attr name="bottomleft">Gets or sets the bottom left corner position of the FRect.</attr>
+    <attr name="bottomright">Gets or sets the bottom right corner position of the FRect.</attr>
+    <method name="ceil">
+      <call>FRect.ceil () -> Rect</call>
+      <desc>
+        Creates a Rect from the specified FRect.
+
+        This creates a Rect using the smallest integral values greater
+        or equal to the FRect floating point values.
+      </desc>
+    </method>
+    <attr name="center">Gets or sets the center position of the FRect.</attr>
+    <attr name="centerx">Gets or sets the horizontal center position of the FRect.</attr>
+    <attr name="centery">Gets or sets the vertical center position of the FRect.</attr>
+    <method name="clamp">
+      <call>FRect.clamp (FRect) -> FRect</call>
+      <desc>
+        Moves the rectangle inside another.
+
+        Returns a new rectangle that is moved to be completely inside
+        the argument FRect. If the rectangle is too large to fit inside,
+        it is centered inside the argument FRect, but its size is not
+        changed.
+      </desc>
+    </method>
+    <method name="clamp_ip">
+      <call>FRect.clamp_ip (FRect) -> None</call>
+      <desc>
+        Moves the rectangle inside another, in place.
+
+        Same as FRect.clamp(FRect), but operates in place.
+      </desc>
+    </method>
+    <method name="clip">
+      <call>FRect.clip (FRect) -> FRect</call>
+      <desc>
+        Crops a rectangle inside another.
+
+        Returns a new rectangle that is cropped to be completely inside
+        the argument FRect. If the two rectangles do not overlap to begin
+        with, a FRect with 0 size is returned. Thus it returns the area, in
+        which both rects overlap.
+      </desc>
+    </method>
+    <method name="collidedict">
+      <call>FRect.collidedict (dict) -> (key, value)</call>
+      <desc>
+        Test if one rectangle in a dictionary intersects.
+
+        Returns the key and value of the first dictionary value that
+        collides with the FRect. If no collisions are found, None is
+        returned. They keys of the passed dict must be FRect objects.
+      </desc>
+    </method>
+    <method name="collidedictall">
+      <call>FRect.collidedictall (dict) -> [(key, value), ...]</call>
+      <desc>
+        Test if all rectangles in a dictionary intersect.
+
+        Returns a list of all the key and value pairs that intersect
+        with the FRect. If no collisions are found an empty list is
+        returned. They keys of the passed dict must be FRect objects.
+      </desc>
+    </method>
+    <method name="collidelist">
+      <call>FRect.collidelist (list) -> index</call>
+      <desc>
+        Test if one rectangle in a list intersects.
+
+        Test whether the rectangle collides with any in a sequence of
+        rectangles. The index of the first collision found is
+        returned. If no collisions are found an index of -1 is returned.
+      </desc>
+    </method>
+    <method name="collidelistall">
+      <call>FRect.collidelistall (list) -> [index, ...]</call>
+      <desc>
+        Test if all rectangles in a list intersect.
+
+        Returns a list of all the indices that contain rectangles that
+        collide with the FRect. If no intersecting rectangles are found,
+        an empty list is returned.
+      </desc>
+    </method>
+    <method name="collidepoint">
+      <call>FRect.collidepoint (x, y) -> bool</call>
+      <desc>
+        Test if a point is inside a rectangle.
+
+        Returns true if the given point is inside the rectangle. A point
+        along the right or bottom edge is not considered to be inside
+        the rectangle.
+      </desc>
+    </method>
+    <method name="colliderect">
+      <call>FRect.colliderect (FRect) -> bool</call>
+      <desc>
+        Test if two rectangles overlap.
+
+        Returns true if any portion of either rectangle overlap (except
+        the top+bottom or left+right edges).
+      </desc>
+    </method>
+    <method name="contains">
+      <call>FRect.contains (FRect) -> bool</call>
+      <desc>
+        Test if one rectangle is inside another.
+
+        Returns true when the argument rectangle is completely inside
+        the FRect.
+      </desc>
+    </method>
+    <method name="fit">
+      <call>FRect.fit (FRect) -> FRect</call>
+      <desc>
+        Resize and move a rectangle with aspect ratio.
+
+        Returns a new rectangle that is moved and resized to fit
+        another. The aspect ratio of the original FRect is preserved, so
+        the new rectangle may be smaller than the target in either width
+        or height.
+      </desc>
+    </method>
+    <method name="floor">
+      <call>FRect.floor () -> Rect</call>
+      <desc>
+        Creates a Rect from the specified FRect.
+
+        This creates a Rect using the largest integral values less than
+        or equal to the FRect floating point values.
+      </desc>
+    </method>
+    <attr name="height">Gets or sets the height of the FRect.</attr>
+    <method name="inflate">
+      <call>FRect.inflate (x, y) -> FRect</call>
+      <desc>
+        Grow or shrink the rectangle size.
+
+        Returns a new rectangle with the size changed by the given
+        offset. The rectangle remains centered around its current
+        center. Negative values will shrink the rectangle.
+      </desc>
+    </method>
+    <method name="inflate_ip">
+      <call>FRect.inflate_ip (x, y) -> None</call>
+      <desc>
+        Grow or shrink the rectangle size, in place.
+
+        Same as FRect.inflate(x, y), but operates in place.
+      </desc>
+    </method>
+    <attr name="left">Gets or sets the left edge position of the FRect.</attr>
+    <attr name="midbottom">Gets or sets the mid bottom edge position of the FRect.</attr>
+    <attr name="midleft">Gets or sets the mid left edge position of the FRect.</attr>
+    <attr name="midright">Gets or sets the mid right edge position of the FRect.</attr>
+    <attr name="midtop">Gets or sets the mid top edge position of the FRect.</attr>
+    <method name="move">
+      <call>FRect.move (x, y) -> FRect</call>
+      <desc>
+        Moves the rectangle.
+
+        Returns a new rectangle that is moved by the given offset. The x
+        and y arguments can be any integer value, positive or negative.
+      </desc>
+    </method>
+    <method name="move_ip">
+      <call>FRect.move_ip (x, y) -> None</call>
+      <desc>
+        Moves the rectangle, in place.
+
+        Same as FRect.move (x, y), but operates in place.
+      </desc>
+    </method>
+    <attr name="right">Gets or sets the right position of the FRect.</attr>
+    <method name="round">
+      <call>FRect.round () -> Rect</call>
+      <desc>
+        Creates a Rect from the specified FRect.
+
+        This creates a Rect using the FRect floating point values
+        rounded to the nearest integral value.
+      </desc>
+    </method>
+    <attr name="size">Gets or sets the width and height of the FRect as 2-value tuple.</attr>
+    <attr name="top">Gets or sets the top edge position of the FRect.</attr>
+    <attr name="topleft">Gets or sets the top left corner position of the FRect.</attr>
+    <attr name="topright">Gets or sets the top right corner position of the FRect.</attr>
+    <method name="trunc">
+      <call>FRect.trunc () -> Rect</call>
+      <desc>
+        Creates a Rect from the specified FRect.
+
+        This creates a Rect using truncated integral values from the
+        Frect floating point values.
+      </desc>
+    </method>
+    <method name="union">
+      <call>FRect.union (FRect) -> FRect</call>
+      <desc>
+        Joins two rectangles into one.
+
+        Returns a new rectangle that completely covers the area of the
+        two provided rectangles. There may be area inside the new FRect
+        that is not covered by the originals.
+      </desc>
+    </method>
+    <method name="union_ip">
+      <call>FRect.union_ip (FRect) -> FRect</call>
+      <desc>
+        Joins two rectangles into one, in place.
+
+        Same as FRect.union(FRect), but operates in place.
+      </desc>
+    </method>
+    <attr name="width">Gets or sets the width of the FRect.</attr>
+    <attr name="x">Gets or sets the horizontal top left position of the FRect.</attr>
+    <attr name="y">Gets or sets the vertical top left position of the FRect.</attr>
   </class>
 
   <class name="Rect">
-    <constructor>
-      Rect (Rect)
-      Rect (FRect)
-      Rect (x, y, w, h)
-      Rect (w, h)
-      Rect ((x, y), (w, h))
-    </constructor>
-    <desc>
-      Rect (...) -> Rect
+    <constructor>Rect (...) -> Rect</constructor>
+    <desc>A class for storing rectangular coordinates.
 
-      A class for storing rectangular coordinates.
-
-      A Rect is used to store and manipulate rectangular coordinates.  TODO
-    </desc>
-    <attr name="bottom">
-      Gets or sets the bottom edge position of the Rect.
-    </attr>
-    <attr name="bottomleft">
-      Gets or sets the bottom left corner position of the Rect.
-    </attr>
-    <attr name="bottomright">
-      Gets or sets the bottom right corner position of the Rect.
-    </attr>
-    <attr name="center">
-      Gets or sets the center position of the Rect.
-    </attr>
-    <attr name="centerx">
-      Gets or sets the horizontal center position of the Rect.
-    </attr>
-    <attr name="centery">
-      Gets or sets the vertical center position of the Rect.
-    </attr>
+    A Rect is used to store and manipulate rectangular coordinates.  TODO</desc>
+    <attr name="bottom">Gets or sets the bottom edge position of the Rect.</attr>
+    <attr name="bottomleft">Gets or sets the bottom left corner position of the Rect.</attr>
+    <attr name="bottomright">Gets or sets the bottom right corner position of the Rect.</attr>
+    <attr name="center">Gets or sets the center position of the Rect.</attr>
+    <attr name="centerx">Gets or sets the horizontal center position of the Rect.</attr>
+    <attr name="centery">Gets or sets the vertical center position of the Rect.</attr>
     <method name="clamp">
+      <call>Rect.clamp (Rect) -> Rect</call>
       <desc>
-        Rect.clamp (Rect) -> Rect
-
         Moves the rectangle inside another.
 
         Returns a new rectangle that is moved to be completely inside
       </desc>
     </method>
     <method name="clamp_ip">
+      <call>Rect.clamp_ip (Rect) -> None</call>
       <desc>
-        Rect.clamp_ip (Rect) -> None
-
         Moves the rectangle inside another, in place.
 
         Same as Rect.clamp(Rect), but operates in place.
       </desc>
     </method>
     <method name="clip">
+      <call>Rect.clip (Rect) -> Rect</call>
       <desc>
-        Rect.clip (Rect) -> Rect
-
         Crops a rectangle inside another.
 
         Returns a new rectangle that is cropped to be completely inside
       </desc>
     </method>
     <method name="collidedict">
+      <call>Rect.collidedict (dict) -> (key, value)</call>
       <desc>
-        Rect.collidedict (dict) -> (key, value)
-
         Test if one rectangle in a dictionary intersects.
 
         Returns the key and value of the first dictionary value that
       </desc>
     </method>
     <method name="collidedictall">
+      <call>Rect.collidedictall (dict) -> [(key, value), ...]</call>
       <desc>
-        Rect.collidedictall (dict) -> [(key, value), ...]
-
         Test if all rectangles in a dictionary intersect.
 
         Returns a list of all the key and value pairs that intersect
       </desc>
     </method>
     <method name="collidelist">
+      <call>Rect.collidelist (list) -> index</call>
       <desc>
-        Rect.collidelist (list) -> index
-
         Test if one rectangle in a list intersects.
 
         Test whether the rectangle collides with any in a sequence of
       </desc>
     </method>
     <method name="collidelistall">
+      <call>Rect.collidelistall (list) -> [index, ...]</call>
       <desc>
-        Rect.collidelistall (list) -> [index, ...]
-
         Test if all rectangles in a list intersect.
 
         Returns a list of all the indices that contain rectangles that
       </desc>
     </method>
     <method name="collidepoint">
+      <call>Rect.collidepoint (x, y) -> bool</call>
       <desc>
-        Rect.collidepoint (x, y) -> bool
-
         Test if a point is inside a rectangle.
 
         Returns true if the given point is inside the rectangle. A point
       </desc>
     </method>
     <method name="colliderect">
+      <call>Rect.colliderect (Rect) -> bool</call>
       <desc>
-        Rect.colliderect (Rect) -> bool
-
         Test if two rectangles overlap.
 
         Returns true if any portion of either rectangle overlap (except
       </desc>
     </method>
     <method name="contains">
+      <call>Rect.contains (Rect) -> bool</call>
       <desc>
-        Rect.contains (Rect) -> bool
-
         Test if one rectangle is inside another.
 
         Returns true when the argument rectangle is completely inside
       </desc>
     </method>
     <method name="fit">
+      <call>Rect.fit (Rect) -> Rect</call>
       <desc>
-        Rect.fit (Rect) -> Rect
-
         Resize and move a rectangle with aspect ratio.
 
         Returns a new rectangle that is moved and resized to fit
         or height.
       </desc>
     </method>
-    <attr name="height">
-      Gets or sets the height of the Rect.
-    </attr>
+    <attr name="height">Gets or sets the height of the Rect.</attr>
     <method name="inflate">
+      <call>Rect.inflate (x, y) -> Rect</call>
       <desc>
-        Rect.inflate (x, y) -> Rect
-
         Grow or shrink the rectangle size.
 
         Returns a new rectangle with the size changed by the given
       </desc>
     </method>
     <method name="inflate_ip">
+      <call>Rect.inflate_ip (x, y) -> None</call>
       <desc>
-        Rect.inflate_ip (x, y) -> None
-
         Grow or shrink the rectangle size, in place.
 
         Same as Rect.inflate(x, y), but operates in place.
       </desc>
     </method>
-    <attr name="left">
-      Gets or sets the left edge position of the Rect.
-    </attr>
-    <attr name="midbottom">
-      Gets or sets the mid bottom edge position of the Rect.
-    </attr>
-    <attr name="midleft">
-      Gets or sets the mid left edge position of the Rect.
-    </attr>
-    <attr name="midright">
-      Gets or sets the mid right edge position of the Rect.
-    </attr>
-    <attr name="midtop">
-      Gets or sets the mid top edge position of the Rect.
-    </attr>
+    <attr name="left">Gets or sets the left edge position of the Rect.</attr>
+    <attr name="midbottom">Gets or sets the mid bottom edge position of the Rect.</attr>
+    <attr name="midleft">Gets or sets the mid left edge position of the Rect.</attr>
+    <attr name="midright">Gets or sets the mid right edge position of the Rect.</attr>
+    <attr name="midtop">Gets or sets the mid top edge position of the Rect.</attr>
     <method name="move">
+      <call>Rect.move (x, y) -> Rect</call>
       <desc>
-        Rect.move (x, y) -> Rect
-
         Moves the rectangle.
 
         Returns a new rectangle that is moved by the given offset. The x
       </desc>
     </method>
     <method name="move_ip">
+      <call>Rect.move_ip (x, y) -> None</call>
       <desc>
-        Rect.move_ip (x, y) -> None
-
         Moves the rectangle, in place.
 
         Same as Rect.move (x, y), but operates in place.
       </desc>
     </method>
-    <attr name="right">
-      Gets or sets the right position of the Rect.
-    </attr>
-    <attr name="size">
-      Gets or sets the width and height of the Rect as 2-value tuple.
-    </attr>
-    <attr name="top">
-      Gets or sets the top edge position of the Rect.
-    </attr>
-    <attr name="topleft">
-      Gets or sets the top left corner position of the Rect.
-    </attr>
-    <attr name="topright">
-      Gets or sets the top right corner position of the Rect.
-    </attr>
+    <attr name="right">Gets or sets the right position of the Rect.</attr>
+    <attr name="size">Gets or sets the width and height of the Rect as 2-value tuple.</attr>
+    <attr name="top">Gets or sets the top edge position of the Rect.</attr>
+    <attr name="topleft">Gets or sets the top left corner position of the Rect.</attr>
+    <attr name="topright">Gets or sets the top right corner position of the Rect.</attr>
     <method name="union">
+      <call>Rect.union (Rect) -> Rect</call>
       <desc>
-        Rect.union (Rect) -> Rect
-
         Joins two rectangles into one.
 
         Returns a new rectangle that completely covers the area of the
       </desc>
     </method>
     <method name="union_ip">
+      <call>Rect.union_ip (Rect) -> Rect</call>
       <desc>
-        Rect.union_ip (Rect) -> Rect
-
         Joins two rectangles into one, in place.
 
         Same as Rect.union(Rect), but operates in place.
       </desc>
     </method>
-    <attr name="width">
-      Gets or sets the width of the Rect.
-    </attr>
-    <attr name="x">
-      Gets or sets the horizontal top left position of the Rect.
-    </attr>
-    <attr name="y">
-      Gets or sets the vertical top left position of the Rect.
-    </attr>
-  </class>
-
-  <class name="FRect">
-    <constructor>
-      FRect (Rect)
-      FRect (FRect)
-      FRect (x, y, w, h)
-      FRect (w, h)
-      FRect ((x, y), (w, h))
-    </constructor>
-    <desc>
-      FRect (...) -> FRect
-
-      A class for storing rectangular coordinates.
-
-      A FRect is used to store and manipulate rectangular coordinates.  TODO
-    </desc>
-    <attr name="bottom">
-      Gets or sets the bottom edge position of the FRect.
-    </attr>
-    <attr name="bottomleft">
-      Gets or sets the bottom left corner position of the FRect.
-    </attr>
-    <attr name="bottomright">
-      Gets or sets the bottom right corner position of the FRect.
-    </attr>
-    <method name="ceil">
-      <desc>
-        FRect.ceil () -> Rect
-        
-        Creates a Rect from the specified FRect.
-
-        This creates a Rect using the smallest integral values greater
-        or equal to the FRect floating point values.
-      </desc>
-    </method>
-    <attr name="center">
-      Gets or sets the center position of the FRect.
-    </attr>
-    <attr name="centerx">
-      Gets or sets the horizontal center position of the FRect.
-    </attr>
-    <attr name="centery">
-      Gets or sets the vertical center position of the FRect.
-    </attr>
-    <method name="clamp">
-      <desc>
-        FRect.clamp (FRect) -> FRect
-
-        Moves the rectangle inside another.
-
-        Returns a new rectangle that is moved to be completely inside
-        the argument FRect. If the rectangle is too large to fit inside,
-        it is centered inside the argument FRect, but its size is not
-        changed.
-      </desc>
-    </method>
-    <method name="clamp_ip">
-      <desc>
-        FRect.clamp_ip (FRect) -> None
-
-        Moves the rectangle inside another, in place.
-
-        Same as FRect.clamp(FRect), but operates in place.
-      </desc>
-    </method>
-    <method name="clip">
-      <desc>
-        FRect.clip (FRect) -> FRect
-
-        Crops a rectangle inside another.
-
-        Returns a new rectangle that is cropped to be completely inside
-        the argument FRect. If the two rectangles do not overlap to begin
-        with, a FRect with 0 size is returned. Thus it returns the area, in
-        which both rects overlap.
-      </desc>
-    </method>
-    <method name="collidedict">
-      <desc>
-        FRect.collidedict (dict) -> (key, value)
-
-        Test if one rectangle in a dictionary intersects.
-
-        Returns the key and value of the first dictionary value that
-        collides with the FRect. If no collisions are found, None is
-        returned. They keys of the passed dict must be FRect objects.
-      </desc>
-    </method>
-    <method name="collidedictall">
-      <desc>
-        FRect.collidedictall (dict) -> [(key, value), ...]
-
-        Test if all rectangles in a dictionary intersect.
-
-        Returns a list of all the key and value pairs that intersect
-        with the FRect. If no collisions are found an empty list is
-        returned. They keys of the passed dict must be FRect objects.
-      </desc>
-    </method>
-    <method name="collidelist">
-      <desc>
-        FRect.collidelist (list) -> index
-
-        Test if one rectangle in a list intersects.
-
-        Test whether the rectangle collides with any in a sequence of
-        rectangles. The index of the first collision found is
-        returned. If no collisions are found an index of -1 is returned.
-      </desc>
-    </method>
-    <method name="collidelistall">
-      <desc>
-        FRect.collidelistall (list) -> [index, ...]
-
-        Test if all rectangles in a list intersect.
-
-        Returns a list of all the indices that contain rectangles that
-        collide with the FRect. If no intersecting rectangles are found,
-        an empty list is returned.
-      </desc>
-    </method>
-    <method name="collidepoint">
-      <desc>
-        FRect.collidepoint (x, y) -> bool
-
-        Test if a point is inside a rectangle.
-
-        Returns true if the given point is inside the rectangle. A point
-        along the right or bottom edge is not considered to be inside
-        the rectangle.
-      </desc>
-    </method>
-    <method name="colliderect">
-      <desc>
-        FRect.colliderect (FRect) -> bool
-
-        Test if two rectangles overlap.
-
-        Returns true if any portion of either rectangle overlap (except
-        the top+bottom or left+right edges).
-      </desc>
-    </method>
-    <method name="contains">
-      <desc>
-        FRect.contains (FRect) -> bool
-
-        Test if one rectangle is inside another.
-
-        Returns true when the argument rectangle is completely inside
-        the FRect.
-      </desc>
-    </method>
-    <method name="fit">
-      <desc>
-        FRect.fit (FRect) -> FRect
-
-        Resize and move a rectangle with aspect ratio.
-
-        Returns a new rectangle that is moved and resized to fit
-        another. The aspect ratio of the original FRect is preserved, so
-        the new rectangle may be smaller than the target in either width
-        or height.
-      </desc>
-    </method>
-    <method name="floor">
-      <desc>
-        FRect.floor () -> Rect
-        
-        Creates a Rect from the specified FRect.
-
-        This creates a Rect using the largest integral values less than
-        or equal to the FRect floating point values.
-      </desc>
-    </method>
-    <attr name="height">
-      Gets or sets the height of the FRect.
-    </attr>
-    <method name="inflate">
-      <desc>
-        FRect.inflate (x, y) -> FRect
-
-        Grow or shrink the rectangle size.
-
-        Returns a new rectangle with the size changed by the given
-        offset. The rectangle remains centered around its current
-        center. Negative values will shrink the rectangle.
-      </desc>
-    </method>
-    <method name="inflate_ip">
-      <desc>
-        FRect.inflate_ip (x, y) -> None
-
-        Grow or shrink the rectangle size, in place.
-
-        Same as FRect.inflate(x, y), but operates in place.
-      </desc>
-    </method>
-    <attr name="left">
-      Gets or sets the left edge position of the FRect.
-    </attr>
-    <attr name="midbottom">
-      Gets or sets the mid bottom edge position of the FRect.
-    </attr>
-    <attr name="midleft">
-      Gets or sets the mid left edge position of the FRect.
-    </attr>
-    <attr name="midright">
-      Gets or sets the mid right edge position of the FRect.
-    </attr>
-    <attr name="midtop">
-      Gets or sets the mid top edge position of the FRect.
-    </attr>
-    <method name="move">
-      <desc>
-        FRect.move (x, y) -> FRect
-
-        Moves the rectangle.
-
-        Returns a new rectangle that is moved by the given offset. The x
-        and y arguments can be any integer value, positive or negative.
-      </desc>
-    </method>
-    <method name="move_ip">
-      <desc>
-        FRect.move_ip (x, y) -> None
-
-        Moves the rectangle, in place.
-
-        Same as FRect.move (x, y), but operates in place.
-      </desc>
-    </method>
-    <attr name="right">
-      Gets or sets the right position of the FRect.
-    </attr>
-    <method name="round">
-      <desc>
-        FRect.round () -> Rect
-        
-        Creates a Rect from the specified FRect.
-
-        This creates a Rect using the FRect floating point values
-        rounded to the nearest integral value.
-      </desc>
-    </method>
-    <attr name="size">
-      Gets or sets the width and height of the FRect as 2-value tuple.
-    </attr>
-    <attr name="top">
-      Gets or sets the top edge position of the FRect.
-    </attr>
-    <attr name="topleft">
-      Gets or sets the top left corner position of the FRect.
-    </attr>
-    <attr name="topright">
-      Gets or sets the top right corner position of the FRect.
-    </attr>
-    <method name="trunc">
-      <desc>
-        FRect.trunc () -> Rect
-        
-        Creates a Rect from the specified FRect.
-
-        This creates a Rect using truncated integral values from the 
-        Frect floating point values.
-      </desc>
-    </method>
-    <method name="union">
-      <desc>
-        FRect.union (FRect) -> FRect
-
-        Joins two rectangles into one.
-
-        Returns a new rectangle that completely covers the area of the
-        two provided rectangles. There may be area inside the new FRect
-        that is not covered by the originals.
-      </desc>
-    </method>
-    <method name="union_ip">
-      <desc>
-        FRect.union_ip (FRect) -> FRect
-
-        Joins two rectangles into one, in place.
-
-        Same as FRect.union(FRect), but operates in place.
-      </desc>
-    </method>
-    <attr name="width">
-      Gets or sets the width of the FRect.
-    </attr>
-    <attr name="x">
-      Gets or sets the horizontal top left position of the FRect.
-    </attr>
-    <attr name="y">
-      Gets or sets the vertical top left position of the FRect.
-    </attr>
+    <attr name="width">Gets or sets the width of the Rect.</attr>
+    <attr name="x">Gets or sets the horizontal top left position of the Rect.</attr>
+    <attr name="y">Gets or sets the vertical top left position of the Rect.</attr>
   </class>
 
 </module>
+