mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-12-16 01:30:07 +01:00
set svn:eol-style property to native
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71161 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,252 +1,252 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#!/usr/bin/env python
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Name: sphinxtools/constants.py
|
||||
# Author: Andrea Gavana
|
||||
#
|
||||
# Created: 30-Nov-2010
|
||||
# Copyright: (c) 2011 by Total Control Software
|
||||
# License: wxWindows License
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# Standard library imports
|
||||
import os
|
||||
import re
|
||||
import datetime
|
||||
|
||||
# Phoenix-specific imports
|
||||
import buildtools.version as version
|
||||
from buildtools.config import phoenixDir, wxDir
|
||||
|
||||
# List of strings that should be ignored when creating inline literals
|
||||
# such as ``ID_ANY`` or ``HORIZONtAL``, with double backticks
|
||||
IGNORE = ['wxPython', 'wxWidgets', 'wxOSX', 'wxMGL', 'wxDFB', 'wxMAC', 'wxGTK', 'wxGTK2', 'wxUniversal',
|
||||
'OS', 'X', 'OSX', 'DFB', 'MAC', 'GTK', 'GTK2', 'MSW', 'wxMSW', 'X11', 'OS2', 'MS', 'XP', 'GTK+',
|
||||
'UI', 'GUI', '--', 'OTOH', 'GDI+', 'API', 'NT', 'RTL', 'GDI', '3D', 'MDI']
|
||||
|
||||
# C++ stuff to Python/ReST stuff
|
||||
VALUE_MAP = {'true': '``True``',
|
||||
'false': '``False``',
|
||||
'``NULL``': '``None``',
|
||||
'NULL': '``None``',
|
||||
'L{OSX}': '`OSX`',
|
||||
'ctor': 'constructor',
|
||||
}
|
||||
|
||||
# This is a list of instances in Phoenix (i.e., without documentation strings), and
|
||||
# For the sake of beauty of the docs they get the inline literal treatment (double backticks)
|
||||
CONSTANT_INSTANCES = ['NullAcceleratorTable', 'TheApp', 'DefaultPosition', 'DefaultSize',
|
||||
'DefaultCoord', 'Coord', 'TheBrushList', 'TheColourDatabase',
|
||||
'NullFont', 'NullBrush', 'NullPalette', 'NullPen', 'EmptyString',
|
||||
'TheFontList', 'NullIcon', 'NullBitmap', 'constructor', 'ThePenList',
|
||||
'DefaultValidator', 'String.Capitalize']
|
||||
|
||||
# Phoenix full version
|
||||
VERSION = '%d.%d.%d' % (version.VER_MAJOR, version.VER_MINOR, version.VER_RELEASE)
|
||||
|
||||
# Things to chop away when ReST-ifying the docstrings
|
||||
PUNCTUATION = '!"#$%\'()*,./:;<=>?@\\^{|}~'
|
||||
|
||||
# Conversion between XML sections and ReST sections
|
||||
SECTIONS = [('return' , ':returns:'),
|
||||
('since' , '.. versionadded::'),
|
||||
('deprecated', '.. deprecated::'),
|
||||
('warning' , '.. warning::'),
|
||||
('remarks' , '.. note::'),
|
||||
('remark' , '.. note::'),
|
||||
('available' , '.. availability::'),
|
||||
('note' , '.. note::'),
|
||||
('see' , '.. seealso::'),
|
||||
('todo' , '.. todo::')]
|
||||
|
||||
|
||||
# List of things to remove/ignore (there may be more)
|
||||
REMOVED_LINKS = ['Library:', 'Category:', 'Predefined objects/pointers:']
|
||||
|
||||
# Dictionary mapping the etg module name to the real Phoenix module name
|
||||
# This needs to be kept up to date when other stuff comes in (i.e., wx.grid,
|
||||
# wx.html and so on)
|
||||
MODULENAME_REPLACE = {'_core' : '',
|
||||
'_dataview': 'dataview.',
|
||||
'_adv' : '',
|
||||
}
|
||||
|
||||
# Other C++ specific things to strip away
|
||||
CPP_ITEMS = ['*', '&', 'const', 'unsigned', '(size_t)', 'size_t', 'void']
|
||||
|
||||
# Serie of paths containing the input data for Sphinx and for the scripts
|
||||
# building the ReST docs:
|
||||
|
||||
# The location of the Phoenix main folder
|
||||
PHOENIXROOT = phoenixDir()
|
||||
|
||||
# The location of the Sphinx main folder
|
||||
SPHINXROOT = os.path.join(PHOENIXROOT, 'docs', 'sphinx')
|
||||
|
||||
# Where the snippets found in the XML docstrings live (There are C++, unconverted and
|
||||
# converted Python snippets in 3 sub-folders
|
||||
SNIPPETROOT = os.path.join(SPHINXROOT, 'rest_substitutions', 'snippets')
|
||||
|
||||
# A folder where some of the difficult-to-translate-to-ReST tables are. There are 3 of
|
||||
# them up to now, for various reasons:
|
||||
# 1. The wx.Sizer flags table is a grid table, very difficult to ReSTify automatically
|
||||
# 2. The wx.ColourDatabase table of colour comes up all messy when ReSTified from XML
|
||||
# 3. The "wxWidgets 2.8 Compatibility Functions" table for wx.VScrolledWindow
|
||||
TABLEROOT = os.path.join(SPHINXROOT, 'rest_substitutions', 'tables')
|
||||
|
||||
# Folder where to save the inheritance diagrams for the classes
|
||||
INHERITANCEROOT = os.path.join(SPHINXROOT, '_static', 'images', 'inheritance')
|
||||
|
||||
# Folder where to save the images found in the wxWidgets overviews or in the XML
|
||||
# docstrings
|
||||
OVERVIEW_IMAGES_ROOT = os.path.join(SPHINXROOT, '_static', 'images', 'overviews')
|
||||
|
||||
# Folder where to save the widgets screenshots (full-size, no thumbnails here)
|
||||
WIDGETS_IMAGES_ROOT = os.path.join(SPHINXROOT, '_static', 'images', 'widgets', 'fullsize')
|
||||
|
||||
# Folder for the icons used for titles, sub-titles and so on for the Sphinx documentation
|
||||
SPHINX_IMAGES_ROOT = os.path.join(SPHINXROOT, '_static', 'images', 'sphinxdocs')
|
||||
|
||||
|
||||
# The Doxygen root for the XML docstrings
|
||||
xmlsrcbase = 'docs/doxygen/out/xml'
|
||||
WXWIN = wxDir()
|
||||
XMLSRC = os.path.join(WXWIN, xmlsrcbase)
|
||||
|
||||
DOXYROOT = os.path.join(WXWIN, 'docs', 'doxygen')
|
||||
|
||||
# Dictionary copied over from tweaker_tools
|
||||
MAGIC_METHODS = {
|
||||
'operator!=' : '__ne__',
|
||||
'operator==' : '__eq__',
|
||||
'operator+' : '__add__',
|
||||
'operator-' : '__sub__',
|
||||
'operator*' : '__mul__',
|
||||
'operator/' : '__div__',
|
||||
'operator+=' : '__iadd__',
|
||||
'operator-=' : '__isub__',
|
||||
'operator*=' : '__imul__',
|
||||
'operator/=' : '__idiv__',
|
||||
'operator bool' : '__int__', # Why not __nonzero__?
|
||||
# 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+)')
|
||||
|
||||
# A list of things used in the post-processing of the HTML files generated by Sphinx
|
||||
# This list is used only to insert a HTML horizontal line (<hr>) after each method/function
|
||||
# description
|
||||
HTML_REPLACE = ['module', 'function', 'method', 'class', 'classmethod', 'staticmethod', 'attribute']
|
||||
|
||||
# Today's date representation for the Sphinx HTML docs
|
||||
TODAY = datetime.date.today().strftime('%d %B %Y')
|
||||
|
||||
# Inheritance diagram external hyperlinks
|
||||
|
||||
PYTHON_DOCS = 'http://docs.python.org/library/'
|
||||
NUMPY_DOCS = 'http://docs.scipy.org/doc/numpy/reference/generated/'
|
||||
|
||||
EXTERN_INHERITANCE = {'UserDict.' : PYTHON_DOCS,
|
||||
'ctypes.' : PYTHON_DOCS,
|
||||
'code.' : PYTHON_DOCS,
|
||||
'exceptions.': PYTHON_DOCS,
|
||||
'threading.' : PYTHON_DOCS,
|
||||
'numpy.' : NUMPY_DOCS
|
||||
}
|
||||
|
||||
# wx.lib and other pure-Python stuff
|
||||
|
||||
class Enumeration(object):
|
||||
|
||||
def __init__(self, name, enumList):
|
||||
|
||||
self.__doc__ = name
|
||||
lookup = { }
|
||||
reverseLookup = { }
|
||||
i = 0
|
||||
uniqueNames = [ ]
|
||||
uniqueValues = [ ]
|
||||
|
||||
for item in enumList:
|
||||
x = item.upper()
|
||||
uniqueNames.append(x)
|
||||
uniqueValues.append(i)
|
||||
lookup[x] = i
|
||||
reverseLookup[i] = x
|
||||
i = i + 1
|
||||
|
||||
self.lookup = lookup
|
||||
self.reverseLookup = reverseLookup
|
||||
|
||||
def __getattr__(self, attr):
|
||||
|
||||
if not self.lookup.has_key(attr):
|
||||
raise AttributeError
|
||||
|
||||
return self.lookup[attr]
|
||||
|
||||
def whatis(self, value):
|
||||
|
||||
return self.reverseLookup[value]
|
||||
|
||||
|
||||
CONSTANT_RE = re.compile('^([\w\s,]+)=', re.M)
|
||||
|
||||
EXCLUDED_ATTRS = ['__builtins__', '__doc__', '__name__', '__file__', '__path__',
|
||||
'__module__', '__all__']
|
||||
|
||||
TYPE_DESCRIPTION = ['library',
|
||||
'package',
|
||||
'py_module', 'pyd_module', 'pyc_module', 'pyw_module',
|
||||
'klass',
|
||||
'function',
|
||||
'method', 'static_method', 'class_method', 'instance_method',
|
||||
'method_descriptor', 'builtin_method', 'builtin_function',
|
||||
'property',
|
||||
'booltype', 'classtype', 'complextype', 'dictproxytype', 'dicttype', 'filetype',
|
||||
'floattype', 'instancetype', 'inttype', 'lambdatype', 'listtype', 'longtype',
|
||||
'nonetype', 'objecttype', 'slicetype', 'strtype', 'tracebacktype', 'tupletype',
|
||||
'typetype', 'unicodetype', 'unknowntype', 'xrangetype']
|
||||
|
||||
object_types = Enumeration('Object_Types', TYPE_DESCRIPTION)
|
||||
|
||||
MODULE_TO_ICON = [(".py", object_types.PY_MODULE, "Py_Module"), (".pyd", object_types.PYD_MODULE, "Pyd_Module"),
|
||||
(".pyc", object_types.PYC_MODULE, "Pyc_Module"), (".pyw", object_types.PYW_MODULE, "Pyw_Module"),
|
||||
(".so", object_types.PYD_MODULE, "Pyd_Module")]
|
||||
|
||||
# wx.tools and other stuff
|
||||
|
||||
DOXY_2_REST = [('@author:', '\n.. moduleauthor:: '),
|
||||
('@deprecated:', '\n.. deprecated:: '),
|
||||
('@param', ':param'),
|
||||
('@var', ':param'),
|
||||
('@keyword', ':keyword'),
|
||||
('@kwarg', ':keyword'),
|
||||
('@note:', '\n.. note:: '),
|
||||
('@package:', '\n**Package:** '),
|
||||
('@package', '\n**Package:** '),
|
||||
('@postcondition:', '\n:postcondition: '),
|
||||
('@pre:', '\n:precondition: '),
|
||||
('@precondition:', '\n:precondition: '),
|
||||
('@requires:', '\n:requires: '),
|
||||
('@returns:', '\n:returns: '),
|
||||
('@return:', '\n:returns: '),
|
||||
('@returns', '\n:returns: '),
|
||||
('@return', '\n:returns: '),
|
||||
('@rtype:', '\n:rtype: '),
|
||||
# ('@section', XXX), Deal with this separately
|
||||
('@see:', '\n.. seealso:: '),
|
||||
('@status:', '\n.. todo:: '),
|
||||
('@summary:', '\n**Summary:** '),
|
||||
('@throws:', '\n:raise: '),
|
||||
('@todo:', '\n.. todo:: '),
|
||||
('@verbatim ', ''), # TODO This one
|
||||
('@verbatim', ''), # TODO This one
|
||||
('@endverbatim ', ''), # TODO This one
|
||||
('@endverbatim', ''), # TODO This one
|
||||
('@version:', '\n:version: ')]
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
#!/usr/bin/env python
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Name: sphinxtools/constants.py
|
||||
# Author: Andrea Gavana
|
||||
#
|
||||
# Created: 30-Nov-2010
|
||||
# Copyright: (c) 2011 by Total Control Software
|
||||
# License: wxWindows License
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# Standard library imports
|
||||
import os
|
||||
import re
|
||||
import datetime
|
||||
|
||||
# Phoenix-specific imports
|
||||
import buildtools.version as version
|
||||
from buildtools.config import phoenixDir, wxDir
|
||||
|
||||
# List of strings that should be ignored when creating inline literals
|
||||
# such as ``ID_ANY`` or ``HORIZONtAL``, with double backticks
|
||||
IGNORE = ['wxPython', 'wxWidgets', 'wxOSX', 'wxMGL', 'wxDFB', 'wxMAC', 'wxGTK', 'wxGTK2', 'wxUniversal',
|
||||
'OS', 'X', 'OSX', 'DFB', 'MAC', 'GTK', 'GTK2', 'MSW', 'wxMSW', 'X11', 'OS2', 'MS', 'XP', 'GTK+',
|
||||
'UI', 'GUI', '--', 'OTOH', 'GDI+', 'API', 'NT', 'RTL', 'GDI', '3D', 'MDI']
|
||||
|
||||
# C++ stuff to Python/ReST stuff
|
||||
VALUE_MAP = {'true': '``True``',
|
||||
'false': '``False``',
|
||||
'``NULL``': '``None``',
|
||||
'NULL': '``None``',
|
||||
'L{OSX}': '`OSX`',
|
||||
'ctor': 'constructor',
|
||||
}
|
||||
|
||||
# This is a list of instances in Phoenix (i.e., without documentation strings), and
|
||||
# For the sake of beauty of the docs they get the inline literal treatment (double backticks)
|
||||
CONSTANT_INSTANCES = ['NullAcceleratorTable', 'TheApp', 'DefaultPosition', 'DefaultSize',
|
||||
'DefaultCoord', 'Coord', 'TheBrushList', 'TheColourDatabase',
|
||||
'NullFont', 'NullBrush', 'NullPalette', 'NullPen', 'EmptyString',
|
||||
'TheFontList', 'NullIcon', 'NullBitmap', 'constructor', 'ThePenList',
|
||||
'DefaultValidator', 'String.Capitalize']
|
||||
|
||||
# Phoenix full version
|
||||
VERSION = '%d.%d.%d' % (version.VER_MAJOR, version.VER_MINOR, version.VER_RELEASE)
|
||||
|
||||
# Things to chop away when ReST-ifying the docstrings
|
||||
PUNCTUATION = '!"#$%\'()*,./:;<=>?@\\^{|}~'
|
||||
|
||||
# Conversion between XML sections and ReST sections
|
||||
SECTIONS = [('return' , ':returns:'),
|
||||
('since' , '.. versionadded::'),
|
||||
('deprecated', '.. deprecated::'),
|
||||
('warning' , '.. warning::'),
|
||||
('remarks' , '.. note::'),
|
||||
('remark' , '.. note::'),
|
||||
('available' , '.. availability::'),
|
||||
('note' , '.. note::'),
|
||||
('see' , '.. seealso::'),
|
||||
('todo' , '.. todo::')]
|
||||
|
||||
|
||||
# List of things to remove/ignore (there may be more)
|
||||
REMOVED_LINKS = ['Library:', 'Category:', 'Predefined objects/pointers:']
|
||||
|
||||
# Dictionary mapping the etg module name to the real Phoenix module name
|
||||
# This needs to be kept up to date when other stuff comes in (i.e., wx.grid,
|
||||
# wx.html and so on)
|
||||
MODULENAME_REPLACE = {'_core' : '',
|
||||
'_dataview': 'dataview.',
|
||||
'_adv' : '',
|
||||
}
|
||||
|
||||
# Other C++ specific things to strip away
|
||||
CPP_ITEMS = ['*', '&', 'const', 'unsigned', '(size_t)', 'size_t', 'void']
|
||||
|
||||
# Serie of paths containing the input data for Sphinx and for the scripts
|
||||
# building the ReST docs:
|
||||
|
||||
# The location of the Phoenix main folder
|
||||
PHOENIXROOT = phoenixDir()
|
||||
|
||||
# The location of the Sphinx main folder
|
||||
SPHINXROOT = os.path.join(PHOENIXROOT, 'docs', 'sphinx')
|
||||
|
||||
# Where the snippets found in the XML docstrings live (There are C++, unconverted and
|
||||
# converted Python snippets in 3 sub-folders
|
||||
SNIPPETROOT = os.path.join(SPHINXROOT, 'rest_substitutions', 'snippets')
|
||||
|
||||
# A folder where some of the difficult-to-translate-to-ReST tables are. There are 3 of
|
||||
# them up to now, for various reasons:
|
||||
# 1. The wx.Sizer flags table is a grid table, very difficult to ReSTify automatically
|
||||
# 2. The wx.ColourDatabase table of colour comes up all messy when ReSTified from XML
|
||||
# 3. The "wxWidgets 2.8 Compatibility Functions" table for wx.VScrolledWindow
|
||||
TABLEROOT = os.path.join(SPHINXROOT, 'rest_substitutions', 'tables')
|
||||
|
||||
# Folder where to save the inheritance diagrams for the classes
|
||||
INHERITANCEROOT = os.path.join(SPHINXROOT, '_static', 'images', 'inheritance')
|
||||
|
||||
# Folder where to save the images found in the wxWidgets overviews or in the XML
|
||||
# docstrings
|
||||
OVERVIEW_IMAGES_ROOT = os.path.join(SPHINXROOT, '_static', 'images', 'overviews')
|
||||
|
||||
# Folder where to save the widgets screenshots (full-size, no thumbnails here)
|
||||
WIDGETS_IMAGES_ROOT = os.path.join(SPHINXROOT, '_static', 'images', 'widgets', 'fullsize')
|
||||
|
||||
# Folder for the icons used for titles, sub-titles and so on for the Sphinx documentation
|
||||
SPHINX_IMAGES_ROOT = os.path.join(SPHINXROOT, '_static', 'images', 'sphinxdocs')
|
||||
|
||||
|
||||
# The Doxygen root for the XML docstrings
|
||||
xmlsrcbase = 'docs/doxygen/out/xml'
|
||||
WXWIN = wxDir()
|
||||
XMLSRC = os.path.join(WXWIN, xmlsrcbase)
|
||||
|
||||
DOXYROOT = os.path.join(WXWIN, 'docs', 'doxygen')
|
||||
|
||||
# Dictionary copied over from tweaker_tools
|
||||
MAGIC_METHODS = {
|
||||
'operator!=' : '__ne__',
|
||||
'operator==' : '__eq__',
|
||||
'operator+' : '__add__',
|
||||
'operator-' : '__sub__',
|
||||
'operator*' : '__mul__',
|
||||
'operator/' : '__div__',
|
||||
'operator+=' : '__iadd__',
|
||||
'operator-=' : '__isub__',
|
||||
'operator*=' : '__imul__',
|
||||
'operator/=' : '__idiv__',
|
||||
'operator bool' : '__int__', # Why not __nonzero__?
|
||||
# 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+)')
|
||||
|
||||
# A list of things used in the post-processing of the HTML files generated by Sphinx
|
||||
# This list is used only to insert a HTML horizontal line (<hr>) after each method/function
|
||||
# description
|
||||
HTML_REPLACE = ['module', 'function', 'method', 'class', 'classmethod', 'staticmethod', 'attribute']
|
||||
|
||||
# Today's date representation for the Sphinx HTML docs
|
||||
TODAY = datetime.date.today().strftime('%d %B %Y')
|
||||
|
||||
# Inheritance diagram external hyperlinks
|
||||
|
||||
PYTHON_DOCS = 'http://docs.python.org/library/'
|
||||
NUMPY_DOCS = 'http://docs.scipy.org/doc/numpy/reference/generated/'
|
||||
|
||||
EXTERN_INHERITANCE = {'UserDict.' : PYTHON_DOCS,
|
||||
'ctypes.' : PYTHON_DOCS,
|
||||
'code.' : PYTHON_DOCS,
|
||||
'exceptions.': PYTHON_DOCS,
|
||||
'threading.' : PYTHON_DOCS,
|
||||
'numpy.' : NUMPY_DOCS
|
||||
}
|
||||
|
||||
# wx.lib and other pure-Python stuff
|
||||
|
||||
class Enumeration(object):
|
||||
|
||||
def __init__(self, name, enumList):
|
||||
|
||||
self.__doc__ = name
|
||||
lookup = { }
|
||||
reverseLookup = { }
|
||||
i = 0
|
||||
uniqueNames = [ ]
|
||||
uniqueValues = [ ]
|
||||
|
||||
for item in enumList:
|
||||
x = item.upper()
|
||||
uniqueNames.append(x)
|
||||
uniqueValues.append(i)
|
||||
lookup[x] = i
|
||||
reverseLookup[i] = x
|
||||
i = i + 1
|
||||
|
||||
self.lookup = lookup
|
||||
self.reverseLookup = reverseLookup
|
||||
|
||||
def __getattr__(self, attr):
|
||||
|
||||
if not self.lookup.has_key(attr):
|
||||
raise AttributeError
|
||||
|
||||
return self.lookup[attr]
|
||||
|
||||
def whatis(self, value):
|
||||
|
||||
return self.reverseLookup[value]
|
||||
|
||||
|
||||
CONSTANT_RE = re.compile('^([\w\s,]+)=', re.M)
|
||||
|
||||
EXCLUDED_ATTRS = ['__builtins__', '__doc__', '__name__', '__file__', '__path__',
|
||||
'__module__', '__all__']
|
||||
|
||||
TYPE_DESCRIPTION = ['library',
|
||||
'package',
|
||||
'py_module', 'pyd_module', 'pyc_module', 'pyw_module',
|
||||
'klass',
|
||||
'function',
|
||||
'method', 'static_method', 'class_method', 'instance_method',
|
||||
'method_descriptor', 'builtin_method', 'builtin_function',
|
||||
'property',
|
||||
'booltype', 'classtype', 'complextype', 'dictproxytype', 'dicttype', 'filetype',
|
||||
'floattype', 'instancetype', 'inttype', 'lambdatype', 'listtype', 'longtype',
|
||||
'nonetype', 'objecttype', 'slicetype', 'strtype', 'tracebacktype', 'tupletype',
|
||||
'typetype', 'unicodetype', 'unknowntype', 'xrangetype']
|
||||
|
||||
object_types = Enumeration('Object_Types', TYPE_DESCRIPTION)
|
||||
|
||||
MODULE_TO_ICON = [(".py", object_types.PY_MODULE, "Py_Module"), (".pyd", object_types.PYD_MODULE, "Pyd_Module"),
|
||||
(".pyc", object_types.PYC_MODULE, "Pyc_Module"), (".pyw", object_types.PYW_MODULE, "Pyw_Module"),
|
||||
(".so", object_types.PYD_MODULE, "Pyd_Module")]
|
||||
|
||||
# wx.tools and other stuff
|
||||
|
||||
DOXY_2_REST = [('@author:', '\n.. moduleauthor:: '),
|
||||
('@deprecated:', '\n.. deprecated:: '),
|
||||
('@param', ':param'),
|
||||
('@var', ':param'),
|
||||
('@keyword', ':keyword'),
|
||||
('@kwarg', ':keyword'),
|
||||
('@note:', '\n.. note:: '),
|
||||
('@package:', '\n**Package:** '),
|
||||
('@package', '\n**Package:** '),
|
||||
('@postcondition:', '\n:postcondition: '),
|
||||
('@pre:', '\n:precondition: '),
|
||||
('@precondition:', '\n:precondition: '),
|
||||
('@requires:', '\n:requires: '),
|
||||
('@returns:', '\n:returns: '),
|
||||
('@return:', '\n:returns: '),
|
||||
('@returns', '\n:returns: '),
|
||||
('@return', '\n:returns: '),
|
||||
('@rtype:', '\n:rtype: '),
|
||||
# ('@section', XXX), Deal with this separately
|
||||
('@see:', '\n.. seealso:: '),
|
||||
('@status:', '\n.. todo:: '),
|
||||
('@summary:', '\n**Summary:** '),
|
||||
('@throws:', '\n:raise: '),
|
||||
('@todo:', '\n.. todo:: '),
|
||||
('@verbatim ', ''), # TODO This one
|
||||
('@verbatim', ''), # TODO This one
|
||||
('@endverbatim ', ''), # TODO This one
|
||||
('@endverbatim', ''), # TODO This one
|
||||
('@version:', '\n:version: ')]
|
||||
|
||||
|
||||
@@ -25,146 +25,146 @@ ENOENT = getattr(errno, 'ENOENT', 0)
|
||||
EPIPE = getattr(errno, 'EPIPE', 0)
|
||||
|
||||
|
||||
class InheritanceDiagram(object):
|
||||
"""
|
||||
Given a list of classes, determines the set of classes that they inherit
|
||||
from all the way to the root "object", and then is able to generate a
|
||||
graphviz dot graph from them.
|
||||
"""
|
||||
|
||||
def __init__(self, classes, main_class=None):
|
||||
|
||||
if main_class is None:
|
||||
self.class_info, self.specials = classes
|
||||
self.class_info = self.class_info.values()
|
||||
else:
|
||||
self.class_info, self.specials = self._class_info(classes)
|
||||
|
||||
self.main_class = main_class
|
||||
|
||||
|
||||
def _class_info(self, classes):
|
||||
"""Return name and bases for all classes that are ancestors of
|
||||
*classes*.
|
||||
|
||||
*parts* gives the number of dotted name parts that is removed from the
|
||||
displayed node names.
|
||||
"""
|
||||
|
||||
all_classes = {}
|
||||
specials = []
|
||||
|
||||
def recurse(cls):
|
||||
nodename, fullname = self.class_name(cls)
|
||||
|
||||
baselist = []
|
||||
all_classes[cls] = (nodename, fullname, baselist)
|
||||
|
||||
for base in cls.__bases__:
|
||||
baselist.append(self.class_name(base)[0])
|
||||
if base not in all_classes:
|
||||
recurse(base)
|
||||
|
||||
for cls in classes:
|
||||
recurse(cls)
|
||||
specials.append(self.class_name(cls)[1])
|
||||
|
||||
return all_classes.values(), specials
|
||||
|
||||
|
||||
def class_name(self, cls):
|
||||
"""Given a class object, return a fully-qualified name.
|
||||
|
||||
This works for things I've tested in matplotlib so far, but may not be
|
||||
completely general.
|
||||
"""
|
||||
|
||||
module = cls.__module__
|
||||
|
||||
if module == '__builtin__':
|
||||
fullname = cls.__name__
|
||||
else:
|
||||
fullname = '%s.%s' % (module, cls.__name__)
|
||||
|
||||
name_parts = fullname.split('.')
|
||||
if 'wx._' in fullname:
|
||||
nodename = fullname = name_parts[-1]
|
||||
else:
|
||||
# Just the last 2 parts
|
||||
class InheritanceDiagram(object):
|
||||
"""
|
||||
Given a list of classes, determines the set of classes that they inherit
|
||||
from all the way to the root "object", and then is able to generate a
|
||||
graphviz dot graph from them.
|
||||
"""
|
||||
|
||||
def __init__(self, classes, main_class=None):
|
||||
|
||||
if main_class is None:
|
||||
self.class_info, self.specials = classes
|
||||
self.class_info = self.class_info.values()
|
||||
else:
|
||||
self.class_info, self.specials = self._class_info(classes)
|
||||
|
||||
self.main_class = main_class
|
||||
|
||||
|
||||
def _class_info(self, classes):
|
||||
"""Return name and bases for all classes that are ancestors of
|
||||
*classes*.
|
||||
|
||||
*parts* gives the number of dotted name parts that is removed from the
|
||||
displayed node names.
|
||||
"""
|
||||
|
||||
all_classes = {}
|
||||
specials = []
|
||||
|
||||
def recurse(cls):
|
||||
nodename, fullname = self.class_name(cls)
|
||||
|
||||
baselist = []
|
||||
all_classes[cls] = (nodename, fullname, baselist)
|
||||
|
||||
for base in cls.__bases__:
|
||||
baselist.append(self.class_name(base)[0])
|
||||
if base not in all_classes:
|
||||
recurse(base)
|
||||
|
||||
for cls in classes:
|
||||
recurse(cls)
|
||||
specials.append(self.class_name(cls)[1])
|
||||
|
||||
return all_classes.values(), specials
|
||||
|
||||
|
||||
def class_name(self, cls):
|
||||
"""Given a class object, return a fully-qualified name.
|
||||
|
||||
This works for things I've tested in matplotlib so far, but may not be
|
||||
completely general.
|
||||
"""
|
||||
|
||||
module = cls.__module__
|
||||
|
||||
if module == '__builtin__':
|
||||
fullname = cls.__name__
|
||||
else:
|
||||
fullname = '%s.%s' % (module, cls.__name__)
|
||||
|
||||
name_parts = fullname.split('.')
|
||||
if 'wx._' in fullname:
|
||||
nodename = fullname = name_parts[-1]
|
||||
else:
|
||||
# Just the last 2 parts
|
||||
nodename = '.'.join(name_parts[-2:])
|
||||
if fullname.startswith('wx.'):
|
||||
fullname = fullname[3:]
|
||||
|
||||
return nodename, fullname
|
||||
|
||||
|
||||
# These are the default attrs for graphviz
|
||||
default_graph_attrs = {
|
||||
'rankdir': 'LR',
|
||||
'size': '"8.0, 12.0"',
|
||||
}
|
||||
default_node_attrs = {
|
||||
'shape': 'box',
|
||||
'fontsize': 10,
|
||||
'height': 0.3,
|
||||
'fontname': 'Vera Sans, DejaVu Sans, Liberation Sans, '
|
||||
'Arial, Helvetica, sans',
|
||||
'style': '"setlinewidth(0.5)"',
|
||||
}
|
||||
default_edge_attrs = {
|
||||
'arrowsize': 0.5,
|
||||
'style': '"setlinewidth(0.5)"',
|
||||
}
|
||||
|
||||
def _format_node_attrs(self, attrs):
|
||||
return ','.join(['%s=%s' % x for x in attrs.items()])
|
||||
|
||||
def _format_graph_attrs(self, attrs):
|
||||
return ''.join(['%s=%s;\n' % x for x in attrs.items()])
|
||||
|
||||
def generate_dot(self, class_summary, name="dummy", graph_attrs={}, node_attrs={}, edge_attrs={}):
|
||||
"""Generate a graphviz dot graph from the classes that were passed in
|
||||
to __init__.
|
||||
|
||||
*name* is the name of the graph.
|
||||
|
||||
*graph_attrs*, *node_attrs*, *edge_attrs* are dictionaries containing
|
||||
key/value pairs to pass on as graphviz properties.
|
||||
"""
|
||||
|
||||
inheritance_graph_attrs = dict(fontsize=9, ratio='auto', size='""', rankdir="LR")
|
||||
inheritance_node_attrs = {"align": "center", 'shape': 'box',
|
||||
'fontsize': 10, 'height': 0.3,
|
||||
'fontname': 'Vera Sans, DejaVu Sans, Liberation Sans, '
|
||||
'Arial, Helvetica, sans', 'style': '"setlinewidth(0.5)"',
|
||||
'labelloc': 'c', 'fontcolor': 'grey45'}
|
||||
|
||||
inheritance_edge_attrs = {'arrowsize': 0.5, 'style': '"setlinewidth(0.5)"', "color": "black"}
|
||||
|
||||
g_attrs = self.default_graph_attrs.copy()
|
||||
n_attrs = self.default_node_attrs.copy()
|
||||
e_attrs = self.default_edge_attrs.copy()
|
||||
g_attrs.update(inheritance_graph_attrs)
|
||||
n_attrs.update(inheritance_node_attrs)
|
||||
e_attrs.update(inheritance_edge_attrs)
|
||||
|
||||
res = []
|
||||
res.append('digraph %s {\n' % name)
|
||||
res.append(self._format_graph_attrs(g_attrs))
|
||||
|
||||
for name, fullname, bases in self.class_info:
|
||||
# Write the node
|
||||
this_node_attrs = n_attrs.copy()
|
||||
|
||||
if fullname in self.specials:
|
||||
this_node_attrs['fontcolor'] = 'black'
|
||||
this_node_attrs['color'] = 'blue'
|
||||
this_node_attrs['style'] = 'bold'
|
||||
|
||||
if self.main_class is None:
|
||||
newname, fullname = Wx2Sphinx(name)
|
||||
else:
|
||||
newname = name
|
||||
|
||||
return nodename, fullname
|
||||
|
||||
|
||||
# These are the default attrs for graphviz
|
||||
default_graph_attrs = {
|
||||
'rankdir': 'LR',
|
||||
'size': '"8.0, 12.0"',
|
||||
}
|
||||
default_node_attrs = {
|
||||
'shape': 'box',
|
||||
'fontsize': 10,
|
||||
'height': 0.3,
|
||||
'fontname': 'Vera Sans, DejaVu Sans, Liberation Sans, '
|
||||
'Arial, Helvetica, sans',
|
||||
'style': '"setlinewidth(0.5)"',
|
||||
}
|
||||
default_edge_attrs = {
|
||||
'arrowsize': 0.5,
|
||||
'style': '"setlinewidth(0.5)"',
|
||||
}
|
||||
|
||||
def _format_node_attrs(self, attrs):
|
||||
return ','.join(['%s=%s' % x for x in attrs.items()])
|
||||
|
||||
def _format_graph_attrs(self, attrs):
|
||||
return ''.join(['%s=%s;\n' % x for x in attrs.items()])
|
||||
|
||||
def generate_dot(self, class_summary, name="dummy", graph_attrs={}, node_attrs={}, edge_attrs={}):
|
||||
"""Generate a graphviz dot graph from the classes that were passed in
|
||||
to __init__.
|
||||
|
||||
*name* is the name of the graph.
|
||||
|
||||
*graph_attrs*, *node_attrs*, *edge_attrs* are dictionaries containing
|
||||
key/value pairs to pass on as graphviz properties.
|
||||
"""
|
||||
|
||||
inheritance_graph_attrs = dict(fontsize=9, ratio='auto', size='""', rankdir="LR")
|
||||
inheritance_node_attrs = {"align": "center", 'shape': 'box',
|
||||
'fontsize': 10, 'height': 0.3,
|
||||
'fontname': 'Vera Sans, DejaVu Sans, Liberation Sans, '
|
||||
'Arial, Helvetica, sans', 'style': '"setlinewidth(0.5)"',
|
||||
'labelloc': 'c', 'fontcolor': 'grey45'}
|
||||
|
||||
inheritance_edge_attrs = {'arrowsize': 0.5, 'style': '"setlinewidth(0.5)"', "color": "black"}
|
||||
|
||||
g_attrs = self.default_graph_attrs.copy()
|
||||
n_attrs = self.default_node_attrs.copy()
|
||||
e_attrs = self.default_edge_attrs.copy()
|
||||
g_attrs.update(inheritance_graph_attrs)
|
||||
n_attrs.update(inheritance_node_attrs)
|
||||
e_attrs.update(inheritance_edge_attrs)
|
||||
|
||||
res = []
|
||||
res.append('digraph %s {\n' % name)
|
||||
res.append(self._format_graph_attrs(g_attrs))
|
||||
|
||||
for name, fullname, bases in self.class_info:
|
||||
# Write the node
|
||||
this_node_attrs = n_attrs.copy()
|
||||
|
||||
if fullname in self.specials:
|
||||
this_node_attrs['fontcolor'] = 'black'
|
||||
this_node_attrs['color'] = 'blue'
|
||||
this_node_attrs['style'] = 'bold'
|
||||
|
||||
if self.main_class is None:
|
||||
newname, fullname = Wx2Sphinx(name)
|
||||
else:
|
||||
newname = name
|
||||
|
||||
if class_summary is None:
|
||||
# Phoenix base classes, assume there is always a link
|
||||
@@ -179,108 +179,108 @@ class InheritanceDiagram(object):
|
||||
full_page = FormatExternalLink(fullname, inheritance=True)
|
||||
if full_page:
|
||||
this_node_attrs['URL'] = full_page
|
||||
|
||||
res.append(' "%s" [%s];\n' %
|
||||
(newname, self._format_node_attrs(this_node_attrs)))
|
||||
|
||||
# Write the edges
|
||||
for base_name in bases:
|
||||
|
||||
this_edge_attrs = e_attrs.copy()
|
||||
if fullname in self.specials:
|
||||
this_edge_attrs['color'] = 'red'
|
||||
|
||||
if self.main_class is None:
|
||||
base_name, dummy = Wx2Sphinx(base_name)
|
||||
|
||||
res.append(' "%s" -> "%s" [%s];\n' %
|
||||
(base_name, newname,
|
||||
self._format_node_attrs(this_edge_attrs)))
|
||||
res.append('}\n')
|
||||
return ''.join(res)
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def MakeInheritanceDiagram(self, class_summary=None):
|
||||
"""
|
||||
Actually generates the inheritance diagram as a PNG file plus the corresponding
|
||||
MAP file for mouse navigation over the inheritance boxes.
|
||||
|
||||
These two files are saved into the ``INHERITANCEROOT`` folder (see `sphinxtools/constants.py`
|
||||
|
||||
res.append(' "%s" [%s];\n' %
|
||||
(newname, self._format_node_attrs(this_node_attrs)))
|
||||
|
||||
# Write the edges
|
||||
for base_name in bases:
|
||||
|
||||
this_edge_attrs = e_attrs.copy()
|
||||
if fullname in self.specials:
|
||||
this_edge_attrs['color'] = 'red'
|
||||
|
||||
if self.main_class is None:
|
||||
base_name, dummy = Wx2Sphinx(base_name)
|
||||
|
||||
res.append(' "%s" -> "%s" [%s];\n' %
|
||||
(base_name, newname,
|
||||
self._format_node_attrs(this_edge_attrs)))
|
||||
res.append('}\n')
|
||||
return ''.join(res)
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def MakeInheritanceDiagram(self, class_summary=None):
|
||||
"""
|
||||
Actually generates the inheritance diagram as a PNG file plus the corresponding
|
||||
MAP file for mouse navigation over the inheritance boxes.
|
||||
|
||||
These two files are saved into the ``INHERITANCEROOT`` folder (see `sphinxtools/constants.py`
|
||||
for more information).
|
||||
|
||||
:param `class_summary`: if not ``None``, used to identify if a class is actually been
|
||||
wrapped or not (to avoid links pointing to non-existent pages).
|
||||
|
||||
:rtype: `tuple`
|
||||
|
||||
:returns: a tuple containing the PNG file name and a string representing the content
|
||||
of the MAP file (with newlines stripped away).
|
||||
|
||||
.. note:: The MAP file is deleted as soon as its content has been read.
|
||||
"""
|
||||
|
||||
static_root = INHERITANCEROOT
|
||||
|
||||
if self.main_class is not None:
|
||||
filename = self.main_class.name
|
||||
else:
|
||||
dummy, filename = Wx2Sphinx(self.specials[0])
|
||||
|
||||
outfn = os.path.join(static_root, filename + '_inheritance.png')
|
||||
mapfile = outfn + '.map'
|
||||
|
||||
if os.path.isfile(outfn) and os.path.isfile(mapfile):
|
||||
fid = open(mapfile, 'rt')
|
||||
map = fid.read()
|
||||
fid.close()
|
||||
return os.path.split(outfn)[1], map.replace('\n', ' ')
|
||||
|
||||
code = self.generate_dot(class_summary)
|
||||
|
||||
# graphviz expects UTF-8 by default
|
||||
if isinstance(code, unicode):
|
||||
code = code.encode('utf-8')
|
||||
|
||||
dot_args = ['dot']
|
||||
|
||||
if os.path.isfile(outfn):
|
||||
os.remove(outfn)
|
||||
if os.path.isfile(mapfile):
|
||||
os.remove(mapfile)
|
||||
|
||||
dot_args.extend(['-Tpng', '-o' + outfn])
|
||||
dot_args.extend(['-Tcmapx', '-o' + mapfile])
|
||||
|
||||
try:
|
||||
|
||||
p = Popen(dot_args, stdout=PIPE, stdin=PIPE, stderr=PIPE)
|
||||
|
||||
except OSError, err:
|
||||
|
||||
if err.errno != ENOENT: # No such file or directory
|
||||
raise
|
||||
|
||||
print '\nERROR: Graphviz command `dot` cannot be run (needed for Graphviz output), check your ``PATH`` setting'
|
||||
|
||||
try:
|
||||
# Graphviz may close standard input when an error occurs,
|
||||
# resulting in a broken pipe on communicate()
|
||||
stdout, stderr = p.communicate(code)
|
||||
|
||||
except OSError, err:
|
||||
|
||||
# in this case, read the standard output and standard error streams
|
||||
# directly, to get the error message(s)
|
||||
stdout, stderr = p.stdout.read(), p.stderr.read()
|
||||
p.wait()
|
||||
|
||||
if p.returncode != 0:
|
||||
print '\nERROR: Graphviz `dot` command exited with error:\n[stderr]\n%s\n[stdout]\n%s\n\n' % (stderr, stdout)
|
||||
|
||||
fid = open(mapfile, 'rt')
|
||||
map = fid.read()
|
||||
fid.close()
|
||||
|
||||
return os.path.split(outfn)[1], map.replace('\n', ' ')
|
||||
wrapped or not (to avoid links pointing to non-existent pages).
|
||||
|
||||
:rtype: `tuple`
|
||||
|
||||
:returns: a tuple containing the PNG file name and a string representing the content
|
||||
of the MAP file (with newlines stripped away).
|
||||
|
||||
.. note:: The MAP file is deleted as soon as its content has been read.
|
||||
"""
|
||||
|
||||
static_root = INHERITANCEROOT
|
||||
|
||||
if self.main_class is not None:
|
||||
filename = self.main_class.name
|
||||
else:
|
||||
dummy, filename = Wx2Sphinx(self.specials[0])
|
||||
|
||||
outfn = os.path.join(static_root, filename + '_inheritance.png')
|
||||
mapfile = outfn + '.map'
|
||||
|
||||
if os.path.isfile(outfn) and os.path.isfile(mapfile):
|
||||
fid = open(mapfile, 'rt')
|
||||
map = fid.read()
|
||||
fid.close()
|
||||
return os.path.split(outfn)[1], map.replace('\n', ' ')
|
||||
|
||||
code = self.generate_dot(class_summary)
|
||||
|
||||
# graphviz expects UTF-8 by default
|
||||
if isinstance(code, unicode):
|
||||
code = code.encode('utf-8')
|
||||
|
||||
dot_args = ['dot']
|
||||
|
||||
if os.path.isfile(outfn):
|
||||
os.remove(outfn)
|
||||
if os.path.isfile(mapfile):
|
||||
os.remove(mapfile)
|
||||
|
||||
dot_args.extend(['-Tpng', '-o' + outfn])
|
||||
dot_args.extend(['-Tcmapx', '-o' + mapfile])
|
||||
|
||||
try:
|
||||
|
||||
p = Popen(dot_args, stdout=PIPE, stdin=PIPE, stderr=PIPE)
|
||||
|
||||
except OSError, err:
|
||||
|
||||
if err.errno != ENOENT: # No such file or directory
|
||||
raise
|
||||
|
||||
print '\nERROR: Graphviz command `dot` cannot be run (needed for Graphviz output), check your ``PATH`` setting'
|
||||
|
||||
try:
|
||||
# Graphviz may close standard input when an error occurs,
|
||||
# resulting in a broken pipe on communicate()
|
||||
stdout, stderr = p.communicate(code)
|
||||
|
||||
except OSError, err:
|
||||
|
||||
# in this case, read the standard output and standard error streams
|
||||
# directly, to get the error message(s)
|
||||
stdout, stderr = p.stdout.read(), p.stderr.read()
|
||||
p.wait()
|
||||
|
||||
if p.returncode != 0:
|
||||
print '\nERROR: Graphviz `dot` command exited with error:\n[stderr]\n%s\n[stdout]\n%s\n\n' % (stderr, stdout)
|
||||
|
||||
fid = open(mapfile, 'rt')
|
||||
map = fid.read()
|
||||
fid.close()
|
||||
|
||||
return os.path.split(outfn)[1], map.replace('\n', ' ')
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,311 +1,311 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#!/usr/bin/env python
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Name: sphinxtools/templates.py
|
||||
# Author: Andrea Gavana
|
||||
#
|
||||
# Created: 30-Nov-2010
|
||||
# Copyright: (c) 2011 by Total Control Software
|
||||
# License: wxWindows License
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
# Main class description, with class name repeated twice
|
||||
TEMPLATE_DESCRIPTION = '''
|
||||
|
||||
.. _%s:
|
||||
|
||||
==========================================================================================================================================
|
||||
|phoenix_title| **%s**
|
||||
==========================================================================================================================================
|
||||
|
||||
'''
|
||||
|
||||
|
||||
# Inheritance diagram template, containing the class name, the PNG file representing
|
||||
# the inheritance diagram, the "ALT" HTML flag (the class name again) and the full
|
||||
# "MAP" HTML flag used for mouse navigation in the inheritance diagram boxes
|
||||
TEMPLATE_INHERITANCE = '''
|
||||
|
||||
|
|
||||
|
||||
|class_hierarchy| Inheritance Diagram
|
||||
=====================================
|
||||
|
||||
Inheritance diagram for %s **%s**
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<p class="graphviz">
|
||||
<img src="_static/images/inheritance/%s" alt="Inheritance diagram of %s" usemap="#dummy" class="inheritance"/>
|
||||
%s
|
||||
</p>
|
||||
|
||||
|
|
||||
|
||||
'''
|
||||
|
||||
|
||||
# Template for the widget screenshots, with one screenshots image file for
|
||||
# each platform
|
||||
TEMPLATE_APPEARANCE = '''
|
||||
|appearance| Control Appearance
|
||||
===============================
|
||||
|
||||
|
|
||||
|
||||
.. figure:: _static/images/widgets/fullsize/wxmsw/%s
|
||||
:alt: wxMSW
|
||||
:figclass: floatleft
|
||||
|
||||
**wxMSW**
|
||||
|
||||
|
||||
.. figure:: _static/images/widgets/fullsize/wxmac/%s
|
||||
:alt: wxMAC
|
||||
:figclass: floatright
|
||||
|
||||
**wxMAC**
|
||||
|
||||
|
||||
.. figure:: _static/images/widgets/fullsize/wxgtk/%s
|
||||
:alt: wxGTK
|
||||
:figclass: floatcenter
|
||||
|
||||
**wxGTK**
|
||||
|
||||
|
||||
|
|
||||
|
||||
'''
|
||||
|
||||
|
||||
# Template for the subclasses of a class, with a string containing a list
|
||||
# of comma separated class names with their ReST role as :ref: prepended
|
||||
TEMPLATE_SUBCLASSES = '''
|
||||
|sub_classes| Known Subclasses
|
||||
==============================
|
||||
|
||||
%s
|
||||
|
||||
|
|
||||
|
||||
'''
|
||||
|
||||
# Template for the superclasses of a class, with a string containing a list
|
||||
# of comma separated class names with their ReST role as :ref: prepended
|
||||
TEMPLATE_SUPERCLASSES = '''
|
||||
|super_classes| Known Superclasses
|
||||
==================================
|
||||
|
||||
%s
|
||||
|
||||
|
|
||||
|
||||
'''
|
||||
|
||||
|
||||
# Template for the method summary of a class, containing a table made of
|
||||
# ``method_name`` ``method description``
|
||||
TEMPLATE_METHOD_SUMMARY = '''
|
||||
|method_summary| Methods Summary
|
||||
================================
|
||||
|
||||
%s
|
||||
|
||||
|
|
||||
|
||||
'''
|
||||
|
||||
|
||||
# Template for the property summary of a class, containing a table made of
|
||||
# ``property_name`` ``property description``
|
||||
TEMPLATE_PROPERTY_SUMMARY = '''
|
||||
|property_summary| Properties Summary
|
||||
=====================================
|
||||
|
||||
%s
|
||||
|
||||
|
|
||||
|
||||
'''
|
||||
|
||||
|
||||
# Template for the Class API title, no input
|
||||
TEMPLATE_API = '''
|
||||
|api| Class API
|
||||
===============
|
||||
|
||||
'''
|
||||
|
||||
# Template for the standalone function summary for a module (wx, wx.dataview
|
||||
# and so on).
|
||||
|
||||
TEMPLATE_FUNCTION_SUMMARY = '''
|
||||
.. include:: headings.inc
|
||||
|
||||
=========================================================================
|
||||
**%s** Functions
|
||||
=========================================================================
|
||||
|
||||
The functions and macros defined in the **%s** module are described here: you can look up a function using the alphabetical listing of them.
|
||||
|
||||
Function Summary
|
||||
================
|
||||
|
||||
|
||||
'''
|
||||
|
||||
|
||||
# Template for the main class index for a module (wx, wx.dataview and so on).
|
||||
TEMPLATE_CLASS_INDEX = '''
|
||||
.. include:: headings.inc
|
||||
|
||||
=========================================================================
|
||||
**%s** Classes
|
||||
=========================================================================
|
||||
|
||||
This is an alphabetical listing of all the classes defined in the **%s** module, together with a brief description of them (if available).
|
||||
|
||||
You can look up a class using the alphabetical listing of them.
|
||||
|
||||
|
||||
Class Summary
|
||||
=============
|
||||
|
||||
|
||||
'''
|
||||
|
||||
|
||||
# Template for the class window styles, with the class name as input
|
||||
TEMPLATE_WINDOW_STYLES = '''
|
||||
|
||||
.. _%s-styles:
|
||||
|
||||
|styles| Window Styles
|
||||
================================
|
||||
|
||||
'''
|
||||
|
||||
|
||||
# Template for the class window extra styles, with the class name as input
|
||||
TEMPLATE_WINDOW_EXTRASTYLES = '''
|
||||
|
||||
.. _%s-extra-styles:
|
||||
|
||||
|extra_styles| Window Extra Styles
|
||||
==================================
|
||||
|
||||
'''
|
||||
|
||||
|
||||
# Template for the class events, with the class name as input
|
||||
TEMPLATE_EVENTS = '''
|
||||
|
||||
.. _%s-events:
|
||||
|
||||
|events| Events Emitted by this Class
|
||||
=====================================
|
||||
|
||||
'''
|
||||
|
||||
TEMPLATE_CONTRIB = '''
|
||||
|
||||
|user| Contributed Examples
|
||||
===========================
|
||||
|
||||
'''
|
||||
|
||||
# Template used to generate the widgets gallery (this needs some work)
|
||||
TEMPLATE_GALLERY = '''
|
||||
|
||||
{%% extends "layout.html" %%}
|
||||
{%% set title = "Thumbnail gallery" %%}
|
||||
|
||||
|
||||
{%% block body %%}
|
||||
|
||||
<h3>Click on any image to go to the relevant documentation</h3>
|
||||
<br/>
|
||||
The gallery is generated by randomly choosing a widget image between the 3 main
|
||||
available ports of wxPython, namely <tt>wxMSW</tt>, <tt>wxGTK</tt> and <tt>wxMAC</tt> every
|
||||
time the <b>Phoenix</b> documentation is built.
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<div class="gallery_class">
|
||||
|
||||
%s
|
||||
|
||||
</div>
|
||||
<br clear="all">
|
||||
|
||||
{%% endblock %%}
|
||||
'''
|
||||
|
||||
|
||||
# Template to generate the "headings.inc" file containing the substitution reference
|
||||
# for the small icons used in the Sphinx titles, sub-titles and so on.
|
||||
TEMPLATE_HEADINGS = '''
|
||||
|
||||
.. |%s| image:: %s
|
||||
:align: middle
|
||||
:width: %dpx
|
||||
|
||||
'''
|
||||
|
||||
# Templates for the summary of modules/packages, containing a table made of
|
||||
# ``module name`` ``short description``
|
||||
TEMPLATE_MODULE_SUMMARY = '''
|
||||
|module_summary| Modules Summary
|
||||
================================
|
||||
|
||||
%s
|
||||
|
||||
|
|
||||
|
||||
'''
|
||||
|
||||
TEMPLATE_PACKAGE_SUMMARY = '''
|
||||
|package_summary| Packages Summary
|
||||
==================================
|
||||
|
||||
%s
|
||||
|
||||
|
|
||||
|
||||
'''
|
||||
|
||||
TEMPLATE_STD_FUNCTION_SUMMARY = '''
|
||||
|function_summary| Functions Summary
|
||||
====================================
|
||||
|
||||
%s
|
||||
|
||||
|
|
||||
|
||||
'''
|
||||
|
||||
TEMPLATE_STD_CLASS_SUMMARY = '''
|
||||
|class_summary| Classes Summary
|
||||
===============================
|
||||
|
||||
%s
|
||||
|
||||
|
|
||||
|
||||
'''
|
||||
|
||||
|
||||
TEMPLATE_TOCTREE = '''
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:hidden:
|
||||
|
||||
%s
|
||||
'''
|
||||
# -*- coding: utf-8 -*-
|
||||
#!/usr/bin/env python
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Name: sphinxtools/templates.py
|
||||
# Author: Andrea Gavana
|
||||
#
|
||||
# Created: 30-Nov-2010
|
||||
# Copyright: (c) 2011 by Total Control Software
|
||||
# License: wxWindows License
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
# Main class description, with class name repeated twice
|
||||
TEMPLATE_DESCRIPTION = '''
|
||||
|
||||
.. _%s:
|
||||
|
||||
==========================================================================================================================================
|
||||
|phoenix_title| **%s**
|
||||
==========================================================================================================================================
|
||||
|
||||
'''
|
||||
|
||||
|
||||
# Inheritance diagram template, containing the class name, the PNG file representing
|
||||
# the inheritance diagram, the "ALT" HTML flag (the class name again) and the full
|
||||
# "MAP" HTML flag used for mouse navigation in the inheritance diagram boxes
|
||||
TEMPLATE_INHERITANCE = '''
|
||||
|
||||
|
|
||||
|
||||
|class_hierarchy| Inheritance Diagram
|
||||
=====================================
|
||||
|
||||
Inheritance diagram for %s **%s**
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<p class="graphviz">
|
||||
<img src="_static/images/inheritance/%s" alt="Inheritance diagram of %s" usemap="#dummy" class="inheritance"/>
|
||||
%s
|
||||
</p>
|
||||
|
||||
|
|
||||
|
||||
'''
|
||||
|
||||
|
||||
# Template for the widget screenshots, with one screenshots image file for
|
||||
# each platform
|
||||
TEMPLATE_APPEARANCE = '''
|
||||
|appearance| Control Appearance
|
||||
===============================
|
||||
|
||||
|
|
||||
|
||||
.. figure:: _static/images/widgets/fullsize/wxmsw/%s
|
||||
:alt: wxMSW
|
||||
:figclass: floatleft
|
||||
|
||||
**wxMSW**
|
||||
|
||||
|
||||
.. figure:: _static/images/widgets/fullsize/wxmac/%s
|
||||
:alt: wxMAC
|
||||
:figclass: floatright
|
||||
|
||||
**wxMAC**
|
||||
|
||||
|
||||
.. figure:: _static/images/widgets/fullsize/wxgtk/%s
|
||||
:alt: wxGTK
|
||||
:figclass: floatcenter
|
||||
|
||||
**wxGTK**
|
||||
|
||||
|
||||
|
|
||||
|
||||
'''
|
||||
|
||||
|
||||
# Template for the subclasses of a class, with a string containing a list
|
||||
# of comma separated class names with their ReST role as :ref: prepended
|
||||
TEMPLATE_SUBCLASSES = '''
|
||||
|sub_classes| Known Subclasses
|
||||
==============================
|
||||
|
||||
%s
|
||||
|
||||
|
|
||||
|
||||
'''
|
||||
|
||||
# Template for the superclasses of a class, with a string containing a list
|
||||
# of comma separated class names with their ReST role as :ref: prepended
|
||||
TEMPLATE_SUPERCLASSES = '''
|
||||
|super_classes| Known Superclasses
|
||||
==================================
|
||||
|
||||
%s
|
||||
|
||||
|
|
||||
|
||||
'''
|
||||
|
||||
|
||||
# Template for the method summary of a class, containing a table made of
|
||||
# ``method_name`` ``method description``
|
||||
TEMPLATE_METHOD_SUMMARY = '''
|
||||
|method_summary| Methods Summary
|
||||
================================
|
||||
|
||||
%s
|
||||
|
||||
|
|
||||
|
||||
'''
|
||||
|
||||
|
||||
# Template for the property summary of a class, containing a table made of
|
||||
# ``property_name`` ``property description``
|
||||
TEMPLATE_PROPERTY_SUMMARY = '''
|
||||
|property_summary| Properties Summary
|
||||
=====================================
|
||||
|
||||
%s
|
||||
|
||||
|
|
||||
|
||||
'''
|
||||
|
||||
|
||||
# Template for the Class API title, no input
|
||||
TEMPLATE_API = '''
|
||||
|api| Class API
|
||||
===============
|
||||
|
||||
'''
|
||||
|
||||
# Template for the standalone function summary for a module (wx, wx.dataview
|
||||
# and so on).
|
||||
|
||||
TEMPLATE_FUNCTION_SUMMARY = '''
|
||||
.. include:: headings.inc
|
||||
|
||||
=========================================================================
|
||||
**%s** Functions
|
||||
=========================================================================
|
||||
|
||||
The functions and macros defined in the **%s** module are described here: you can look up a function using the alphabetical listing of them.
|
||||
|
||||
Function Summary
|
||||
================
|
||||
|
||||
|
||||
'''
|
||||
|
||||
|
||||
# Template for the main class index for a module (wx, wx.dataview and so on).
|
||||
TEMPLATE_CLASS_INDEX = '''
|
||||
.. include:: headings.inc
|
||||
|
||||
=========================================================================
|
||||
**%s** Classes
|
||||
=========================================================================
|
||||
|
||||
This is an alphabetical listing of all the classes defined in the **%s** module, together with a brief description of them (if available).
|
||||
|
||||
You can look up a class using the alphabetical listing of them.
|
||||
|
||||
|
||||
Class Summary
|
||||
=============
|
||||
|
||||
|
||||
'''
|
||||
|
||||
|
||||
# Template for the class window styles, with the class name as input
|
||||
TEMPLATE_WINDOW_STYLES = '''
|
||||
|
||||
.. _%s-styles:
|
||||
|
||||
|styles| Window Styles
|
||||
================================
|
||||
|
||||
'''
|
||||
|
||||
|
||||
# Template for the class window extra styles, with the class name as input
|
||||
TEMPLATE_WINDOW_EXTRASTYLES = '''
|
||||
|
||||
.. _%s-extra-styles:
|
||||
|
||||
|extra_styles| Window Extra Styles
|
||||
==================================
|
||||
|
||||
'''
|
||||
|
||||
|
||||
# Template for the class events, with the class name as input
|
||||
TEMPLATE_EVENTS = '''
|
||||
|
||||
.. _%s-events:
|
||||
|
||||
|events| Events Emitted by this Class
|
||||
=====================================
|
||||
|
||||
'''
|
||||
|
||||
TEMPLATE_CONTRIB = '''
|
||||
|
||||
|user| Contributed Examples
|
||||
===========================
|
||||
|
||||
'''
|
||||
|
||||
# Template used to generate the widgets gallery (this needs some work)
|
||||
TEMPLATE_GALLERY = '''
|
||||
|
||||
{%% extends "layout.html" %%}
|
||||
{%% set title = "Thumbnail gallery" %%}
|
||||
|
||||
|
||||
{%% block body %%}
|
||||
|
||||
<h3>Click on any image to go to the relevant documentation</h3>
|
||||
<br/>
|
||||
The gallery is generated by randomly choosing a widget image between the 3 main
|
||||
available ports of wxPython, namely <tt>wxMSW</tt>, <tt>wxGTK</tt> and <tt>wxMAC</tt> every
|
||||
time the <b>Phoenix</b> documentation is built.
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<div class="gallery_class">
|
||||
|
||||
%s
|
||||
|
||||
</div>
|
||||
<br clear="all">
|
||||
|
||||
{%% endblock %%}
|
||||
'''
|
||||
|
||||
|
||||
# Template to generate the "headings.inc" file containing the substitution reference
|
||||
# for the small icons used in the Sphinx titles, sub-titles and so on.
|
||||
TEMPLATE_HEADINGS = '''
|
||||
|
||||
.. |%s| image:: %s
|
||||
:align: middle
|
||||
:width: %dpx
|
||||
|
||||
'''
|
||||
|
||||
# Templates for the summary of modules/packages, containing a table made of
|
||||
# ``module name`` ``short description``
|
||||
TEMPLATE_MODULE_SUMMARY = '''
|
||||
|module_summary| Modules Summary
|
||||
================================
|
||||
|
||||
%s
|
||||
|
||||
|
|
||||
|
||||
'''
|
||||
|
||||
TEMPLATE_PACKAGE_SUMMARY = '''
|
||||
|package_summary| Packages Summary
|
||||
==================================
|
||||
|
||||
%s
|
||||
|
||||
|
|
||||
|
||||
'''
|
||||
|
||||
TEMPLATE_STD_FUNCTION_SUMMARY = '''
|
||||
|function_summary| Functions Summary
|
||||
====================================
|
||||
|
||||
%s
|
||||
|
||||
|
|
||||
|
||||
'''
|
||||
|
||||
TEMPLATE_STD_CLASS_SUMMARY = '''
|
||||
|class_summary| Classes Summary
|
||||
===============================
|
||||
|
||||
%s
|
||||
|
||||
|
|
||||
|
||||
'''
|
||||
|
||||
|
||||
TEMPLATE_TOCTREE = '''
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:hidden:
|
||||
|
||||
%s
|
||||
'''
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user