Phoenix: update the sphinx_generator.py file and correct the Sphinx documentation for missing image header, unwanted sections in wx.TextCtrl and other minor cosmetic adjustments.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@70743 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Andrea Gavana
2012-02-28 22:18:11 +00:00
parent c80c343ae9
commit 47aa4014fa
14 changed files with 101 additions and 24 deletions

View File

@@ -17,6 +17,6 @@
{% block header %}
<div class="floatcenter" style="background-color: white; text-align: middle; align: middle; padding: 40px 10px 15px 15px">
<img src="{{ pathto("_static/phoenix_top.png", 1) }}" alt="Phoenix Logo" align="middle" />
<img src="{{ pathto("_static/images/sphinxdocs/phoenix_top.png", 1) }}" alt="Phoenix Logo" align="middle" />
</div>
{% endblock %}

View File

@@ -25,7 +25,7 @@ sys.path.append('..')
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.todo', 'sphinx.ext.autodoc',
'sphinx.ext.autosummary', 'sphinx.ext.coverage',
'availability']
'availability'] #, 'rst2pdf.pdfbuilder']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
@@ -261,18 +261,3 @@ pdf_verbosity = 2
# Enable experimental feature to split table cells. Use it
# if you get "DelayedTable too big" errors
pdf_splittables = True
##def process_docstring(app, what, name, obj, options, lines):
##
## if what == "data":
##
## fid = open("autodata_docstrings.pkl", "rb")
## autodata_dict = cPickle.load(fid)
## fid.close()
##
## if name in autodata_dict:
## lines[:] = [autodata_dict[name].strip()]
##
##
##def setup(app):
## app.connect('autodoc-process-docstring', process_docstring)

View File

@@ -0,0 +1,3 @@
image.SetOption(wx.IMAGE_OPTION_CUR_HOTSPOT_X, hotSpotX)
image.SetOption(wx.IMAGE_OPTION_CUR_HOTSPOT_X, hotSpotY)

View File

@@ -0,0 +1,8 @@
class MyFSFile(wx.FSFile):
def __init__(self):
wx.FSFile.__init__(self)

View File

@@ -0,0 +1,2 @@
wx.FileSystem.AddHandler(My_FS_Handler)

View File

@@ -0,0 +1,4 @@
ChangePathTo("dir/subdir/xh.htm")
ChangePathTo("dir/subdir", True)
ChangePathTo("dir/subdir/", True)

View File

@@ -0,0 +1,4 @@
f = fs.OpenFile("hello.htm") # opens file 'hello.htm'
fs.ChangePathTo("subdir/folder", True)
f = fs.OpenFile("hello.htm") # opens file 'subdir/folder/hello.htm' !!

View File

@@ -0,0 +1,5 @@
def CanOpen(self, location):
return self.GetProtocol(location) == "http"

View File

@@ -0,0 +1,3 @@
if GetMimeTypeFromExt("index.htm") == "text/html":
wx.MessageBox("Is HTML!")

View File

@@ -0,0 +1,35 @@
def OnAbout(self, event):
bcur = wx.BeginBusyCursor()
wx.FileSystem.AddHandler(wx.MemoryFSHandler)
wx.MemoryFSHandler.AddFile("logo.pcx", wx.Bitmap("logo.pcx", wx.BITMAP_TYPE_PCX))
wx.MemoryFSHandler.AddFile("about.htm",
"<html><body>About: "
"<img src=\"memory:logo.pcx\"></body></html>")
dlg = wx.Dialog(self, -1, _("About"))
topsizer = wx.BoxSizer(wx.VERTICAL)
html = wx.html.HtmlWindow(dlg, size=wx.Size(380, 160), style=wx.HW_SCROLLBAR_NEVER)
html.SetBorders(0)
html.LoadPage("memory:about.htm")
html.SetSize(html.GetInternalRepresentation().GetWidth(),
html.GetInternalRepresentation().GetHeight())
topsizer.Add(html, 1, wx.ALL, 10)
topsizer.Add(wx.StaticLine(dlg, -1), 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 10)
topsizer.Add(wx.Button(dlg, wx.ID_OK, "Ok"),
0, wx.ALL | wx.ALIGN_RIGHT, 15)
dlg.SetAutoLayout(True)
dlg.SetSizer(topsizer)
topsizer.Fit(dlg)
dlg.Centre()
dlg.ShowModal()
wx.MemoryFSHandler.RemoveFile("logo.pcx")
wx.MemoryFSHandler.RemoveFile("about.htm")

