dabodoc Commit
Revision 23
Date: 2005-10-04 14:25:39 -0700 (Tue, 04 Oct 2005)
Author: paul
Changed:
_U trunk/api/
A trunk/api/getDaboModules.py
U trunk/api/makeApiDoc.py
A trunk/api/makeDaboApiDoc.py
Log:
Moved the getApiDoc() over to the dabodoc/api repository, and set up a
new script "makeDaboApiDoc" which goes through the Dabo repository,
generates a html page for each class it finds, and provides a index.html
which points to each. I'll build off of this to create the ultimate
api doc solution.
Diff:
Property changes on: trunk/api
___________________________________________________________________
Name: svn:ignore
+ *.pyc
Added: trunk/api/getDaboModules.py
===================================================================
--- trunk/api/getDaboModules.py 2005-10-04 05:20:22 UTC (rev 22)
+++ trunk/api/getDaboModules.py 2005-10-04 21:25:39 UTC (rev 23)
@@ -0,0 +1,69 @@
+import dabo
+import dabo.common
+dabo.ui.loadUI("wx")
+
+
+def getDaboModules():
+ modules = [
+ "dabo",
+ "dabo.dApp",
+ "dabo.dSecurityManager",
+ "dabo.dUserSettingProvider",
+ "dabo.db",
+ "dabo.db.dConnection",
+ "dabo.db.dCursorMixin",
+ "dabo.db.dConnectInfo",
+ "dabo.db.dbMySQL",
+ "dabo.db.dbPostgreSQL",
+ "dabo.db.dbFirebird",
+ "dabo.db.dbSQLite",
+ "dabo.biz",
+ "dabo.biz.dBizobj",
+ "dabo.ui",
+ "dabo.ui.uiwx",]
+
+ # Now we dynamically gather the ui classes to document:
+ controlClasses = []
+ formClasses = []
+ sizerClasses = []
+
+ for i in dir(dabo.ui):
+ item = dabo.ui.__dict__[i]
+ if type(item) == type:
+ if "Mixin" not in item.__name__:
+ if issubclass(item, dabo.ui.dControlMixin):
+ controlClasses.append(item)
+ if issubclass(item, dabo.ui.dFormMixin):
+ formClasses.append(item)
+ if issubclass(item, dabo.ui.dSizerMixin):
+ sizerClasses.append(item)
+
+ print "Control Classes:"
+ for i in controlClasses:
+ modules.append("dabo.ui.uiwx.%s" % i.__name__)
+ print "\t %s" % i.__name__
+
+ print "Form Classes:"
+ for i in formClasses:
+ modules.append("dabo.ui.uiwx.%s" % i.__name__)
+ print "\t %s" % i.__name__
+
+ print "Sizer Classes:"
+ for i in sizerClasses:
+ modules.append("dabo.ui.uiwx.%s" % i.__name__)
+ print "\t %s" % i.__name__
+
+ return modules
+
+def getDaboClasses():
+ classes = []
+ for module in (dabo, dabo.db, dabo.biz, dabo.ui):
+ for i in dir(module):
+ c = module.__dict__[i]
+ if type(c) == type and issubclass(c,
dabo.common.dObject):
+ classes.append(c)
+ def sortfunc(a,b):
+ return cmp(a.__name__, b.__name__)
+
+ classes.sort(sortfunc)
+ return classes
Modified: trunk/api/makeApiDoc.py
===================================================================
--- trunk/api/makeApiDoc.py 2005-10-04 05:20:22 UTC (rev 22)
+++ trunk/api/makeApiDoc.py 2005-10-04 21:25:39 UTC (rev 23)
@@ -7,6 +7,7 @@
import os
import dabo
dabo.ui.loadUI("wx")
+from getDaboModules import getDaboModules
_outputType = "html"
#_outputType = "pdf"
@@ -21,56 +22,11 @@
_name = "Dabo %s (Revision %s)" % (_version["version"], _version["revision"])
_url = "http://dabodev.com"
-modules = [
- "dabo",
- "dabo.dApp",
- "dabo.dSecurityManager",
- "dabo.dUserSettingProvider",
- "dabo.db",
- "dabo.db.dConnection",
- "dabo.db.dCursorMixin",
- "dabo.db.dConnectInfo",
- "dabo.db.dbMySQL",
- "dabo.db.dbPostgreSQL",
- "dabo.db.dbFirebird",
- "dabo.db.dbSQLite",
- "dabo.biz",
- "dabo.biz.dBizobj",
- "dabo.ui",
- "dabo.ui.uiwx",]
+modules = getDaboModules()
-# Now we dynamically gather the ui classes to document:
-controlClasses = []
-formClasses = []
-sizerClasses = []
+print modules
+sys.exit()
-for i in dir(dabo.ui):
- item = dabo.ui.__dict__[i]
- if type(item) == type:
- if "Mixin" not in item.__name__:
- if issubclass(item, dabo.ui.dControlMixin):
- controlClasses.append(item)
- if issubclass(item, dabo.ui.dFormMixin):
- formClasses.append(item)
- if issubclass(item, dabo.ui.dSizerMixin):
- sizerClasses.append(item)
-
-print "Control Classes:"
-for i in controlClasses:
- modules.append("dabo.ui.uiwx.%s" % i.__name__)
- print "\t %s" % i.__name__
-
-print "Form Classes:"
-for i in formClasses:
- modules.append("dabo.ui.uiwx.%s" % i.__name__)
- print "\t %s" % i.__name__
-
-print "Sizer Classes:"
-for i in sizerClasses:
- modules.append("dabo.ui.uiwx.%s" % i.__name__)
- print "\t %s" % i.__name__
-
-
modulestring = " ".join(modules)
os.system("""python ./epydoc_cli.py --%s --inheritance %s --url "%s" --name
"%s" --no-private %s""" % (_outputType,
_inheritanceFormat, _url, _name, modulestring))
Added: trunk/api/makeDaboApiDoc.py
===================================================================
--- trunk/api/makeDaboApiDoc.py 2005-10-04 05:20:22 UTC (rev 22)
+++ trunk/api/makeDaboApiDoc.py 2005-10-04 21:25:39 UTC (rev 23)
@@ -0,0 +1,144 @@
+#!/usr/bin/env python
+
+import os
+import sys
+import dabo
+dabo.ui.loadUI("wx")
+from getDaboModules import getDaboClasses
+
+## This is my new attempt at API documentation, which doesn't use epydoc and
+## will do a better job of only grabbing the things we actually want to
+## to document. It is pretty basic now (4 Oct 2005), but does print out the
+## PEM's for every Dabo object it finds, although it will need some help
+## finding some things (dSecurityManager, dReportWriter, ...). I want to
+## add cascading stylesheets and the ability to print to PDF (for an API
+## book). Next step: make the item listings for each PEM jump to the docstring
+## for those items. For methods, include the method signature. The detailed
+## docstrings will be at the bottom of each page. --pkm
+
+
+def getApiDoc(cls, outputType="html-single"):
+ PEM_COLUMNS = float(3) ## float simply for round() to work right
+
+ className = cls.__name__
+ classDoc = cls.__doc__
+ if classDoc is None:
+ classDoc = ""
+ classDoc = "<br>".join(classDoc.split("\n"))
+
+ html = """
+<h1>Class %(className)s</h1>
+<p>%(classDoc)s</p>
+<hr>
+""" % locals()
+
+ def getListing(name, items):
+ html = """
+<h2>%(name)s</h2>
+<table width="100%%" cellpadding="5" cellspacing="0" border="0">
+""" % locals()
+
+ for idx, item in enumerate(items):
+ definedHere = (cls.__dict__.has_key(item))
+ if idx % PEM_COLUMNS == 0:
+ if idx > 0:
+ html += """ </tr>
+"""
+ html += """ <tr>
+"""
+ if definedHere:
+ html += """ <td><b><a
href="#prop_%(item)s">%(item)s</a></b></td>
+""" % locals()
+ else:
+ html += """ <td><a
href="#prop_%(item)s">%(item)s</a></td>
+""" % locals()
+
+ html += """
+ </tr>
+</table>
+<hr>
+"""
+ return html
+
+ # Property, Event, Method Listings:
+ html += getListing("Properties", cls.getPropertyList(refresh=True))
+ html += getListing("Events", cls.getEventList())
+ html += getListing("Methods", cls.getMethodList(refresh=True))
+
+ return html
+
+if os.path.exists("./daboApiDoc"):
+ sys.exit("Please move existing ./daboApiDoc out of the way first.")
+
+os.mkdir("./daboApiDoc")
+os.chdir("./daboApiDoc")
+
+
+classes = getDaboClasses()
+for class_ in classes:
+ filename = "%s.%s.html" % (class_.__module__, class_.__name__)
+ html = getApiDoc(class_)
+ f = open(filename, "w")
+ f.write(html)
+ f.close()
+
+
+html = """
+<table border="0" cellpadding="5" cellspacing="0" width="100%">
+ <tr>
+ <td width="33%"> </td>
+ <td width="33%" valign="top">
+ <b>Dabo:</b><br>"""
+
+for class_ in classes:
+ if "dabo.d" in class_.__module__ and "dabo.db" not in class_.__module__:
+ html += """
+ <a href="./%s.%s.html">%s</a><br>""" %
(class_.__module__, class_.__name__,
+ class_.__name__)
+
+html += """
+ </td>
+ <td width="33%"> </td>
+ </tr>
+ <tr>
+ <td width="33%" valign="top">
+ <b>db:</b><br>"""
+
+for class_ in classes:
+ if "dabo.db" in class_.__module__:
+ html += """
+ <a href="./%s.%s.html">%s</a><br>""" %
(class_.__module__, class_.__name__,
+ class_.__name__)
+
+html += """
+ </td>
+ <td width="33%" valign="top">
+ <b>biz:</b><br>"""
+
+for class_ in classes:
+ if "dabo.biz" in class_.__module__:
+ html += """
+ <a href="./%s.%s.html">%s</a><br>""" %
(class_.__module__, class_.__name__,
+ class_.__name__)
+
+html += """
+ </td>
+ <td width="33%" valign="top">
+ <b>ui:</b><br>"""
+
+for class_ in classes:
+ if "dabo.ui" in class_.__module__:
+ html += """
+ <a href="./%s.%s.html">%s</a><br>""" %
(class_.__module__, class_.__name__,
+ class_.__name__)
+
+html += """
+ </td>
+ </tr>
+</table>
+"""
+
+filename = "index.html"
+f = open(filename, "w")
+f.write(html)
+f.close()
Property changes on: trunk/api/makeDaboApiDoc.py
___________________________________________________________________
Name: svn:executable
+ *
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev