mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
Added method list to gendocs
This commit is contained in:
parent
22648e6577
commit
968b1c835d
@ -485,7 +485,6 @@ class CodeDatabase:
|
|||||||
self.globalfn = []
|
self.globalfn = []
|
||||||
print "Reading C++ source files"
|
print "Reading C++ source files"
|
||||||
for cxx in cxxlist:
|
for cxx in cxxlist:
|
||||||
#print "Reading source file "+cxx
|
|
||||||
tokzr = InterrogateTokenizer(cxx)
|
tokzr = InterrogateTokenizer(cxx)
|
||||||
idb = InterrogateDatabase(tokzr)
|
idb = InterrogateDatabase(tokzr)
|
||||||
for type in idb.types.values():
|
for type in idb.types.values():
|
||||||
@ -503,7 +502,6 @@ class CodeDatabase:
|
|||||||
self.funcs[type.scopedname+"."+func.pyname] = func
|
self.funcs[type.scopedname+"."+func.pyname] = func
|
||||||
print "Reading Python sources files"
|
print "Reading Python sources files"
|
||||||
for py in pylist:
|
for py in pylist:
|
||||||
#print "Reading source file "+py
|
|
||||||
pyinf = ParseTreeInfo(readFile(py), py)
|
pyinf = ParseTreeInfo(readFile(py), py)
|
||||||
for type in pyinf.class_info.keys():
|
for type in pyinf.class_info.keys():
|
||||||
typinf = pyinf.class_info[type]
|
typinf = pyinf.class_info[type]
|
||||||
@ -656,27 +654,32 @@ def generateFunctionDocs(code, method):
|
|||||||
chunk = chunk + "</td></tr></table><br>\n"
|
chunk = chunk + "</td></tr></table><br>\n"
|
||||||
return chunk
|
return chunk
|
||||||
|
|
||||||
def generateLinkTable(table, cols, urlprefix, urlsuffix):
|
def generateLinkTable(link, text, cols, urlprefix, urlsuffix):
|
||||||
table = table[:]
|
column = (len(link)+cols-1)/cols
|
||||||
column = (len(table)+cols-1)/cols
|
|
||||||
percent = 100 / cols
|
percent = 100 / cols
|
||||||
for i in range(cols): table.append("")
|
|
||||||
result = '<table width="100%">\n'
|
result = '<table width="100%">\n'
|
||||||
for i in range(column):
|
for i in range(column):
|
||||||
line = ""
|
line = ""
|
||||||
for j in range(cols):
|
for j in range(cols):
|
||||||
slot = table[i + column*j]
|
slot = i + column*j
|
||||||
line = line + '<td width="' + str(percent) + '%">' + linkTo(urlprefix+slot+urlsuffix,slot) + "</td>"
|
linkval = ""
|
||||||
|
textval = ""
|
||||||
|
if (slot < len(link)): linkval = link[slot]
|
||||||
|
if (slot < len(text)): textval = text[slot]
|
||||||
|
if (i==0):
|
||||||
|
line = line + '<td width="' + str(percent) + '%">' + linkTo(urlprefix+linkval+urlsuffix,textval) + "</td>"
|
||||||
|
else:
|
||||||
|
line = line + '<td>' + linkTo(urlprefix+linkval+urlsuffix,textval) + "</td>"
|
||||||
result = result + "<tr>" + line + "</tr>\n"
|
result = result + "<tr>" + line + "</tr>\n"
|
||||||
result = result + "</table>\n"
|
result = result + "</table>\n"
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def generate(pversion, indirlist, directdirlist, docdir, header, footer, urlprefix, urlsuffix):
|
|
||||||
ignore = {}
|
|
||||||
ignore["__init__.py"] = 1
|
|
||||||
|
|
||||||
|
def generate(pversion, indirlist, directdirlist, docdir, header, footer, urlprefix, urlsuffix):
|
||||||
if isinstance(directdirlist, types.StringTypes):
|
if isinstance(directdirlist, types.StringTypes):
|
||||||
directdirlist = [directdirlist]
|
directdirlist = [directdirlist]
|
||||||
|
ignore = {}
|
||||||
|
ignore["__init__.py"] = 1
|
||||||
for directdir in directdirlist:
|
for directdir in directdirlist:
|
||||||
ignore[directdir + "/src/directscripts"] = 1
|
ignore[directdir + "/src/directscripts"] = 1
|
||||||
ignore[directdir + "/src/extensions"] = 1
|
ignore[directdir + "/src/extensions"] = 1
|
||||||
@ -693,7 +696,6 @@ def generate(pversion, indirlist, directdirlist, docdir, header, footer, urlpref
|
|||||||
xclasses = classes[:]
|
xclasses = classes[:]
|
||||||
print "Generating HTML pages"
|
print "Generating HTML pages"
|
||||||
for type in classes:
|
for type in classes:
|
||||||
#print "Generating page for class "+type
|
|
||||||
body = "<h1>" + type + "</h1>\n"
|
body = "<h1>" + type + "</h1>\n"
|
||||||
comment = code.getClassComment(type)
|
comment = code.getClassComment(type)
|
||||||
body = body + "<ul>\n" + comment + "</ul>\n\n"
|
body = body + "<ul>\n" + comment + "</ul>\n\n"
|
||||||
@ -727,18 +729,63 @@ def generate(pversion, indirlist, directdirlist, docdir, header, footer, urlpref
|
|||||||
writeFile(docdir + "/" + modtype + ".html", body)
|
writeFile(docdir + "/" + modtype + ".html", body)
|
||||||
xclasses.append(modtype)
|
xclasses.append(modtype)
|
||||||
xclasses.sort()
|
xclasses.sort()
|
||||||
|
|
||||||
index = "<h1>List of Classes - Panda " + pversion + "</h1>\n"
|
index = "<h1>List of Classes - Panda " + pversion + "</h1>\n"
|
||||||
index = index + generateLinkTable(xclasses,3,urlprefix,urlsuffix)
|
index = index + generateLinkTable(xclasses,xclasses,3,urlprefix,urlsuffix)
|
||||||
fnlist = code.getGlobalFunctionList()[:]
|
fnlist = code.getGlobalFunctionList()[:]
|
||||||
fnlist.sort()
|
fnlist.sort()
|
||||||
fnnames = []
|
fnnames = []
|
||||||
for i in range(len(fnlist)):
|
for i in range(len(fnlist)):
|
||||||
fnnames.append(code.getFunctionName(fnlist[i]))
|
fnnames.append(code.getFunctionName(fnlist[i]))
|
||||||
index = index + "<h1>List of Global Functions - Panda " + pversion + "</h1>\n"
|
index = header + index + footer
|
||||||
index = index + generateLinkTable(fnnames,3,"#","")
|
writeFile(docdir + "/classes.html", index)
|
||||||
|
|
||||||
|
index = "<h1>List of Global Functions - Panda " + pversion + "</h1>\n"
|
||||||
|
index = index + generateLinkTable(fnnames,fnnames,3,"#","")
|
||||||
for func in fnlist:
|
for func in fnlist:
|
||||||
index = index + generateFunctionDocs(code, func)
|
index = index + generateFunctionDocs(code, func)
|
||||||
index = header + index + footer
|
index = header + index + footer
|
||||||
|
writeFile(docdir + "/functions.html", index)
|
||||||
|
|
||||||
|
table = {}
|
||||||
|
for type in classes:
|
||||||
|
for method in code.getClassMethods(type)[:]:
|
||||||
|
name = code.getFunctionName(method)
|
||||||
|
prefix = name[0].upper()
|
||||||
|
if (table.has_key(prefix)==0): table[prefix] = {}
|
||||||
|
if (table[prefix].has_key(name)==0): table[prefix][name] = []
|
||||||
|
table[prefix][name].append(type)
|
||||||
|
|
||||||
|
index = "<h1>List of Methods - Panda " + pversion + "</h1>\n"
|
||||||
|
|
||||||
|
prefixes = table.keys()
|
||||||
|
prefixes.sort()
|
||||||
|
for prefix in prefixes:
|
||||||
|
index = index + linkTo("#"+prefix, prefix) + " "
|
||||||
|
index = index + "<br><br>"
|
||||||
|
for prefix in prefixes:
|
||||||
|
index = index + '<a name="' + prefix + '">' + "\n"
|
||||||
|
names = table[prefix].keys()
|
||||||
|
names.sort()
|
||||||
|
for name in names:
|
||||||
|
line = '<b>' + name + ":</b><ul>\n"
|
||||||
|
ctypes = table[prefix][name]
|
||||||
|
ctypes.sort()
|
||||||
|
for type in ctypes:
|
||||||
|
line = line + "<li>" + linkTo(urlprefix+type+urlsuffix+"#"+name, type) + "\n"
|
||||||
|
line = line + "</ul>\n"
|
||||||
|
index = index + line + "\n"
|
||||||
|
index = header + index + footer
|
||||||
|
writeFile(docdir + "/methods.html", index)
|
||||||
|
|
||||||
|
index = "<h1>Panda " + pversion + "</h1>\n"
|
||||||
|
index = index + "<ul>\n"
|
||||||
|
index = index + "<li>" + linkTo(urlprefix+"classes"+urlsuffix, "List of all Classes") + "\n"
|
||||||
|
index = index + "</ul>\n"
|
||||||
|
index = index + "<ul>\n"
|
||||||
|
index = index + "<li>" + linkTo(urlprefix+"functions"+urlsuffix, "List of all Global Functions") + "\n"
|
||||||
|
index = index + "</ul>\n"
|
||||||
|
index = index + "<ul>\n"
|
||||||
|
index = index + "<li>" + linkTo(urlprefix+"methods"+urlsuffix, "List of all Methods (very long)") + "\n"
|
||||||
|
index = index + "</ul>\n"
|
||||||
writeFile(docdir + "/index.html", index)
|
writeFile(docdir + "/index.html", index)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user