View File

@@ -0,0 +1,17 @@
class MyWidget(wx.Window):
def __init__(self, parent):
pre = wx.PreWindow() # Use Pre- constructor here!
# Do this first:
self.SetBackgroundStyle(wx.BG_STYLE_TRANSPARENT)
# And really create the window afterwards:
pre.Create(parent)
self.PostCreate(pre)

View File

@@ -1685,7 +1685,7 @@ class Title(Node):
text = '|phoenix_title| ' + ConvertToPython(self.element.text)
lentext = len(text)
text = '\n\n%s\n%s\n\n'%(text, '='*lentext)
text = '\n\n%s\n%s\n\n'%(text.rstrip('.'), '='*lentext)
return text
@@ -2001,6 +2001,7 @@ class XMLDocString(object):
rest_class = Emphasis(element, parent)
elif tag == 'title':
text = ConvertToPython(element.text)
rest_class = Title(element, parent)
elif tag == 'para':
@@ -2788,7 +2789,7 @@ class SphinxGenerator(generators.DocsGeneratorBase):
filename = self.current_module + "%s.txt"%name
WriteSphinxOutput(stream, filename)
WriteSphinxOutput(stream, filename, append=True)
# -----------------------------------------------------------------------
@@ -2945,7 +2946,7 @@ class SphinxGenerator(generators.DocsGeneratorBase):
name = RemoveWxPrefix(self.current_class.name) or self.current_class.pyName
filename = self.current_module + "%s.txt"%name
WriteSphinxOutput(stream, filename)
WriteSphinxOutput(stream, filename, append=True)
# -----------------------------------------------------------------------
@@ -2971,7 +2972,7 @@ class SphinxGenerator(generators.DocsGeneratorBase):
filename = self.current_module + "%s.txt"%name
WriteSphinxOutput(stream, filename)
WriteSphinxOutput(stream, filename, append=True)
def createPropertyLinks(self, name, prop):

View File

@@ -131,6 +131,8 @@ MAGIC_METHODS = {
# TODO: add more
}
SECTIONS_EXCLUDE = {'TextCtrl': ('|phoenix_title| TextCtrl and ``C++`` Streams', '|phoenix_title| Event Handling')}
# A regex to split a string keeping the whitespaces
RE_KEEP_SPACES = re.compile(r'(\s+)')
@@ -141,7 +143,7 @@ HTML_REPLACE = ['module', 'function', 'method', 'class', 'classmethod', 'staticm
# The SVN revision of wxWidgets/Phoenix used to build the Sphinx docs.
# There must be a more intelligent way to get this information automatically.
SVN_REVISION = '70154'
SVN_REVISION = '70741'
# Today's date representation for the Sphinx HTML docs
TODAY = datetime.date.today().strftime('%d %B %Y')

View File

@@ -22,7 +22,7 @@ import templates
from buildtools.config import copyIfNewer, writeIfChanged, newer
from utilities import Wx2Sphinx
from constants import HTML_REPLACE, SVN_REVISION, TODAY, SPHINXROOT
from constants import HTML_REPLACE, SVN_REVISION, TODAY, SPHINXROOT, SECTIONS_EXCLUDE
from constants import CONSTANT_INSTANCES, WIDGETS_IMAGES_ROOT, SPHINX_IMAGES_ROOT
@@ -118,6 +118,14 @@ def BuildEnumsAndMethods(sphinxDir):
for old, new in enum_dict.items():
text = text.replace(old, new)
widget_name = os.path.split(os.path.splitext(input)[0])[1]
if widget_name in SECTIONS_EXCLUDE:
start, end = SECTIONS_EXCLUDE[widget_name]
lindex = text.index(start)
rindex = text.index(end)
text = text[0:lindex] + text[rindex:]
# Replace the "Perl Note" stuff, we don't need it
newtext = ''
for line in text.splitlines():
@@ -479,7 +487,7 @@ def PostProcess(folder):
fileNames = glob.glob(folder + "/*.html")
phoenix_image = '<div class="floatcenter" style="background-color: white; text-align: middle; align: middle; padding: 40px 10px 15px 15px">\n' \
'<img src="_static/phoenix_top.png" alt="Phoenix Logo" align="middle" />\n' \
'<img src="_static/images/sphinxdocs/phoenix_top.png" alt="Phoenix Logo" align="middle" />\n' \
'</div>'