X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ec873c943d71f0d5f13e3398557071448cda6c23..a4027e74873007e3430af3bd77019bcab76f6c04:/wxPython/docs/bin/pythonize_docs.py diff --git a/wxPython/docs/bin/pythonize_docs.py b/wxPython/docs/bin/pythonize_docs.py deleted file mode 100644 index 52259bcd06..0000000000 --- a/wxPython/docs/bin/pythonize_docs.py +++ /dev/null @@ -1,119 +0,0 @@ -import sys, os, string, glob -import re -from docparser.wxclasses import * -from docparser.wxhtmlparse import * -import wx - -# HTML macros -html_heading = "

%s

" - -def classToHTML(name, thisclass): - global outdir, classes - page = open(os.path.join(outdir, "wx_" + name.lower() + ".html"), "w") - classname = namespacify_wxClasses(name) - page.write(thisclass.asHtml()) - page.write("
" + html_heading % "Methods") - - methods = thisclass.methods - if len(thisclass.derivedFrom) > 0: - for parentclass in thisclass.derivedFrom: - classname = parentclass.replace("wx.", "wx") - if classname in classes.keys(): - derivedmethods = classes[classname].methods - if parentclass in derivedmethods: - derivedmethods.pop(parentclass) - methods.update(derivedmethods) - - methodnames = sortMethods(classname, methods.keys()) - - for method in methodnames: - page.write("%s
" % (methods[method].getAnchorName(), method)) - - page.write("
") - - for method in methodnames: - page.write(methods[method].asHtml()) - page.write("
") - page.close() - -def sortMethods(classname, methodnames): - names = methodnames - names.sort() - # bump the constructor to the top of the list. - if classname in names: - names.remove(classname) - names.insert(0, classname) - - return names - -def makeDocString(name, docstring, longdocs=""): - myname = name.replace("wx.", "wx") - return "DocStr(%s, \"%s\", \"%s\");\n\n" % (myname, docstring, longdocs) - -def classToReST(name, thisclass): - global restdir - page = open(os.path.join(restdir, "_" + name + "_docstrings.i"), "w") - page.write(makeDocString(thisclass.name, thisclass.description)) - - classname = namespacify_wxClasses(name) - methodnames = sortMethods(classname, thisclass.methods.keys()) - - for method in methodnames: - docstr = makeDocString(name + "::" + method.replace("wx.", "wx"), thisclass.methods[method].asReST()) - page.write(docstr) - - page.close() - - -docspath = sys.argv[1] -if not os.path.isdir(docspath): - # get default directory - print "Please specify the directory where docs are located." - -outdir = os.path.join(docspath, outputdir) -if not os.path.exists(outdir): - os.makedirs(outdir) - -restdir = os.path.join(docspath, "docstrings") -if not os.path.exists(restdir): - os.makedirs(restdir) - -classes_page = os.path.join(docspath, "wx_classref.html") -print "docspath: %s" % (classes_page) -if os.path.exists(classes_page): - - # first, add namespace conventions to classes page. - output = open(os.path.join(outdir, os.path.basename(classes_page)), "w") - output.write("") - - propsfile = open(os.path.join(outdir, "props.py"), "w") - propsfile.write("import wx\n\n") - - # now, change the classes. - print "parsing wx HTML docs..." - classes = getClasses(classes_page) - names = classes.keys() - names.sort() - propConflicts = [] - for name in names: - basename = name.replace("wx", "") - urlname = "wx_%s.html" % name.lower() - output.write("%s
" % (urlname, basename)) - print "creating HTML docs for " + name - classToHTML(name, classes[name]) - print "creating rest docs for " + name - classToReST(name, classes[name]) - propsfile.write(classes[name].createProps()) - - propsfile.close() - output.write("") - output.close() - - print "prop conflicts: " + `propConflicts` - -#for doc in glob.glob(os.path.join(docspath, "wx_*.html")): -# print "doc is: %s" % (doc) -# pythonize_doc(doc) - - - \ No newline at end of file