You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(115) |
Aug
(120) |
Sep
(137) |
Oct
(170) |
Nov
(461) |
Dec
(263) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(120) |
Feb
(74) |
Mar
(35) |
Apr
(74) |
May
(245) |
Jun
(356) |
Jul
(240) |
Aug
(115) |
Sep
(78) |
Oct
(225) |
Nov
(98) |
Dec
(271) |
| 2009 |
Jan
(132) |
Feb
(84) |
Mar
(74) |
Apr
(56) |
May
(90) |
Jun
(79) |
Jul
(83) |
Aug
(296) |
Sep
(214) |
Oct
(76) |
Nov
(82) |
Dec
(66) |
| 2010 |
Jan
(46) |
Feb
(58) |
Mar
(51) |
Apr
(77) |
May
(58) |
Jun
(126) |
Jul
(128) |
Aug
(64) |
Sep
(50) |
Oct
(44) |
Nov
(48) |
Dec
(54) |
| 2011 |
Jan
(68) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <jd...@us...> - 2009-08-11 11:41:35
|
Revision: 7462
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7462&view=rev
Author: jdh2358
Date: 2009-08-11 11:41:29 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
update screenshots
Modified Paths:
--------------
trunk/py4science/examples/sphinx_qs/_static/fancy_screenshot.png
Modified: trunk/py4science/examples/sphinx_qs/_static/fancy_screenshot.png
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-08-11 11:40:07
|
Revision: 7461
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7461&view=rev
Author: jdh2358
Date: 2009-08-11 11:40:00 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
rename project sampledoc
Modified Paths:
--------------
trunk/py4science/examples/sphinx_qs/Makefile
trunk/py4science/examples/sphinx_qs/_static/logo.png
trunk/py4science/examples/sphinx_qs/conf.py
trunk/py4science/examples/sphinx_qs/custom_look.rst
trunk/py4science/examples/sphinx_qs/extensions.rst
trunk/py4science/examples/sphinx_qs/getting_started.rst
trunk/py4science/examples/sphinx_qs/index.rst
Modified: trunk/py4science/examples/sphinx_qs/Makefile
===================================================================
--- trunk/py4science/examples/sphinx_qs/Makefile 2009-08-11 11:33:59 UTC (rev 7460)
+++ trunk/py4science/examples/sphinx_qs/Makefile 2009-08-11 11:40:00 UTC (rev 7461)
@@ -60,9 +60,9 @@
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in _build/qthelp, like this:"
- @echo "# qcollectiongenerator _build/qthelp/py4sci.qhcp"
+ @echo "# qcollectiongenerator _build/qthelp/sampledoc.qhcp"
@echo "To view the help file:"
- @echo "# assistant -collectionFile _build/qthelp/py4sci.qhc"
+ @echo "# assistant -collectionFile _build/qthelp/sampledoc.qhc"
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex
Modified: trunk/py4science/examples/sphinx_qs/_static/logo.png
===================================================================
(Binary files differ)
Modified: trunk/py4science/examples/sphinx_qs/conf.py
===================================================================
--- trunk/py4science/examples/sphinx_qs/conf.py 2009-08-11 11:33:59 UTC (rev 7460)
+++ trunk/py4science/examples/sphinx_qs/conf.py 2009-08-11 11:40:00 UTC (rev 7461)
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# py4sci documentation build configuration file, created by
+# sampledoc documentation build configuration file, created by
# sphinx-quickstart on Tue Aug 11 05:04:40 2009.
#
# This file is execfile()d with the current directory set to its containing dir.
@@ -45,7 +45,7 @@
master_doc = 'index'
# General information about the project.
-project = u'py4sci'
+project = u'sampledoc'
copyright = u'2009, jdh'
# The version info for the project you're documenting, acts as replacement for
@@ -166,7 +166,7 @@
#html_file_suffix = ''
# Output file base name for HTML help builder.
-htmlhelp_basename = 'py4scidoc'
+htmlhelp_basename = 'sampledocdoc'
# -- Options for LaTeX output --------------------------------------------------
@@ -180,7 +180,7 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
- ('index', 'py4sci.tex', u'py4sci Documentation',
+ ('index', 'sampledoc.tex', u'sampledoc Documentation',
u'jdh', 'manual'),
]
Modified: trunk/py4science/examples/sphinx_qs/custom_look.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/custom_look.rst 2009-08-11 11:33:59 UTC (rev 7460)
+++ trunk/py4science/examples/sphinx_qs/custom_look.rst 2009-08-11 11:40:00 UTC (rev 7461)
@@ -14,10 +14,10 @@
:ref:`fetching-the-data`). Since I did a svn checkout before, I will
just copy the stuff I need from there::
- home:~/tmp/py4sci> cp ../sphinx_qs/_static/default.css _static/
- home:~/tmp/py4sci> cp ../sphinx_qs/_templates/layout.html _templates/
- home:~/tmp/py4sci> cp ../sphinx_qs/_static/logo.png _static/
- home:~/tmp/py4sci> ls _static/ _templates/
+ home:~/tmp/sampledoc> cp ../sphinx_qs/_static/default.css _static/
+ home:~/tmp/sampledoc> cp ../sphinx_qs/_templates/layout.html _templates/
+ home:~/tmp/sampledoc> cp ../sphinx_qs/_static/logo.png _static/
+ home:~/tmp/sampledoc> ls _static/ _templates/
_static/:
basic_screenshot.png default.css logo.png
@@ -48,7 +48,7 @@
<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
<a href="{{ pathto('index') }}"><img src="{{
- pathto("_static/logo.png", 1) }}" border="0" alt="py4sci"/></a>
+ pathto("_static/logo.png", 1) }}" border="0" alt="sampledoc"/></a>
</div>
{{ super() }}
{% endblock %}
Modified: trunk/py4science/examples/sphinx_qs/extensions.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/extensions.rst 2009-08-11 11:33:59 UTC (rev 7460)
+++ trunk/py4science/examples/sphinx_qs/extensions.rst 2009-08-11 11:40:00 UTC (rev 7461)
@@ -14,11 +14,11 @@
and showing you how to install and use them for your own project.
First let's grab the python extension files from the :file:`sphinxext`
directory from svn (see :ref:`fetching-the-data`, and install them in
-our :file:`py4sci` project :file:`sphinxext` directory::
+our :file:`sampledoc` project :file:`sphinxext` directory::
- home:~/tmp/py4sci> mkdir sphinxext
- home:~/tmp/py4sci> cp ../sphinx_qs/sphinxext/*.py sphinxext/
- home:~/tmp/py4sci> ls sphinxext/
+ home:~/tmp/sampledoc> mkdir sphinxext
+ home:~/tmp/sampledoc> cp ../sphinx_qs/sphinxext/*.py sphinxext/
+ home:~/tmp/sampledoc> ls sphinxext/
apigen.py inheritance_diagram.py
docscrape.py ipython_console_highlighting.py
docscrape_sphinx.py numpydoc.py
Modified: trunk/py4science/examples/sphinx_qs/getting_started.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/getting_started.rst 2009-08-11 11:33:59 UTC (rev 7460)
+++ trunk/py4science/examples/sphinx_qs/getting_started.rst 2009-08-11 11:40:00 UTC (rev 7461)
@@ -27,10 +27,10 @@
> sphinx-quickstart
-accepting most of the defaults. I choose "py4sci" as the name of my
+accepting most of the defaults. I choose "sampledoc" as the name of my
project. cd into your new directory and check the contents::
- home:~/tmp/py4sci> ls
+ home:~/tmp/sampledoc> ls
Makefile _static conf.py
_build _templates index.rst
@@ -61,9 +61,9 @@
First, I'll cd to the directory containing my project, and get the
"finished" product, and then copy in just the files I need::
- home:~/tmp/py4sci> pwd
- /Users/jdhunter/tmp/py4sci
- home:~/tmp/py4sci> cd ..
+ home:~/tmp/sampledoc> pwd
+ /Users/jdhunter/tmp/sampledoc
+ home:~/tmp/sampledoc> cd ..
home:~/tmp> svn co
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/\
py4science/examples/sphinx_qs
@@ -77,8 +77,8 @@
A sphinx_qs/getting_started.rst
A sphinx_qs/index.rst
Checked out revision 7449.
- home:~/tmp> cp sphinx_qs/getting_started.rst py4sci/
- home:~/tmp> cp sphinx_qs/_static/basic_screenshot.png py4sci/_static/
+ home:~/tmp> cp sphinx_qs/getting_started.rst sampledoc/
+ home:~/tmp> cp sphinx_qs/_static/basic_screenshot.png sampledoc/_static/
Now we are ready to rebuild the docs. We used the image directory to
include to the screenshot above with::
Modified: trunk/py4science/examples/sphinx_qs/index.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/index.rst 2009-08-11 11:33:59 UTC (rev 7460)
+++ trunk/py4science/examples/sphinx_qs/index.rst 2009-08-11 11:40:00 UTC (rev 7461)
@@ -1,10 +1,10 @@
-.. py4sci documentation master file, created by
+.. sampledoc documentation master file, created by
sphinx-quickstart on Tue Aug 11 05:04:40 2009.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
-Welcome to py4sci's documentation!
-==================================
+sampledoc tutorial
+==================
Contents:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-08-11 11:34:08
|
Revision: 7460
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7460&view=rev
Author: jdh2358
Date: 2009-08-11 11:33:59 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
cleaned up some build errors and warnings
Modified Paths:
--------------
trunk/py4science/examples/sphinx_qs/cheatsheet.rst
trunk/py4science/examples/sphinx_qs/extensions.rst
trunk/py4science/examples/sphinx_qs/getting_started.rst
Modified: trunk/py4science/examples/sphinx_qs/cheatsheet.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/cheatsheet.rst 2009-08-11 11:27:30 UTC (rev 7459)
+++ trunk/py4science/examples/sphinx_qs/cheatsheet.rst 2009-08-11 11:33:59 UTC (rev 7460)
@@ -24,10 +24,8 @@
Or literally include code:
-.. literalinclude:: ../pyplots/ellipses.py
+.. literalinclude:: pyplots/ellipses.py
-
-
.. _making-a-list:
Making a list
@@ -81,7 +79,7 @@
It is easy to make a link to `yahoo <http://yahoo.com>`_ or to some
section inside this document (see :ref:`making-a-table`) or another
-document (see :ref:`final-results`).
+document.
You can also reference classes, modules, functions, etc that are
documented using the sphinx `autodoc
@@ -92,68 +90,6 @@
-.. _making-a-list:
-
-Making a list
-=============
-
-It is easy to make lists in rest
-
-Bullet points
--------------
-
-This is a subsection making bullet points
-
-* point A
-
-* point B
-
-* point C
-
-
-Enumerated points
-------------------
-
-This is a subsection making numbered points
-
-#. point A
-
-#. point B
-
-#. point C
-
-
-.. _making-a-table:
-
-Making a table
-==============
-
-This shows you how to make a table -- if you only want to make a list see :ref:`making-a-list`.
-
-================== ============
-Name Age
-================== ============
-John D Hunter 40
-Cast of Thousands 41
-And Still More 42
-================== ============
-
-.. _making-links:
-
-Making links
-============
-
-It is easy to make a link to `yahoo <http://yahoo.com>`_ or to some
-section inside this document (see :ref:`making-a-table`) or another
-document (see :ref:`final-results`).
-
-You can also reference classes, modules, functions, etc that are
-documented using the sphinx `autodoc
-<http://sphinx.pocoo.org/ext/autodoc.html>`_ facilites. For example,
-see the module :mod:`matplotlib.backend_bases` documentation, or the
-class :class:`~matplotlib.backend_bases.LocationEvent`, or the method
-:meth:`~matplotlib.backend_bases.FigureCanvasBase.mpl_connect`.
-
.. _cheatsheet-literal:
This file
Modified: trunk/py4science/examples/sphinx_qs/extensions.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/extensions.rst 2009-08-11 11:27:30 UTC (rev 7459)
+++ trunk/py4science/examples/sphinx_qs/extensions.rst 2009-08-11 11:33:59 UTC (rev 7460)
@@ -13,7 +13,7 @@
groups, eg numpy and ipython. We're collecting these in this tutorial
and showing you how to install and use them for your own project.
First let's grab the python extension files from the :file:`sphinxext`
-directory from svn (see :ref:`getting-the-data`, and install them in
+directory from svn (see :ref:`fetching-the-data`, and install them in
our :file:`py4sci` project :file:`sphinxext` directory::
home:~/tmp/py4sci> mkdir sphinxext
@@ -118,7 +118,7 @@
refer to it using the ``plot`` directive. To include the source code
for the plot in the document, pass the ``include-source`` parameter::
- .. plot:: ../pyplots/ellipses.py
+ .. plot:: pyplots/ellipses.py
:include-source:
In the HTML version of the document, the plot includes links to the
Modified: trunk/py4science/examples/sphinx_qs/getting_started.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/getting_started.rst 2009-08-11 11:27:30 UTC (rev 7459)
+++ trunk/py4science/examples/sphinx_qs/getting_started.rst 2009-08-11 11:33:59 UTC (rev 7460)
@@ -9,6 +9,7 @@
other goodies.
.. _installing-docdir:
+
Installing your doc directory
=============================
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-08-11 11:27:39
|
Revision: 7459
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7459&view=rev
Author: jdh2358
Date: 2009-08-11 11:27:30 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
fixed some build errors
Modified Paths:
--------------
trunk/py4science/examples/sphinx_qs/conf.py
trunk/py4science/examples/sphinx_qs/extensions.rst
trunk/py4science/examples/sphinx_qs/index.rst
Modified: trunk/py4science/examples/sphinx_qs/conf.py
===================================================================
--- trunk/py4science/examples/sphinx_qs/conf.py 2009-08-11 11:24:27 UTC (rev 7458)
+++ trunk/py4science/examples/sphinx_qs/conf.py 2009-08-11 11:27:30 UTC (rev 7459)
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# py4sci documentation build configuration file, created by
-# sphinx-quickstart on Tue Aug 11 04:33:46 2009.
+# sphinx-quickstart on Tue Aug 11 05:04:40 2009.
#
# This file is execfile()d with the current directory set to its containing dir.
#
@@ -13,17 +13,25 @@
import sys, os
-# If extensions (or modules to document with autodoc) are in another directory,
-# add these directories to sys.path here. If the directory is relative to the
-# documentation root, use os.path.abspath to make it absolute, like shown here.
-#sys.path.append(os.path.abspath('.'))
+# If your extensions are in another directory, add it here. If the directory
+# is relative to the documentation root, use os.path.abspath to make it
+# absolute, like shown here.
+sys.path.append(os.path.abspath('sphinxext'))
# -- General configuration -----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['sphinx.ext.autodoc']
+extensions = ['matplotlib.sphinxext.mathmpl',
+ 'matplotlib.sphinxext.only_directives',
+ 'matplotlib.sphinxext.plot_directive',
+ 'sphinx.ext.autodoc',
+ 'sphinx.ext.doctest',
+ 'ipython_console_highlighting',
+ 'inheritance_diagram',
+ 'numpydoc']
+
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
@@ -45,9 +53,9 @@
# built documents.
#
# The short X.Y version.
-version = '0.1'
+version = '1.0'
# The full version, including alpha/beta/rc tags.
-release = '0.1'
+release = '1.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Modified: trunk/py4science/examples/sphinx_qs/extensions.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/extensions.rst 2009-08-11 11:24:27 UTC (rev 7458)
+++ trunk/py4science/examples/sphinx_qs/extensions.rst 2009-08-11 11:27:30 UTC (rev 7459)
@@ -125,7 +125,7 @@
original source code, a high-resolution PNG and a PDF. In the PDF
version of the document, the plot is included as a scalable PDF.
-.. plot:: pyplots/elegant.py
+.. plot:: pyplots/ellipses.py
:include-source:
Inheritance diagrams
Modified: trunk/py4science/examples/sphinx_qs/index.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/index.rst 2009-08-11 11:24:27 UTC (rev 7458)
+++ trunk/py4science/examples/sphinx_qs/index.rst 2009-08-11 11:27:30 UTC (rev 7459)
@@ -14,6 +14,8 @@
getting_started.rst
custom_look.rst
extensions.rst
+ cheatsheet.rst
+ emacs_help.rst
Indices and tables
==================
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-08-11 11:24:36
|
Revision: 7458
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7458&view=rev
Author: jdh2358
Date: 2009-08-11 11:24:27 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
rename extensions
Modified Paths:
--------------
trunk/py4science/examples/sphinx_qs/index.rst
Added Paths:
-----------
trunk/py4science/examples/sphinx_qs/extensions.rst
Removed Paths:
-------------
trunk/py4science/examples/sphinx_qs/sphinx_extensions.rst
Copied: trunk/py4science/examples/sphinx_qs/extensions.rst (from rev 7457, trunk/py4science/examples/sphinx_qs/sphinx_extensions.rst)
===================================================================
--- trunk/py4science/examples/sphinx_qs/extensions.rst (rev 0)
+++ trunk/py4science/examples/sphinx_qs/extensions.rst 2009-08-11 11:24:27 UTC (rev 7458)
@@ -0,0 +1,154 @@
+.. _extensions:
+
+
+****************************************************
+Sphinx extensions for embedded plots, math and more
+****************************************************
+
+Sphinx is written in python, and supports the ability to write custom
+extensions. We've written a few for the matplotlib documentation,
+some of which are part of matplotlib itself in the
+matplotlib.sphinxext module, some of which are included only in the
+sphinx doc directory, and there are other extensions written by other
+groups, eg numpy and ipython. We're collecting these in this tutorial
+and showing you how to install and use them for your own project.
+First let's grab the python extension files from the :file:`sphinxext`
+directory from svn (see :ref:`getting-the-data`, and install them in
+our :file:`py4sci` project :file:`sphinxext` directory::
+
+ home:~/tmp/py4sci> mkdir sphinxext
+ home:~/tmp/py4sci> cp ../sphinx_qs/sphinxext/*.py sphinxext/
+ home:~/tmp/py4sci> ls sphinxext/
+ apigen.py inheritance_diagram.py
+ docscrape.py ipython_console_highlighting.py
+ docscrape_sphinx.py numpydoc.py
+
+In addition to the builtin matplotlib extensions for embedding pyplot
+plots and rendering math with matplotlib's native math engine, we also
+have extensions for syntax highlighting ipython sessions, making
+inhertiance diagrams, and more.
+
+We need to inform sphinx of our new extensions in the :file:`conf.py`
+file by adding the following. First we tell it where to find the extensions::
+
+ # If your extensions are in another directory, add it here. If the
+ # directory is relative to the documentation root, use
+ # os.path.abspath to make it absolute, like shown here.
+ sys.path.append(os.path.abspath('sphinxext'))
+
+And then we tell it what extensions to load::
+
+ # Add any Sphinx extension module names here, as strings. They can
+ # be extensions coming with Sphinx (named 'sphinx.ext.*') or your
+ # custom ones.
+ extensions = ['matplotlib.sphinxext.mathmpl',
+ 'matplotlib.sphinxext.only_directives',
+ 'matplotlib.sphinxext.plot_directive',
+ 'sphinx.ext.autodoc',
+ 'sphinx.ext.doctest',
+ 'ipython_console_highlighting',
+ 'inheritance_diagram',
+ 'numpydoc']
+
+
+Now let's look at some of these in action. You can see the literal
+source for this file at :ref:`extensions-literal`.
+
+
+.. _ipython-highlighting:
+
+ipython sessions
+================
+
+Michael Droettboom contributed a sphinx extension which does pygments
+syntax highlighting on ipython sessions
+
+.. sourcecode:: ipython
+
+ In [69]: lines = plot([1,2,3])
+
+ In [70]: setp(lines)
+ alpha: float
+ animated: [True | False]
+ antialiased or aa: [True | False]
+ ...snip
+
+This support is included in this template, but will also be included
+in a future version of Pygments by default.
+
+.. _using-math:
+
+Using math
+==========
+
+In sphinx you can include inline math :math:`x\leftarrow y\ x\forall
+y\ x-y` or display math
+
+.. math::
+
+ W^{3\beta}_{\delta_1 \rho_1 \sigma_2} = U^{3\beta}_{\delta_1 \rho_1} + \frac{1}{8 \pi 2} \int^{\alpha_2}_{\alpha_2} d \alpha^\prime_2 \left[\frac{ U^{2\beta}_{\delta_1 \rho_1} - \alpha^\prime_2U^{1\beta}_{\rho_1 \sigma_2} }{U^{0\beta}_{\rho_1 \sigma_2}}\right]
+
+This documentation framework includes a Sphinx extension,
+:file:`sphinxext/mathmpl.py`, that uses matplotlib to render math
+equations when generating HTML, and LaTeX itself when generating a
+PDF. This can be useful on systems that have matplotlib, but not
+LaTeX, installed. To use it, add ``mathmpl`` to the list of
+extensions in :file:`conf.py`.
+
+Current SVN versions of Sphinx now include built-in support for math.
+There are two flavors:
+
+ - pngmath: uses dvipng to render the equation
+
+ - jsmath: renders the math in the browser using Javascript
+
+To use these extensions instead, add ``sphinx.ext.pngmath`` or
+``sphinx.ext.jsmath`` to the list of extensions in :file:`conf.py`.
+
+All three of these options for math are designed to behave in the same
+way.
+
+.. _emacs-helpers:
+
+Inserting matplotlib plots
+==========================
+
+Inserting automatically-generated plots is easy. Simply put the
+script to generate the plot in the :file:`pyplots` directory, and
+refer to it using the ``plot`` directive. To include the source code
+for the plot in the document, pass the ``include-source`` parameter::
+
+ .. plot:: ../pyplots/ellipses.py
+ :include-source:
+
+In the HTML version of the document, the plot includes links to the
+original source code, a high-resolution PNG and a PDF. In the PDF
+version of the document, the plot is included as a scalable PDF.
+
+.. plot:: pyplots/elegant.py
+ :include-source:
+
+Inheritance diagrams
+====================
+
+Inheritance diagrams can be inserted directly into the document by
+providing a list of class or module names to the
+``inheritance-diagram`` directive.
+
+For example::
+
+ .. inheritance-diagram:: codecs
+
+produces:
+
+.. inheritance-diagram:: codecs
+
+
+.. _extensions-literal:
+
+This file
+=========
+
+.. literalinclude:: extensions.rst
+
+
Modified: trunk/py4science/examples/sphinx_qs/index.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/index.rst 2009-08-11 11:22:28 UTC (rev 7457)
+++ trunk/py4science/examples/sphinx_qs/index.rst 2009-08-11 11:24:27 UTC (rev 7458)
@@ -13,7 +13,7 @@
getting_started.rst
custom_look.rst
- sphinx_extensions.rst
+ extensions.rst
Indices and tables
==================
Deleted: trunk/py4science/examples/sphinx_qs/sphinx_extensions.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/sphinx_extensions.rst 2009-08-11 11:22:28 UTC (rev 7457)
+++ trunk/py4science/examples/sphinx_qs/sphinx_extensions.rst 2009-08-11 11:24:27 UTC (rev 7458)
@@ -1,154 +0,0 @@
-.. _extensions:
-
-
-****************************************************
-Sphinx extensions for embedded plots, math and more
-****************************************************
-
-Sphinx is written in python, and supports the ability to write custom
-extensions. We've written a few for the matplotlib documentation,
-some of which are part of matplotlib itself in the
-matplotlib.sphinxext module, some of which are included only in the
-sphinx doc directory, and there are other extensions written by other
-groups, eg numpy and ipython. We're collecting these in this tutorial
-and showing you how to install and use them for your own project.
-First let's grab the python extension files from the :file:`sphinxext`
-directory from svn (see :ref:`getting-the-data`, and install them in
-our :file:`py4sci` project :file:`sphinxext` directory::
-
- home:~/tmp/py4sci> mkdir sphinxext
- home:~/tmp/py4sci> cp ../sphinx_qs/sphinxext/*.py sphinxext/
- home:~/tmp/py4sci> ls sphinxext/
- apigen.py inheritance_diagram.py
- docscrape.py ipython_console_highlighting.py
- docscrape_sphinx.py numpydoc.py
-
-In addition to the builtin matplotlib extensions for embedding pyplot
-plots and rendering math with matplotlib's native math engine, we also
-have extensions for syntax highlighting ipython sessions, making
-inhertiance diagrams, and more.
-
-We need to inform sphinx of our new extensions in the :file:`conf.py`
-file by adding the following. First we tell it where to find the extensions::
-
- # If your extensions are in another directory, add it here. If the
- # directory is relative to the documentation root, use
- # os.path.abspath to make it absolute, like shown here.
- sys.path.append(os.path.abspath('sphinxext'))
-
-And then we tell it what extensions to load::
-
- # Add any Sphinx extension module names here, as strings. They can
- # be extensions coming with Sphinx (named 'sphinx.ext.*') or your
- # custom ones.
- extensions = ['matplotlib.sphinxext.mathmpl',
- 'matplotlib.sphinxext.only_directives',
- 'matplotlib.sphinxext.plot_directive',
- 'sphinx.ext.autodoc',
- 'sphinx.ext.doctest',
- 'ipython_console_highlighting',
- 'inheritance_diagram',
- 'numpydoc']
-
-
-Now let's look at some of these in action. You can see the literal
-source for this file at :ref:`sphinx-extensions-literal`.
-
-
-.. _ipython-highlighting:
-
-ipython sessions
-================
-
-Michael Droettboom contributed a sphinx extension which does pygments
-syntax highlighting on ipython sessions
-
-.. sourcecode:: ipython
-
- In [69]: lines = plot([1,2,3])
-
- In [70]: setp(lines)
- alpha: float
- animated: [True | False]
- antialiased or aa: [True | False]
- ...snip
-
-This support is included in this template, but will also be included
-in a future version of Pygments by default.
-
-.. _using-math:
-
-Using math
-==========
-
-In sphinx you can include inline math :math:`x\leftarrow y\ x\forall
-y\ x-y` or display math
-
-.. math::
-
- W^{3\beta}_{\delta_1 \rho_1 \sigma_2} = U^{3\beta}_{\delta_1 \rho_1} + \frac{1}{8 \pi 2} \int^{\alpha_2}_{\alpha_2} d \alpha^\prime_2 \left[\frac{ U^{2\beta}_{\delta_1 \rho_1} - \alpha^\prime_2U^{1\beta}_{\rho_1 \sigma_2} }{U^{0\beta}_{\rho_1 \sigma_2}}\right]
-
-This documentation framework includes a Sphinx extension,
-:file:`sphinxext/mathmpl.py`, that uses matplotlib to render math
-equations when generating HTML, and LaTeX itself when generating a
-PDF. This can be useful on systems that have matplotlib, but not
-LaTeX, installed. To use it, add ``mathmpl`` to the list of
-extensions in :file:`conf.py`.
-
-Current SVN versions of Sphinx now include built-in support for math.
-There are two flavors:
-
- - pngmath: uses dvipng to render the equation
-
- - jsmath: renders the math in the browser using Javascript
-
-To use these extensions instead, add ``sphinx.ext.pngmath`` or
-``sphinx.ext.jsmath`` to the list of extensions in :file:`conf.py`.
-
-All three of these options for math are designed to behave in the same
-way.
-
-.. _emacs-helpers:
-
-Inserting matplotlib plots
-==========================
-
-Inserting automatically-generated plots is easy. Simply put the
-script to generate the plot in the :file:`pyplots` directory, and
-refer to it using the ``plot`` directive. To include the source code
-for the plot in the document, pass the ``include-source`` parameter::
-
- .. plot:: ../pyplots/ellipses.py
- :include-source:
-
-In the HTML version of the document, the plot includes links to the
-original source code, a high-resolution PNG and a PDF. In the PDF
-version of the document, the plot is included as a scalable PDF.
-
-.. plot:: pyplots/elegant.py
- :include-source:
-
-Inheritance diagrams
-====================
-
-Inheritance diagrams can be inserted directly into the document by
-providing a list of class or module names to the
-``inheritance-diagram`` directive.
-
-For example::
-
- .. inheritance-diagram:: codecs
-
-produces:
-
-.. inheritance-diagram:: codecs
-
-
-.. _sphinx-extensions-literal:
-
-This file
-=========
-
-.. literalinclude:: sphinx_extensions.rst
-
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-08-11 11:22:35
|
Revision: 7457
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7457&view=rev
Author: jdh2358
Date: 2009-08-11 11:22:28 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
added pyplots and extensions
Modified Paths:
--------------
trunk/py4science/examples/sphinx_qs/cheatsheet.rst
trunk/py4science/examples/sphinx_qs/custom_look.rst
trunk/py4science/examples/sphinx_qs/getting_started.rst
trunk/py4science/examples/sphinx_qs/index.rst
Added Paths:
-----------
trunk/py4science/examples/sphinx_qs/emacs_help.rst
trunk/py4science/examples/sphinx_qs/pyplots/
trunk/py4science/examples/sphinx_qs/pyplots/ellipses.py
trunk/py4science/examples/sphinx_qs/sphinx_extensions.rst
Modified: trunk/py4science/examples/sphinx_qs/cheatsheet.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/cheatsheet.rst 2009-08-11 10:59:31 UTC (rev 7456)
+++ trunk/py4science/examples/sphinx_qs/cheatsheet.rst 2009-08-11 11:22:28 UTC (rev 7457)
@@ -1,38 +1,162 @@
-.. _sphinx_helpers:
-
-
-******************
-Sphinx Cheat Sheet
-******************
-
-Cheat sheet on how to make this site and install these extensions and
-other goodies. You can see a literal version of this file below in
-:ref:`sphinx-literal`.
-
-.. _installing-docdir:
-Installing your doc directory
-=============================
-
-You may already have sphinx `sphinx <http://sphinx.pocoo.org/>`_
-installed -- you can check by doing::
-
- python -c 'import sphinx'
-
-If that fails grab the latest version of and install it with::
-
- > sudo easy_install sphinx
-
-Now you are ready to build a template for your docs, using
-sphinx-quickstart::
-
- > sphinx-quickstart
-
-accepting most of the defaults. I choose "py4sci" as the name of my project
-
-We can test the installation by changing into the project directory,
-and typing `make html`::
-
- cd py4sci
- make html
-
-
+.. _cheat-sheet:
+
+******************
+Sphinx cheat sheet
+******************
+
+Here is a quick and dirty cheat sheet for some common stuff you want
+to do in sphinx and ReST. You can see the literal source for this
+file at :ref:`cheatsheet
+-literal`.
+
+
+.. _formatting-text:
+
+Formatting text
+===============
+
+You use inline markup to make text *italics*, **bold**, or ``monotype``.
+
+You can represent code blocks fairly easily::
+
+ import numpy as np
+ x = np.random.rand(12)
+
+Or literally include code:
+
+.. literalinclude:: ../pyplots/ellipses.py
+
+
+
+.. _making-a-list:
+
+Making a list
+=============
+
+It is easy to make lists in rest
+
+Bullet points
+-------------
+
+This is a subsection making bullet points
+
+* point A
+
+* point B
+
+* point C
+
+
+Enumerated points
+------------------
+
+This is a subsection making numbered points
+
+#. point A
+
+#. point B
+
+#. point C
+
+
+.. _making-a-table:
+
+Making a table
+==============
+
+This shows you how to make a table -- if you only want to make a list see :ref:`making-a-list`.
+
+================== ============
+Name Age
+================== ============
+John D Hunter 40
+Cast of Thousands 41
+And Still More 42
+================== ============
+
+.. _making-links:
+
+Making links
+============
+
+It is easy to make a link to `yahoo <http://yahoo.com>`_ or to some
+section inside this document (see :ref:`making-a-table`) or another
+document (see :ref:`final-results`).
+
+You can also reference classes, modules, functions, etc that are
+documented using the sphinx `autodoc
+<http://sphinx.pocoo.org/ext/autodoc.html>`_ facilites. For example,
+see the module :mod:`matplotlib.backend_bases` documentation, or the
+class :class:`~matplotlib.backend_bases.LocationEvent`, or the method
+:meth:`~matplotlib.backend_bases.FigureCanvasBase.mpl_connect`.
+
+
+
+.. _making-a-list:
+
+Making a list
+=============
+
+It is easy to make lists in rest
+
+Bullet points
+-------------
+
+This is a subsection making bullet points
+
+* point A
+
+* point B
+
+* point C
+
+
+Enumerated points
+------------------
+
+This is a subsection making numbered points
+
+#. point A
+
+#. point B
+
+#. point C
+
+
+.. _making-a-table:
+
+Making a table
+==============
+
+This shows you how to make a table -- if you only want to make a list see :ref:`making-a-list`.
+
+================== ============
+Name Age
+================== ============
+John D Hunter 40
+Cast of Thousands 41
+And Still More 42
+================== ============
+
+.. _making-links:
+
+Making links
+============
+
+It is easy to make a link to `yahoo <http://yahoo.com>`_ or to some
+section inside this document (see :ref:`making-a-table`) or another
+document (see :ref:`final-results`).
+
+You can also reference classes, modules, functions, etc that are
+documented using the sphinx `autodoc
+<http://sphinx.pocoo.org/ext/autodoc.html>`_ facilites. For example,
+see the module :mod:`matplotlib.backend_bases` documentation, or the
+class :class:`~matplotlib.backend_bases.LocationEvent`, or the method
+:meth:`~matplotlib.backend_bases.FigureCanvasBase.mpl_connect`.
+
+.. _cheatsheet-literal:
+
+This file
+=========
+
+.. literalinclude:: cheatsheet.rst
Modified: trunk/py4science/examples/sphinx_qs/custom_look.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/custom_look.rst 2009-08-11 10:59:31 UTC (rev 7456)
+++ trunk/py4science/examples/sphinx_qs/custom_look.rst 2009-08-11 11:22:28 UTC (rev 7457)
@@ -1,9 +1,9 @@
.. _custom_look:
-*********************
-Customizing the site
-*********************
+******************************************
+Customizing the look and feel of the site
+******************************************
The `sphinx <http://sphinx.pocoo.org/>`_ site itself looks better than
the sites created with the default css, so here we'll invoke Tufte's
Added: trunk/py4science/examples/sphinx_qs/emacs_help.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/emacs_help.rst (rev 0)
+++ trunk/py4science/examples/sphinx_qs/emacs_help.rst 2009-08-11 11:22:28 UTC (rev 7457)
@@ -0,0 +1,40 @@
+.. _working-with-emacs:
+
+*******************
+Emacs ReST support
+*******************
+
+Emacs helpers
+=============
+
+There is an emacs mode `rst.el
+<http://docutils.sourceforge.net/tools/editors/emacs/rst.el>`_ which
+automates many important ReST tasks like building and updateing
+table-of-contents, and promoting or demoting section headings. Here
+is the basic ``.emacs`` configuration::
+
+ (require 'rst)
+ (setq auto-mode-alist
+ (append '(("\\.txt$" . rst-mode)
+ ("\\.rst$" . rst-mode)
+ ("\\.rest$" . rst-mode)) auto-mode-alist))
+
+
+Some helpful functions::
+
+ C-c TAB - rst-toc-insert
+
+ Insert table of contents at point
+
+ C-c C-u - rst-toc-update
+
+ Update the table of contents at point
+
+ C-c C-l rst-shift-region-left
+
+ Shift region to the left
+
+ C-c C-r rst-shift-region-right
+
+ Shift region to the right
+
Modified: trunk/py4science/examples/sphinx_qs/getting_started.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/getting_started.rst 2009-08-11 10:59:31 UTC (rev 7456)
+++ trunk/py4science/examples/sphinx_qs/getting_started.rst 2009-08-11 11:22:28 UTC (rev 7457)
@@ -6,8 +6,7 @@
***************
Cheat sheet on how to make this site and install these extensions and
-other goodies. You can see a literal version of this file below in
-:ref:`sphinx-literal`.
+other goodies.
.. _installing-docdir:
Installing your doc directory
@@ -106,4 +105,3 @@
the `sphinx <http://sphinx.pocoo.org/>`_ site itself -- see
:ref:`custom_look`.
-
Modified: trunk/py4science/examples/sphinx_qs/index.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/index.rst 2009-08-11 10:59:31 UTC (rev 7456)
+++ trunk/py4science/examples/sphinx_qs/index.rst 2009-08-11 11:22:28 UTC (rev 7457)
@@ -13,6 +13,7 @@
getting_started.rst
custom_look.rst
+ sphinx_extensions.rst
Indices and tables
==================
Added: trunk/py4science/examples/sphinx_qs/pyplots/ellipses.py
===================================================================
--- trunk/py4science/examples/sphinx_qs/pyplots/ellipses.py (rev 0)
+++ trunk/py4science/examples/sphinx_qs/pyplots/ellipses.py 2009-08-11 11:22:28 UTC (rev 7457)
@@ -0,0 +1,19 @@
+from pylab import *
+from matplotlib.patches import Ellipse
+
+delta = 45.0 # degrees
+
+angles = arange(0, 360+delta, delta)
+ells = [Ellipse((1, 1), 4, 2, a) for a in angles]
+
+a = subplot(111, aspect='equal')
+
+for e in ells:
+ e.set_clip_box(a.bbox)
+ e.set_alpha(0.1)
+ a.add_artist(e)
+
+xlim(-2, 4)
+ylim(-1, 3)
+
+show()
Added: trunk/py4science/examples/sphinx_qs/sphinx_extensions.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/sphinx_extensions.rst (rev 0)
+++ trunk/py4science/examples/sphinx_qs/sphinx_extensions.rst 2009-08-11 11:22:28 UTC (rev 7457)
@@ -0,0 +1,154 @@
+.. _extensions:
+
+
+****************************************************
+Sphinx extensions for embedded plots, math and more
+****************************************************
+
+Sphinx is written in python, and supports the ability to write custom
+extensions. We've written a few for the matplotlib documentation,
+some of which are part of matplotlib itself in the
+matplotlib.sphinxext module, some of which are included only in the
+sphinx doc directory, and there are other extensions written by other
+groups, eg numpy and ipython. We're collecting these in this tutorial
+and showing you how to install and use them for your own project.
+First let's grab the python extension files from the :file:`sphinxext`
+directory from svn (see :ref:`getting-the-data`, and install them in
+our :file:`py4sci` project :file:`sphinxext` directory::
+
+ home:~/tmp/py4sci> mkdir sphinxext
+ home:~/tmp/py4sci> cp ../sphinx_qs/sphinxext/*.py sphinxext/
+ home:~/tmp/py4sci> ls sphinxext/
+ apigen.py inheritance_diagram.py
+ docscrape.py ipython_console_highlighting.py
+ docscrape_sphinx.py numpydoc.py
+
+In addition to the builtin matplotlib extensions for embedding pyplot
+plots and rendering math with matplotlib's native math engine, we also
+have extensions for syntax highlighting ipython sessions, making
+inhertiance diagrams, and more.
+
+We need to inform sphinx of our new extensions in the :file:`conf.py`
+file by adding the following. First we tell it where to find the extensions::
+
+ # If your extensions are in another directory, add it here. If the
+ # directory is relative to the documentation root, use
+ # os.path.abspath to make it absolute, like shown here.
+ sys.path.append(os.path.abspath('sphinxext'))
+
+And then we tell it what extensions to load::
+
+ # Add any Sphinx extension module names here, as strings. They can
+ # be extensions coming with Sphinx (named 'sphinx.ext.*') or your
+ # custom ones.
+ extensions = ['matplotlib.sphinxext.mathmpl',
+ 'matplotlib.sphinxext.only_directives',
+ 'matplotlib.sphinxext.plot_directive',
+ 'sphinx.ext.autodoc',
+ 'sphinx.ext.doctest',
+ 'ipython_console_highlighting',
+ 'inheritance_diagram',
+ 'numpydoc']
+
+
+Now let's look at some of these in action. You can see the literal
+source for this file at :ref:`sphinx-extensions-literal`.
+
+
+.. _ipython-highlighting:
+
+ipython sessions
+================
+
+Michael Droettboom contributed a sphinx extension which does pygments
+syntax highlighting on ipython sessions
+
+.. sourcecode:: ipython
+
+ In [69]: lines = plot([1,2,3])
+
+ In [70]: setp(lines)
+ alpha: float
+ animated: [True | False]
+ antialiased or aa: [True | False]
+ ...snip
+
+This support is included in this template, but will also be included
+in a future version of Pygments by default.
+
+.. _using-math:
+
+Using math
+==========
+
+In sphinx you can include inline math :math:`x\leftarrow y\ x\forall
+y\ x-y` or display math
+
+.. math::
+
+ W^{3\beta}_{\delta_1 \rho_1 \sigma_2} = U^{3\beta}_{\delta_1 \rho_1} + \frac{1}{8 \pi 2} \int^{\alpha_2}_{\alpha_2} d \alpha^\prime_2 \left[\frac{ U^{2\beta}_{\delta_1 \rho_1} - \alpha^\prime_2U^{1\beta}_{\rho_1 \sigma_2} }{U^{0\beta}_{\rho_1 \sigma_2}}\right]
+
+This documentation framework includes a Sphinx extension,
+:file:`sphinxext/mathmpl.py`, that uses matplotlib to render math
+equations when generating HTML, and LaTeX itself when generating a
+PDF. This can be useful on systems that have matplotlib, but not
+LaTeX, installed. To use it, add ``mathmpl`` to the list of
+extensions in :file:`conf.py`.
+
+Current SVN versions of Sphinx now include built-in support for math.
+There are two flavors:
+
+ - pngmath: uses dvipng to render the equation
+
+ - jsmath: renders the math in the browser using Javascript
+
+To use these extensions instead, add ``sphinx.ext.pngmath`` or
+``sphinx.ext.jsmath`` to the list of extensions in :file:`conf.py`.
+
+All three of these options for math are designed to behave in the same
+way.
+
+.. _emacs-helpers:
+
+Inserting matplotlib plots
+==========================
+
+Inserting automatically-generated plots is easy. Simply put the
+script to generate the plot in the :file:`pyplots` directory, and
+refer to it using the ``plot`` directive. To include the source code
+for the plot in the document, pass the ``include-source`` parameter::
+
+ .. plot:: ../pyplots/ellipses.py
+ :include-source:
+
+In the HTML version of the document, the plot includes links to the
+original source code, a high-resolution PNG and a PDF. In the PDF
+version of the document, the plot is included as a scalable PDF.
+
+.. plot:: pyplots/elegant.py
+ :include-source:
+
+Inheritance diagrams
+====================
+
+Inheritance diagrams can be inserted directly into the document by
+providing a list of class or module names to the
+``inheritance-diagram`` directive.
+
+For example::
+
+ .. inheritance-diagram:: codecs
+
+produces:
+
+.. inheritance-diagram:: codecs
+
+
+.. _sphinx-extensions-literal:
+
+This file
+=========
+
+.. literalinclude:: sphinx_extensions.rst
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-08-11 10:59:39
|
Revision: 7456
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7456&view=rev
Author: jdh2358
Date: 2009-08-11 10:59:31 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
added sphinxext
Added Paths:
-----------
trunk/py4science/examples/sphinx_qs/sphinxext/
trunk/py4science/examples/sphinx_qs/sphinxext/apigen.py
trunk/py4science/examples/sphinx_qs/sphinxext/docscrape.py
trunk/py4science/examples/sphinx_qs/sphinxext/docscrape_sphinx.py
trunk/py4science/examples/sphinx_qs/sphinxext/inheritance_diagram.py
trunk/py4science/examples/sphinx_qs/sphinxext/ipython_console_highlighting.py
trunk/py4science/examples/sphinx_qs/sphinxext/numpydoc.py
Added: trunk/py4science/examples/sphinx_qs/sphinxext/apigen.py
===================================================================
--- trunk/py4science/examples/sphinx_qs/sphinxext/apigen.py (rev 0)
+++ trunk/py4science/examples/sphinx_qs/sphinxext/apigen.py 2009-08-11 10:59:31 UTC (rev 7456)
@@ -0,0 +1,426 @@
+"""Attempt to generate templates for module reference with Sphinx
+
+XXX - we exclude extension modules
+
+To include extension modules, first identify them as valid in the
+``_uri2path`` method, then handle them in the ``_parse_module`` script.
+
+We get functions and classes by parsing the text of .py files.
+Alternatively we could import the modules for discovery, and we'd have
+to do that for extension modules. This would involve changing the
+``_parse_module`` method to work via import and introspection, and
+might involve changing ``discover_modules`` (which determines which
+files are modules, and therefore which module URIs will be passed to
+``_parse_module``).
+
+NOTE: this is a modified version of a script originally shipped with the
+PyMVPA project, which we've adapted for NIPY use. PyMVPA is an MIT-licensed
+project."""
+
+# Stdlib imports
+import os
+import re
+
+# Functions and classes
+class ApiDocWriter(object):
+ ''' Class for automatic detection and parsing of API docs
+ to Sphinx-parsable reST format'''
+
+ # only separating first two levels
+ rst_section_levels = ['*', '=', '-', '~', '^']
+
+ def __init__(self,
+ package_name,
+ rst_extension='.rst',
+ package_skip_patterns=None,
+ module_skip_patterns=None,
+ ):
+ ''' Initialize package for parsing
+
+ Parameters
+ ----------
+ package_name : string
+ Name of the top-level package. *package_name* must be the
+ name of an importable package
+ rst_extension : string, optional
+ Extension for reST files, default '.rst'
+ package_skip_patterns : None or sequence of {strings, regexps}
+ Sequence of strings giving URIs of packages to be excluded
+ Operates on the package path, starting at (including) the
+ first dot in the package path, after *package_name* - so,
+ if *package_name* is ``sphinx``, then ``sphinx.util`` will
+ result in ``.util`` being passed for earching by these
+ regexps. If is None, gives default. Default is:
+ ['\.tests$']
+ module_skip_patterns : None or sequence
+ Sequence of strings giving URIs of modules to be excluded
+ Operates on the module name including preceding URI path,
+ back to the first dot after *package_name*. For example
+ ``sphinx.util.console`` results in the string to search of
+ ``.util.console``
+ If is None, gives default. Default is:
+ ['\.setup$', '\._']
+ '''
+ if package_skip_patterns is None:
+ package_skip_patterns = ['\\.tests$']
+ if module_skip_patterns is None:
+ module_skip_patterns = ['\\.setup$', '\\._']
+ self.package_name = package_name
+ self.rst_extension = rst_extension
+ self.package_skip_patterns = package_skip_patterns
+ self.module_skip_patterns = module_skip_patterns
+
+ def get_package_name(self):
+ return self._package_name
+
+ def set_package_name(self, package_name):
+ ''' Set package_name
+
+ >>> docwriter = ApiDocWriter('sphinx')
+ >>> import sphinx
+ >>> docwriter.root_path == sphinx.__path__[0]
+ True
+ >>> docwriter.package_name = 'docutils'
+ >>> import docutils
+ >>> docwriter.root_path == docutils.__path__[0]
+ True
+ '''
+ # It's also possible to imagine caching the module parsing here
+ self._package_name = package_name
+ self.root_module = __import__(package_name)
+ self.root_path = self.root_module.__path__[0]
+ self.written_modules = None
+
+ package_name = property(get_package_name, set_package_name, None,
+ 'get/set package_name')
+
+ def _get_object_name(self, line):
+ ''' Get second token in line
+ >>> docwriter = ApiDocWriter('sphinx')
+ >>> docwriter._get_object_name(" def func(): ")
+ 'func'
+ >>> docwriter._get_object_name(" class Klass(object): ")
+ 'Klass'
+ >>> docwriter._get_object_name(" class Klass: ")
+ 'Klass'
+ '''
+ name = line.split()[1].split('(')[0].strip()
+ # in case we have classes which are not derived from object
+ # ie. old style classes
+ return name.rstrip(':')
+
+ def _uri2path(self, uri):
+ ''' Convert uri to absolute filepath
+
+ Parameters
+ ----------
+ uri : string
+ URI of python module to return path for
+
+ Returns
+ -------
+ path : None or string
+ Returns None if there is no valid path for this URI
+ Otherwise returns absolute file system path for URI
+
+ Examples
+ --------
+ >>> docwriter = ApiDocWriter('sphinx')
+ >>> import sphinx
+ >>> modpath = sphinx.__path__[0]
+ >>> res = docwriter._uri2path('sphinx.builder')
+ >>> res == os.path.join(modpath, 'builder.py')
+ True
+ >>> res = docwriter._uri2path('sphinx')
+ >>> res == os.path.join(modpath, '__init__.py')
+ True
+ >>> docwriter._uri2path('sphinx.does_not_exist')
+
+ '''
+ if uri == self.package_name:
+ return os.path.join(self.root_path, '__init__.py')
+ path = uri.replace('.', os.path.sep)
+ path = path.replace(self.package_name + os.path.sep, '')
+ path = os.path.join(self.root_path, path)
+ # XXX maybe check for extensions as well?
+ if os.path.exists(path + '.py'): # file
+ path += '.py'
+ elif os.path.exists(os.path.join(path, '__init__.py')):
+ path = os.path.join(path, '__init__.py')
+ else:
+ return None
+ return path
+
+ def _path2uri(self, dirpath):
+ ''' Convert directory path to uri '''
+ relpath = dirpath.replace(self.root_path, self.package_name)
+ if relpath.startswith(os.path.sep):
+ relpath = relpath[1:]
+ return relpath.replace(os.path.sep, '.')
+
+ def _parse_module(self, uri):
+ ''' Parse module defined in *uri* '''
+ filename = self._uri2path(uri)
+ if filename is None:
+ # nothing that we could handle here.
+ return ([],[])
+ f = open(filename, 'rt')
+ functions, classes = self._parse_lines(f)
+ f.close()
+ return functions, classes
+
+ def _parse_lines(self, linesource):
+ ''' Parse lines of text for functions and classes '''
+ functions = []
+ classes = []
+ for line in linesource:
+ if line.startswith('def ') and line.count('('):
+ # exclude private stuff
+ name = self._get_object_name(line)
+ if not name.startswith('_'):
+ functions.append(name)
+ elif line.startswith('class '):
+ # exclude private stuff
+ name = self._get_object_name(line)
+ if not name.startswith('_'):
+ classes.append(name)
+ else:
+ pass
+ functions.sort()
+ classes.sort()
+ return functions, classes
+
+ def generate_api_doc(self, uri):
+ '''Make autodoc documentation template string for a module
+
+ Parameters
+ ----------
+ uri : string
+ python location of module - e.g 'sphinx.builder'
+
+ Returns
+ -------
+ S : string
+ Contents of API doc
+ '''
+ # get the names of all classes and functions
+ functions, classes = self._parse_module(uri)
+ if not len(functions) and not len(classes):
+ print 'WARNING: Empty -',uri # dbg
+ return ''
+
+ # Make a shorter version of the uri that omits the package name for
+ # titles
+ uri_short = re.sub(r'^%s\.' % self.package_name,'',uri)
+
+ ad = '.. AUTO-GENERATED FILE -- DO NOT EDIT!\n\n'
+
+ chap_title = uri_short
+ ad += (chap_title+'\n'+ self.rst_section_levels[1] * len(chap_title)
+ + '\n\n')
+
+ # Set the chapter title to read 'module' for all modules except for the
+ # main packages
+ if '.' in uri:
+ title = 'Module: :mod:`' + uri_short + '`'
+ else:
+ title = ':mod:`' + uri_short + '`'
+ ad += title + '\n' + self.rst_section_levels[2] * len(title)
+
+ if len(classes):
+ ad += '\nInheritance diagram for ``%s``:\n\n' % uri
+ ad += '.. inheritance-diagram:: %s \n' % uri
+ ad += ' :parts: 3\n'
+
+ ad += '\n.. automodule:: ' + uri + '\n'
+ ad += '\n.. currentmodule:: ' + uri + '\n'
+ multi_class = len(classes) > 1
+ multi_fx = len(functions) > 1
+ if multi_class:
+ ad += '\n' + 'Classes' + '\n' + \
+ self.rst_section_levels[2] * 7 + '\n'
+ elif len(classes) and multi_fx:
+ ad += '\n' + 'Class' + '\n' + \
+ self.rst_section_levels[2] * 5 + '\n'
+ for c in classes:
+ ad += '\n:class:`' + c + '`\n' \
+ + self.rst_section_levels[multi_class + 2 ] * \
+ (len(c)+9) + '\n\n'
+ ad += '\n.. autoclass:: ' + c + '\n'
+ # must NOT exclude from index to keep cross-refs working
+ ad += ' :members:\n' \
+ ' :undoc-members:\n' \
+ ' :show-inheritance:\n' \
+ '\n' \
+ ' .. automethod:: __init__\n'
+ if multi_fx:
+ ad += '\n' + 'Functions' + '\n' + \
+ self.rst_section_levels[2] * 9 + '\n\n'
+ elif len(functions) and multi_class:
+ ad += '\n' + 'Function' + '\n' + \
+ self.rst_section_levels[2] * 8 + '\n\n'
+ for f in functions:
+ # must NOT exclude from index to keep cross-refs working
+ ad += '\n.. autofunction:: ' + uri + '.' + f + '\n\n'
+ return ad
+
+ def _survives_exclude(self, matchstr, match_type):
+ ''' Returns True if *matchstr* does not match patterns
+
+ ``self.package_name`` removed from front of string if present
+
+ Examples
+ --------
+ >>> dw = ApiDocWriter('sphinx')
+ >>> dw._survives_exclude('sphinx.okpkg', 'package')
+ True
+ >>> dw.package_skip_patterns.append('^\\.badpkg$')
+ >>> dw._survives_exclude('sphinx.badpkg', 'package')
+ False
+ >>> dw._survives_exclude('sphinx.badpkg', 'module')
+ True
+ >>> dw._survives_exclude('sphinx.badmod', 'module')
+ True
+ >>> dw.module_skip_patterns.append('^\\.badmod$')
+ >>> dw._survives_exclude('sphinx.badmod', 'module')
+ False
+ '''
+ if match_type == 'module':
+ patterns = self.module_skip_patterns
+ elif match_type == 'package':
+ patterns = self.package_skip_patterns
+ else:
+ raise ValueError('Cannot interpret match type "%s"'
+ % match_type)
+ # Match to URI without package name
+ L = len(self.package_name)
+ if matchstr[:L] == self.package_name:
+ matchstr = matchstr[L:]
+ for pat in patterns:
+ try:
+ pat.search
+ except AttributeError:
+ pat = re.compile(pat)
+ if pat.search(matchstr):
+ return False
+ return True
+
+ def discover_modules(self):
+ ''' Return module sequence discovered from ``self.package_name``
+
+
+ Parameters
+ ----------
+ None
+
+ Returns
+ -------
+ mods : sequence
+ Sequence of module names within ``self.package_name``
+
+ Examples
+ --------
+ >>> dw = ApiDocWriter('sphinx')
+ >>> mods = dw.discover_modules()
+ >>> 'sphinx.util' in mods
+ True
+ >>> dw.package_skip_patterns.append('\.util$')
+ >>> 'sphinx.util' in dw.discover_modules()
+ False
+ >>>
+ '''
+ modules = [self.package_name]
+ # raw directory parsing
+ for dirpath, dirnames, filenames in os.walk(self.root_path):
+ # Check directory names for packages
+ root_uri = self._path2uri(os.path.join(self.root_path,
+ dirpath))
+ for dirname in dirnames[:]: # copy list - we modify inplace
+ package_uri = '.'.join((root_uri, dirname))
+ if (self._uri2path(package_uri) and
+ self._survives_exclude(package_uri, 'package')):
+ modules.append(package_uri)
+ else:
+ dirnames.remove(dirname)
+ # Check filenames for modules
+ for filename in filenames:
+ module_name = filename[:-3]
+ module_uri = '.'.join((root_uri, module_name))
+ if (self._uri2path(module_uri) and
+ self._survives_exclude(module_uri, 'module')):
+ modules.append(module_uri)
+ return sorted(modules)
+
+ def write_modules_api(self, modules,outdir):
+ # write the list
+ written_modules = []
+ for m in modules:
+ api_str = self.generate_api_doc(m)
+ if not api_str:
+ continue
+ # write out to file
+ outfile = os.path.join(outdir,
+ m + self.rst_extension)
+ fileobj = open(outfile, 'wt')
+ fileobj.write(api_str)
+ fileobj.close()
+ written_modules.append(m)
+ self.written_modules = written_modules
+
+ def write_api_docs(self, outdir):
+ """Generate API reST files.
+
+ Parameters
+ ----------
+ outdir : string
+ Directory name in which to store files
+ We create automatic filenames for each module
+
+ Returns
+ -------
+ None
+
+ Notes
+ -----
+ Sets self.written_modules to list of written modules
+ """
+ if not os.path.exists(outdir):
+ os.mkdir(outdir)
+ # compose list of modules
+ modules = self.discover_modules()
+ self.write_modules_api(modules,outdir)
+
+ def write_index(self, outdir, froot='gen', relative_to=None):
+ """Make a reST API index file from written files
+
+ Parameters
+ ----------
+ path : string
+ Filename to write index to
+ outdir : string
+ Directory to which to write generated index file
+ froot : string, optional
+ root (filename without extension) of filename to write to
+ Defaults to 'gen'. We add ``self.rst_extension``.
+ relative_to : string
+ path to which written filenames are relative. This
+ component of the written file path will be removed from
+ outdir, in the generated index. Default is None, meaning,
+ leave path as it is.
+ """
+ if self.written_modules is None:
+ raise ValueError('No modules written')
+ # Get full filename path
+ path = os.path.join(outdir, froot+self.rst_extension)
+ # Path written into index is relative to rootpath
+ if relative_to is not None:
+ relpath = outdir.replace(relative_to + os.path.sep, '')
+ else:
+ relpath = outdir
+ idx = open(path,'wt')
+ w = idx.write
+ w('.. AUTO-GENERATED FILE -- DO NOT EDIT!\n\n')
+ w('.. toctree::\n\n')
+ for f in self.written_modules:
+ w(' %s\n' % os.path.join(relpath,f))
+ idx.close()
Added: trunk/py4science/examples/sphinx_qs/sphinxext/docscrape.py
===================================================================
--- trunk/py4science/examples/sphinx_qs/sphinxext/docscrape.py (rev 0)
+++ trunk/py4science/examples/sphinx_qs/sphinxext/docscrape.py 2009-08-11 10:59:31 UTC (rev 7456)
@@ -0,0 +1,497 @@
+"""Extract reference documentation from the NumPy source tree.
+
+"""
+
+import inspect
+import textwrap
+import re
+import pydoc
+from StringIO import StringIO
+from warnings import warn
+4
+class Reader(object):
+ """A line-based string reader.
+
+ """
+ def __init__(self, data):
+ """
+ Parameters
+ ----------
+ data : str
+ String with lines separated by '\n'.
+
+ """
+ if isinstance(data,list):
+ self._str = data
+ else:
+ self._str = data.split('\n') # store string as list of lines
+
+ self.reset()
+
+ def __getitem__(self, n):
+ return self._str[n]
+
+ def reset(self):
+ self._l = 0 # current line nr
+
+ def read(self):
+ if not self.eof():
+ out = self[self._l]
+ self._l += 1
+ return out
+ else:
+ return ''
+
+ def seek_next_non_empty_line(self):
+ for l in self[self._l:]:
+ if l.strip():
+ break
+ else:
+ self._l += 1
+
+ def eof(self):
+ return self._l >= len(self._str)
+
+ def read_to_condition(self, condition_func):
+ start = self._l
+ for line in self[start:]:
+ if condition_func(line):
+ return self[start:self._l]
+ self._l += 1
+ if self.eof():
+ return self[start:self._l+1]
+ return []
+
+ def read_to_next_empty_line(self):
+ self.seek_next_non_empty_line()
+ def is_empty(line):
+ return not line.strip()
+ return self.read_to_condition(is_empty)
+
+ def read_to_next_unindented_line(self):
+ def is_unindented(line):
+ return (line.strip() and (len(line.lstrip()) == len(line)))
+ return self.read_to_condition(is_unindented)
+
+ def peek(self,n=0):
+ if self._l + n < len(self._str):
+ return self[self._l + n]
+ else:
+ return ''
+
+ def is_empty(self):
+ return not ''.join(self._str).strip()
+
+
+class NumpyDocString(object):
+ def __init__(self,docstring):
+ docstring = textwrap.dedent(docstring).split('\n')
+
+ self._doc = Reader(docstring)
+ self._parsed_data = {
+ 'Signature': '',
+ 'Summary': [''],
+ 'Extended Summary': [],
+ 'Parameters': [],
+ 'Returns': [],
+ 'Raises': [],
+ 'Warns': [],
+ 'Other Parameters': [],
+ 'Attributes': [],
+ 'Methods': [],
+ 'See Also': [],
+ 'Notes': [],
+ 'Warnings': [],
+ 'References': '',
+ 'Examples': '',
+ 'index': {}
+ }
+
+ self._parse()
+
+ def __getitem__(self,key):
+ return self._parsed_data[key]
+
+ def __setitem__(self,key,val):
+ if not self._parsed_data.has_key(key):
+ warn("Unknown section %s" % key)
+ else:
+ self._parsed_data[key] = val
+
+ def _is_at_section(self):
+ self._doc.seek_next_non_empty_line()
+
+ if self._doc.eof():
+ return False
+
+ l1 = self._doc.peek().strip() # e.g. Parameters
+
+ if l1.startswith('.. index::'):
+ return True
+
+ l2 = self._doc.peek(1).strip() # ---------- or ==========
+ return l2.startswith('-'*len(l1)) or l2.startswith('='*len(l1))
+
+ def _strip(self,doc):
+ i = 0
+ j = 0
+ for i,line in enumerate(doc):
+ if line.strip(): break
+
+ for j,line in enumerate(doc[::-1]):
+ if line.strip(): break
+
+ return doc[i:len(doc)-j]
+
+ def _read_to_next_section(self):
+ section = self._doc.read_to_next_empty_line()
+
+ while not self._is_at_section() and not self._doc.eof():
+ if not self._doc.peek(-1).strip(): # previous line was empty
+ section += ['']
+
+ section += self._doc.read_to_next_empty_line()
+
+ return section
+
+ def _read_sections(self):
+ while not self._doc.eof():
+ data = self._read_to_next_section()
+ name = data[0].strip()
+
+ if name.startswith('..'): # index section
+ yield name, data[1:]
+ elif len(data) < 2:
+ yield StopIteration
+ else:
+ yield name, self._strip(data[2:])
+
+ def _parse_param_list(self,content):
+ r = Reader(content)
+ params = []
+ while not r.eof():
+ header = r.read().strip()
+ if ' : ' in header:
+ arg_name, arg_type = header.split(' : ')[:2]
+ else:
+ arg_name, arg_type = header, ''
+
+ desc = r.read_to_next_unindented_line()
+ desc = dedent_lines(desc)
+
+ params.append((arg_name,arg_type,desc))
+
+ return params
+
+
+ _name_rgx = re.compile(r"^\s*(:(?P<role>\w+):`(?P<name>[a-zA-Z0-9_.-]+)`|"
+ r" (?P<name2>[a-zA-Z0-9_.-]+))\s*", re.X)
+ def _parse_see_also(self, content):
+ """
+ func_name : Descriptive text
+ continued text
+ another_func_name : Descriptive text
+ func_name1, func_name2, :meth:`func_name`, func_name3
+
+ """
+ items = []
+
+ def parse_item_name(text):
+ """Match ':role:`name`' or 'name'"""
+ m = self._name_rgx.match(text)
+ if m:
+ g = m.groups()
+ if g[1] is None:
+ return g[3], None
+ else:
+ return g[2], g[1]
+ raise ValueError("%s is not a item name" % text)
+
+ def push_item(name, rest):
+ if not name:
+ return
+ name, role = parse_item_name(name)
+ items.append((name, list(rest), role))
+ del rest[:]
+
+ current_func = None
+ rest = []
+
+ for line in content:
+ if not line.strip(): continue
+
+ m = self._name_rgx.match(line)
+ if m and line[m.end():].strip().startswith(':'):
+ push_item(current_func, rest)
+ current_func, line = line[:m.end()], line[m.end():]
+ rest = [line.split(':', 1)[1].strip()]
+ if not rest[0]:
+ rest = []
+ elif not line.startswith(' '):
+ push_item(current_func, rest)
+ current_func = None
+ if ',' in line:
+ for func in line.split(','):
+ push_item(func, [])
+ elif line.strip():
+ current_func = line
+ elif current_func is not None:
+ rest.append(line.strip())
+ push_item(current_func, rest)
+ return items
+
+ def _parse_index(self, section, content):
+ """
+ .. index: default
+ :refguide: something, else, and more
+
+ """
+ def strip_each_in(lst):
+ return [s.strip() for s in lst]
+
+ out = {}
+ section = section.split('::')
+ if len(section) > 1:
+ out['default'] = strip_each_in(section[1].split(','))[0]
+ for line in content:
+ line = line.split(':')
+ if len(line) > 2:
+ out[line[1]] = strip_each_in(line[2].split(','))
+ return out
+
+ def _parse_summary(self):
+ """Grab signature (if given) and summary"""
+ if self._is_at_section():
+ return
+
+ summary = self._doc.read_to_next_empty_line()
+ summary_str = " ".join([s.strip() for s in summary]).strip()
+ if re.compile('^([\w., ]+=)?\s*[\w\.]+\(.*\)$').match(summary_str):
+ self['Signature'] = summary_str
+ if not self._is_at_section():
+ self['Summary'] = self._doc.read_to_next_empty_line()
+ else:
+ self['Summary'] = summary
+
+ if not self._is_at_section():
+ self['Extended Summary'] = self._read_to_next_section()
+
+ def _parse(self):
+ self._doc.reset()
+ self._parse_summary()
+
+ for (section,content) in self._read_sections():
+ if not section.startswith('..'):
+ section = ' '.join([s.capitalize() for s in section.split(' ')])
+ if section in ('Parameters', 'Attributes', 'Methods',
+ 'Returns', 'Raises', 'Warns'):
+ self[section] = self._parse_param_list(content)
+ elif section.startswith('.. index::'):
+ self['index'] = self._parse_index(section, content)
+ elif section == 'See Also':
+ self['See Also'] = self._parse_see_also(content)
+ else:
+ self[section] = content
+
+ # string conversion routines
+
+ def _str_header(self, name, symbol='-'):
+ return [name, len(name)*symbol]
+
+ def _str_indent(self, doc, indent=4):
+ out = []
+ for line in doc:
+ out += [' '*indent + line]
+ return out
+
+ def _str_signature(self):
+ if self['Signature']:
+ return [self['Signature'].replace('*','\*')] + ['']
+ else:
+ return ['']
+
+ def _str_summary(self):
+ if self['Summary']:
+ return self['Summary'] + ['']
+ else:
+ return []
+
+ def _str_extended_summary(self):
+ if self['Extended Summary']:
+ return self['Extended Summary'] + ['']
+ else:
+ return []
+
+ def _str_param_list(self, name):
+ out = []
+ if self[name]:
+ out += self._str_header(name)
+ for param,param_type,desc in self[name]:
+ out += ['%s : %s' % (param, param_type)]
+ out += self._str_indent(desc)
+ out += ['']
+ return out
+
+ def _str_section(self, name):
+ out = []
+ if self[name]:
+ out += self._str_header(name)
+ out += self[name]
+ out += ['']
+ return out
+
+ def _str_see_also(self, func_role):
+ if not self['See Also']: return []
+ out = []
+ out += self._str_header("See Also")
+ last_had_desc = True
+ for func, desc, role in self['See Also']:
+ if role:
+ link = ':%s:`%s`' % (role, func)
+ elif func_role:
+ link = ':%s:`%s`' % (func_role, func)
+ else:
+ link = "`%s`_" % func
+ if desc or last_had_desc:
+ out += ['']
+ out += [link]
+ else:
+ out[-1] += ", %s" % link
+ if desc:
+ out += self._str_indent([' '.join(desc)])
+ last_had_desc = True
+ else:
+ last_had_desc = False
+ out += ['']
+ return out
+
+ def _str_index(self):
+ idx = self['index']
+ out = []
+ out += ['.. index:: %s' % idx.get('default','')]
+ for section, references in idx.iteritems():
+ if section == 'default':
+ continue
+ out += [' :%s: %s' % (section, ', '.join(references))]
+ return out
+
+ def __str__(self, func_role=''):
+ out = []
+ out += self._str_signature()
+ out += self._str_summary()
+ out += self._str_extended_summary()
+ for param_list in ('Parameters','Returns','Raises'):
+ out += self._str_param_list(param_list)
+ out += self._str_section('Warnings')
+ out += self._str_see_also(func_role)
+ for s in ('Notes','References','Examples'):
+ out += self._str_section(s)
+ out += self._str_index()
+ return '\n'.join(out)
+
+
+def indent(str,indent=4):
+ indent_str = ' '*indent
+ if str is None:
+ return indent_str
+ lines = str.split('\n')
+ return '\n'.join(indent_str + l for l in lines)
+
+def dedent_lines(lines):
+ """Deindent a list of lines maximally"""
+ return textwrap.dedent("\n".join(lines)).split("\n")
+
+def header(text, style='-'):
+ return text + '\n' + style*len(text) + '\n'
+
+
+class FunctionDoc(NumpyDocString):
+ def __init__(self, func, role='func', doc=None):
+ self._f = func
+ self._role = role # e.g. "func" or "meth"
+ if doc is None:
+ doc = inspect.getdoc(func) or ''
+ try:
+ NumpyDocString.__init__(self, doc)
+ except ValueError, e:
+ print '*'*78
+ print "ERROR: '%s' while parsing `%s`" % (e, self._f)
+ print '*'*78
+ #print "Docstring follows:"
+ #print doclines
+ #print '='*78
+
+ if not self['Signature']:
+ func, func_name = self.get_func()
+ try:
+ # try to read signature
+ argspec = inspect.getargspec(func)
+ argspec = inspect.formatargspec(*argspec)
+ argspec = argspec.replace('*','\*')
+ signature = '%s%s' % (func_name, argspec)
+ except TypeError, e:
+ signature = '%s()' % func_name
+ self['Signature'] = signature
+
+ def get_func(self):
+ func_name = getattr(self._f, '__name__', self.__class__.__name__)
+ if inspect.isclass(self._f):
+ func = getattr(self._f, '__call__', self._f.__init__)
+ else:
+ func = self._f
+ return func, func_name
+
+ def __str__(self):
+ out = ''
+
+ func, func_name = self.get_func()
+ signature = self['Signature'].replace('*', '\*')
+
+ roles = {'func': 'function',
+ 'meth': 'method'}
+
+ if self._role:
+ if not roles.has_key(self._role):
+ print "Warning: invalid role %s" % self._role
+ out += '.. %s:: %s\n \n\n' % (roles.get(self._role,''),
+ func_name)
+
+ out += super(FunctionDoc, self).__str__(func_role=self._role)
+ return out
+
+
+class ClassDoc(NumpyDocString):
+ def __init__(self,cls,modulename='',func_doc=FunctionDoc,doc=None):
+ if not inspect.isclass(cls):
+ raise ValueError("Initialise using a class. Got %r" % cls)
+ self._cls = cls
+
+ if modulename and not modulename.endswith('.'):
+ modulename += '.'
+ self._mod = modulename
+ self._name = cls.__name__
+ self._func_doc = func_doc
+
+ if doc is None:
+ doc = pydoc.getdoc(cls)
+
+ NumpyDocString.__init__(self, doc)
+
+ @property
+ def methods(self):
+ return [name for name,func in inspect.getmembers(self._cls)
+ if not name.startswith('_') and callable(func)]
+
+ def __str__(self):
+ out = ''
+ out += super(ClassDoc, self).__str__()
+ out += "\n\n"
+
+ #for m in self.methods:
+ # print "Parsing `%s`" % m
+ # out += str(self._func_doc(getattr(self._cls,m), 'meth')) + '\n\n'
+ # out += '.. index::\n single: %s; %s\n\n' % (self._name, m)
+
+ return out
+
+
Added: trunk/py4science/examples/sphinx_qs/sphinxext/docscrape_sphinx.py
===================================================================
--- trunk/py4science/examples/sphinx_qs/sphinxext/docscrape_sphinx.py (rev 0)
+++ trunk/py4science/examples/sphinx_qs/sphinxext/docscrape_sphinx.py 2009-08-11 10:59:31 UTC (rev 7456)
@@ -0,0 +1,136 @@
+import re, inspect, textwrap, pydoc
+from docscrape import NumpyDocString, FunctionDoc, ClassDoc
+
+class SphinxDocString(NumpyDocString):
+ # string conversion routines
+ def _str_header(self, name, symbol='`'):
+ return ['.. rubric:: ' + name, '']
+
+ def _str_field_list(self, name):
+ return [':' + name + ':']
+
+ def _str_indent(self, doc, indent=4):
+ out = []
+ for line in doc:
+ out += [' '*indent + line]
+ return out
+
+ def _str_signature(self):
+ return ['']
+ if self['Signature']:
+ return ['``%s``' % self['Signature']] + ['']
+ else:
+ return ['']
+
+ def _str_summary(self):
+ return self['Summary'] + ['']
+
+ def _str_extended_summary(self):
+ return self['Extended Summary'] + ['']
+
+ def _str_param_list(self, name):
+ out = []
+ if self[name]:
+ out += self._str_field_list(name)
+ out += ['']
+ for param,param_type,desc in self[name]:
+ out += self._str_indent(['**%s** : %s' % (param.strip(),
+ param_type)])
+ out += ['']
+ out += self._str_indent(desc,8)
+ out += ['']
+ return out
+
+ def _str_section(self, name):
+ out = []
+ if self[name]:
+ out += self._str_header(name)
+ out += ['']
+ content = textwrap.dedent("\n".join(self[name])).split("\n")
+ out += content
+ out += ['']
+ return out
+
+ def _str_see_also(self, func_role):
+ out = []
+ if self['See Also']:
+ see_also = super(SphinxDocString, self)._str_see_also(func_role)
+ out = ['.. seealso::', '']
+ out += self._str_indent(see_also[2:])
+ return out
+
+ def _str_warnings(self):
+ out = []
+ if self['Warnings']:
+ out = ['.. warning::', '']
+ out += self._str_indent(self['Warnings'])
+ return out
+
+ def _str_index(self):
+ idx = self['index']
+ out = []
+ if len(idx) == 0:
+ return out
+
+ out += ['.. index:: %s' % idx.get('default','')]
+ for section, references in idx.iteritems():
+ if section == 'default':
+ continue
+ elif section == 'refguide':
+ out += [' single: %s' % (', '.join(references))]
+ else:
+ out += [' %s: %s' % (section, ','.join(references))]
+ return out
+
+ def _str_references(self):
+ out = []
+ if self['References']:
+ out += self._str_header('References')
+ if isinstance(self['References'], str):
+ self['References'] = [self['References']]
+ out.extend(self['References'])
+ out += ['']
+ return out
+
+ def __str__(self, indent=0, func_role="obj"):
+ out = []
+ out += self._str_signature()
+ out += self._str_index() + ['']
+ out += self._str_summary()
+ out += self._str_extended_summary()
+ for param_list in ('Parameters', 'Attributes', 'Methods',
+ 'Returns','Raises'):
+ out += self._str_param_list(param_list)
+ out += self._str_warnings()
+ out += self._str_see_also(func_role)
+ out += self._str_section('Notes')
+ out += self._str_references()
+ out += self._str_section('Examples')
+ out = self._str_indent(out,indent)
+ return '\n'.join(out)
+
+class SphinxFunctionDoc(SphinxDocString, FunctionDoc):
+ pass
+
+class SphinxClassDoc(SphinxDocString, ClassDoc):
+ pass
+
+def get_doc_object(obj, what=None, doc=None):
+ if what is None:
+ if inspect.isclass(obj):
+ what = 'class'
+ elif inspect.ismodule(obj):
+ what = 'module'
+ elif callable(obj):
+ what = 'function'
+ else:
+ what = 'object'
+ if what == 'class':
+ return SphinxClassDoc(obj, '', func_doc=SphinxFunctionDoc, doc=doc)
+ elif what in ('function', 'method'):
+ return SphinxFunctionDoc(obj, '', doc=doc)
+ else:
+ if doc is None:
+ doc = pydoc.getdoc(obj)
+ return SphinxDocString(doc)
+
Added: trunk/py4science/examples/sphinx_qs/sphinxext/inheritance_diagram.py
===================================================================
--- trunk/py4science/examples/sphinx_qs/sphinxext/inheritance_diagram.py (rev 0)
+++ trunk/py4science/examples/sphinx_qs/sphinxext/inheritance_diagram.py 2009-08-11 10:59:31 UTC (rev 7456)
@@ -0,0 +1,407 @@
+"""
+Defines a docutils directive for inserting inheritance diagrams.
+
+Provide the directive with one or more classes or modules (separated
+by whitespace). For modules, all of the classes in that module will
+be used.
+
+Example::
+
+ Given the following classes:
+
+ class A: pass
+ class B(A): pass
+ class C(A): pass
+ class D(B, C): pass
+ class E(B): pass
+
+ .. inheritance-diagram: D E
+
+ Produces a graph like the following:
+
+ A
+ / \
+ B C
+ / \ /
+ E D
+
+The graph is inserted as a PNG+image map into HTML and a PDF in
+LaTeX.
+"""
+
+import inspect
+import os
+import re
+import subprocess
+try:
+ from hashlib import md5
+except ImportError:
+ from md5 import md5
+
+from docutils.nodes import Body, Element
+from docutils.parsers.rst import directives
+from sphinx.roles import xfileref_role
+
+def my_import(name):
+ """Module importer - taken from the python documentation.
+
+ This function allows importing names with dots in them."""
+
+ mod = __import__(name)
+ components = name.split('.')
+ for comp in components[1:]:
+ mod = getattr(mod, comp)
+ return mod
+
+class DotException(Exception):
+ pass
+
+class InheritanceGraph(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, class_names, show_builtins=False):
+ """
+ *class_names* is a list of child classes to show bases from.
+
+ If *show_builtins* is True, then Python builtins will be shown
+ in the graph.
+ """
+ self.class_names = class_names
+ self.classes = self._import_classes(class_names)
+ self.all_classes = self._all_classes(self.classes)
+ if len(self.all_classes) == 0:
+ raise ValueError("No classes found for inheritance diagram")
+ self.show_builtins = show_builtins
+
+ py_sig_re = re.compile(r'''^([\w.]*\.)? # class names
+ (\w+) \s* $ # optionally arguments
+ ''', re.VERBOSE)
+
+ def _import_class_or_module(self, name):
+ """
+ Import a class using its fully-qualified *name*.
+ """
+ try:
+ path, base = self.py_sig_re.match(name).groups()
+ except:
+ raise ValueError(
+ "Invalid class or module '%s' specified for inheritance diagram" % name)
+ fullname = (path or '') + base
+ path = (path and path.rstrip('.'))
+ if not path:
+ path = base
+ try:
+ module = __import__(path, None, None, [])
+ # We must do an import of the fully qualified name. Otherwise if a
+ # subpackage 'a.b' is requested where 'import a' does NOT provide
+ # 'a.b' automatically, then 'a.b' will not be found below. This
+ # second call will force the equivalent of 'import a.b' to happen
+ # after the top-level import above.
+ my_import(fullname)
+
+ except ImportError:
+ raise ValueError(
+ "Could not import class or module '%s' specified for inheritance diagram" % name)
+
+ try:
+ todoc = module
+ for comp in fullname.split('.')[1:]:
+ todoc = getattr(todoc, comp)
+ except AttributeError:
+ raise ValueError(
+ "Could not find class or module '%s' specified for inheritance diagram" % name)
+
+ # If a class, just return it
+ if inspect.isclass(todoc):
+ return [todoc]
+ elif inspect.ismodule(todoc):
+ classes = []
+ for cls in todoc.__dict__.values():
+ if inspect.isclass(cls) and cls.__module__ == todoc.__name__:
+ classes.append(cls)
+ return classes
+ raise ValueError(
+ "'%s' does not resolve to a class or module" % name)
+
+ def _import_classes(self, class_names):
+ """
+ Import a list of classes.
+ """
+ classes = []
+ for name in class_names:
+ classes.extend(self._import_class_or_module(name))
+ return classes
+
+ def _all_classes(self, classes):
+ """
+ Return a list of all classes that are ancestors of *classes*.
+ """
+ all_classes = {}
+
+ def recurse(cls):
+ all_classes[cls] = None
+ for c in cls.__bases__:
+ if c not in all_classes:
+ recurse(c)
+
+ for cls in classes:
+ recurse(cls)
+
+ return all_classes.keys()
+
+ def class_name(self, cls, parts=0):
+ """
+ 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__)
+ if parts == 0:
+ return fullname
+ name_parts = fullname.split('.')
+ return '.'.join(name_parts[-parts:])
+
+ def get_all_class_names(self):
+ """
+ Get all of the class names involved in the graph.
+ """
+ return [self.class_name(x) for x in self.all_classes]
+
+ # These are the default options for graphviz
+ default_graph_options = {
+ "rankdir": "LR",
+ "size": '"8.0, 12.0"'
+ }
+ default_node_options = {
+ "shape": "box",
+ "fontsize": 10,
+ "height": 0.25,
+ "fontname": "Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",
+ "style": '"setlinewidth(0.5)"'
+ }
+ default_edge_options = {
+ "arrowsize": 0.5,
+ "style": '"setlinewidth(0.5)"'
+ }
+
+ def _format_node_options(self, options):
+ return ','.join(["%s=%s" % x for x in options.items()])
+ def _format_graph_options(self, options):
+ return ''.join(["%s=%s;\n" % x for x in options.items()])
+
+ def generate_dot(self, fd, name, parts=0, urls={},
+ graph_options={}, node_options={},
+ edge_options={}):
+ """
+ Generate a graphviz dot graph from the classes that
+ were passed in to __init__.
+
+ *fd* is a Python file-like object to write to.
+
+ *name* is the name of the graph
+
+ *urls* is a dictionary mapping class names to http urls
+
+ *graph_options*, *node_options*, *edge_options* are
+ dictionaries containing key/value pairs to pass on as graphviz
+ properties.
+ """
+ g_options = self.default_graph_options.copy()
+ g_options.update(graph_options)
+ n_options = self.default_node_options.copy()
+ n_options.update(node_options)
+ e_options = self.default_edge_options.copy()
+ e_options.update(edge_options)
+
+ fd.write('digraph %s {\n' % name)
+ fd.write(self._format_graph_options(g_options))
+
+ for cls in self.all_classes:
+ if not self.show_builtins and cls in __builtins__.values():
+ continue
+
+ name = self.class_name(cls, parts)
+
+ # Write the node
+ this_node_options = n_options.copy()
+ url = urls.get(self.class_name(cls))
+ if url is not None:
+ this_node_options['URL'] = '"%s"' % url
+ fd.write(' "%s" [%s];\n' %
+ (name, self._format_node_options(this_node_options)))
+
+ # Write the edges
+ for base in cls.__bases__:
+ if not self.show_builtins and base in __builtins__.values():
+ continue
+
+ base_name = self.class_name(base, parts)
+ fd.write(' "%s" -> "%s" [%s];\n' %
+ (base_name, name,
+ self._format_node_options(e_options)))
+ fd.write('}\n')
+
+ def run_dot(self, args, name, parts=0, urls={},
+ graph_options={}, node_options={}, edge_options={}):
+ """
+ Run graphviz 'dot' over this graph, returning whatever 'dot'
+ writes to stdout.
+
+ *args* will be passed along as commandline arguments.
+
+ *name* is the name of the graph
+
+ *urls* is a dictionary mapping class names to http urls
+
+ Raises DotException for any of the many os and
+ installation-related errors that may occur.
+ """
+ try:
+ dot = subprocess.Popen(['dot'] + list(args),
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+ close_fds=True)
+ except OSError:
+ raise DotException("Could not execute 'dot'. Are you sure you have 'graphviz' installed?")
+ except ValueError:
+ raise DotException("'dot' called with invalid arguments")
+ except:
+ raise DotException("Unexpected error calling 'dot'")
+
+ self.generate_dot(dot.stdin, name, parts, urls, graph_options,
+ node_options, edge_options)
+ dot.stdin.close()
+ result = dot.stdout.read()
+ returncode = dot.wait()
+ if returncode != 0:
+ raise DotException("'dot' returned the errorcode %d" % returncode)
+ return result
+
+class inheritance_diagram(Body, Element):
+ """
+ A docutils node to use as a placeholder for the inheritance
+ diagram.
+ """
+ pass
+
+def inheritance_diagram_directive(name, arguments, options, content, lineno,
+ content_offset, block_text, state,
+ state_machine):
+ """
+ Run when the inheritance_diagram directive is first encountered.
+ """
+ node = inheritance_diagram()
+
+ class_names = arguments
+
+ # Create a graph starting with the list of classes
+ graph = InheritanceGraph(class_names)
+
+ # Create xref nodes for each target of the graph's image map and
+ # add them to the doc tree so that Sphinx can resolve the
+ # references to real URLs later. These nodes will eventually be
+ # removed from the doctree after we're done with them.
+ for name in graph.get_all_class_names():
+ refnodes, x = xfileref_role(
+ 'class', ':class:`%s`' % name, name, 0, state)
+ node.extend(refnodes)
+ # Store the graph object so we can use it to generate the
+ # dot file later
+ node['graph'] = graph
+ # Store the original content for use as a hash
+ node['parts'] = options.get('parts', 0)
+ node['content'] = " ".join(class_names)
+ return [node]
+
+def get_graph_hash(node):
+ return md5(node['content'] + str(node['parts'])).hexdigest()[-10:]
+
+def html_output_graph(self, node):
+ """
+ Output the graph for HTML. This will insert a PNG with clickable
+ image map.
+ """
+ graph = node['graph']
+ parts = node['parts']
+
+ graph_hash = get_graph_hash(node)
+ name = "inheritance%s" % graph_hash
+ path = '_images'
+ dest_path = os.path.join(setup.app.builder.outdir, path)
+ if not os.path.exists(dest_path):
+ os.makedirs(dest_path)
+ png_path = os.path.join(dest_path, name + ".png")
+ path = setup.app.builder.imgpath
+
+ # Create a mapping from fully-qualified class names to URLs.
+ urls = {}
+ for child in node:
+ if child.get('refuri') is not None:
+ urls[child['reftitle']] = child.get('refuri')
+ elif child.get('refid') is not None:
+ urls[child['reftitle']] = '#' + child.get('refid')
+
+ # These arguments to dot will save a PNG file to disk and write
+ # an HTML image map to stdout.
+ image_map = graph.run_dot(['-Tpng', '-o%s' % png_path, '-Tcmapx'],
+ name, parts, urls)
+ return ('<img src="%s/%s.png" usemap="#%s" class="inheritance"/>%s' %
+ (path, name, name, image_map))
+
+def latex_output_graph(self, node):
+ """
+ Output the graph for LaTeX. This will insert a PDF.
+ """
+ graph = node['graph']
+ parts = node['parts']
+
+ graph_hash = get_graph_hash(node)
+ name = "inheritance%s" % graph_hash
+ dest_path = os.path.abspath(os.path.join(setup.app.builder.outdir, '_images'))
+ if not os.path.exists(dest_path):
+ os.makedirs(dest_path)
+ pdf_path = os.path.abspath(os.path.join(dest_path, name + ".pdf"))
+
+ graph.run_dot(['-Tpdf', '-o%s' % pdf_path],
+ name, parts, graph_options={'size': '"6.0,6.0"'})
+ return '\n\\includegraphics{%s}\n\n' % pdf_path
+
+def visit_inheritance_diagram(inner_func):
+ """
+ This is just a wrapper around html/latex_output_graph to make it
+ easier to handle errors and insert warnings.
+ """
+ def visitor(self, node):
+ try:
+ content = inner_func(self, node)
+ except DotException, e:
+ # Insert the exception as a warning in the document
+ warning = self.document.reporter.warning(str(e), line=node.line)
+ warning.parent = node
+ node.children = [warning]
+ else:
+ source = self.document.attributes['source']
+ self.body.append(content)
+ node.children = []
+ return visitor
+
+def do_nothing(self, node):
+ pass
+
+def setup(app):
+ setup.app = app
+ setup.confdir = app.confdir
+
+ app.add_node(
+ inheritance_diagram,
+ latex=(visit_inheritance_diagram(latex_output_graph), do_nothing),
+ html=(visit_inheritance_diagram(html_output_graph), do_nothing))
+ app.add_directive(
+ 'inheritance-diagram', inheritance_diagram_directive,
+ False, (1, 100, 0), parts = directives.nonnegative_int)
Added: trunk/py4science/examples/sphinx_qs/sphinxext/ipython_console_highlighting.py
===================================================================
--- trunk/py4science/examples/sphinx_qs/sphinxext/ipython_console_highlighting.py (rev 0)
+++ trunk/py4science/examples/sphinx_qs/sphinxext/ipython_console_highlighting.py 2009-08-11 10:59:31 UTC (rev 7456)
@@ -0,0 +1,98 @@
+"""reST directive for syntax-highlighting ipython interactive sessions.
+"""
+
+#-----------------------------------------------------------------------------
+# Needed modules
+
+# Standard library
+import re
+
+# Third party
+from pygments.lexer import Lexer, do_insertions
+from pygments.lexers.agile import (PythonConsoleLexer, PythonLexer,
+ PythonTracebackLexer)
+from pygments.token import Comment, Generic
+
+from sphinx import highlighting
+
+
+#-----------------------------------------------------------------------------
+# Global constants
+line_re = re.compile('.*?\n')
+
+#-----------------------------------------------------------------------------
+# Code begins - classes and functions
+
+class IPythonConsoleLexer(Lexer):
+ """
+ For IPython console output or doctests, such as:
+
+ .. sourcecode:: ipython
+
+ In [1]: a = 'foo'
+
+ In [2]: a
+ Out[2]: 'foo'
+
+ In [3]: print a
+ foo
+
+ In [4]: 1 / 0
+
+ Notes:
+
+ - Tracebacks are not currently supported.
+
+ - It assumes the default IPython prompts, not customized ones.
+ """
+
+ name = 'IPython console session'
+ aliases = ['ipython']
+ mimetypes = ['text/x-ipython-console']
+ input_prompt = re.compile("(In \[[0-9]+\]: )|( \.\.\.+:)")
+ output_prompt = re.compile("(Out\[[0-9]+\]: )|( \.\.\.+:)")
+ continue_prompt = re.compile(" \.\.\.+:")
+ tb_start = re.compile("\-+")
+
+ def get_tokens_unprocessed(self, text):
+ pylexer = PythonLexer(**self.options)
+ tblexer = PythonTracebackLexer(**self.options)
+
+ curcode = ''
+ insertions = []
+ for match in line_re.finditer(text):
+ line = match.group()
+ input_prompt = self.input_prompt.match(line)
+ continue_prompt = self.continue_prompt.match(line.rstrip())
+ output_prompt = self.output_prompt.match(line)
+ if line.startswith("#"):
+ insertions.append((len(curcode),
+ [(0, Comment, line)]))
+ elif input_prompt is not None:
+ insertions.append((len(curcode),
+ [(0, Generic.Prompt, input_prompt.group())]))
+ curcode += line[input_prompt.end():]
+ elif continue_prompt is not None:
+ insertions.append((len(curcode),
+ [(0, Generic.Prompt, continue_prompt.group())]))
+ curcode += line[continue_prompt.end():]
+ elif output_prompt is not None:
+ insertions.append((len(curcode),
+ [(0, Generic.Output, output_prompt.group())]))
+ curcode += line[output_prompt.end():]
+ else:
+ if curcode:
+ for item in do_insertions(insertions,
+ pylexer.get_tokens_unprocessed(curcode)):
+ yield item
+ curcode = ''
+ insertions = []
+ yield match.start(), Generic.Output, line
+ if curcode:
+ for item in do_insertions(insertions,
+ pylexer.get_tokens_unprocessed(curcode)):
+ yield item
+
+#-----------------------------------------------------------------------------
+# Register the extension as a valid pygments lexer
+highlighting.lexers['ipython'] = IPythonConsoleLexer()
Added: trunk/py4science/examples/sphinx_qs/sphinxext/numpydoc.py
===================================================================
--- trunk/py4science/examples/sphinx_qs/sphinxext/numpydoc.py (rev 0)
+++ trunk/py4science/examples/sphinx_qs/sphinxext/numpydoc.py 2009-08-11 10:59:31 UTC (rev 7456)
@@ -0,0 +1,116 @@
+"""
+========
+numpydoc
+========
+
+Sphinx extension that handles docstrings in the Numpy standard format. [1]
+
+It will:
+
+- Convert Parameters etc. sections to field lists.
+- Convert See Also section to a See also entry.
+- Renumber references.
+- Extract the signature from the docstring, if it can't be determined otherwise.
+
+.. [1] http://projects.scipy.org/scipy/numpy/wiki/CodingStyleGuidelines#docstring-standard
+
+"""
+
+import os, re, pydoc
+from docscrape_sphinx import get_doc_object, SphinxDocString
+import inspect
+
+def mangle_docstrings(app, what, name, obj, options, lines,
+ reference_offset=[0]):
+ if what == 'module':
+ # Strip top title
+ title_re = re.compile(r'^\s*[#*=]{4,}\n[a-z0-9 -]+\n[#*=]{4,}\s*',
+ re.I|re.S)
+ lines[:] = title_re.sub('', "\n".join(lines)).split("\n")
+ else:
+ doc = get_doc_object(obj, what, "\n".join(lines))
+ lines[:] = str(doc).split("\n")
+
+ if app.config.numpydoc_edit_link and hasattr(obj, '__name__') and \
+ obj.__name__:
+ if hasattr(obj, '__module__'):
+ v = dict(full_name="%s.%s" % (obj.__module__, obj.__name__))
+ else:
+ v = dict(full_name=obj.__name__)
+ lines += ['', '.. htmlonly::', '']
+ lines += [' %s' % x for x in
+ (app.config.numpydoc_edit_link % v).split("\n")]
+
+ # replace reference numbers so that there are no duplicates
+ references = []
+ for l in lines:
+ l = l.strip()
+ if l.startswith('.. ['):
+ try:
+ references.append(int(l[len('.. ['):l.index(']')]))
+ except ValueError:
+ print "WARNING: invalid reference in %s docstring" % name
+
+ # Start renaming from the biggest number, otherwise we may
+ # overwrite references.
+ references.sort()
+ if references:
+ for i, line in enumerate(lines):
+ for r in references:
+ new_r = reference_offset[0] + r
+ lines[i] = lines[i].replace('[%d]_' % r,
+ '[%d]_' % new_r)
+ lines[i] = lines[i].replace('.. [%d]' % r,
+ '.. [%d]' % new_r)
+
+ reference_offset[0] += len(references)
+
+def mangle_signature(app, what, name, obj, options, sig, retann):
+ # Do not try to inspect classes that don't define `__init__`
+ if (inspect.isclass(obj) and
+ 'initializes x; see ' in pydoc.getdoc(obj.__init__)):
+ return '', ''
+
+ if not (callable(obj) or hasattr(obj, '__argspec_is_invalid_')): return
+ if not hasattr(obj, '__doc__'): return
+
+ doc = SphinxDocString(pydoc.getdoc(obj))
+ if doc['Signature']:
+ sig = re.sub("^[^(]*", "", doc['Signature'])
+ return sig, ''
+
+def initialize(app):
+ try:
+ app.connect('autodoc-process-signature', mangle_signature)
+ except:
+ monkeypatch_sphinx_ext_autodoc()
+
+def setup(app, get_doc_object_=get_doc_object):
+ global get_doc_object
+ get_doc_object = get_doc_object_
+
+ app.connect('autodoc-process-docstring', mangle_docstrings)
+ app.connect('builder-inited', initialize)
+ app.add_config_value('numpydoc_edit_link', None, True)
+
+#------------------------------------------------------------------------------
+# Monkeypatch sphinx.ext.autodoc to accept argspecless autodocs (Sphinx < 0.5)
+#------------------------------------------------------------------------------
+
+def monkeypatch_sphinx_ext_autodoc():
+ global _original_format_signature
+ import sphinx.ext.autodoc
+
+ if sphinx.ext.autodoc.format_signature is our_format_signature:
+ return
+
+ print "[numpydoc] Monkeypatching sphinx.ext.autodoc ..."
+ _original_format_signature = sphinx.ext.autodoc.format_signature
+ sphinx.ext.autodoc.format_signature = our_format_signature
+
+def our_format_signature(what, obj):
+ r = mangle_signature(None, what, None, obj, None, None, None)
+ if r is not None:
+ return r[0]
+ else:
+ return _original_format_signature(what, obj)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-08-11 10:54:15
|
Revision: 7455
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7455&view=rev
Author: jdh2358
Date: 2009-08-11 10:54:07 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
update fancy screenshot
Modified Paths:
--------------
trunk/py4science/examples/sphinx_qs/_static/fancy_screenshot.png
trunk/py4science/examples/sphinx_qs/custom_look.rst
trunk/py4science/examples/sphinx_qs/getting_started.rst
trunk/py4science/examples/sphinx_qs/index.rst
Modified: trunk/py4science/examples/sphinx_qs/_static/fancy_screenshot.png
===================================================================
(Binary files differ)
Modified: trunk/py4science/examples/sphinx_qs/custom_look.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/custom_look.rst 2009-08-11 10:45:16 UTC (rev 7454)
+++ trunk/py4science/examples/sphinx_qs/custom_look.rst 2009-08-11 10:54:07 UTC (rev 7455)
@@ -5,13 +5,14 @@
Customizing the site
*********************
-the `<http://sphinx.pocoo.org/>`_ site itself looks better than the
-sites created with the default css, so here we'll invoke Tufte's
+The `sphinx <http://sphinx.pocoo.org/>`_ site itself looks better than
+the sites created with the default css, so here we'll invoke Tufte's
phrase "Intelligence imitates but genious steals and grab their css
and part of their layout. As before, you can either get the required
-files :file:`_static/default.css`, :file:`_templates:layout.html` and :file:`_static\logo.png`
-from the website or svn (see :ref:`fetching-the-data`). Since I did a
-svn checkout before, I will just copy the stuff I need from there::
+files :file:`_static/default.css`, :file:`_templates:layout.html` and
+:file:`_static\logo.png` from the website or svn (see
+:ref:`fetching-the-data`). Since I did a svn checkout before, I will
+just copy the stuff I need from there::
home:~/tmp/py4sci> cp ../sphinx_qs/_static/default.css _static/
home:~/tmp/py4sci> cp ../sphinx_qs/_templates/layout.html _templates/
@@ -23,9 +24,15 @@
_templates/:
layout.html
-Sphinx will automatically pick up the css and layout html files since we put them in the
-default places with the default names, but we have to manually include the logo in our :file:`layout.html`. Let's take a look at the
-layout file: the first part puts a horizontal navigation bar at the top of our page, like you see on the `sphinx <http://sphinx.pocoo.org>`_ and `matplotlib <http://matplotlib.sourceforge.net/>`_ sites, the second part includes a logo that when we click on it will take us `home` and the last part moves the vertical navigation panels to the right side of the page.
+Sphinx will automatically pick up the css and layout html files since
+we put them in the default places with the default names, but we have
+to manually include the logo in our :file:`layout.html`. Let's take a
+look at the layout file: the first part puts a horizontal navigation
+bar at the top of our page, like you see on the `sphinx
+<http://sphinx.pocoo.org>`_ and `matplotlib
+<http://matplotlib.sourceforge.net/>`_ sites, the second part includes
+a logo that when we click on it will take us `home` and the last part
+moves the vertical navigation panels to the right side of the page::
{% extends "!layout.html" %}
@@ -49,3 +56,7 @@
{# put the sidebar before the body #}
{% block sidebar1 %}{{ sidebar() }}{% endblock %}
{% block sidebar2 %}{% endblock %}
+
+Once you rebuild the site with a ``make html`` and reload the page in your browser, you should see a fancier site that looks like this
+
+.. image:: _static/fancy_screenshot.png
Modified: trunk/py4science/examples/sphinx_qs/getting_started.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/getting_started.rst 2009-08-11 10:45:16 UTC (rev 7454)
+++ trunk/py4science/examples/sphinx_qs/getting_started.rst 2009-08-11 10:54:07 UTC (rev 7455)
@@ -1,9 +1,9 @@
-.. _sphinx_helpers:
+.. _getting_started:
-******************
-Sphinx Cheat Sheet
-******************
+***************
+Getting started
+***************
Cheat sheet on how to make this site and install these extensions and
other goodies. You can see a literal version of this file below in
@@ -103,4 +103,7 @@
Next we'll customize the look and feel of our site to give it a logo,
some custom css, and update the navigation panels to look more like
-the `<http://sphinx.pocoo.org/>`_ site itself -- see :ref:`custom_look`.
+the `sphinx <http://sphinx.pocoo.org/>`_ site itself -- see
+:ref:`custom_look`.
+
+
Modified: trunk/py4science/examples/sphinx_qs/index.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/index.rst 2009-08-11 10:45:16 UTC (rev 7454)
+++ trunk/py4science/examples/sphinx_qs/index.rst 2009-08-11 10:54:07 UTC (rev 7455)
@@ -12,6 +12,7 @@
:maxdepth: 2
getting_started.rst
+ custom_look.rst
Indices and tables
==================
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-08-11 10:45:28
|
Revision: 7454
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7454&view=rev
Author: jdh2358
Date: 2009-08-11 10:45:16 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
added fancy screenshot
Modified Paths:
--------------
trunk/py4science/examples/sphinx_qs/custom_look.rst
Added Paths:
-----------
trunk/py4science/examples/sphinx_qs/_static/fancy_screenshot.png
Added: trunk/py4science/examples/sphinx_qs/_static/fancy_screenshot.png
===================================================================
(Binary files differ)
Property changes on: trunk/py4science/examples/sphinx_qs/_static/fancy_screenshot.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/py4science/examples/sphinx_qs/custom_look.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/custom_look.rst 2009-08-11 10:39:12 UTC (rev 7453)
+++ trunk/py4science/examples/sphinx_qs/custom_look.rst 2009-08-11 10:45:16 UTC (rev 7454)
@@ -9,5 +9,43 @@
sites created with the default css, so here we'll invoke Tufte's
phrase "Intelligence imitates but genious steals and grab their css
and part of their layout. As before, you can either get the required
-files :file:`_static/sphinx.css` and :file:`_templates:layout.html`
-from the website or svn (see :ref:`fetching-the-data`)
+files :file:`_static/default.css`, :file:`_templates:layout.html` and :file:`_static\logo.png`
+from the website or svn (see :ref:`fetching-the-data`). Since I did a
+svn checkout before, I will just copy the stuff I need from there::
+
+ home:~/tmp/py4sci> cp ../sphinx_qs/_static/default.css _static/
+ home:~/tmp/py4sci> cp ../sphinx_qs/_templates/layout.html _templates/
+ home:~/tmp/py4sci> cp ../sphinx_qs/_static/logo.png _static/
+ home:~/tmp/py4sci> ls _static/ _templates/
+ _static/:
+ basic_screenshot.png default.css logo.png
+
+ _templates/:
+ layout.html
+
+Sphinx will automatically pick up the css and layout html files since we put them in the
+default places with the default names, but we have to manually include the logo in our :file:`layout.html`. Let's take a look at the
+layout file: the first part puts a horizontal navigation bar at the top of our page, like you see on the `sphinx <http://sphinx.pocoo.org>`_ and `matplotlib <http://matplotlib.sourceforge.net/>`_ sites, the second part includes a logo that when we click on it will take us `home` and the last part moves the vertical navigation panels to the right side of the page.
+
+ {% extends "!layout.html" %}
+
+
+ {% block rootrellink %}
+ <li><a href="{{ pathto('index') }}">home</a>| </li>
+ <li><a href="{{ pathto('search') }}">search</a>| </li>
+ <li><a href="{{ pathto('contents') }}">documentation </a> »</li>
+ {% endblock %}
+
+
+ {% block relbar1 %}
+
+ <div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
+ <a href="{{ pathto('index') }}"><img src="{{
+ pathto("_static/logo.png", 1) }}" border="0" alt="py4sci"/></a>
+ </div>
+ {{ super() }}
+ {% endblock %}
+
+ {# put the sidebar before the body #}
+ {% block sidebar1 %}{{ sidebar() }}{% endblock %}
+ {% block sidebar2 %}{% endblock %}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-08-11 10:39:18
|
Revision: 7453
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7453&view=rev
Author: jdh2358
Date: 2009-08-11 10:39:12 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
added the logo png
Added Paths:
-----------
trunk/py4science/examples/sphinx_qs/_static/logo.png
Added: trunk/py4science/examples/sphinx_qs/_static/logo.png
===================================================================
(Binary files differ)
Property changes on: trunk/py4science/examples/sphinx_qs/_static/logo.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-08-11 10:34:24
|
Revision: 7452
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7452&view=rev
Author: jdh2358
Date: 2009-08-11 10:34:17 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
use the default css name
Added Paths:
-----------
trunk/py4science/examples/sphinx_qs/_static/default.css
Removed Paths:
-------------
trunk/py4science/examples/sphinx_qs/_static/sphinx.css
Copied: trunk/py4science/examples/sphinx_qs/_static/default.css (from rev 7451, trunk/py4science/examples/sphinx_qs/_static/sphinx.css)
===================================================================
--- trunk/py4science/examples/sphinx_qs/_static/default.css (rev 0)
+++ trunk/py4science/examples/sphinx_qs/_static/default.css 2009-08-11 10:34:17 UTC (rev 7452)
@@ -0,0 +1,507 @@
+/**
+ * Alternate Sphinx design
+ * Originally created by Armin Ronacher for Werkzeug, adapted by Georg Brandl.
+ */
+
+body {
+ font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', 'Verdana', sans-serif;
+ font-size: 14px;
+ letter-spacing: -0.01em;
+ line-height: 150%;
+ text-align: center;
+ /*background-color: #AFC1C4; */
+ background-color: #BFD1D4;
+ color: black;
+ padding: 0;
+ border: 1px solid #aaa;
+
+ margin: 0px 80px 0px 80px;
+ min-width: 740px;
+}
+
+a {
+ color: #CA7900;
+ text-decoration: none;
+}
+
+a:hover {
+ color: #2491CF;
+}
+
+pre {
+ font-family: 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
+ font-size: 0.95em;
+ letter-spacing: 0.015em;
+ padding: 0.5em;
+ border: 1px solid #ccc;
+ background-color: #f8f8f8;
+}
+
+td.linenos pre {
+ padding: 0.5em 0;
+ border: 0;
+ background-color: transparent;
+ color: #aaa;
+}
+
+table.highlighttable {
+ margin-left: 0.5em;
+}
+
+table.highlighttable td {
+ padding: 0 0.5em 0 0.5em;
+}
+
+cite, code, tt {
+ font-family: 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
+ font-size: 0.95em;
+ letter-spacing: 0.01em;
+}
+
+hr {
+ border: 1px solid #abc;
+ margin: 2em;
+}
+
+tt {
+ background-color: #f2f2f2;
+ border-bottom: 1px solid #ddd;
+ color: #333;
+}
+
+tt.descname {
+ background-color: transparent;
+ font-weight: bold;
+ font-size: 1.2em;
+ border: 0;
+}
+
+tt.descclassname {
+ background-color: transparent;
+ border: 0;
+}
+
+tt.xref {
+ background-color: transparent;
+ font-weight: bold;
+ border: 0;
+}
+
+a tt {
+ background-color: transparent;
+ font-weight: bold;
+ border: 0;
+ color: #CA7900;
+}
+
+a tt:hover {
+ color: #2491CF;
+}
+
+dl {
+ margin-bottom: 15px;
+}
+
+dd p {
+ margin-top: 0px;
+}
+
+dd ul, dd table {
+ margin-bottom: 10px;
+}
+
+dd {
+ margin-top: 3px;
+ margin-bottom: 10px;
+ margin-left: 30px;
+}
+
+.refcount {
+ color: #060;
+}
+
+dt:target,
+.highlight {
+ background-color: #fbe54e;
+}
+
+dl.class, dl.function {
+ border-top: 2px solid #888;
+}
+
+dl.method, dl.attribute {
+ border-top: 1px solid #aaa;
+}
+
+dl.glossary dt {
+ font-weight: bold;
+ font-size: 1.1em;
+}
+
+pre {
+ line-height: 120%;
+}
+
+pre a {
+ color: inherit;
+ text-decoration: underline;
+}
+
+.first {
+ margin-top: 0 !important;
+}
+
+div.document {
+ background-color: white;
+ text-align: left;
+ background-image: url(contents.png);
+ background-repeat: repeat-x;
+}
+
+/*
+div.documentwrapper {
+ width: 100%;
+}
+*/
+
+div.clearer {
+ clear: both;
+}
+
+div.related h3 {
+ display: none;
+}
+
+div.related ul {
+ background-image: url(navigation.png);
+ height: 2em;
+ list-style: none;
+ border-top: 1px solid #ddd;
+ border-bottom: 1px solid #ddd;
+ margin: 0;
+ padding-left: 10px;
+}
+
+div.related ul li {
+ margin: 0;
+ padding: 0;
+ height: 2em;
+ float: left;
+}
+
+div.related ul li.right {
+ float: right;
+ margin-right: 5px;
+}
+
+div.related ul li a {
+ margin: 0;
+ padding: 0 5px 0 5px;
+ line-height: 1.75em;
+ color: #EE9816;
+}
+
+div.related ul li a:hover {
+ color: #3CA8E7;
+}
+
+div.body {
+ margin: 0;
+ padding: 0.5em 20px 20px 20px;
+}
+
+div.bodywrapper {
+ margin: 0 240px 0 0;
+ border-right: 1px solid #ccc;
+}
+
+div.body a {
+ text-decoration: underline;
+}
+
+div.sphinxsidebar {
+ margin: 0;
+ padding: 0.5em 15px 15px 0;
+ width: 210px;
+ float: right;
+ text-align: left;
+/* margin-left: -100%; */
+}
+
+div.sphinxsidebar h4, div.sphinxsidebar h3 {
+ margin: 1em 0 0.5em 0;
+ font-size: 0.9em;
+ padding: 0.1em 0 0.1em 0.5em;
+ color: white;
+ border: 1px solid #86989B;
+ background-color: #AFC1C4;
+}
+
+div.sphinxsidebar ul {
+ padding-left: 1.5em;
+ margin-top: 7px;
+ list-style: none;
+ padding: 0;
+ line-height: 130%;
+}
+
+div.sphinxsidebar ul ul {
+ list-style: square;
+ margin-left: 20px;
+}
+
+p {
+ margin: 0.8em 0 0.5em 0;
+}
+
+p.rubric {
+ font-weight: bold;
+}
+
+h1 {
+ margin: 0;
+ padding: 0.7em 0 0.3em 0;
+ font-size: 1.5em;
+ color: #11557C;
+}
+
+h2 {
+ margin: 1.3em 0 0.2em 0;
+ font-size: 1.35em;
+ padding: 0;
+}
+
+h3 {
+ margin: 1em 0 -0.3em 0;
+ font-size: 1.2em;
+}
+
+h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
+ color: black!important;
+}
+
+h1 a.anchor, h2 a.anchor, h3 a.anchor, h4 a.anchor, h5 a.anchor, h6 a.anchor {
+ display: none;
+ margin: 0 0 0 0.3em;
+ padding: 0 0.2em 0 0.2em;
+ color: #aaa!important;
+}
+
+h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor,
+h5:hover a.anchor, h6:hover a.anchor {
+ display: inline;
+}
+
+h1 a.anchor:hover, h2 a.anchor:hover, h3 a.anchor:hover, h4 a.anchor:hover,
+h5 a.anchor:hover, h6 a.anchor:hover {
+ color: #777;
+ background-color: #eee;
+}
+
+table {
+ border-collapse: collapse;
+ margin: 0 -0.5em 0 -0.5em;
+}
+
+table td, table th {
+ padding: 0.2em 0.5em 0.2em 0.5em;
+}
+
+div.footer {
+ background-color: #E3EFF1;
+ color: #86989B;
+ padding: 3px 8px 3px 0;
+ clear: both;
+ font-size: 0.8em;
+ text-align: right;
+}
+
+div.footer a {
+ color: #86989B;
+ text-decoration: underline;
+}
+
+div.pagination {
+ margin-top: 2em;
+ padding-top: 0.5em;
+ border-top: 1px solid black;
+ text-align: center;
+}
+
+div.sphinxsidebar ul.toc {
+ margin: 1em 0 1em 0;
+ padding: 0 0 0 0.5em;
+ list-style: none;
+}
+
+div.sphinxsidebar ul.toc li {
+ margin: 0.5em 0 0.5em 0;
+ font-size: 0.9em;
+ line-height: 130%;
+}
+
+div.sphinxsidebar ul.toc li p {
+ margin: 0;
+ padding: 0;
+}
+
+div.sphinxsidebar ul.toc ul {
+ margin: 0.2em 0 0.2em 0;
+ padding: 0 0 0 1.8em;
+}
+
+div.sphinxsidebar ul.toc ul li {
+ padding: 0;
+}
+
+div.admonition, div.warning {
+ font-size: 0.9em;
+ margin: 1em 0 0 0;
+ border: 1px solid #86989B;
+ background-color: #f7f7f7;
+}
+
+div.admonition p, div.warning p {
+ margin: 0.5em 1em 0.5em 1em;
+ padding: 0;
+}
+
+div.admonition pre, div.warning pre {
+ margin: 0.4em 1em 0.4em 1em;
+}
+
+div.admonition p.admonition-title,
+div.warning p.admonition-title {
+ margin: 0;
+ padding: 0.1em 0 0.1em 0.5em;
+ color: white;
+ border-bottom: 1px solid #86989B;
+ font-weight: bold;
+ background-color: #AFC1C4;
+}
+
+div.warning {
+ border: 1px solid #940000;
+}
+
+div.warning p.admonition-title {
+ background-color: #CF0000;
+ border-bottom-color: #940000;
+}
+
+div.admonition ul, div.admonition ol,
+div.warning ul, div.warning ol {
+ margin: 0.1em 0.5em 0.5em 3em;
+ padding: 0;
+}
+
+div.versioninfo {
+ margin: 1em 0 0 0;
+ border: 1px solid #ccc;
+ background-color: #DDEAF0;
+ padding: 8px;
+ line-height: 1.3em;
+ font-size: 0.9em;
+}
+
+
+a.headerlink {
+ color: #c60f0f!important;
+ font-size: 1em;
+ margin-left: 6px;
+ padding: 0 4px 0 4px;
+ text-decoration: none!important;
+ visibility: hidden;
+}
+
+h1:hover > a.headerlink,
+h2:hover > a.headerlink,
+h3:hover > a.headerlink,
+h4:hover > a.headerlink,
+h5:hover > a.headerlink,
+h6:hover > a.headerlink,
+dt:hover > a.headerlink {
+ visibility: visible;
+}
+
+a.headerlink:hover {
+ background-color: #ccc;
+ color: white!important;
+}
+
+table.indextable td {
+ text-align: left;
+ vertical-align: top;
+}
+
+table.indextable dl, table.indextable dd {
+ margin-top: 0;
+ margin-bottom: 0;
+}
+
+table.indextable tr.pcap {
+ height: 10px;
+}
+
+table.indextable tr.cap {
+ margin-top: 10px;
+ background-color: #f2f2f2;
+}
+
+img.toggler {
+ margin-right: 3px;
+ margin-top: 3px;
+ cursor: pointer;
+}
+
+img.inheritance {
+ border: 0px
+}
+
+form.pfform {
+ margin: 10px 0 20px 0;
+}
+
+table.contentstable {
+ width: 90%;
+}
+
+table.contentstable p.biglink {
+ line-height: 150%;
+}
+
+a.biglink {
+ font-size: 1.3em;
+}
+
+span.linkdescr {
+ font-style: italic;
+ padding-top: 5px;
+ font-size: 90%;
+}
+
+ul.search {
+ margin: 10px 0 0 20px;
+ padding: 0;
+}
+
+ul.search li {
+ padding: 5px 0 5px 20px;
+ background-image: url(file.png);
+ background-repeat: no-repeat;
+ background-position: 0 7px;
+}
+
+ul.search li a {
+ font-weight: bold;
+}
+
+ul.search li div.context {
+ color: #888;
+ margin: 2px 0 0 30px;
+ text-align: left;
+}
+
+ul.keywordmatches li.goodmatch a {
+ font-weight: bold;
+}
Deleted: trunk/py4science/examples/sphinx_qs/_static/sphinx.css
===================================================================
--- trunk/py4science/examples/sphinx_qs/_static/sphinx.css 2009-08-11 10:30:33 UTC (rev 7451)
+++ trunk/py4science/examples/sphinx_qs/_static/sphinx.css 2009-08-11 10:34:17 UTC (rev 7452)
@@ -1,507 +0,0 @@
-/**
- * Alternate Sphinx design
- * Originally created by Armin Ronacher for Werkzeug, adapted by Georg Brandl.
- */
-
-body {
- font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', 'Verdana', sans-serif;
- font-size: 14px;
- letter-spacing: -0.01em;
- line-height: 150%;
- text-align: center;
- /*background-color: #AFC1C4; */
- background-color: #BFD1D4;
- color: black;
- padding: 0;
- border: 1px solid #aaa;
-
- margin: 0px 80px 0px 80px;
- min-width: 740px;
-}
-
-a {
- color: #CA7900;
- text-decoration: none;
-}
-
-a:hover {
- color: #2491CF;
-}
-
-pre {
- font-family: 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
- font-size: 0.95em;
- letter-spacing: 0.015em;
- padding: 0.5em;
- border: 1px solid #ccc;
- background-color: #f8f8f8;
-}
-
-td.linenos pre {
- padding: 0.5em 0;
- border: 0;
- background-color: transparent;
- color: #aaa;
-}
-
-table.highlighttable {
- margin-left: 0.5em;
-}
-
-table.highlighttable td {
- padding: 0 0.5em 0 0.5em;
-}
-
-cite, code, tt {
- font-family: 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
- font-size: 0.95em;
- letter-spacing: 0.01em;
-}
-
-hr {
- border: 1px solid #abc;
- margin: 2em;
-}
-
-tt {
- background-color: #f2f2f2;
- border-bottom: 1px solid #ddd;
- color: #333;
-}
-
-tt.descname {
- background-color: transparent;
- font-weight: bold;
- font-size: 1.2em;
- border: 0;
-}
-
-tt.descclassname {
- background-color: transparent;
- border: 0;
-}
-
-tt.xref {
- background-color: transparent;
- font-weight: bold;
- border: 0;
-}
-
-a tt {
- background-color: transparent;
- font-weight: bold;
- border: 0;
- color: #CA7900;
-}
-
-a tt:hover {
- color: #2491CF;
-}
-
-dl {
- margin-bottom: 15px;
-}
-
-dd p {
- margin-top: 0px;
-}
-
-dd ul, dd table {
- margin-bottom: 10px;
-}
-
-dd {
- margin-top: 3px;
- margin-bottom: 10px;
- margin-left: 30px;
-}
-
-.refcount {
- color: #060;
-}
-
-dt:target,
-.highlight {
- background-color: #fbe54e;
-}
-
-dl.class, dl.function {
- border-top: 2px solid #888;
-}
-
-dl.method, dl.attribute {
- border-top: 1px solid #aaa;
-}
-
-dl.glossary dt {
- font-weight: bold;
- font-size: 1.1em;
-}
-
-pre {
- line-height: 120%;
-}
-
-pre a {
- color: inherit;
- text-decoration: underline;
-}
-
-.first {
- margin-top: 0 !important;
-}
-
-div.document {
- background-color: white;
- text-align: left;
- background-image: url(contents.png);
- background-repeat: repeat-x;
-}
-
-/*
-div.documentwrapper {
- width: 100%;
-}
-*/
-
-div.clearer {
- clear: both;
-}
-
-div.related h3 {
- display: none;
-}
-
-div.related ul {
- background-image: url(navigation.png);
- height: 2em;
- list-style: none;
- border-top: 1px solid #ddd;
- border-bottom: 1px solid #ddd;
- margin: 0;
- padding-left: 10px;
-}
-
-div.related ul li {
- margin: 0;
- padding: 0;
- height: 2em;
- float: left;
-}
-
-div.related ul li.right {
- float: right;
- margin-right: 5px;
-}
-
-div.related ul li a {
- margin: 0;
- padding: 0 5px 0 5px;
- line-height: 1.75em;
- color: #EE9816;
-}
-
-div.related ul li a:hover {
- color: #3CA8E7;
-}
-
-div.body {
- margin: 0;
- padding: 0.5em 20px 20px 20px;
-}
-
-div.bodywrapper {
- margin: 0 240px 0 0;
- border-right: 1px solid #ccc;
-}
-
-div.body a {
- text-decoration: underline;
-}
-
-div.sphinxsidebar {
- margin: 0;
- padding: 0.5em 15px 15px 0;
- width: 210px;
- float: right;
- text-align: left;
-/* margin-left: -100%; */
-}
-
-div.sphinxsidebar h4, div.sphinxsidebar h3 {
- margin: 1em 0 0.5em 0;
- font-size: 0.9em;
- padding: 0.1em 0 0.1em 0.5em;
- color: white;
- border: 1px solid #86989B;
- background-color: #AFC1C4;
-}
-
-div.sphinxsidebar ul {
- padding-left: 1.5em;
- margin-top: 7px;
- list-style: none;
- padding: 0;
- line-height: 130%;
-}
-
-div.sphinxsidebar ul ul {
- list-style: square;
- margin-left: 20px;
-}
-
-p {
- margin: 0.8em 0 0.5em 0;
-}
-
-p.rubric {
- font-weight: bold;
-}
-
-h1 {
- margin: 0;
- padding: 0.7em 0 0.3em 0;
- font-size: 1.5em;
- color: #11557C;
-}
-
-h2 {
- margin: 1.3em 0 0.2em 0;
- font-size: 1.35em;
- padding: 0;
-}
-
-h3 {
- margin: 1em 0 -0.3em 0;
- font-size: 1.2em;
-}
-
-h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
- color: black!important;
-}
-
-h1 a.anchor, h2 a.anchor, h3 a.anchor, h4 a.anchor, h5 a.anchor, h6 a.anchor {
- display: none;
- margin: 0 0 0 0.3em;
- padding: 0 0.2em 0 0.2em;
- color: #aaa!important;
-}
-
-h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor,
-h5:hover a.anchor, h6:hover a.anchor {
- display: inline;
-}
-
-h1 a.anchor:hover, h2 a.anchor:hover, h3 a.anchor:hover, h4 a.anchor:hover,
-h5 a.anchor:hover, h6 a.anchor:hover {
- color: #777;
- background-color: #eee;
-}
-
-table {
- border-collapse: collapse;
- margin: 0 -0.5em 0 -0.5em;
-}
-
-table td, table th {
- padding: 0.2em 0.5em 0.2em 0.5em;
-}
-
-div.footer {
- background-color: #E3EFF1;
- color: #86989B;
- padding: 3px 8px 3px 0;
- clear: both;
- font-size: 0.8em;
- text-align: right;
-}
-
-div.footer a {
- color: #86989B;
- text-decoration: underline;
-}
-
-div.pagination {
- margin-top: 2em;
- padding-top: 0.5em;
- border-top: 1px solid black;
- text-align: center;
-}
-
-div.sphinxsidebar ul.toc {
- margin: 1em 0 1em 0;
- padding: 0 0 0 0.5em;
- list-style: none;
-}
-
-div.sphinxsidebar ul.toc li {
- margin: 0.5em 0 0.5em 0;
- font-size: 0.9em;
- line-height: 130%;
-}
-
-div.sphinxsidebar ul.toc li p {
- margin: 0;
- padding: 0;
-}
-
-div.sphinxsidebar ul.toc ul {
- margin: 0.2em 0 0.2em 0;
- padding: 0 0 0 1.8em;
-}
-
-div.sphinxsidebar ul.toc ul li {
- padding: 0;
-}
-
-div.admonition, div.warning {
- font-size: 0.9em;
- margin: 1em 0 0 0;
- border: 1px solid #86989B;
- background-color: #f7f7f7;
-}
-
-div.admonition p, div.warning p {
- margin: 0.5em 1em 0.5em 1em;
- padding: 0;
-}
-
-div.admonition pre, div.warning pre {
- margin: 0.4em 1em 0.4em 1em;
-}
-
-div.admonition p.admonition-title,
-div.warning p.admonition-title {
- margin: 0;
- padding: 0.1em 0 0.1em 0.5em;
- color: white;
- border-bottom: 1px solid #86989B;
- font-weight: bold;
- background-color: #AFC1C4;
-}
-
-div.warning {
- border: 1px solid #940000;
-}
-
-div.warning p.admonition-title {
- background-color: #CF0000;
- border-bottom-color: #940000;
-}
-
-div.admonition ul, div.admonition ol,
-div.warning ul, div.warning ol {
- margin: 0.1em 0.5em 0.5em 3em;
- padding: 0;
-}
-
-div.versioninfo {
- margin: 1em 0 0 0;
- border: 1px solid #ccc;
- background-color: #DDEAF0;
- padding: 8px;
- line-height: 1.3em;
- font-size: 0.9em;
-}
-
-
-a.headerlink {
- color: #c60f0f!important;
- font-size: 1em;
- margin-left: 6px;
- padding: 0 4px 0 4px;
- text-decoration: none!important;
- visibility: hidden;
-}
-
-h1:hover > a.headerlink,
-h2:hover > a.headerlink,
-h3:hover > a.headerlink,
-h4:hover > a.headerlink,
-h5:hover > a.headerlink,
-h6:hover > a.headerlink,
-dt:hover > a.headerlink {
- visibility: visible;
-}
-
-a.headerlink:hover {
- background-color: #ccc;
- color: white!important;
-}
-
-table.indextable td {
- text-align: left;
- vertical-align: top;
-}
-
-table.indextable dl, table.indextable dd {
- margin-top: 0;
- margin-bottom: 0;
-}
-
-table.indextable tr.pcap {
- height: 10px;
-}
-
-table.indextable tr.cap {
- margin-top: 10px;
- background-color: #f2f2f2;
-}
-
-img.toggler {
- margin-right: 3px;
- margin-top: 3px;
- cursor: pointer;
-}
-
-img.inheritance {
- border: 0px
-}
-
-form.pfform {
- margin: 10px 0 20px 0;
-}
-
-table.contentstable {
- width: 90%;
-}
-
-table.contentstable p.biglink {
- line-height: 150%;
-}
-
-a.biglink {
- font-size: 1.3em;
-}
-
-span.linkdescr {
- font-style: italic;
- padding-top: 5px;
- font-size: 90%;
-}
-
-ul.search {
- margin: 10px 0 0 20px;
- padding: 0;
-}
-
-ul.search li {
- padding: 5px 0 5px 20px;
- background-image: url(file.png);
- background-repeat: no-repeat;
- background-position: 0 7px;
-}
-
-ul.search li a {
- font-weight: bold;
-}
-
-ul.search li div.context {
- color: #888;
- margin: 2px 0 0 30px;
- text-align: left;
-}
-
-ul.keywordmatches li.goodmatch a {
- font-weight: bold;
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-08-11 10:30:43
|
Revision: 7451
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7451&view=rev
Author: jdh2358
Date: 2009-08-11 10:30:33 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
added css and layout
Added Paths:
-----------
trunk/py4science/examples/sphinx_qs/_static/sphinx.css
trunk/py4science/examples/sphinx_qs/_templates/layout.html
Added: trunk/py4science/examples/sphinx_qs/_static/sphinx.css
===================================================================
--- trunk/py4science/examples/sphinx_qs/_static/sphinx.css (rev 0)
+++ trunk/py4science/examples/sphinx_qs/_static/sphinx.css 2009-08-11 10:30:33 UTC (rev 7451)
@@ -0,0 +1,507 @@
+/**
+ * Alternate Sphinx design
+ * Originally created by Armin Ronacher for Werkzeug, adapted by Georg Brandl.
+ */
+
+body {
+ font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', 'Verdana', sans-serif;
+ font-size: 14px;
+ letter-spacing: -0.01em;
+ line-height: 150%;
+ text-align: center;
+ /*background-color: #AFC1C4; */
+ background-color: #BFD1D4;
+ color: black;
+ padding: 0;
+ border: 1px solid #aaa;
+
+ margin: 0px 80px 0px 80px;
+ min-width: 740px;
+}
+
+a {
+ color: #CA7900;
+ text-decoration: none;
+}
+
+a:hover {
+ color: #2491CF;
+}
+
+pre {
+ font-family: 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
+ font-size: 0.95em;
+ letter-spacing: 0.015em;
+ padding: 0.5em;
+ border: 1px solid #ccc;
+ background-color: #f8f8f8;
+}
+
+td.linenos pre {
+ padding: 0.5em 0;
+ border: 0;
+ background-color: transparent;
+ color: #aaa;
+}
+
+table.highlighttable {
+ margin-left: 0.5em;
+}
+
+table.highlighttable td {
+ padding: 0 0.5em 0 0.5em;
+}
+
+cite, code, tt {
+ font-family: 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
+ font-size: 0.95em;
+ letter-spacing: 0.01em;
+}
+
+hr {
+ border: 1px solid #abc;
+ margin: 2em;
+}
+
+tt {
+ background-color: #f2f2f2;
+ border-bottom: 1px solid #ddd;
+ color: #333;
+}
+
+tt.descname {
+ background-color: transparent;
+ font-weight: bold;
+ font-size: 1.2em;
+ border: 0;
+}
+
+tt.descclassname {
+ background-color: transparent;
+ border: 0;
+}
+
+tt.xref {
+ background-color: transparent;
+ font-weight: bold;
+ border: 0;
+}
+
+a tt {
+ background-color: transparent;
+ font-weight: bold;
+ border: 0;
+ color: #CA7900;
+}
+
+a tt:hover {
+ color: #2491CF;
+}
+
+dl {
+ margin-bottom: 15px;
+}
+
+dd p {
+ margin-top: 0px;
+}
+
+dd ul, dd table {
+ margin-bottom: 10px;
+}
+
+dd {
+ margin-top: 3px;
+ margin-bottom: 10px;
+ margin-left: 30px;
+}
+
+.refcount {
+ color: #060;
+}
+
+dt:target,
+.highlight {
+ background-color: #fbe54e;
+}
+
+dl.class, dl.function {
+ border-top: 2px solid #888;
+}
+
+dl.method, dl.attribute {
+ border-top: 1px solid #aaa;
+}
+
+dl.glossary dt {
+ font-weight: bold;
+ font-size: 1.1em;
+}
+
+pre {
+ line-height: 120%;
+}
+
+pre a {
+ color: inherit;
+ text-decoration: underline;
+}
+
+.first {
+ margin-top: 0 !important;
+}
+
+div.document {
+ background-color: white;
+ text-align: left;
+ background-image: url(contents.png);
+ background-repeat: repeat-x;
+}
+
+/*
+div.documentwrapper {
+ width: 100%;
+}
+*/
+
+div.clearer {
+ clear: both;
+}
+
+div.related h3 {
+ display: none;
+}
+
+div.related ul {
+ background-image: url(navigation.png);
+ height: 2em;
+ list-style: none;
+ border-top: 1px solid #ddd;
+ border-bottom: 1px solid #ddd;
+ margin: 0;
+ padding-left: 10px;
+}
+
+div.related ul li {
+ margin: 0;
+ padding: 0;
+ height: 2em;
+ float: left;
+}
+
+div.related ul li.right {
+ float: right;
+ margin-right: 5px;
+}
+
+div.related ul li a {
+ margin: 0;
+ padding: 0 5px 0 5px;
+ line-height: 1.75em;
+ color: #EE9816;
+}
+
+div.related ul li a:hover {
+ color: #3CA8E7;
+}
+
+div.body {
+ margin: 0;
+ padding: 0.5em 20px 20px 20px;
+}
+
+div.bodywrapper {
+ margin: 0 240px 0 0;
+ border-right: 1px solid #ccc;
+}
+
+div.body a {
+ text-decoration: underline;
+}
+
+div.sphinxsidebar {
+ margin: 0;
+ padding: 0.5em 15px 15px 0;
+ width: 210px;
+ float: right;
+ text-align: left;
+/* margin-left: -100%; */
+}
+
+div.sphinxsidebar h4, div.sphinxsidebar h3 {
+ margin: 1em 0 0.5em 0;
+ font-size: 0.9em;
+ padding: 0.1em 0 0.1em 0.5em;
+ color: white;
+ border: 1px solid #86989B;
+ background-color: #AFC1C4;
+}
+
+div.sphinxsidebar ul {
+ padding-left: 1.5em;
+ margin-top: 7px;
+ list-style: none;
+ padding: 0;
+ line-height: 130%;
+}
+
+div.sphinxsidebar ul ul {
+ list-style: square;
+ margin-left: 20px;
+}
+
+p {
+ margin: 0.8em 0 0.5em 0;
+}
+
+p.rubric {
+ font-weight: bold;
+}
+
+h1 {
+ margin: 0;
+ padding: 0.7em 0 0.3em 0;
+ font-size: 1.5em;
+ color: #11557C;
+}
+
+h2 {
+ margin: 1.3em 0 0.2em 0;
+ font-size: 1.35em;
+ padding: 0;
+}
+
+h3 {
+ margin: 1em 0 -0.3em 0;
+ font-size: 1.2em;
+}
+
+h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
+ color: black!important;
+}
+
+h1 a.anchor, h2 a.anchor, h3 a.anchor, h4 a.anchor, h5 a.anchor, h6 a.anchor {
+ display: none;
+ margin: 0 0 0 0.3em;
+ padding: 0 0.2em 0 0.2em;
+ color: #aaa!important;
+}
+
+h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor,
+h5:hover a.anchor, h6:hover a.anchor {
+ display: inline;
+}
+
+h1 a.anchor:hover, h2 a.anchor:hover, h3 a.anchor:hover, h4 a.anchor:hover,
+h5 a.anchor:hover, h6 a.anchor:hover {
+ color: #777;
+ background-color: #eee;
+}
+
+table {
+ border-collapse: collapse;
+ margin: 0 -0.5em 0 -0.5em;
+}
+
+table td, table th {
+ padding: 0.2em 0.5em 0.2em 0.5em;
+}
+
+div.footer {
+ background-color: #E3EFF1;
+ color: #86989B;
+ padding: 3px 8px 3px 0;
+ clear: both;
+ font-size: 0.8em;
+ text-align: right;
+}
+
+div.footer a {
+ color: #86989B;
+ text-decoration: underline;
+}
+
+div.pagination {
+ margin-top: 2em;
+ padding-top: 0.5em;
+ border-top: 1px solid black;
+ text-align: center;
+}
+
+div.sphinxsidebar ul.toc {
+ margin: 1em 0 1em 0;
+ padding: 0 0 0 0.5em;
+ list-style: none;
+}
+
+div.sphinxsidebar ul.toc li {
+ margin: 0.5em 0 0.5em 0;
+ font-size: 0.9em;
+ line-height: 130%;
+}
+
+div.sphinxsidebar ul.toc li p {
+ margin: 0;
+ padding: 0;
+}
+
+div.sphinxsidebar ul.toc ul {
+ margin: 0.2em 0 0.2em 0;
+ padding: 0 0 0 1.8em;
+}
+
+div.sphinxsidebar ul.toc ul li {
+ padding: 0;
+}
+
+div.admonition, div.warning {
+ font-size: 0.9em;
+ margin: 1em 0 0 0;
+ border: 1px solid #86989B;
+ background-color: #f7f7f7;
+}
+
+div.admonition p, div.warning p {
+ margin: 0.5em 1em 0.5em 1em;
+ padding: 0;
+}
+
+div.admonition pre, div.warning pre {
+ margin: 0.4em 1em 0.4em 1em;
+}
+
+div.admonition p.admonition-title,
+div.warning p.admonition-title {
+ margin: 0;
+ padding: 0.1em 0 0.1em 0.5em;
+ color: white;
+ border-bottom: 1px solid #86989B;
+ font-weight: bold;
+ background-color: #AFC1C4;
+}
+
+div.warning {
+ border: 1px solid #940000;
+}
+
+div.warning p.admonition-title {
+ background-color: #CF0000;
+ border-bottom-color: #940000;
+}
+
+div.admonition ul, div.admonition ol,
+div.warning ul, div.warning ol {
+ margin: 0.1em 0.5em 0.5em 3em;
+ padding: 0;
+}
+
+div.versioninfo {
+ margin: 1em 0 0 0;
+ border: 1px solid #ccc;
+ background-color: #DDEAF0;
+ padding: 8px;
+ line-height: 1.3em;
+ font-size: 0.9em;
+}
+
+
+a.headerlink {
+ color: #c60f0f!important;
+ font-size: 1em;
+ margin-left: 6px;
+ padding: 0 4px 0 4px;
+ text-decoration: none!important;
+ visibility: hidden;
+}
+
+h1:hover > a.headerlink,
+h2:hover > a.headerlink,
+h3:hover > a.headerlink,
+h4:hover > a.headerlink,
+h5:hover > a.headerlink,
+h6:hover > a.headerlink,
+dt:hover > a.headerlink {
+ visibility: visible;
+}
+
+a.headerlink:hover {
+ background-color: #ccc;
+ color: white!important;
+}
+
+table.indextable td {
+ text-align: left;
+ vertical-align: top;
+}
+
+table.indextable dl, table.indextable dd {
+ margin-top: 0;
+ margin-bottom: 0;
+}
+
+table.indextable tr.pcap {
+ height: 10px;
+}
+
+table.indextable tr.cap {
+ margin-top: 10px;
+ background-color: #f2f2f2;
+}
+
+img.toggler {
+ margin-right: 3px;
+ margin-top: 3px;
+ cursor: pointer;
+}
+
+img.inheritance {
+ border: 0px
+}
+
+form.pfform {
+ margin: 10px 0 20px 0;
+}
+
+table.contentstable {
+ width: 90%;
+}
+
+table.contentstable p.biglink {
+ line-height: 150%;
+}
+
+a.biglink {
+ font-size: 1.3em;
+}
+
+span.linkdescr {
+ font-style: italic;
+ padding-top: 5px;
+ font-size: 90%;
+}
+
+ul.search {
+ margin: 10px 0 0 20px;
+ padding: 0;
+}
+
+ul.search li {
+ padding: 5px 0 5px 20px;
+ background-image: url(file.png);
+ background-repeat: no-repeat;
+ background-position: 0 7px;
+}
+
+ul.search li a {
+ font-weight: bold;
+}
+
+ul.search li div.context {
+ color: #888;
+ margin: 2px 0 0 30px;
+ text-align: left;
+}
+
+ul.keywordmatches li.goodmatch a {
+ font-weight: bold;
+}
Added: trunk/py4science/examples/sphinx_qs/_templates/layout.html
===================================================================
--- trunk/py4science/examples/sphinx_qs/_templates/layout.html (rev 0)
+++ trunk/py4science/examples/sphinx_qs/_templates/layout.html 2009-08-11 10:30:33 UTC (rev 7451)
@@ -0,0 +1,23 @@
+{% extends "!layout.html" %}
+
+
+{% block rootrellink %}
+ <li><a href="{{ pathto('index') }}">home</a>| </li>
+ <li><a href="{{ pathto('search') }}">search</a>| </li>
+ <li><a href="{{ pathto('contents') }}">documentation </a> »</li>
+{% endblock %}
+
+
+{% block relbar1 %}
+
+<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
+<a href="{{ pathto('index') }}"><img src="{{
+pathto("_static/logo.png", 1) }}" border="0" alt="py4sci"/></a>
+</div>
+{{ super() }}
+{% endblock %}
+
+{# put the sidebar before the body #}
+{% block sidebar1 %}{{ sidebar() }}{% endblock %}
+{% block sidebar2 %}{% endblock %}
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-08-11 10:28:55
|
Revision: 7450
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7450&view=rev
Author: jdh2358
Date: 2009-08-11 10:28:47 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
added customizing look and feel
Modified Paths:
--------------
trunk/py4science/examples/sphinx_qs/getting_started.rst
trunk/py4science/examples/sphinx_qs/index.rst
Added Paths:
-----------
trunk/py4science/examples/sphinx_qs/custom_look.rst
Added: trunk/py4science/examples/sphinx_qs/custom_look.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/custom_look.rst (rev 0)
+++ trunk/py4science/examples/sphinx_qs/custom_look.rst 2009-08-11 10:28:47 UTC (rev 7450)
@@ -0,0 +1,13 @@
+.. _custom_look:
+
+
+*********************
+Customizing the site
+*********************
+
+the `<http://sphinx.pocoo.org/>`_ site itself looks better than the
+sites created with the default css, so here we'll invoke Tufte's
+phrase "Intelligence imitates but genious steals and grab their css
+and part of their layout. As before, you can either get the required
+files :file:`_static/sphinx.css` and :file:`_templates:layout.html`
+from the website or svn (see :ref:`fetching-the-data`)
Modified: trunk/py4science/examples/sphinx_qs/getting_started.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/getting_started.rst 2009-08-11 09:57:52 UTC (rev 7449)
+++ trunk/py4science/examples/sphinx_qs/getting_started.rst 2009-08-11 10:28:47 UTC (rev 7450)
@@ -44,3 +44,63 @@
.. image:: _static/basic_screenshot.png
+.. _fetching-the-data:
+
+Fetching the data
+-----------------
+
+Now we will start to customize out docs. Grab a couple of files from
+the `web site
+<http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/py4science/examples/sphinx_qs/>`_
+or svn. You will need :file:`getting_started.rst` and
+:file:`_static/basic_screenshot.png`. All of the files live in the
+"completed" version of this tutorial, but since this is a tutorial,
+we'll just grab them one at a time, so you can learn what needs to be
+changed where. Since we have more files to come, I'm going to grab
+the whole svn directory and just copy the files I need over for now.
+First, I'll cd to the directory containing my project, and get the
+"finished" product, and then copy in just the files I need::
+
+ home:~/tmp/py4sci> pwd
+ /Users/jdhunter/tmp/py4sci
+ home:~/tmp/py4sci> cd ..
+ home:~/tmp> svn co
+ https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/\
+ py4science/examples/sphinx_qs
+ A sphinx_qs/cheatsheet.rst
+ A sphinx_qs/_static
+ A sphinx_qs/_static/basic_screenshot.png
+ A sphinx_qs/conf.py
+ A sphinx_qs/Makefile
+ A sphinx_qs/_templates
+ A sphinx_qs/_build
+ A sphinx_qs/getting_started.rst
+ A sphinx_qs/index.rst
+ Checked out revision 7449.
+ home:~/tmp> cp sphinx_qs/getting_started.rst py4sci/
+ home:~/tmp> cp sphinx_qs/_static/basic_screenshot.png py4sci/_static/
+
+Now we are ready to rebuild the docs. We used the image directory to
+include to the screenshot above with::
+
+ .. image:: _static/basic_screenshot.png
+
+The last step is to modify :file:`index.rst` to include the
+getting_started file (be careful with the indentation, the
+"getting_started" should line up with the ':' in ``:maxdepth``::
+
+ Contents:
+
+ .. toctree::
+ :maxdepth: 2
+
+ getting_started.rst
+
+and then rebuild the docs with ``make html``. When you reload the
+page, you should see a link to the "Getting Started" docs, and in
+there this page with the screenshot. `Voila!`
+
+
+Next we'll customize the look and feel of our site to give it a logo,
+some custom css, and update the navigation panels to look more like
+the `<http://sphinx.pocoo.org/>`_ site itself -- see :ref:`custom_look`.
Modified: trunk/py4science/examples/sphinx_qs/index.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/index.rst 2009-08-11 09:57:52 UTC (rev 7449)
+++ trunk/py4science/examples/sphinx_qs/index.rst 2009-08-11 10:28:47 UTC (rev 7450)
@@ -1,5 +1,5 @@
.. py4sci documentation master file, created by
- sphinx-quickstart on Tue Aug 11 04:33:46 2009.
+ sphinx-quickstart on Tue Aug 11 05:04:40 2009.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
@@ -12,6 +12,7 @@
:maxdepth: 2
getting_started.rst
+
Indices and tables
==================
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-08-11 09:57:58
|
Revision: 7449
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7449&view=rev
Author: jdh2358
Date: 2009-08-11 09:57:52 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
working on a sphinx_qs tutorial
Added Paths:
-----------
trunk/py4science/examples/sphinx_qs/
trunk/py4science/examples/sphinx_qs/Makefile
trunk/py4science/examples/sphinx_qs/_build/
trunk/py4science/examples/sphinx_qs/_static/
trunk/py4science/examples/sphinx_qs/_static/basic_screenshot.png
trunk/py4science/examples/sphinx_qs/_templates/
trunk/py4science/examples/sphinx_qs/cheatsheet.rst
trunk/py4science/examples/sphinx_qs/conf.py
trunk/py4science/examples/sphinx_qs/getting_started.rst
trunk/py4science/examples/sphinx_qs/index.rst
Added: trunk/py4science/examples/sphinx_qs/Makefile
===================================================================
--- trunk/py4science/examples/sphinx_qs/Makefile (rev 0)
+++ trunk/py4science/examples/sphinx_qs/Makefile 2009-08-11 09:57:52 UTC (rev 7449)
@@ -0,0 +1,88 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS =
+SPHINXBUILD = sphinx-build
+PAPER =
+
+# Internal variables.
+PAPEROPT_a4 = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS = -d _build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest
+
+help:
+ @echo "Please use \`make <target>' where <target> is one of"
+ @echo " html to make standalone HTML files"
+ @echo " dirhtml to make HTML files named index.html in directories"
+ @echo " pickle to make pickle files"
+ @echo " json to make JSON files"
+ @echo " htmlhelp to make HTML files and a HTML help project"
+ @echo " qthelp to make HTML files and a qthelp project"
+ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+ @echo " changes to make an overview of all changed/added/deprecated items"
+ @echo " linkcheck to check all external links for integrity"
+ @echo " doctest to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+ -rm -rf _build/*
+
+html:
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html
+ @echo
+ @echo "Build finished. The HTML pages are in _build/html."
+
+dirhtml:
+ $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) _build/dirhtml
+ @echo
+ @echo "Build finished. The HTML pages are in _build/dirhtml."
+
+pickle:
+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) _build/pickle
+ @echo
+ @echo "Build finished; now you can process the pickle files."
+
+json:
+ $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) _build/json
+ @echo
+ @echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp
+ @echo
+ @echo "Build finished; now you can run HTML Help Workshop with the" \
+ ".hhp project file in _build/htmlhelp."
+
+qthelp:
+ $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) _build/qthelp
+ @echo
+ @echo "Build finished; now you can run "qcollectiongenerator" with the" \
+ ".qhcp project file in _build/qthelp, like this:"
+ @echo "# qcollectiongenerator _build/qthelp/py4sci.qhcp"
+ @echo "To view the help file:"
+ @echo "# assistant -collectionFile _build/qthelp/py4sci.qhc"
+
+latex:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex
+ @echo
+ @echo "Build finished; the LaTeX files are in _build/latex."
+ @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
+ "run these through (pdf)latex."
+
+changes:
+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) _build/changes
+ @echo
+ @echo "The overview file is in _build/changes."
+
+linkcheck:
+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) _build/linkcheck
+ @echo
+ @echo "Link check complete; look for any errors in the above output " \
+ "or in _build/linkcheck/output.txt."
+
+doctest:
+ $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) _build/doctest
+ @echo "Testing of doctests in the sources finished, look at the " \
+ "results in _build/doctest/output.txt."
Added: trunk/py4science/examples/sphinx_qs/_static/basic_screenshot.png
===================================================================
(Binary files differ)
Property changes on: trunk/py4science/examples/sphinx_qs/_static/basic_screenshot.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/py4science/examples/sphinx_qs/cheatsheet.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/cheatsheet.rst (rev 0)
+++ trunk/py4science/examples/sphinx_qs/cheatsheet.rst 2009-08-11 09:57:52 UTC (rev 7449)
@@ -0,0 +1,38 @@
+.. _sphinx_helpers:
+
+
+******************
+Sphinx Cheat Sheet
+******************
+
+Cheat sheet on how to make this site and install these extensions and
+other goodies. You can see a literal version of this file below in
+:ref:`sphinx-literal`.
+
+.. _installing-docdir:
+Installing your doc directory
+=============================
+
+You may already have sphinx `sphinx <http://sphinx.pocoo.org/>`_
+installed -- you can check by doing::
+
+ python -c 'import sphinx'
+
+If that fails grab the latest version of and install it with::
+
+ > sudo easy_install sphinx
+
+Now you are ready to build a template for your docs, using
+sphinx-quickstart::
+
+ > sphinx-quickstart
+
+accepting most of the defaults. I choose "py4sci" as the name of my project
+
+We can test the installation by changing into the project directory,
+and typing `make html`::
+
+ cd py4sci
+ make html
+
+
Added: trunk/py4science/examples/sphinx_qs/conf.py
===================================================================
--- trunk/py4science/examples/sphinx_qs/conf.py (rev 0)
+++ trunk/py4science/examples/sphinx_qs/conf.py 2009-08-11 09:57:52 UTC (rev 7449)
@@ -0,0 +1,194 @@
+# -*- coding: utf-8 -*-
+#
+# py4sci documentation build configuration file, created by
+# sphinx-quickstart on Tue Aug 11 04:33:46 2009.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#sys.path.append(os.path.abspath('.'))
+
+# -- General configuration -----------------------------------------------------
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.autodoc']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'py4sci'
+copyright = u'2009, jdh'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '0.1'
+# The full version, including alpha/beta/rc tags.
+release = '0.1'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of documents that shouldn't be included in the build.
+#unused_docs = []
+
+# List of directories, relative to source directory, that shouldn't be searched
+# for source files.
+exclude_trees = ['_build']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. Major themes that come with
+# Sphinx are currently 'default' and 'sphinxdoc'.
+html_theme = 'default'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further. For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar. Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_use_modindex = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it. The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = ''
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'py4scidoc'
+
+
+# -- Options for LaTeX output --------------------------------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual]).
+latex_documents = [
+ ('index', 'py4sci.tex', u'py4sci Documentation',
+ u'jdh', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_use_modindex = True
Added: trunk/py4science/examples/sphinx_qs/getting_started.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/getting_started.rst (rev 0)
+++ trunk/py4science/examples/sphinx_qs/getting_started.rst 2009-08-11 09:57:52 UTC (rev 7449)
@@ -0,0 +1,46 @@
+.. _sphinx_helpers:
+
+
+******************
+Sphinx Cheat Sheet
+******************
+
+Cheat sheet on how to make this site and install these extensions and
+other goodies. You can see a literal version of this file below in
+:ref:`sphinx-literal`.
+
+.. _installing-docdir:
+Installing your doc directory
+=============================
+
+You may already have sphinx `sphinx <http://sphinx.pocoo.org/>`_
+installed -- you can check by doing::
+
+ python -c 'import sphinx'
+
+If that fails grab the latest version of and install it with::
+
+ > sudo easy_install sphinx
+
+Now you are ready to build a template for your docs, using
+sphinx-quickstart::
+
+ > sphinx-quickstart
+
+accepting most of the defaults. I choose "py4sci" as the name of my
+project. cd into your new directory and check the contents::
+
+ home:~/tmp/py4sci> ls
+ Makefile _static conf.py
+ _build _templates index.rst
+
+The index.rst is the master ReST for your project, but before adding
+anything, let's see if we can build some html::
+
+ make html
+
+If you now point your browser to :file:`_build/html/index.html`, you
+should see a basic spinx site.
+
+.. image:: _static/basic_screenshot.png
+
Added: trunk/py4science/examples/sphinx_qs/index.rst
===================================================================
--- trunk/py4science/examples/sphinx_qs/index.rst (rev 0)
+++ trunk/py4science/examples/sphinx_qs/index.rst 2009-08-11 09:57:52 UTC (rev 7449)
@@ -0,0 +1,21 @@
+.. py4sci documentation master file, created by
+ sphinx-quickstart on Tue Aug 11 04:33:46 2009.
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
+
+Welcome to py4sci's documentation!
+==================================
+
+Contents:
+
+.. toctree::
+ :maxdepth: 2
+
+ getting_started.rst
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-08-11 09:26:47
|
Revision: 7448
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7448&view=rev
Author: jdh2358
Date: 2009-08-11 09:26:40 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
added logo, css, fixed email api
Modified Paths:
--------------
trunk/py4science/examples/sphinx_template2/Makefile
trunk/py4science/examples/sphinx_template2/autogen_api.py
trunk/py4science/examples/sphinx_template2/conf.py
Added Paths:
-----------
trunk/py4science/examples/sphinx_template2/_static/logo.png
trunk/py4science/examples/sphinx_template2/_static/sphinx.css
trunk/py4science/examples/sphinx_template2/_templates/layout.html
Modified: trunk/py4science/examples/sphinx_template2/Makefile
===================================================================
--- trunk/py4science/examples/sphinx_template2/Makefile 2009-08-11 07:16:27 UTC (rev 7447)
+++ trunk/py4science/examples/sphinx_template2/Makefile 2009-08-11 09:26:40 UTC (rev 7448)
@@ -32,7 +32,7 @@
@echo " dist all, and then puts the results in dist/"
clean:
- -rm -rf build/ dist/ _static/* api/generated/*rst pyplots/*png pyplots/*pdf
+ -rm -rf build/ dist/ api/generated/*rst pyplots/*png pyplots/*pdf
pdf: latex
cd build/latex && make all-pdf
Added: trunk/py4science/examples/sphinx_template2/_static/logo.png
===================================================================
(Binary files differ)
Property changes on: trunk/py4science/examples/sphinx_template2/_static/logo.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/py4science/examples/sphinx_template2/_static/sphinx.css
===================================================================
--- trunk/py4science/examples/sphinx_template2/_static/sphinx.css (rev 0)
+++ trunk/py4science/examples/sphinx_template2/_static/sphinx.css 2009-08-11 09:26:40 UTC (rev 7448)
@@ -0,0 +1,507 @@
+/**
+ * Alternate Sphinx design
+ * Originally created by Armin Ronacher for Werkzeug, adapted by Georg Brandl.
+ */
+
+body {
+ font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', 'Verdana', sans-serif;
+ font-size: 14px;
+ letter-spacing: -0.01em;
+ line-height: 150%;
+ text-align: center;
+ /*background-color: #AFC1C4; */
+ background-color: #BFD1D4;
+ color: black;
+ padding: 0;
+ border: 1px solid #aaa;
+
+ margin: 0px 80px 0px 80px;
+ min-width: 740px;
+}
+
+a {
+ color: #CA7900;
+ text-decoration: none;
+}
+
+a:hover {
+ color: #2491CF;
+}
+
+pre {
+ font-family: 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
+ font-size: 0.95em;
+ letter-spacing: 0.015em;
+ padding: 0.5em;
+ border: 1px solid #ccc;
+ background-color: #f8f8f8;
+}
+
+td.linenos pre {
+ padding: 0.5em 0;
+ border: 0;
+ background-color: transparent;
+ color: #aaa;
+}
+
+table.highlighttable {
+ margin-left: 0.5em;
+}
+
+table.highlighttable td {
+ padding: 0 0.5em 0 0.5em;
+}
+
+cite, code, tt {
+ font-family: 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
+ font-size: 0.95em;
+ letter-spacing: 0.01em;
+}
+
+hr {
+ border: 1px solid #abc;
+ margin: 2em;
+}
+
+tt {
+ background-color: #f2f2f2;
+ border-bottom: 1px solid #ddd;
+ color: #333;
+}
+
+tt.descname {
+ background-color: transparent;
+ font-weight: bold;
+ font-size: 1.2em;
+ border: 0;
+}
+
+tt.descclassname {
+ background-color: transparent;
+ border: 0;
+}
+
+tt.xref {
+ background-color: transparent;
+ font-weight: bold;
+ border: 0;
+}
+
+a tt {
+ background-color: transparent;
+ font-weight: bold;
+ border: 0;
+ color: #CA7900;
+}
+
+a tt:hover {
+ color: #2491CF;
+}
+
+dl {
+ margin-bottom: 15px;
+}
+
+dd p {
+ margin-top: 0px;
+}
+
+dd ul, dd table {
+ margin-bottom: 10px;
+}
+
+dd {
+ margin-top: 3px;
+ margin-bottom: 10px;
+ margin-left: 30px;
+}
+
+.refcount {
+ color: #060;
+}
+
+dt:target,
+.highlight {
+ background-color: #fbe54e;
+}
+
+dl.class, dl.function {
+ border-top: 2px solid #888;
+}
+
+dl.method, dl.attribute {
+ border-top: 1px solid #aaa;
+}
+
+dl.glossary dt {
+ font-weight: bold;
+ font-size: 1.1em;
+}
+
+pre {
+ line-height: 120%;
+}
+
+pre a {
+ color: inherit;
+ text-decoration: underline;
+}
+
+.first {
+ margin-top: 0 !important;
+}
+
+div.document {
+ background-color: white;
+ text-align: left;
+ background-image: url(contents.png);
+ background-repeat: repeat-x;
+}
+
+/*
+div.documentwrapper {
+ width: 100%;
+}
+*/
+
+div.clearer {
+ clear: both;
+}
+
+div.related h3 {
+ display: none;
+}
+
+div.related ul {
+ background-image: url(navigation.png);
+ height: 2em;
+ list-style: none;
+ border-top: 1px solid #ddd;
+ border-bottom: 1px solid #ddd;
+ margin: 0;
+ padding-left: 10px;
+}
+
+div.related ul li {
+ margin: 0;
+ padding: 0;
+ height: 2em;
+ float: left;
+}
+
+div.related ul li.right {
+ float: right;
+ margin-right: 5px;
+}
+
+div.related ul li a {
+ margin: 0;
+ padding: 0 5px 0 5px;
+ line-height: 1.75em;
+ color: #EE9816;
+}
+
+div.related ul li a:hover {
+ color: #3CA8E7;
+}
+
+div.body {
+ margin: 0;
+ padding: 0.5em 20px 20px 20px;
+}
+
+div.bodywrapper {
+ margin: 0 240px 0 0;
+ border-right: 1px solid #ccc;
+}
+
+div.body a {
+ text-decoration: underline;
+}
+
+div.sphinxsidebar {
+ margin: 0;
+ padding: 0.5em 15px 15px 0;
+ width: 210px;
+ float: right;
+ text-align: left;
+/* margin-left: -100%; */
+}
+
+div.sphinxsidebar h4, div.sphinxsidebar h3 {
+ margin: 1em 0 0.5em 0;
+ font-size: 0.9em;
+ padding: 0.1em 0 0.1em 0.5em;
+ color: white;
+ border: 1px solid #86989B;
+ background-color: #AFC1C4;
+}
+
+div.sphinxsidebar ul {
+ padding-left: 1.5em;
+ margin-top: 7px;
+ list-style: none;
+ padding: 0;
+ line-height: 130%;
+}
+
+div.sphinxsidebar ul ul {
+ list-style: square;
+ margin-left: 20px;
+}
+
+p {
+ margin: 0.8em 0 0.5em 0;
+}
+
+p.rubric {
+ font-weight: bold;
+}
+
+h1 {
+ margin: 0;
+ padding: 0.7em 0 0.3em 0;
+ font-size: 1.5em;
+ color: #11557C;
+}
+
+h2 {
+ margin: 1.3em 0 0.2em 0;
+ font-size: 1.35em;
+ padding: 0;
+}
+
+h3 {
+ margin: 1em 0 -0.3em 0;
+ font-size: 1.2em;
+}
+
+h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
+ color: black!important;
+}
+
+h1 a.anchor, h2 a.anchor, h3 a.anchor, h4 a.anchor, h5 a.anchor, h6 a.anchor {
+ display: none;
+ margin: 0 0 0 0.3em;
+ padding: 0 0.2em 0 0.2em;
+ color: #aaa!important;
+}
+
+h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor,
+h5:hover a.anchor, h6:hover a.anchor {
+ display: inline;
+}
+
+h1 a.anchor:hover, h2 a.anchor:hover, h3 a.anchor:hover, h4 a.anchor:hover,
+h5 a.anchor:hover, h6 a.anchor:hover {
+ color: #777;
+ background-color: #eee;
+}
+
+table {
+ border-collapse: collapse;
+ margin: 0 -0.5em 0 -0.5em;
+}
+
+table td, table th {
+ padding: 0.2em 0.5em 0.2em 0.5em;
+}
+
+div.footer {
+ background-color: #E3EFF1;
+ color: #86989B;
+ padding: 3px 8px 3px 0;
+ clear: both;
+ font-size: 0.8em;
+ text-align: right;
+}
+
+div.footer a {
+ color: #86989B;
+ text-decoration: underline;
+}
+
+div.pagination {
+ margin-top: 2em;
+ padding-top: 0.5em;
+ border-top: 1px solid black;
+ text-align: center;
+}
+
+div.sphinxsidebar ul.toc {
+ margin: 1em 0 1em 0;
+ padding: 0 0 0 0.5em;
+ list-style: none;
+}
+
+div.sphinxsidebar ul.toc li {
+ margin: 0.5em 0 0.5em 0;
+ font-size: 0.9em;
+ line-height: 130%;
+}
+
+div.sphinxsidebar ul.toc li p {
+ margin: 0;
+ padding: 0;
+}
+
+div.sphinxsidebar ul.toc ul {
+ margin: 0.2em 0 0.2em 0;
+ padding: 0 0 0 1.8em;
+}
+
+div.sphinxsidebar ul.toc ul li {
+ padding: 0;
+}
+
+div.admonition, div.warning {
+ font-size: 0.9em;
+ margin: 1em 0 0 0;
+ border: 1px solid #86989B;
+ background-color: #f7f7f7;
+}
+
+div.admonition p, div.warning p {
+ margin: 0.5em 1em 0.5em 1em;
+ padding: 0;
+}
+
+div.admonition pre, div.warning pre {
+ margin: 0.4em 1em 0.4em 1em;
+}
+
+div.admonition p.admonition-title,
+div.warning p.admonition-title {
+ margin: 0;
+ padding: 0.1em 0 0.1em 0.5em;
+ color: white;
+ border-bottom: 1px solid #86989B;
+ font-weight: bold;
+ background-color: #AFC1C4;
+}
+
+div.warning {
+ border: 1px solid #940000;
+}
+
+div.warning p.admonition-title {
+ background-color: #CF0000;
+ border-bottom-color: #940000;
+}
+
+div.admonition ul, div.admonition ol,
+div.warning ul, div.warning ol {
+ margin: 0.1em 0.5em 0.5em 3em;
+ padding: 0;
+}
+
+div.versioninfo {
+ margin: 1em 0 0 0;
+ border: 1px solid #ccc;
+ background-color: #DDEAF0;
+ padding: 8px;
+ line-height: 1.3em;
+ font-size: 0.9em;
+}
+
+
+a.headerlink {
+ color: #c60f0f!important;
+ font-size: 1em;
+ margin-left: 6px;
+ padding: 0 4px 0 4px;
+ text-decoration: none!important;
+ visibility: hidden;
+}
+
+h1:hover > a.headerlink,
+h2:hover > a.headerlink,
+h3:hover > a.headerlink,
+h4:hover > a.headerlink,
+h5:hover > a.headerlink,
+h6:hover > a.headerlink,
+dt:hover > a.headerlink {
+ visibility: visible;
+}
+
+a.headerlink:hover {
+ background-color: #ccc;
+ color: white!important;
+}
+
+table.indextable td {
+ text-align: left;
+ vertical-align: top;
+}
+
+table.indextable dl, table.indextable dd {
+ margin-top: 0;
+ margin-bottom: 0;
+}
+
+table.indextable tr.pcap {
+ height: 10px;
+}
+
+table.indextable tr.cap {
+ margin-top: 10px;
+ background-color: #f2f2f2;
+}
+
+img.toggler {
+ margin-right: 3px;
+ margin-top: 3px;
+ cursor: pointer;
+}
+
+img.inheritance {
+ border: 0px
+}
+
+form.pfform {
+ margin: 10px 0 20px 0;
+}
+
+table.contentstable {
+ width: 90%;
+}
+
+table.contentstable p.biglink {
+ line-height: 150%;
+}
+
+a.biglink {
+ font-size: 1.3em;
+}
+
+span.linkdescr {
+ font-style: italic;
+ padding-top: 5px;
+ font-size: 90%;
+}
+
+ul.search {
+ margin: 10px 0 0 20px;
+ padding: 0;
+}
+
+ul.search li {
+ padding: 5px 0 5px 20px;
+ background-image: url(file.png);
+ background-repeat: no-repeat;
+ background-position: 0 7px;
+}
+
+ul.search li a {
+ font-weight: bold;
+}
+
+ul.search li div.context {
+ color: #888;
+ margin: 2px 0 0 30px;
+ text-align: left;
+}
+
+ul.keywordmatches li.goodmatch a {
+ font-weight: bold;
+}
Added: trunk/py4science/examples/sphinx_template2/_templates/layout.html
===================================================================
--- trunk/py4science/examples/sphinx_template2/_templates/layout.html (rev 0)
+++ trunk/py4science/examples/sphinx_template2/_templates/layout.html 2009-08-11 09:26:40 UTC (rev 7448)
@@ -0,0 +1,23 @@
+{% extends "!layout.html" %}
+
+
+{% block rootrellink %}
+ <li><a href="{{ pathto('index') }}">home</a>| </li>
+ <li><a href="{{ pathto('search') }}">search</a>| </li>
+ <li><a href="{{ pathto('contents') }}">documentation </a> »</li>
+{% endblock %}
+
+
+{% block relbar1 %}
+
+<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
+<a href="{{ pathto('index') }}"><img src="{{
+pathto("_static/logo.png", 1) }}" border="0" alt="py4sci"/></a>
+</div>
+{{ super() }}
+{% endblock %}
+
+{# put the sidebar before the body #}
+{% block sidebar1 %}{{ sidebar() }}{% endblock %}
+{% block sidebar2 %}{% endblock %}
+
Modified: trunk/py4science/examples/sphinx_template2/autogen_api.py
===================================================================
--- trunk/py4science/examples/sphinx_template2/autogen_api.py 2009-08-11 07:16:27 UTC (rev 7447)
+++ trunk/py4science/examples/sphinx_template2/autogen_api.py 2009-08-11 09:26:40 UTC (rev 7448)
@@ -16,7 +16,7 @@
outdir = pjoin('api','generated')
docwriter = ApiDocWriter(package,rst_extension='.rst')
# Skip packages you don't want to document
- docwriter.package_skip_patterns += [r'\.mime',
+ docwriter.package_skip_patterns += [r'\.mime', 'test',
]
# For modules, there are also skip patterns
docwriter.module_skip_patterns += [ r'\.mime',
Modified: trunk/py4science/examples/sphinx_template2/conf.py
===================================================================
--- trunk/py4science/examples/sphinx_template2/conf.py 2009-08-11 07:16:27 UTC (rev 7447)
+++ trunk/py4science/examples/sphinx_template2/conf.py 2009-08-11 09:26:40 UTC (rev 7448)
@@ -28,13 +28,13 @@
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['matplotlib.sphinxext.mathmpl',
+extensions = ['matplotlib.sphinxext.mathmpl',
'matplotlib.sphinxext.only_directives',
'matplotlib.sphinxext.plot_directive',
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
- 'ipython_console_highlighting',
- 'inheritance_diagram',
+ 'ipython_console_highlighting',
+ 'inheritance_diagram',
'numpydoc']
# Add any paths that contain templates here, relative to this directory.
@@ -92,7 +92,7 @@
# The style sheet to use for HTML and HTML Help pages. A file of that name
# must exist either in Sphinx' static/ path, or in one of the custom paths
# given in html_static_path.
-html_style = 'default.css'
+html_style = 'sphinx.css'
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <he...@us...> - 2009-08-11 07:16:34
|
Revision: 7447
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7447&view=rev
Author: heeres
Date: 2009-08-11 07:16:27 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
Merged revisions 7446 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_99_maint
........
r7446 | heeres | 2009-08-11 09:06:15 +0200 (Tue, 11 Aug 2009) | 2 lines
Fix bugs: #2830483 (axis scaling), 2834105 (z order problem)
........
Modified Paths:
--------------
trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py
trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py
trunk/matplotlib/lib/mpl_toolkits/mplot3d/axis3d.py
Property Changed:
----------------
trunk/matplotlib/
trunk/matplotlib/doc/pyplots/README
trunk/matplotlib/doc/sphinxext/gen_gallery.py
trunk/matplotlib/doc/sphinxext/gen_rst.py
trunk/matplotlib/examples/misc/multiprocess.py
trunk/matplotlib/examples/mplot3d/contour3d_demo.py
trunk/matplotlib/examples/mplot3d/contourf3d_demo.py
trunk/matplotlib/examples/mplot3d/polys3d_demo.py
trunk/matplotlib/examples/mplot3d/scatter3d_demo.py
trunk/matplotlib/examples/mplot3d/surface3d_demo.py
trunk/matplotlib/examples/mplot3d/wire3d_demo.py
trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py
trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py
trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py
Property changes on: trunk/matplotlib
___________________________________________________________________
Modified: svnmerge-integrated
- /branches/mathtex:1-7263 /branches/v0_98_5_maint:1-7253 /branches/v0_99_maint:1-7444
+ /branches/mathtex:1-7263 /branches/v0_98_5_maint:1-7253 /branches/v0_99_maint:1-7446
Modified: svn:mergeinfo
- /branches/v0_91_maint:5753-5771
/branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
+ /branches/v0_91_maint:5753-5771
/branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446
Property changes on: trunk/matplotlib/doc/pyplots/README
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/doc/pyplots/README:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
+ /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/doc/pyplots/README:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446
Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/doc/sphinxext/gen_gallery.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
+ /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/doc/sphinxext/gen_gallery.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446
Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/doc/sphinxext/gen_rst.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
+ /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/doc/sphinxext/gen_rst.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446
Property changes on: trunk/matplotlib/examples/misc/multiprocess.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/examples/misc/log.py:5753-5771
/branches/v0_98_5_maint/examples/misc/log.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/misc/multiprocess.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
+ /branches/v0_91_maint/examples/misc/log.py:5753-5771
/branches/v0_98_5_maint/examples/misc/log.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/misc/multiprocess.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446
Property changes on: trunk/matplotlib/examples/mplot3d/contour3d_demo.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/examples/mplot3d/contour.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/contour.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/contour3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
+ /branches/v0_91_maint/examples/mplot3d/contour.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/contour.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/contour3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446
Property changes on: trunk/matplotlib/examples/mplot3d/contourf3d_demo.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/examples/mplot3d/contourf.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/contourf.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/contourf3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
+ /branches/v0_91_maint/examples/mplot3d/contourf.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/contourf.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/contourf3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446
Property changes on: trunk/matplotlib/examples/mplot3d/polys3d_demo.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/examples/mplot3d/polys.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/polys.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/polys3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
+ /branches/v0_91_maint/examples/mplot3d/polys.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/polys.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/polys3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446
Property changes on: trunk/matplotlib/examples/mplot3d/scatter3d_demo.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/examples/mplot3d/scatter.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/scatter.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/scatter3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
+ /branches/v0_91_maint/examples/mplot3d/scatter.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/scatter.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/scatter3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446
Property changes on: trunk/matplotlib/examples/mplot3d/surface3d_demo.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/examples/mplot3d/surface.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/surface.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/surface3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
+ /branches/v0_91_maint/examples/mplot3d/surface.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/surface.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/surface3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446
Property changes on: trunk/matplotlib/examples/mplot3d/wire3d_demo.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/examples/mplot3d/wire.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/wire.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/wire3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
+ /branches/v0_91_maint/examples/mplot3d/wire.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/wire.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/wire3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446
Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/lib/matplotlib/sphinxext/mathmpl.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
+ /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/lib/matplotlib/sphinxext/mathmpl.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446
Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/lib/matplotlib/sphinxext/only_directives.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
+ /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/lib/matplotlib/sphinxext/only_directives.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446
Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/lib/matplotlib/sphinxext/plot_directive.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
+ /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/lib/matplotlib/sphinxext/plot_directive.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446
Modified: trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py 2009-08-11 07:06:15 UTC (rev 7446)
+++ trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py 2009-08-11 07:16:27 UTC (rev 7447)
@@ -217,9 +217,19 @@
def draw(self, renderer):
Patch.draw(self, renderer)
+def get_patch_verts(patch):
+ """Return a list of vertices for the path of a patch."""
+ trans = patch.get_patch_transform()
+ path = patch.get_path()
+ polygons = path.to_polygons(trans)
+ if len(polygons):
+ return polygons[0]
+ else:
+ return []
+
def patch_2d_to_3d(patch, z=0, zdir='z'):
"""Convert a Patch to a Patch3D object."""
- verts = patch.get_verts()
+ verts = get_patch_verts(patch)
patch.__class__ = Patch3D
patch.set_3d_properties(verts, z, zdir)
@@ -333,7 +343,7 @@
if self._zsort:
z_segments_2d = [(np.average(zs), zip(xs, ys), fc, ec) for
(xs, ys, zs), fc, ec in zip(xyzlist, cface, cedge)]
- z_segments_2d.sort(reverse=True)
+ z_segments_2d.sort(cmp=lambda x, y: cmp(y[0], x[0]))
else:
raise ValueError, "whoops"
Modified: trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py 2009-08-11 07:06:15 UTC (rev 7446)
+++ trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py 2009-08-11 07:16:27 UTC (rev 7447)
@@ -200,14 +200,17 @@
def get_w_lims(self):
'''Get 3d world limits.'''
- minpy, maxx = self.get_xlim3d()
+ minx, maxx = self.get_xlim3d()
miny, maxy = self.get_ylim3d()
minz, maxz = self.get_zlim3d()
- return minpy, maxx, miny, maxy, minz, maxz
+ return minx, maxx, miny, maxy, minz, maxz
def _determine_lims(self, xmin=None, xmax=None, *args, **kwargs):
if xmax is None and cbook.iterable(xmin):
xmin, xmax = xmin
+ if xmin == xmax:
+ xmin -= 0.5
+ xmax += 0.5
return (xmin, xmax)
def set_xlim3d(self, *args, **kwargs):
@@ -442,12 +445,12 @@
elif self.button_pressed == 3:
# zoom view
# hmmm..this needs some help from clipping....
- minpy, maxx, miny, maxy, minz, maxz = self.get_w_lims()
+ minx, maxx, miny, maxy, minz, maxz = self.get_w_lims()
df = 1-((h - dy)/h)
- dx = (maxx-minpy)*df
+ dx = (maxx-minx)*df
dy = (maxy-miny)*df
dz = (maxz-minz)*df
- self.set_xlim3d(minpy - dx, maxx + dx)
+ self.set_xlim3d(minx - dx, maxx + dx)
self.set_ylim3d(miny - dy, maxy + dy)
self.set_zlim3d(minz - dz, maxz + dz)
self.get_proj()
@@ -903,13 +906,12 @@
patches = Axes.bar(self, left, height, *args, **kwargs)
if not cbook.iterable(zs):
- zs = np.ones(len(left))*zs
+ zs = np.ones(len(left)) * zs
-
verts = []
verts_zs = []
for p, z in zip(patches, zs):
- vs = p.get_verts()
+ vs = art3d.get_patch_verts(p)
verts += vs.tolist()
verts_zs += [z] * len(vs)
art3d.patch_2d_to_3d(p, zs, zdir)
@@ -933,7 +935,6 @@
had_data = self.has_data()
if not cbook.iterable(x):
- print 'not interable'
x, y, z = [x], [y], [z]
if not cbook.iterable(dx):
dx, dy, dz = [dx], [dy], [dz]
Modified: trunk/matplotlib/lib/mpl_toolkits/mplot3d/axis3d.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/mplot3d/axis3d.py 2009-08-11 07:06:15 UTC (rev 7446)
+++ trunk/matplotlib/lib/mpl_toolkits/mplot3d/axis3d.py 2009-08-11 07:16:27 UTC (rev 7447)
@@ -103,9 +103,6 @@
def get_major_ticks(self):
ticks = maxis.XAxis.get_major_ticks(self)
for t in ticks:
- def update_coords(renderer, self=t.label1):
- return text_update_coords(self, renderer)
- # Text overrides setattr so need this to force new method
t.tick1line.set_transform(self.axes.transData)
t.tick2line.set_transform(self.axes.transData)
t.gridline.set_transform(self.axes.transData)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <he...@us...> - 2009-08-11 07:06:27
|
Revision: 7446
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7446&view=rev
Author: heeres
Date: 2009-08-11 07:06:15 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
Fix bugs: #2830483 (axis scaling), 2834105 (z order problem)
Modified Paths:
--------------
branches/v0_99_maint/lib/mpl_toolkits/mplot3d/art3d.py
branches/v0_99_maint/lib/mpl_toolkits/mplot3d/axes3d.py
branches/v0_99_maint/lib/mpl_toolkits/mplot3d/axis3d.py
Modified: branches/v0_99_maint/lib/mpl_toolkits/mplot3d/art3d.py
===================================================================
--- branches/v0_99_maint/lib/mpl_toolkits/mplot3d/art3d.py 2009-08-10 00:47:21 UTC (rev 7445)
+++ branches/v0_99_maint/lib/mpl_toolkits/mplot3d/art3d.py 2009-08-11 07:06:15 UTC (rev 7446)
@@ -217,9 +217,19 @@
def draw(self, renderer):
Patch.draw(self, renderer)
+def get_patch_verts(patch):
+ """Return a list of vertices for the path of a patch."""
+ trans = patch.get_patch_transform()
+ path = patch.get_path()
+ polygons = path.to_polygons(trans)
+ if len(polygons):
+ return polygons[0]
+ else:
+ return []
+
def patch_2d_to_3d(patch, z=0, zdir='z'):
"""Convert a Patch to a Patch3D object."""
- verts = patch.get_verts()
+ verts = get_patch_verts(patch)
patch.__class__ = Patch3D
patch.set_3d_properties(verts, z, zdir)
@@ -333,7 +343,7 @@
if self._zsort:
z_segments_2d = [(np.average(zs), zip(xs, ys), fc, ec) for
(xs, ys, zs), fc, ec in zip(xyzlist, cface, cedge)]
- z_segments_2d.sort(reverse=True)
+ z_segments_2d.sort(cmp=lambda x, y: cmp(y[0], x[0]))
else:
raise ValueError, "whoops"
Modified: branches/v0_99_maint/lib/mpl_toolkits/mplot3d/axes3d.py
===================================================================
--- branches/v0_99_maint/lib/mpl_toolkits/mplot3d/axes3d.py 2009-08-10 00:47:21 UTC (rev 7445)
+++ branches/v0_99_maint/lib/mpl_toolkits/mplot3d/axes3d.py 2009-08-11 07:06:15 UTC (rev 7446)
@@ -200,14 +200,17 @@
def get_w_lims(self):
'''Get 3d world limits.'''
- minpy, maxx = self.get_xlim3d()
+ minx, maxx = self.get_xlim3d()
miny, maxy = self.get_ylim3d()
minz, maxz = self.get_zlim3d()
- return minpy, maxx, miny, maxy, minz, maxz
+ return minx, maxx, miny, maxy, minz, maxz
def _determine_lims(self, xmin=None, xmax=None, *args, **kwargs):
if xmax is None and cbook.iterable(xmin):
xmin, xmax = xmin
+ if xmin == xmax:
+ xmin -= 0.5
+ xmax += 0.5
return (xmin, xmax)
def set_xlim3d(self, *args, **kwargs):
@@ -442,12 +445,12 @@
elif self.button_pressed == 3:
# zoom view
# hmmm..this needs some help from clipping....
- minpy, maxx, miny, maxy, minz, maxz = self.get_w_lims()
+ minx, maxx, miny, maxy, minz, maxz = self.get_w_lims()
df = 1-((h - dy)/h)
- dx = (maxx-minpy)*df
+ dx = (maxx-minx)*df
dy = (maxy-miny)*df
dz = (maxz-minz)*df
- self.set_xlim3d(minpy - dx, maxx + dx)
+ self.set_xlim3d(minx - dx, maxx + dx)
self.set_ylim3d(miny - dy, maxy + dy)
self.set_zlim3d(minz - dz, maxz + dz)
self.get_proj()
@@ -903,13 +906,12 @@
patches = Axes.bar(self, left, height, *args, **kwargs)
if not cbook.iterable(zs):
- zs = np.ones(len(left))*zs
+ zs = np.ones(len(left)) * zs
-
verts = []
verts_zs = []
for p, z in zip(patches, zs):
- vs = p.get_verts()
+ vs = art3d.get_patch_verts(p)
verts += vs.tolist()
verts_zs += [z] * len(vs)
art3d.patch_2d_to_3d(p, zs, zdir)
@@ -933,7 +935,6 @@
had_data = self.has_data()
if not cbook.iterable(x):
- print 'not interable'
x, y, z = [x], [y], [z]
if not cbook.iterable(dx):
dx, dy, dz = [dx], [dy], [dz]
Modified: branches/v0_99_maint/lib/mpl_toolkits/mplot3d/axis3d.py
===================================================================
--- branches/v0_99_maint/lib/mpl_toolkits/mplot3d/axis3d.py 2009-08-10 00:47:21 UTC (rev 7445)
+++ branches/v0_99_maint/lib/mpl_toolkits/mplot3d/axis3d.py 2009-08-11 07:06:15 UTC (rev 7446)
@@ -103,9 +103,6 @@
def get_major_ticks(self):
ticks = maxis.XAxis.get_major_ticks(self)
for t in ticks:
- def update_coords(renderer, self=t.label1):
- return text_update_coords(self, renderer)
- # Text overrides setattr so need this to force new method
t.tick1line.set_transform(self.axes.transData)
t.tick2line.set_transform(self.axes.transData)
t.gridline.set_transform(self.axes.transData)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2009-08-10 01:22:21
|
Revision: 7442
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7442&view=rev
Author: efiring
Date: 2009-08-10 00:02:56 +0000 (Mon, 10 Aug 2009)
Log Message:
-----------
patch from sage project: make unicode_safe safer
Modified Paths:
--------------
branches/v0_99_maint/lib/matplotlib/cbook.py
Modified: branches/v0_99_maint/lib/matplotlib/cbook.py
===================================================================
--- branches/v0_99_maint/lib/matplotlib/cbook.py 2009-08-09 20:58:24 UTC (rev 7441)
+++ branches/v0_99_maint/lib/matplotlib/cbook.py 2009-08-10 00:02:56 UTC (rev 7442)
@@ -13,13 +13,21 @@
major, minor1, minor2, s, tmp = sys.version_info
-# on some systems, locale.getpreferredencoding returns None, which can break unicode
-preferredencoding = locale.getpreferredencoding()
+# On some systems, locale.getpreferredencoding returns None,
+# which can break unicode; and the sage project reports that
+# some systems have incorrect locale specifications, e.g.,
+# an encoding instead of a valid locale name.
+try:
+ preferredencoding = locale.getpreferredencoding()
+except ValueError:
+ preferredencoding = None
+
def unicode_safe(s):
if preferredencoding is None: return unicode(s)
else: return unicode(s, preferredencoding)
+
class converter:
"""
Base class for handling string -> python type with support for
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2009-08-10 00:47:32
|
Revision: 7445
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7445&view=rev
Author: efiring
Date: 2009-08-10 00:47:21 +0000 (Mon, 10 Aug 2009)
Log Message:
-----------
Merged revisions 7442-7444 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_99_maint
........
r7442 | efiring | 2009-08-09 14:02:56 -1000 (Sun, 09 Aug 2009) | 2 lines
patch from sage project: make unicode_safe safer
........
r7443 | efiring | 2009-08-09 14:19:19 -1000 (Sun, 09 Aug 2009) | 3 lines
Patch from Jason, sage project: prevent failure with tiny arrows.
Also deleting unwanted whitespace in bezier.py.
........
r7444 | efiring | 2009-08-09 14:31:30 -1000 (Sun, 09 Aug 2009) | 3 lines
Sage patch, slightly modified, to improve tk/tcl detection.
http://trac.sagemath.org/sage_trac/ticket/4176
........
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/bezier.py
trunk/matplotlib/lib/matplotlib/cbook.py
trunk/matplotlib/lib/matplotlib/patches.py
trunk/matplotlib/setupext.py
Property Changed:
----------------
trunk/matplotlib/
trunk/matplotlib/doc/pyplots/README
trunk/matplotlib/doc/sphinxext/gen_gallery.py
trunk/matplotlib/doc/sphinxext/gen_rst.py
trunk/matplotlib/examples/misc/multiprocess.py
trunk/matplotlib/examples/mplot3d/contour3d_demo.py
trunk/matplotlib/examples/mplot3d/contourf3d_demo.py
trunk/matplotlib/examples/mplot3d/polys3d_demo.py
trunk/matplotlib/examples/mplot3d/scatter3d_demo.py
trunk/matplotlib/examples/mplot3d/surface3d_demo.py
trunk/matplotlib/examples/mplot3d/wire3d_demo.py
trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py
trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py
trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py
Property changes on: trunk/matplotlib
___________________________________________________________________
Modified: svnmerge-integrated
- /branches/mathtex:1-7263 /branches/v0_98_5_maint:1-7253 /branches/v0_99_maint:1-7433
+ /branches/mathtex:1-7263 /branches/v0_98_5_maint:1-7253 /branches/v0_99_maint:1-7444
Modified: svn:mergeinfo
- /branches/v0_91_maint:5753-5771
/branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint:7338,7393,7395-7404,7407-7424,7428-7433
+ /branches/v0_91_maint:5753-5771
/branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
Property changes on: trunk/matplotlib/doc/pyplots/README
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/doc/pyplots/README:7338,7393,7395-7404,7407-7424,7428-7433
+ /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/doc/pyplots/README:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/doc/sphinxext/gen_gallery.py:7338,7393,7395-7404,7407-7424,7428-7433
+ /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/doc/sphinxext/gen_gallery.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/doc/sphinxext/gen_rst.py:7338,7393,7395-7404,7407-7424,7428-7433
+ /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/doc/sphinxext/gen_rst.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
Property changes on: trunk/matplotlib/examples/misc/multiprocess.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/examples/misc/log.py:5753-5771
/branches/v0_98_5_maint/examples/misc/log.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/misc/multiprocess.py:7338,7393,7395-7404,7407-7424,7428-7433
+ /branches/v0_91_maint/examples/misc/log.py:5753-5771
/branches/v0_98_5_maint/examples/misc/log.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/misc/multiprocess.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
Property changes on: trunk/matplotlib/examples/mplot3d/contour3d_demo.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/examples/mplot3d/contour.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/contour.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/contour3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433
+ /branches/v0_91_maint/examples/mplot3d/contour.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/contour.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/contour3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
Property changes on: trunk/matplotlib/examples/mplot3d/contourf3d_demo.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/examples/mplot3d/contourf.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/contourf.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/contourf3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433
+ /branches/v0_91_maint/examples/mplot3d/contourf.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/contourf.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/contourf3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
Property changes on: trunk/matplotlib/examples/mplot3d/polys3d_demo.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/examples/mplot3d/polys.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/polys.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/polys3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433
+ /branches/v0_91_maint/examples/mplot3d/polys.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/polys.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/polys3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
Property changes on: trunk/matplotlib/examples/mplot3d/scatter3d_demo.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/examples/mplot3d/scatter.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/scatter.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/scatter3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433
+ /branches/v0_91_maint/examples/mplot3d/scatter.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/scatter.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/scatter3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
Property changes on: trunk/matplotlib/examples/mplot3d/surface3d_demo.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/examples/mplot3d/surface.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/surface.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/surface3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433
+ /branches/v0_91_maint/examples/mplot3d/surface.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/surface.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/surface3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
Property changes on: trunk/matplotlib/examples/mplot3d/wire3d_demo.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/examples/mplot3d/wire.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/wire.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/wire3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433
+ /branches/v0_91_maint/examples/mplot3d/wire.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/wire.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/wire3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
Modified: trunk/matplotlib/lib/matplotlib/bezier.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/bezier.py 2009-08-10 00:31:30 UTC (rev 7444)
+++ trunk/matplotlib/lib/matplotlib/bezier.py 2009-08-10 00:47:21 UTC (rev 7445)
@@ -18,7 +18,7 @@
""" return a intersecting point between a line through (cx1, cy1)
and having angle t1 and a line through (cx2, cy2) and angle t2.
"""
-
+
# line1 => sin_t1 * (x - cx1) - cos_t1 * (y - cy1) = 0.
# line1 => sin_t1 * x + cos_t1 * y = sin_t1*cx1 - cos_t1*cy1
@@ -32,7 +32,7 @@
ad_bc = a*d-b*c
if ad_bc == 0.:
raise ValueError("Given lines do not intersect")
-
+
#rhs_inverse
a_, b_ = d, -b
c_, d_ = -c, a
@@ -53,7 +53,7 @@
if length == 0.:
return cx, cy, cx, cy
-
+
cos_t1, sin_t1 = sin_t, -cos_t
cos_t2, sin_t2 = -sin_t, cos_t
@@ -81,7 +81,7 @@
def split_de_casteljau(beta, t):
"""split a bezier segment defined by its controlpoints *beta*
into two separate segment divided at *t* and return their control points.
-
+
"""
beta = np.asarray(beta)
beta_list = [beta]
@@ -101,20 +101,20 @@
-def find_bezier_t_intersecting_with_closedpath(bezier_point_at_t, inside_closedpath,
+def find_bezier_t_intersecting_with_closedpath(bezier_point_at_t, inside_closedpath,
t0=0., t1=1., tolerence=0.01):
""" Find a parameter t0 and t1 of the given bezier path which
bounds the intersecting points with a provided closed
path(*inside_closedpath*). Search starts from *t0* and *t1* and it
uses a simple bisecting algorithm therefore one of the end point
must be inside the path while the orther doesn't. The search stop
- when |t0-t1| gets smaller than the given tolerence.
+ when |t0-t1| gets smaller than the given tolerence.
value for
- bezier_point_at_t : a function which returns x, y coordinates at *t*
- inside_closedpath : return True if the point is insed the path
-
+
"""
# inside_closedpath : function
@@ -146,11 +146,11 @@
t0 = middle_t
start = middle
start_inside = middle_inside
-
+
class BezierSegment:
"""
A simple class of a 2-dimensional bezier segment
@@ -192,19 +192,19 @@
def split_bezier_intersecting_with_closedpath(bezier,
- inside_closedpath,
+ inside_closedpath,
tolerence=0.01):
"""
bezier : control points of the bezier segment
inside_closedpath : a function which returns true if the point is inside the path
"""
-
+
bz = BezierSegment(bezier)
bezier_point_at_t = bz.point_at_t
t0, t1 = find_bezier_t_intersecting_with_closedpath(bezier_point_at_t,
- inside_closedpath,
+ inside_closedpath,
tolerence=tolerence)
_left, _right = split_de_casteljau(bezier, (t0+t1)/2.)
@@ -213,23 +213,23 @@
def find_r_to_boundary_of_closedpath(inside_closedpath, xy,
- cos_t, sin_t,
+ cos_t, sin_t,
rmin=0., rmax=1., tolerence=0.01):
"""
Find a radius r (centered at *xy*) between *rmin* and *rmax* at
which it intersect with the path.
-
+
inside_closedpath : function
cx, cy : center
cos_t, sin_t : cosine and sine for the angle
- rmin, rmax :
+ rmin, rmax :
"""
cx, cy = xy
def _f(r):
return cos_t*r + cx, sin_t*r + cy
- find_bezier_t_intersecting_with_closedpath(_f, inside_closedpath,
+ find_bezier_t_intersecting_with_closedpath(_f, inside_closedpath,
t0=rmin, t1=rmax, tolerence=tolerence)
@@ -238,7 +238,7 @@
def split_path_inout(path, inside, tolerence=0.01, reorder_inout=False):
""" divide a path into two segment at the point where inside(x, y)
- becomes False.
+ becomes False.
"""
path_iter = path.iter_segments()
@@ -262,7 +262,7 @@
break
ctl_points_old = ctl_points
-
+
if bezier_path is None:
raise ValueError("The path does not seem to intersect with the patch")
@@ -286,7 +286,7 @@
verts_right = right[:]
#i += 1
-
+
if path.codes is None:
path_in = Path(concat([path.vertices[:i], verts_left]))
path_out = Path(concat([verts_right, path.vertices[i:]]))
@@ -297,16 +297,16 @@
path_out = Path(concat([verts_right, path.vertices[i:]]),
concat([codes_right, path.codes[i:]]))
-
+
if reorder_inout and begin_inside == False:
path_in, path_out = path_out, path_in
return path_in, path_out
-
-
+
+
def inside_circle(cx, cy, r):
r2 = r**2
def _f(xy):
@@ -328,7 +328,7 @@
"""
Given the quadraitc bezier control points *bezier2*, returns
control points of quadrativ bezier lines roughly parralel to given
- one separated by *width*.
+ one separated by *width*.
"""
# The parallel bezier lines constructed by following ways.
@@ -374,7 +374,7 @@
"""
Being similar to get_parallels, returns
control points of two quadrativ bezier lines having a width roughly parralel to given
- one separated by *width*.
+ one separated by *width*.
"""
xx1, yy1 = bezier2[2]
@@ -389,17 +389,17 @@
x1, y1, x2, y2 = get_normal_points(cx, cy, cos_t, sin_t, length)
- xx12, yy12 = (xx1+xx2)/2., (yy1+yy2)/2.,
- xx23, yy23 = (xx2+xx3)/2., (yy2+yy3)/2.,
+ xx12, yy12 = (xx1+xx2)/2., (yy1+yy2)/2.,
+ xx23, yy23 = (xx2+xx3)/2., (yy2+yy3)/2.,
dist = sqrt((xx12-xx23)**2 + (yy12-yy23)**2)
cos_t, sin_t = (xx12-xx23)/dist, (yy12-yy23)/dist,
-
+
xm1, ym1, xm2, ym2 = get_normal_points(xx2, yy2, cos_t, sin_t, length*shrink_factor)
l_plus = [(x1, y1), (xm1, ym1), (xx1, yy1)]
l_minus = [(x2, y2), (xm2, ym2), (xx1, yy1)]
-
+
return l_plus, l_minus
@@ -418,7 +418,7 @@
"""
Being similar to get_parallels, returns
control points of two quadrativ bezier lines having a width roughly parralel to given
- one separated by *width*.
+ one separated by *width*.
"""
# c1, cm, c2
@@ -446,9 +446,9 @@
# find c12, c23 and c123 which are middle points of c1-cm, cm-c3 and c12-c23
c12x, c12y = (c1x+cmx)*.5, (c1y+cmy)*.5
- c23x, c23y = (cmx+c3x)*.5, (cmy+c3y)*.5
+ c23x, c23y = (cmx+c3x)*.5, (cmy+c3y)*.5
c123x, c123y = (c12x+c23x)*.5, (c12y+c23y)*.5
-
+
# tangential angle of c123 (angle between c12 and c23)
cos_t123, sin_t123 = get_cos_sin(c12x, c12y, c23x, c23y)
@@ -481,7 +481,7 @@
return Path(p.vertices, c)
else:
return p
-
+
def concatenate_paths(paths):
"""
concatenate list of paths into a single path.
Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cbook.py 2009-08-10 00:31:30 UTC (rev 7444)
+++ trunk/matplotlib/lib/matplotlib/cbook.py 2009-08-10 00:47:21 UTC (rev 7445)
@@ -19,13 +19,21 @@
major, minor1, minor2, s, tmp = sys.version_info
-# on some systems, locale.getpreferredencoding returns None, which can break unicode
-preferredencoding = locale.getpreferredencoding()
+# On some systems, locale.getpreferredencoding returns None,
+# which can break unicode; and the sage project reports that
+# some systems have incorrect locale specifications, e.g.,
+# an encoding instead of a valid locale name.
+try:
+ preferredencoding = locale.getpreferredencoding()
+except ValueError:
+ preferredencoding = None
+
def unicode_safe(s):
if preferredencoding is None: return unicode(s)
else: return unicode(s, preferredencoding)
+
class converter:
"""
Base class for handling string -> python type with support for
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py 2009-08-10 00:31:30 UTC (rev 7444)
+++ trunk/matplotlib/lib/matplotlib/patches.py 2009-08-10 00:47:21 UTC (rev 7445)
@@ -2326,15 +2326,21 @@
x, y = path.vertices[0]
insideA = inside_circle(x, y, shrinkA)
- left, right = split_path_inout(path, insideA)
- path = right
+ try:
+ left, right = split_path_inout(path, insideA)
+ path = right
+ except ValueError:
+ pass
if shrinkB:
x, y = path.vertices[-1]
insideB = inside_circle(x, y, shrinkB)
- left, right = split_path_inout(path, insideB)
- path = left
+ try:
+ left, right = split_path_inout(path, insideB)
+ path = left
+ except ValueError:
+ pass
return path
Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/lib/matplotlib/sphinxext/mathmpl.py:7338,7393,7395-7404,7407-7424,7428-7433
+ /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/lib/matplotlib/sphinxext/mathmpl.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/lib/matplotlib/sphinxext/only_directives.py:7338,7393,7395-7404,7407-7424,7428-7433
+ /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/lib/matplotlib/sphinxext/only_directives.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/lib/matplotlib/sphinxext/plot_directive.py:7338,7393,7395-7404,7407-7424,7428-7433
+ /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/lib/matplotlib/sphinxext/plot_directive.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444
Modified: trunk/matplotlib/setupext.py
===================================================================
--- trunk/matplotlib/setupext.py 2009-08-10 00:31:30 UTC (rev 7444)
+++ trunk/matplotlib/setupext.py 2009-08-10 00:47:21 UTC (rev 7445)
@@ -545,7 +545,7 @@
else:
add_base_flags(module)
module.libraries.append('z')
-
+
# put this last for library link order
module.libraries.extend(std_libs)
@@ -1037,6 +1037,7 @@
try:
tcl_lib_dir, tk_lib_dir, tk_ver = query_tcltk()
except:
+ tk_ver = ''
result = hardcoded_tcl_config()
else:
result = parse_tcl_config(tcl_lib_dir, tk_lib_dir)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2009-08-10 00:31:36
|
Revision: 7444
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7444&view=rev
Author: efiring
Date: 2009-08-10 00:31:30 +0000 (Mon, 10 Aug 2009)
Log Message:
-----------
Sage patch, slightly modified, to improve tk/tcl detection.
http://trac.sagemath.org/sage_trac/ticket/4176
Modified Paths:
--------------
branches/v0_99_maint/setupext.py
Modified: branches/v0_99_maint/setupext.py
===================================================================
--- branches/v0_99_maint/setupext.py 2009-08-10 00:19:19 UTC (rev 7443)
+++ branches/v0_99_maint/setupext.py 2009-08-10 00:31:30 UTC (rev 7444)
@@ -545,7 +545,7 @@
else:
add_base_flags(module)
module.libraries.append('z')
-
+
# put this last for library link order
module.libraries.extend(std_libs)
@@ -1037,6 +1037,7 @@
try:
tcl_lib_dir, tk_lib_dir, tk_ver = query_tcltk()
except:
+ tk_ver = ''
result = hardcoded_tcl_config()
else:
result = parse_tcl_config(tcl_lib_dir, tk_lib_dir)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2009-08-10 00:20:04
|
Revision: 7443
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7443&view=rev
Author: efiring
Date: 2009-08-10 00:19:19 +0000 (Mon, 10 Aug 2009)
Log Message:
-----------
Patch from Jason, sage project: prevent failure with tiny arrows.
Also deleting unwanted whitespace in bezier.py.
Modified Paths:
--------------
branches/v0_99_maint/lib/matplotlib/bezier.py
branches/v0_99_maint/lib/matplotlib/patches.py
Modified: branches/v0_99_maint/lib/matplotlib/bezier.py
===================================================================
--- branches/v0_99_maint/lib/matplotlib/bezier.py 2009-08-10 00:02:56 UTC (rev 7442)
+++ branches/v0_99_maint/lib/matplotlib/bezier.py 2009-08-10 00:19:19 UTC (rev 7443)
@@ -18,7 +18,7 @@
""" return a intersecting point between a line through (cx1, cy1)
and having angle t1 and a line through (cx2, cy2) and angle t2.
"""
-
+
# line1 => sin_t1 * (x - cx1) - cos_t1 * (y - cy1) = 0.
# line1 => sin_t1 * x + cos_t1 * y = sin_t1*cx1 - cos_t1*cy1
@@ -32,7 +32,7 @@
ad_bc = a*d-b*c
if ad_bc == 0.:
raise ValueError("Given lines do not intersect")
-
+
#rhs_inverse
a_, b_ = d, -b
c_, d_ = -c, a
@@ -53,7 +53,7 @@
if length == 0.:
return cx, cy, cx, cy
-
+
cos_t1, sin_t1 = sin_t, -cos_t
cos_t2, sin_t2 = -sin_t, cos_t
@@ -81,7 +81,7 @@
def split_de_casteljau(beta, t):
"""split a bezier segment defined by its controlpoints *beta*
into two separate segment divided at *t* and return their control points.
-
+
"""
beta = np.asarray(beta)
beta_list = [beta]
@@ -101,20 +101,20 @@
-def find_bezier_t_intersecting_with_closedpath(bezier_point_at_t, inside_closedpath,
+def find_bezier_t_intersecting_with_closedpath(bezier_point_at_t, inside_closedpath,
t0=0., t1=1., tolerence=0.01):
""" Find a parameter t0 and t1 of the given bezier path which
bounds the intersecting points with a provided closed
path(*inside_closedpath*). Search starts from *t0* and *t1* and it
uses a simple bisecting algorithm therefore one of the end point
must be inside the path while the orther doesn't. The search stop
- when |t0-t1| gets smaller than the given tolerence.
+ when |t0-t1| gets smaller than the given tolerence.
value for
- bezier_point_at_t : a function which returns x, y coordinates at *t*
- inside_closedpath : return True if the point is insed the path
-
+
"""
# inside_closedpath : function
@@ -146,11 +146,11 @@
t0 = middle_t
start = middle
start_inside = middle_inside
-
+
class BezierSegment:
"""
A simple class of a 2-dimensional bezier segment
@@ -192,19 +192,19 @@
def split_bezier_intersecting_with_closedpath(bezier,
- inside_closedpath,
+ inside_closedpath,
tolerence=0.01):
"""
bezier : control points of the bezier segment
inside_closedpath : a function which returns true if the point is inside the path
"""
-
+
bz = BezierSegment(bezier)
bezier_point_at_t = bz.point_at_t
t0, t1 = find_bezier_t_intersecting_with_closedpath(bezier_point_at_t,
- inside_closedpath,
+ inside_closedpath,
tolerence=tolerence)
_left, _right = split_de_casteljau(bezier, (t0+t1)/2.)
@@ -213,23 +213,23 @@
def find_r_to_boundary_of_closedpath(inside_closedpath, xy,
- cos_t, sin_t,
+ cos_t, sin_t,
rmin=0., rmax=1., tolerence=0.01):
"""
Find a radius r (centered at *xy*) between *rmin* and *rmax* at
which it intersect with the path.
-
+
inside_closedpath : function
cx, cy : center
cos_t, sin_t : cosine and sine for the angle
- rmin, rmax :
+ rmin, rmax :
"""
cx, cy = xy
def _f(r):
return cos_t*r + cx, sin_t*r + cy
- find_bezier_t_intersecting_with_closedpath(_f, inside_closedpath,
+ find_bezier_t_intersecting_with_closedpath(_f, inside_closedpath,
t0=rmin, t1=rmax, tolerence=tolerence)
@@ -238,7 +238,7 @@
def split_path_inout(path, inside, tolerence=0.01, reorder_inout=False):
""" divide a path into two segment at the point where inside(x, y)
- becomes False.
+ becomes False.
"""
path_iter = path.iter_segments()
@@ -262,7 +262,7 @@
break
ctl_points_old = ctl_points
-
+
if bezier_path is None:
raise ValueError("The path does not seem to intersect with the patch")
@@ -286,7 +286,7 @@
verts_right = right[:]
#i += 1
-
+
if path.codes is None:
path_in = Path(concat([path.vertices[:i], verts_left]))
path_out = Path(concat([verts_right, path.vertices[i:]]))
@@ -297,16 +297,16 @@
path_out = Path(concat([verts_right, path.vertices[i:]]),
concat([codes_right, path.codes[i:]]))
-
+
if reorder_inout and begin_inside == False:
path_in, path_out = path_out, path_in
return path_in, path_out
-
-
+
+
def inside_circle(cx, cy, r):
r2 = r**2
def _f(xy):
@@ -328,7 +328,7 @@
"""
Given the quadraitc bezier control points *bezier2*, returns
control points of quadrativ bezier lines roughly parralel to given
- one separated by *width*.
+ one separated by *width*.
"""
# The parallel bezier lines constructed by following ways.
@@ -374,7 +374,7 @@
"""
Being similar to get_parallels, returns
control points of two quadrativ bezier lines having a width roughly parralel to given
- one separated by *width*.
+ one separated by *width*.
"""
xx1, yy1 = bezier2[2]
@@ -389,17 +389,17 @@
x1, y1, x2, y2 = get_normal_points(cx, cy, cos_t, sin_t, length)
- xx12, yy12 = (xx1+xx2)/2., (yy1+yy2)/2.,
- xx23, yy23 = (xx2+xx3)/2., (yy2+yy3)/2.,
+ xx12, yy12 = (xx1+xx2)/2., (yy1+yy2)/2.,
+ xx23, yy23 = (xx2+xx3)/2., (yy2+yy3)/2.,
dist = sqrt((xx12-xx23)**2 + (yy12-yy23)**2)
cos_t, sin_t = (xx12-xx23)/dist, (yy12-yy23)/dist,
-
+
xm1, ym1, xm2, ym2 = get_normal_points(xx2, yy2, cos_t, sin_t, length*shrink_factor)
l_plus = [(x1, y1), (xm1, ym1), (xx1, yy1)]
l_minus = [(x2, y2), (xm2, ym2), (xx1, yy1)]
-
+
return l_plus, l_minus
@@ -418,7 +418,7 @@
"""
Being similar to get_parallels, returns
control points of two quadrativ bezier lines having a width roughly parralel to given
- one separated by *width*.
+ one separated by *width*.
"""
# c1, cm, c2
@@ -446,9 +446,9 @@
# find c12, c23 and c123 which are middle points of c1-cm, cm-c3 and c12-c23
c12x, c12y = (c1x+cmx)*.5, (c1y+cmy)*.5
- c23x, c23y = (cmx+c3x)*.5, (cmy+c3y)*.5
+ c23x, c23y = (cmx+c3x)*.5, (cmy+c3y)*.5
c123x, c123y = (c12x+c23x)*.5, (c12y+c23y)*.5
-
+
# tangential angle of c123 (angle between c12 and c23)
cos_t123, sin_t123 = get_cos_sin(c12x, c12y, c23x, c23y)
@@ -481,7 +481,7 @@
return Path(p.vertices, c)
else:
return p
-
+
def concatenate_paths(paths):
"""
concatenate list of paths into a single path.
Modified: branches/v0_99_maint/lib/matplotlib/patches.py
===================================================================
--- branches/v0_99_maint/lib/matplotlib/patches.py 2009-08-10 00:02:56 UTC (rev 7442)
+++ branches/v0_99_maint/lib/matplotlib/patches.py 2009-08-10 00:19:19 UTC (rev 7443)
@@ -2326,15 +2326,21 @@
x, y = path.vertices[0]
insideA = inside_circle(x, y, shrinkA)
- left, right = split_path_inout(path, insideA)
- path = right
+ try:
+ left, right = split_path_inout(path, insideA)
+ path = right
+ except ValueError:
+ pass
if shrinkB:
x, y = path.vertices[-1]
insideB = inside_circle(x, y, shrinkB)
- left, right = split_path_inout(path, insideB)
- path = left
+ try:
+ left, right = split_path_inout(path, insideB)
+ path = left
+ except ValueError:
+ pass
return path
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-08-09 20:58:31
|
Revision: 7441
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7441&view=rev
Author: leejjoon
Date: 2009-08-09 20:58:24 +0000 (Sun, 09 Aug 2009)
Log Message:
-----------
added demo_text_path.py
Added Paths:
-----------
trunk/matplotlib/examples/pylab_examples/demo_text_path.py
Added: trunk/matplotlib/examples/pylab_examples/demo_text_path.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/demo_text_path.py (rev 0)
+++ trunk/matplotlib/examples/pylab_examples/demo_text_path.py 2009-08-09 20:58:24 UTC (rev 7441)
@@ -0,0 +1,213 @@
+
+# -*- coding: utf-8 -*-
+
+import matplotlib.pyplot as plt
+from matplotlib.image import BboxImage
+import numpy as np
+from matplotlib.transforms import Affine2D, IdentityTransform
+
+import matplotlib.font_manager as font_manager
+from matplotlib.ft2font import FT2Font, KERNING_DEFAULT, LOAD_NO_HINTING
+from matplotlib.font_manager import FontProperties
+from matplotlib.path import Path
+import matplotlib.patches as mpatches
+
+from matplotlib.offsetbox import AnnotationBbox,\
+ AnchoredOffsetbox, AuxTransformBox
+
+#from matplotlib.offsetbox import
+
+from matplotlib.cbook import get_sample_data
+
+
+class TextPatch(mpatches.PathPatch):
+
+ FONT_SCALE = 100.
+
+ def __init__(self, xy, s, size=None, prop=None, bbox_image=None,
+ *kl, **kwargs):
+ if prop is None:
+ prop = FontProperties()
+
+ if size is None:
+ size = prop.get_size_in_points()
+
+ self._xy = xy
+ self.set_size(size)
+
+ self.text_path = self.text_get_path(prop, s)
+
+ mpatches.PathPatch.__init__(self, self.text_path, *kl, **kwargs)
+
+ self._init_bbox_image(bbox_image)
+
+
+ def _init_bbox_image(self, im):
+
+ if im is None:
+ self.bbox_image = None
+ else:
+ bbox_image = BboxImage(self.get_window_extent,
+ norm = None,
+ origin=None,
+ )
+ bbox_image.set_transform(IdentityTransform())
+
+ bbox_image.set_data(im)
+ self.bbox_image = bbox_image
+
+ def draw(self, renderer=None):
+
+
+ if self.bbox_image is not None:
+ # the clip path must be updated every draw. any solution? -JJ
+ self.bbox_image.set_clip_path(self.text_path, self.get_transform())
+ self.bbox_image.draw(renderer)
+
+ mpatches.PathPatch.draw(self, renderer)
+
+
+ def set_size(self, size):
+ self._size = size
+
+ def get_size(self):
+ return self._size
+
+ def get_patch_transform(self):
+ tr = Affine2D().scale(self._size/self.FONT_SCALE, self._size/self.FONT_SCALE)
+ return tr.translate(*self._xy)
+
+ def glyph_char_path(self, glyph, currx=0.):
+
+ verts, codes = [], []
+ for step in glyph.path:
+ if step[0] == 0: # MOVE_TO
+ verts.append((step[1], step[2]))
+ codes.append(Path.MOVETO)
+ elif step[0] == 1: # LINE_TO
+ verts.append((step[1], step[2]))
+ codes.append(Path.LINETO)
+ elif step[0] == 2: # CURVE3
+ verts.extend([(step[1], step[2]),
+ (step[3], step[4])])
+ codes.extend([Path.CURVE3, Path.CURVE3])
+ elif step[0] == 3: # CURVE4
+ verts.extend([(step[1], step[2]),
+ (step[3], step[4]),
+ (step[5], step[6])])
+ codes.extend([Path.CURVE4, Path.CURVE4, Path.CURVE4])
+ elif step[0] == 4: # ENDPOLY
+ verts.append((0, 0,))
+ codes.append(Path.CLOSEPOLY)
+
+ verts = [(x+currx, y) for (x,y) in verts]
+
+ return verts, codes
+
+
+ def text_get_path(self, prop, s):
+
+ fname = font_manager.findfont(prop)
+ font = FT2Font(str(fname))
+
+ font.set_size(self.FONT_SCALE, 72)
+
+ cmap = font.get_charmap()
+ lastgind = None
+
+ currx = 0
+
+ verts, codes = [], []
+
+ for c in s:
+
+ ccode = ord(c)
+ gind = cmap.get(ccode)
+ if gind is None:
+ ccode = ord('?')
+ gind = 0
+ glyph = font.load_char(ccode, flags=LOAD_NO_HINTING)
+
+
+ if lastgind is not None:
+ kern = font.get_kerning(lastgind, gind, KERNING_DEFAULT)
+ else:
+ kern = 0
+ currx += (kern / 64.0) #/ (self.FONT_SCALE)
+
+ verts1, codes1 = self.glyph_char_path(glyph, currx)
+ verts.extend(verts1)
+ codes.extend(codes1)
+
+
+ currx += (glyph.linearHoriAdvance / 65536.0) #/ (self.FONT_SCALE)
+ lastgind = gind
+
+ return Path(verts, codes)
+
+if 1:
+
+ fig = plt.figure(1)
+
+ # EXAMPLE 1
+
+ ax = plt.subplot(211)
+
+ from matplotlib._png import read_png
+ fn = get_sample_data("lena.png", asfileobj=False)
+ arr = read_png(fn)
+ p = TextPatch((0, 0), "!?", size=150, fc="none", ec="k",
+ bbox_image=arr,
+ transform=IdentityTransform())
+ p.set_clip_on(False)
+
+ # make offset box
+ offsetbox = AuxTransformBox(IdentityTransform())
+ offsetbox.add_artist(p)
+
+ # make anchored offset box
+ ao = AnchoredOffsetbox(loc=2, child=offsetbox, frameon=True, borderpad=0.2)
+
+ ax.add_artist(ao)
+
+
+
+ # EXAMPLE 2
+
+ ax = plt.subplot(212)
+
+ shadow1 = TextPatch((3, -2), "TextPath", size=70, fc="none", ec="0.6", lw=3,
+ transform=IdentityTransform())
+ shadow2 = TextPatch((3, -2), "TextPath", size=70, fc="0.3", ec="none",
+ transform=IdentityTransform())
+
+ arr = np.arange(256).reshape(1,256)/256.
+ text_path = TextPatch((0, 0), "TextPath", size=70, fc="none", ec="none", lw=1,
+ bbox_image=arr,
+ transform=IdentityTransform())
+
+ # make offset box
+ offsetbox = AuxTransformBox(IdentityTransform())
+ offsetbox.add_artist(shadow1)
+ offsetbox.add_artist(shadow2)
+ offsetbox.add_artist(text_path)
+
+ # place the anchored offset box using AnnotationBbox
+ ab = AnnotationBbox(offsetbox, (0.5, 0.5),
+ xycoords='data',
+ boxcoords="offset points",
+ box_alignment=(0.5,0.5),
+ )
+
+
+ ax.add_artist(ab)
+
+ ax.set_xlim(0, 1)
+ ax.set_ylim(0, 1)
+
+
+
+
+
+ plt.draw()
+ plt.show()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-08-09 19:38:56
|
Revision: 7440
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7440&view=rev
Author: leejjoon
Date: 2009-08-09 19:38:48 +0000 (Sun, 09 Aug 2009)
Log Message:
-----------
AnnotationBbox implemented.
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/offsetbox.py
trunk/matplotlib/lib/matplotlib/text.py
trunk/matplotlib/lib/mpl_toolkits/axes_grid/anchored_artists.py
Added Paths:
-----------
trunk/matplotlib/examples/pylab_examples/demo_annotation_box.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-08-09 19:25:49 UTC (rev 7439)
+++ trunk/matplotlib/CHANGELOG 2009-08-09 19:38:48 UTC (rev 7440)
@@ -1,3 +1,7 @@
+2009-08-09 AnnotationBbox added. Similar to Annotation, but works with
+ OffsetBox instead of Text. See the example
+ demo_annotation_box.py. -JJL
+
2009-08-07 BboxImage implemented. Two examples, demo_bboximage.py and
demo_ribbon_box.py added. - JJL
Added: trunk/matplotlib/examples/pylab_examples/demo_annotation_box.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/demo_annotation_box.py (rev 0)
+++ trunk/matplotlib/examples/pylab_examples/demo_annotation_box.py 2009-08-09 19:38:48 UTC (rev 7440)
@@ -0,0 +1,94 @@
+import matplotlib.pyplot as plt
+from matplotlib.offsetbox import TextArea, DrawingArea, OffsetImage, \
+ AnnotationBbox
+from matplotlib.cbook import get_sample_data
+
+import numpy as np
+
+if 1:
+ fig = plt.gcf()
+ fig.clf()
+ ax = plt.subplot(111)
+
+ offsetbox = TextArea("Test 1", minimumdescent=False)
+
+ xy = (0.5, 0.7)
+
+ ax.plot(xy[0], xy[1], ".r")
+
+ ab = AnnotationBbox(offsetbox, xy,
+ xybox=(-20, 40),
+ xycoords='data',
+ boxcoords="offset points",
+ arrowprops=dict(arrowstyle="->"))
+ ax.add_artist(ab)
+
+ offsetbox = TextArea("Test", minimumdescent=False)
+
+ ab = AnnotationBbox(offsetbox, xy,
+ xybox=(1.02, xy[1]),
+ xycoords='data',
+ boxcoords=("axes fraction", "data"),
+ box_alignment=(0.,0.5),
+ arrowprops=dict(arrowstyle="->"))
+ ax.add_artist(ab)
+
+
+ from matplotlib.patches import Circle
+ da = DrawingArea(20, 20, 0, 0)
+ p = Circle((10, 10), 10)
+ da.add_artist(p)
+
+ xy = [0.3, 0.55]
+ ab = AnnotationBbox(da, xy,
+ xybox=(1.02, xy[1]),
+ xycoords='data',
+ boxcoords=("axes fraction", "data"),
+ box_alignment=(0.,0.5),
+ arrowprops=dict(arrowstyle="->"))
+ #arrowprops=None)
+
+ ax.add_artist(ab)
+
+
+ arr = np.arange(100).reshape((10,10))
+ im = OffsetImage(arr, zoom=2)
+
+ ab = AnnotationBbox(im, xy,
+ xybox=(-50., 50.),
+ xycoords='data',
+ boxcoords="offset points",
+ pad=0.3,
+ arrowprops=dict(arrowstyle="->"))
+ #arrowprops=None)
+
+ ax.add_artist(ab)
+
+
+ # another image
+
+
+ from matplotlib._png import read_png
+ fn = get_sample_data("lena.png", asfileobj=False)
+ arr_lena = read_png(fn)
+
+ imagebox = OffsetImage(arr_lena, zoom=0.2)
+
+ ab = AnnotationBbox(imagebox, xy,
+ xybox=(120., -80.),
+ xycoords='data',
+ boxcoords="offset points",
+ pad=0.5,
+ arrowprops=dict(arrowstyle="->",
+ connectionstyle="angle,angleA=0,angleB=90,rad=3")
+ )
+
+
+ ax.add_artist(ab)
+
+ ax.set_xlim(0, 1)
+ ax.set_ylim(0, 1)
+
+
+ plt.draw()
+ plt.show()
Modified: trunk/matplotlib/lib/matplotlib/offsetbox.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/offsetbox.py 2009-08-09 19:25:49 UTC (rev 7439)
+++ trunk/matplotlib/lib/matplotlib/offsetbox.py 2009-08-09 19:38:48 UTC (rev 7440)
@@ -19,13 +19,21 @@
import matplotlib.artist as martist
import matplotlib.text as mtext
import numpy as np
-from matplotlib.transforms import Bbox, BboxBase, TransformedBbox, BboxTransformTo
+from matplotlib.transforms import Bbox, BboxBase, TransformedBbox, \
+ IdentityTransform
from matplotlib.font_manager import FontProperties
-from matplotlib.patches import FancyBboxPatch
+from matplotlib.patches import FancyBboxPatch, FancyArrowPatch
from matplotlib import rcParams
+import matplotlib.cbook as cbook
+
+#from bboximage import BboxImage
+from matplotlib.image import BboxImage
+
from matplotlib.patches import bbox_artist as mbbox_artist
+
+
DEBUG=False
# for debuging use
def bbox_artist(*args, **kwargs):
@@ -744,7 +752,7 @@
def get_extent(self, renderer):
# clear the offset transforms
- _off = self.ref_offset_transform.to_values() # to be restored later
+ _off = self.offset_transform.to_values() # to be restored later
self.ref_offset_transform.clear()
self.offset_transform.clear()
@@ -755,8 +763,10 @@
# adjust ref_offset_tansform
self.ref_offset_transform.translate(-ub.x0, -ub.y0)
+
# restor offset transform
- self.offset_transform.matrix_from_values(*_off)
+ mtx = self.offset_transform.matrix_from_values(*_off)
+ self.offset_transform.set_matrix(mtx)
return ub.width, ub.height, 0., 0.
@@ -890,10 +900,10 @@
else:
return TransformedBbox(self._bbox_to_anchor,
transform)
-
+
def set_bbox_to_anchor(self, bbox, transform=None):
"""
set the bbox that the child will be anchored.
@@ -901,7 +911,7 @@
*bbox* can be a Bbox instance, a list of [left, bottom, width,
height], or a list of [left, bottom] where the width and
height will be assumed to be zero. The bbox will be
- transformed to display coordinate by the given transform.
+ transformed to display coordinate by the given transform.
"""
if bbox is None or isinstance(bbox, BboxBase):
self._bbox_to_anchor = bbox
@@ -951,6 +961,13 @@
self.set_offset(_offset)
+ def update_frame(self, bbox, fontsize=None):
+ self.patch.set_bounds(bbox.x0, bbox.y0,
+ bbox.width, bbox.height)
+
+ if fontsize:
+ self.patch.set_mutation_scale(fontsize)
+
def draw(self, renderer):
"draw the artist"
@@ -962,11 +979,7 @@
if self._drawFrame:
# update the location and size of the legend
bbox = self.get_window_extent(renderer)
- self.patch.set_bounds(bbox.x0, bbox.y0,
- bbox.width, bbox.height)
-
- self.patch.set_mutation_scale(fontsize)
-
+ self.update_frame(bbox, fontsize)
self.patch.draw(renderer)
@@ -1004,3 +1017,399 @@
container = parentbbox.padded(-borderpad)
anchored_box = bbox.anchored(c, container=container)
return anchored_box.x0, anchored_box.y0
+
+
+class AnchoredText(AnchoredOffsetbox):
+ """
+ AnchoredOffsetbox with Text
+ """
+
+ def __init__(self, s, loc, pad=0.4, borderpad=0.5, prop=None, **kwargs):
+ """
+ *s* : string
+ *loc* : location code
+ *prop* : font property
+ *pad* : pad between the text and the frame as fraction of the font size.
+ *borderpad* : pad between the frame and the axes (or bbox_to_anchor).
+
+ other keyword parameters of AnchoredOffsetbox are also allowed.
+ """
+
+ self.txt = TextArea(s, textprops=prop,
+ minimumdescent=False)
+ fp = self.txt._text.get_fontproperties()
+
+ super(AnchoredText, self).__init__(loc, pad=pad, borderpad=borderpad,
+ child=self.txt,
+ prop=fp,
+ **kwargs)
+
+
+
+class OffsetImage(OffsetBox):
+ def __init__(self, arr,
+ zoom=1,
+ cmap = None,
+ norm = None,
+ interpolation=None,
+ origin=None,
+ filternorm=1,
+ filterrad=4.0,
+ resample = False,
+ dpi_cor=True,
+ **kwargs
+ ):
+
+ self._dpi_cor = dpi_cor
+
+ self.image = BboxImage(bbox=self.get_window_extent,
+ cmap = cmap,
+ norm = norm,
+ interpolation=interpolation,
+ origin=origin,
+ filternorm=filternorm,
+ filterrad=filterrad,
+ resample = resample,
+ **kwargs
+ )
+
+ self._children = [self.image]
+
+ self.set_zoom(zoom)
+ self.set_data(arr)
+
+ OffsetBox.__init__(self)
+
+
+ def set_data(self, arr):
+ self._data = np.asarray(arr)
+ self.image.set_data(self._data)
+
+ def get_data(self):
+ return self._data
+
+ def set_zoom(self, zoom):
+ self._zoom = zoom
+
+ def get_zoom(self):
+ return self._zoom
+
+# def set_axes(self, axes):
+# self.image.set_axes(axes)
+# martist.Artist.set_axes(self, axes)
+
+# def set_offset(self, xy):
+# """
+# set offset of the container.
+
+# Accept : tuple of x,y cooridnate in disokay units.
+# """
+# self._offset = xy
+
+# self.offset_transform.clear()
+# self.offset_transform.translate(xy[0], xy[1])
+
+
+ def get_offset(self):
+ """
+ return offset of the container.
+ """
+ return self._offset
+
+
+ def get_window_extent(self, renderer):
+ '''
+ get the bounding box in display space.
+ '''
+ w, h, xd, yd = self.get_extent(renderer)
+ ox, oy = self.get_offset()
+ return mtransforms.Bbox.from_bounds(ox-xd, oy-yd, w, h)
+
+
+ def get_extent(self, renderer):
+
+ if self._dpi_cor: # True, do correction
+ dpi_cor = renderer.points_to_pixels(1.)
+ else:
+ dpi_cor = 1.
+
+ zoom = self.get_zoom()
+ data = self.get_data()
+ ny, nx = data.shape[:2]
+ w, h = nx*zoom, ny*zoom
+
+ return w, h, 0, 0
+
+
+
+ def draw(self, renderer):
+ """
+ Draw the children
+ """
+
+ self.image.draw(renderer)
+
+ #bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
+
+
+
+from matplotlib.text import _AnnotationBase
+
+class AnnotationBbox(martist.Artist, _AnnotationBase):
+ """
+ Annotation-like class, but with offsetbox instead of Text.
+ """
+
+ zorder = 3
+
+ def __str__(self):
+ return "AnnotationBbox(%g,%g)"%(self.xy[0],self.xy[1])
+ def __init__(self, offsetbox, xy,
+ xybox=None,
+ xycoords='data',
+ boxcoords=None,
+ frameon=True, pad=0.4, # BboxPatch
+ annotation_clip=None,
+ box_alignment=(0.5, 0.5),
+ bboxprops=None,
+ arrowprops=None,
+ fontsize=None,
+ **kwargs):
+ """
+ *offsetbox* : OffsetBox instance
+
+ *xycoords* : same as Annotation but can be a tuple of two
+ strings which are interpreted as x and y coordinates.
+
+ *boxcoords* : similar to textcoords as Annotation but can be a
+ tuple of two strings which are interpreted as x and y
+ coordinates.
+
+ *box_alignment* : a tuple of two floats for a vertical and
+ horizontal alignment of the offset box w.r.t. the *boxcoords*.
+ The lower-left corner is (0.0) and upper-right corner is (1.1).
+
+ other parameters are identical to that of Annotation.
+ """
+ self.offsetbox = offsetbox
+
+ self.arrowprops = arrowprops
+
+ self.set_fontsize(fontsize)
+
+
+ if arrowprops is not None:
+ self._arrow_relpos = self.arrowprops.pop("relpos", (0.5, 0.5))
+ self.arrow_patch = FancyArrowPatch((0, 0), (1,1),
+ **self.arrowprops)
+ else:
+ self._arrow_relpos = None
+ self.arrow_patch = None
+
+ _AnnotationBase.__init__(self,
+ xy, xytext=xybox,
+ xycoords=xycoords, textcoords=boxcoords,
+ annotation_clip=annotation_clip)
+
+ martist.Artist.__init__(self, **kwargs)
+
+ #self._fw, self._fh = 0., 0. # for alignment
+ self._box_alignment = box_alignment
+
+ # frame
+ self.patch = FancyBboxPatch(
+ xy=(0.0, 0.0), width=1., height=1.,
+ facecolor='w', edgecolor='k',
+ mutation_scale=self.prop.get_size_in_points(),
+ snap=True
+ )
+ self.patch.set_boxstyle("square",pad=pad)
+ if bboxprops:
+ self.patch.set(**bboxprops)
+ self._drawFrame = frameon
+
+
+ __init__.__doc__ = cbook.dedent(__init__.__doc__) % martist.kwdocd
+
+ def contains(self,event):
+ t,tinfo = self.offsetbox.contains(event)
+ if self.arrow is not None:
+ a,ainfo=self.arrow.contains(event)
+ t = t or a
+
+ # self.arrow_patch is currently not checked as this can be a line - JJ
+
+ return t,tinfo
+
+
+ def get_children(self):
+ children = [self.offsetbox, self.patch]
+ if self.arrow_patch:
+ children.append(self.arrow_patch)
+ return children
+
+ def set_figure(self, fig):
+
+ if self.arrow_patch is not None:
+ self.arrow_patch.set_figure(fig)
+ self.offsetbox.set_figure(fig)
+ martist.Artist.set_figure(self, fig)
+
+ def set_fontsize(self, s=None):
+ """
+ set fontsize in points
+ """
+ if s is None:
+ s = rcParams["legend.fontsize"]
+
+ self.prop=FontProperties(size=s)
+
+ def get_fontsize(self, s=None):
+ """
+ return fontsize in points
+ """
+ return self.prop.get_size_in_points()
+
+ def update_positions(self, renderer):
+ "Update the pixel positions of the annotated point and the text."
+ xy_pixel = self._get_position_xy(renderer)
+ self._update_position_xybox(renderer, xy_pixel)
+
+ mutation_scale = renderer.points_to_pixels(self.get_fontsize())
+ self.patch.set_mutation_scale(mutation_scale)
+
+ if self.arrow_patch:
+ self.arrow_patch.set_mutation_scale(mutation_scale)
+
+
+ def _update_position_xybox(self, renderer, xy_pixel):
+ "Update the pixel positions of the annotation text and the arrow patch."
+
+ x, y = self.xytext
+ if isinstance(self.textcoords, tuple):
+ xcoord, ycoord = self.textcoords
+ x1, y1 = self._get_xy(x, y, xcoord)
+ x2, y2 = self._get_xy(x, y, ycoord)
+ ox0, oy0 = x1, y2
+ else:
+ ox0, oy0 = self._get_xy(x, y, self.textcoords)
+
+ #self.offsetbox.set_bbox_to_anchor((ox0, oy0))
+ w, h, xd, yd = self.offsetbox.get_extent(renderer)
+
+ _fw, _fh = self._box_alignment
+ self.offsetbox.set_offset((ox0-_fw*w, oy0-_fh*h))
+
+ # update patch position
+ bbox = self.offsetbox.get_window_extent(renderer)
+ #self.offsetbox.set_offset((ox0-_fw*w, oy0-_fh*h))
+ self.patch.set_bounds(bbox.x0, bbox.y0,
+ bbox.width, bbox.height)
+
+ x, y = xy_pixel
+
+ ox1, oy1 = x, y
+
+ if self.arrowprops:
+ x0, y0 = x, y
+
+ d = self.arrowprops.copy()
+
+ # Use FancyArrowPatch if self.arrowprops has "arrowstyle" key.
+
+ # adjust the starting point of the arrow relative to
+ # the textbox.
+ # TODO : Rotation needs to be accounted.
+ relpos = self._arrow_relpos
+
+ ox0 = bbox.x0 + bbox.width * relpos[0]
+ oy0 = bbox.y0 + bbox.height * relpos[1]
+
+ # The arrow will be drawn from (ox0, oy0) to (ox1,
+ # oy1). It will be first clipped by patchA and patchB.
+ # Then it will be shrinked by shirnkA and shrinkB
+ # (in points). If patch A is not set, self.bbox_patch
+ # is used.
+
+ self.arrow_patch.set_positions((ox0, oy0), (ox1,oy1))
+ fs = self.prop.get_size_in_points()
+ mutation_scale = d.pop("mutation_scale", fs)
+ mutation_scale = renderer.points_to_pixels(mutation_scale)
+ self.arrow_patch.set_mutation_scale(mutation_scale)
+
+ patchA = d.pop("patchA", self.patch)
+ self.arrow_patch.set_patchA(patchA)
+
+
+
+ def draw(self, renderer):
+ """
+ Draw the :class:`Annotation` object to the given *renderer*.
+ """
+
+ if renderer is not None:
+ self._renderer = renderer
+ if not self.get_visible(): return
+
+ xy_pixel = self._get_position_xy(renderer)
+
+ if not self._check_xy(renderer, xy_pixel):
+ return
+
+ self.update_positions(renderer)
+
+ if self.arrow_patch is not None:
+ if self.arrow_patch.figure is None and self.figure is not None:
+ self.arrow_patch.figure = self.figure
+ self.arrow_patch.draw(renderer)
+
+ if self._drawFrame:
+ self.patch.draw(renderer)
+
+ self.offsetbox.draw(renderer)
+
+
+
+
+if __name__ == "__main__":
+
+ fig = plt.figure(1)
+ fig.clf()
+ ax = plt.subplot(121)
+
+ #txt = ax.text(0.5, 0.5, "Test", size=30, ha="center", color="w")
+ kwargs = dict()
+
+ a = np.arange(256).reshape(16,16)/256.
+ myimage = OffsetImage(a,
+ zoom=2,
+ norm = None,
+ origin=None,
+ **kwargs
+ )
+ ax.add_artist(myimage)
+
+ myimage.set_offset((100, 100))
+
+
+ myimage2 = OffsetImage(a,
+ zoom=2,
+ norm = None,
+ origin=None,
+ **kwargs
+ )
+ ann = AnnotationBbox(myimage2, (0.5, 0.5),
+ xybox=(30, 30),
+ xycoords='data',
+ boxcoords="offset points",
+ frameon=True, pad=0.4, # BboxPatch
+ bboxprops=dict(boxstyle="round", fc="y"),
+ fontsize=None,
+ arrowprops=dict(arrowstyle="->"),
+ )
+
+ ax.add_artist(ann)
+
+ plt.draw()
+ plt.show()
+
Modified: trunk/matplotlib/lib/matplotlib/text.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/text.py 2009-08-09 19:25:49 UTC (rev 7439)
+++ trunk/matplotlib/lib/matplotlib/text.py 2009-08-09 19:38:48 UTC (rev 7440)
@@ -1340,7 +1340,158 @@
artist.kwdocd['TextWithDash'] = artist.kwdoc(TextWithDash)
-class Annotation(Text):
+class _AnnotationBase(object):
+ def __init__(self,
+ xy, xytext=None,
+ xycoords='data', textcoords=None,
+ annotation_clip=None):
+ if xytext is None:
+ xytext = xy
+ if textcoords is None:
+ textcoords = xycoords
+ # we'll draw ourself after the artist we annotate by default
+ x,y = self.xytext = xytext
+
+ self.xy = xy
+ self.xycoords = xycoords
+ self.textcoords = textcoords
+ self.set_annotation_clip(annotation_clip)
+
+ def _get_xy(self, x, y, s):
+ if s=='data':
+ trans = self.axes.transData
+ x = float(self.convert_xunits(x))
+ y = float(self.convert_yunits(y))
+ return trans.transform_point((x, y))
+ elif s=='offset points':
+ # convert the data point
+ dx, dy = self.xy
+
+ # prevent recursion
+ if self.xycoords == 'offset points':
+ return self._get_xy(dx, dy, 'data')
+
+ dx, dy = self._get_xy(dx, dy, self.xycoords)
+
+ # convert the offset
+ dpi = self.figure.get_dpi()
+ x *= dpi/72.
+ y *= dpi/72.
+
+ # add the offset to the data point
+ x += dx
+ y += dy
+
+ return x, y
+ elif s=='polar':
+ theta, r = x, y
+ x = r*np.cos(theta)
+ y = r*np.sin(theta)
+ trans = self.axes.transData
+ return trans.transform_point((x,y))
+ elif s=='figure points':
+ #points from the lower left corner of the figure
+ dpi = self.figure.dpi
+ l,b,w,h = self.figure.bbox.bounds
+ r = l+w
+ t = b+h
+
+ x *= dpi/72.
+ y *= dpi/72.
+ if x<0:
+ x = r + x
+ if y<0:
+ y = t + y
+ return x,y
+ elif s=='figure pixels':
+ #pixels from the lower left corner of the figure
+ l,b,w,h = self.figure.bbox.bounds
+ r = l+w
+ t = b+h
+ if x<0:
+ x = r + x
+ if y<0:
+ y = t + y
+ return x, y
+ elif s=='figure fraction':
+ #(0,0) is lower left, (1,1) is upper right of figure
+ trans = self.figure.transFigure
+ return trans.transform_point((x,y))
+ elif s=='axes points':
+ #points from the lower left corner of the axes
+ dpi = self.figure.dpi
+ l,b,w,h = self.axes.bbox.bounds
+ r = l+w
+ t = b+h
+ if x<0:
+ x = r + x*dpi/72.
+ else:
+ x = l + x*dpi/72.
+ if y<0:
+ y = t + y*dpi/72.
+ else:
+ y = b + y*dpi/72.
+ return x, y
+ elif s=='axes pixels':
+ #pixels from the lower left corner of the axes
+
+ l,b,w,h = self.axes.bbox.bounds
+ r = l+w
+ t = b+h
+ if x<0:
+ x = r + x
+ else:
+ x = l + x
+ if y<0:
+ y = t + y
+ else:
+ y = b + y
+ return x, y
+ elif s=='axes fraction':
+ #(0,0) is lower left, (1,1) is upper right of axes
+ trans = self.axes.transAxes
+ return trans.transform_point((x, y))
+
+ def set_annotation_clip(self, b):
+ """
+ set *annotation_clip* attribute.
+
+ * True : the annotation will only be drawn when self.xy is inside the axes.
+ * False : the annotation will always be drawn regardless of its position.
+ * None : the self.xy will be checked only if *xycoords* is "data"
+ """
+ self._annotation_clip = b
+
+ def get_annotation_clip(self):
+ """
+ Return *annotation_clip* attribute.
+ See :meth:`set_annotation_clip` for the meaning of return values.
+ """
+ return self._annotation_clip
+
+ def _get_position_xy(self, renderer):
+ "Return the pixel position of the the annotated point."
+ x, y = self.xy
+ return self._get_xy(x, y, self.xycoords)
+
+ def _check_xy(self, renderer, xy_pixel):
+ """
+ given the xy pixel coordinate, check if the annotation need to
+ be drawn.
+ """
+
+ b = self.get_annotation_clip()
+ if b or (b is None and self.xycoords == "data"):
+ # check if self.xy is inside the axes.
+ if not self.axes.contains_point(xy_pixel):
+ return False
+
+ return True
+
+
+
+
+class Annotation(Text, _AnnotationBase):
"""
A :class:`~matplotlib.text.Text` class to make annotating things
in the figure, such as :class:`~matplotlib.figure.Figure`,
@@ -1354,6 +1505,7 @@
xycoords='data',
textcoords=None,
arrowprops=None,
+ annotation_clip=None,
**kwargs):
"""
Annotate the *x*, *y* point *xy* with text *s* at *x*, *y*
@@ -1442,16 +1594,14 @@
%(Text)s
"""
- if xytext is None:
- xytext = xy
- if textcoords is None:
- textcoords = xycoords
- # we'll draw ourself after the artist we annotate by default
- x,y = self.xytext = xytext
+
+ _AnnotationBase.__init__(self,
+ xy, xytext=xytext,
+ xycoords=xycoords, textcoords=textcoords,
+ annotation_clip=annotation_clip)
+
+ x,y = self.xytext
Text.__init__(self, x, y, s, **kwargs)
- self.xy = xy
- self.xycoords = xycoords
- self.textcoords = textcoords
self.arrowprops = arrowprops
@@ -1465,9 +1615,6 @@
else:
self.arrow_patch = None
- # if True, draw annotation only if self.xy is inside the axes
- self._annotation_clip = None
-
__init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
def contains(self,event):
@@ -1489,131 +1636,13 @@
self.arrow_patch.set_figure(fig)
Artist.set_figure(self, fig)
- def _get_xy(self, x, y, s):
- if s=='data':
- trans = self.axes.transData
- x = float(self.convert_xunits(x))
- y = float(self.convert_yunits(y))
- return trans.transform_point((x, y))
- elif s=='offset points':
- # convert the data point
- dx, dy = self.xy
- # prevent recursion
- if self.xycoords == 'offset points':
- return self._get_xy(dx, dy, 'data')
-
- dx, dy = self._get_xy(dx, dy, self.xycoords)
-
- # convert the offset
- dpi = self.figure.get_dpi()
- x *= dpi/72.
- y *= dpi/72.
-
- # add the offset to the data point
- x += dx
- y += dy
-
- return x, y
- elif s=='polar':
- theta, r = x, y
- x = r*np.cos(theta)
- y = r*np.sin(theta)
- trans = self.axes.transData
- return trans.transform_point((x,y))
- elif s=='figure points':
- #points from the lower left corner of the figure
- dpi = self.figure.dpi
- l,b,w,h = self.figure.bbox.bounds
- r = l+w
- t = b+h
-
- x *= dpi/72.
- y *= dpi/72.
- if x<0:
- x = r + x
- if y<0:
- y = t + y
- return x,y
- elif s=='figure pixels':
- #pixels from the lower left corner of the figure
- l,b,w,h = self.figure.bbox.bounds
- r = l+w
- t = b+h
- if x<0:
- x = r + x
- if y<0:
- y = t + y
- return x, y
- elif s=='figure fraction':
- #(0,0) is lower left, (1,1) is upper right of figure
- trans = self.figure.transFigure
- return trans.transform_point((x,y))
- elif s=='axes points':
- #points from the lower left corner of the axes
- dpi = self.figure.dpi
- l,b,w,h = self.axes.bbox.bounds
- r = l+w
- t = b+h
- if x<0:
- x = r + x*dpi/72.
- else:
- x = l + x*dpi/72.
- if y<0:
- y = t + y*dpi/72.
- else:
- y = b + y*dpi/72.
- return x, y
- elif s=='axes pixels':
- #pixels from the lower left corner of the axes
-
- l,b,w,h = self.axes.bbox.bounds
- r = l+w
- t = b+h
- if x<0:
- x = r + x
- else:
- x = l + x
- if y<0:
- y = t + y
- else:
- y = b + y
- return x, y
- elif s=='axes fraction':
- #(0,0) is lower left, (1,1) is upper right of axes
- trans = self.axes.transAxes
- return trans.transform_point((x, y))
-
- def set_annotation_clip(self, b):
- """
- set *annotation_clip* attribute.
-
- * True : the annotation will only be drawn when self.xy is inside the axes.
- * False : the annotation will always be drawn regardless of its position.
- * None : the self.xy will be checked only if *xycoords* is "data"
- """
- self._annotation_clip = b
-
- def get_annotation_clip(self):
- """
- Return *annotation_clip* attribute.
- See :meth:`set_annotation_clip` for the meaning of return values.
- """
- return self._annotation_clip
-
-
def update_positions(self, renderer):
"Update the pixel positions of the annotated point and the text."
xy_pixel = self._get_position_xy(renderer)
self._update_position_xytext(renderer, xy_pixel)
- def _get_position_xy(self, renderer):
- "Return the pixel position of the the annotated point."
- x, y = self.xy
- return self._get_xy(x, y, self.xycoords)
-
-
def _update_position_xytext(self, renderer, xy_pixel):
"Update the pixel positions of the annotation text and the arrow patch."
@@ -1698,21 +1727,6 @@
self.arrow.set_clip_box(self.get_clip_box())
- def _check_xy(self, renderer, xy_pixel):
- """
- given the xy pixel coordinate, check if the annotation need to
- be drawn.
- """
-
- b = self.get_annotation_clip()
- if b or (b is None and self.xycoords == "data"):
- # check if self.xy is inside the axes.
- if not self.axes.contains_point(xy_pixel):
- return False
-
- return True
-
-
def draw(self, renderer):
"""
Draw the :class:`Annotation` object to the given *renderer*.
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/anchored_artists.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/anchored_artists.py 2009-08-09 19:25:49 UTC (rev 7439)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/anchored_artists.py 2009-08-09 19:38:48 UTC (rev 7440)
@@ -1,41 +1,35 @@
-
-from matplotlib.font_manager import FontProperties
-from matplotlib import rcParams
from matplotlib.patches import Rectangle, Ellipse
+import numpy as np
+
from matplotlib.offsetbox import AnchoredOffsetbox, AuxTransformBox, VPacker,\
- TextArea, DrawingArea
+ TextArea, AnchoredText, DrawingArea, AnnotationBbox
-class AnchoredText(AnchoredOffsetbox):
- def __init__(self, s, loc, pad=0.4, borderpad=0.5, prop=None, **kwargs):
+class AnchoredDrawingArea(AnchoredOffsetbox):
+ """
+ AnchoredOffsetbox with DrawingArea
+ """
- self.txt = TextArea(s, textprops=prop,
- minimumdescent=False)
- fp = self.txt._text.get_fontproperties()
-
- super(AnchoredText, self).__init__(loc, pad=pad, borderpad=borderpad,
- child=self.txt,
- prop=fp,
- **kwargs)
-
-
-
-class AnchoredDrawingArea(AnchoredOffsetbox):
def __init__(self, width, height, xdescent, ydescent,
loc, pad=0.4, borderpad=0.5, prop=None, frameon=True,
**kwargs):
+ """
+ *width*, *height*, *xdescent*, *ydescent* : the dimensions of the DrawingArea.
+ *prop* : font property. this is only used for scaling the paddings.
+ """
self.da = DrawingArea(width, height, xdescent, ydescent, clip=True)
self.drawing_area = self.da
-
+
super(AnchoredDrawingArea, self).__init__(loc, pad=pad, borderpad=borderpad,
child=self.da,
prop=None,
frameon=frameon,
**kwargs)
+
class AnchoredAuxTransformBox(AnchoredOffsetbox):
def __init__(self, transform, loc,
pad=0.4, borderpad=0.5, prop=None, frameon=True, **kwargs):
@@ -49,6 +43,7 @@
**kwargs)
+
class AnchoredEllipse(AnchoredOffsetbox):
def __init__(self, transform, width, height, angle, loc,
pad=0.1, borderpad=0.1, prop=None, frameon=True, **kwargs):
@@ -93,3 +88,73 @@
prop=prop,
frameon=frameon, **kwargs)
+
+if __name__ == "__main__":
+
+ import matplotlib.pyplot as plt
+
+ fig = plt.gcf()
+ fig.clf()
+ ax = plt.subplot(111)
+
+ offsetbox = AnchoredText("Test", loc=6, pad=0.3,
+ borderpad=0.3, prop=None)
+ xy = (0.5, 0.5)
+ ax.plot([0.5], [0.5], "xk")
+ ab = AnnotationBbox(offsetbox, xy,
+ xybox=(1., .5),
+ xycoords='data',
+ boxcoords=("axes fraction", "data"),
+ arrowprops=dict(arrowstyle="->"))
+ #arrowprops=None)
+
+ ax.add_artist(ab)
+
+
+ from matplotlib.patches import Circle
+ ada = AnchoredDrawingArea(20, 20, 0, 0,
+ loc=6, pad=0.1, borderpad=0.3, frameon=True)
+ p = Circle((10, 10), 10)
+ ada.da.add_artist(p)
+
+ ab = AnnotationBbox(ada, (0.3, 0.4),
+ xybox=(1., 0.4),
+ xycoords='data',
+ boxcoords=("axes fraction", "data"),
+ arrowprops=dict(arrowstyle="->"))
+ #arrowprops=None)
+
+ ax.add_artist(ab)
+
+
+ arr = np.arange(100).reshape((10,10))
+ im = AnchoredImage(arr,
+ loc=4,
+ pad=0.5, borderpad=0.2, prop=None, frameon=True,
+ zoom=1,
+ cmap = None,
+ norm = None,
+ interpolation=None,
+ origin=None,
+ extent=None,
+ filternorm=1,
+ filterrad=4.0,
+ resample = False,
+ )
+
+ ab = AnnotationBbox(im, (0.5, 0.5),
+ xybox=(-10., 10.),
+ xycoords='data',
+ boxcoords="offset points",
+ arrowprops=dict(arrowstyle="->"))
+ #arrowprops=None)
+
+ ax.add_artist(ab)
+
+ ax.set_xlim(0, 1)
+ ax.set_ylim(0, 1)
+
+
+ plt.draw()
+ plt.show()
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-08-09 19:25:56
|
Revision: 7439
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7439&view=rev
Author: leejjoon
Date: 2009-08-09 19:25:49 +0000 (Sun, 09 Aug 2009)
Log Message:
-----------
reorganization of AxesImage and BboxImage
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/image.py
Modified: trunk/matplotlib/lib/matplotlib/image.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/image.py 2009-08-09 18:50:15 UTC (rev 7438)
+++ trunk/matplotlib/lib/matplotlib/image.py 2009-08-09 19:25:49 UTC (rev 7439)
@@ -26,7 +26,7 @@
from matplotlib.transforms import BboxBase
-class AxesImage(martist.Artist, cm.ScalarMappable):
+class _AxesImageBase(martist.Artist, cm.ScalarMappable):
zorder = 1
# map interpolation strings to module constants
_interpd = {
@@ -62,7 +62,6 @@
norm = None,
interpolation=None,
origin=None,
- extent=None,
filternorm=1,
filterrad=4.0,
resample = False,
@@ -87,7 +86,6 @@
if origin is None: origin = rcParams['image.origin']
self.origin = origin
- self._extent = extent
self.set_filternorm(filternorm)
self.set_filterrad(filterrad)
self._filterrad = filterrad
@@ -126,108 +124,9 @@
self._rgbacache = None
cm.ScalarMappable.changed(self)
-
def make_image(self, magnification=1.0):
- if self._A is None:
- raise RuntimeError('You must first set the image array or the image attribute')
+ raise RuntimeError('The make_image method must be overridden.')
- xmin, xmax, ymin, ymax = self.get_extent()
- dxintv = xmax-xmin
- dyintv = ymax-ymin
-
- # the viewport scale factor
- sx = dxintv/self.axes.viewLim.width
- sy = dyintv/self.axes.viewLim.height
- numrows, numcols = self._A.shape[:2]
- if sx > 2:
- x0 = (self.axes.viewLim.x0-xmin)/dxintv * numcols
- ix0 = max(0, int(x0 - self._filterrad))
- x1 = (self.axes.viewLim.x1-xmin)/dxintv * numcols
- ix1 = min(numcols, int(x1 + self._filterrad))
- xslice = slice(ix0, ix1)
- xmin_old = xmin
- xmin = xmin_old + ix0*dxintv/numcols
- xmax = xmin_old + ix1*dxintv/numcols
- dxintv = xmax - xmin
- sx = dxintv/self.axes.viewLim.width
- else:
- xslice = slice(0, numcols)
-
- if sy > 2:
- y0 = (self.axes.viewLim.y0-ymin)/dyintv * numrows
- iy0 = max(0, int(y0 - self._filterrad))
- y1 = (self.axes.viewLim.y1-ymin)/dyintv * numrows
- iy1 = min(numrows, int(y1 + self._filterrad))
- if self.origin == 'upper':
- yslice = slice(numrows-iy1, numrows-iy0)
- else:
- yslice = slice(iy0, iy1)
- ymin_old = ymin
- ymin = ymin_old + iy0*dyintv/numrows
- ymax = ymin_old + iy1*dyintv/numrows
- dyintv = ymax - ymin
- sy = dyintv/self.axes.viewLim.height
- else:
- yslice = slice(0, numrows)
-
- if xslice != self._oldxslice or yslice != self._oldyslice:
- self._imcache = None
- self._oldxslice = xslice
- self._oldyslice = yslice
-
- if self._imcache is None:
- if self._A.dtype == np.uint8 and len(self._A.shape) == 3:
- im = _image.frombyte(self._A[yslice,xslice,:], 0)
- im.is_grayscale = False
- else:
- if self._rgbacache is None:
- x = self.to_rgba(self._A, self._alpha)
- self._rgbacache = x
- else:
- x = self._rgbacache
- im = _image.fromarray(x[yslice,xslice], 0)
- if len(self._A.shape) == 2:
- im.is_grayscale = self.cmap.is_gray()
- else:
- im.is_grayscale = False
- self._imcache = im
-
- if self.origin=='upper':
- im.flipud_in()
- else:
- im = self._imcache
-
- fc = self.axes.patch.get_facecolor()
- bg = mcolors.colorConverter.to_rgba(fc, 0)
- im.set_bg( *bg)
-
- # image input dimensions
- im.reset_matrix()
- numrows, numcols = im.get_size()
-
- im.set_interpolation(self._interpd[self._interpolation])
-
- im.set_resample(self._resample)
-
- # the viewport translation
- tx = (xmin-self.axes.viewLim.x0)/dxintv * numcols
- ty = (ymin-self.axes.viewLim.y0)/dyintv * numrows
-
- l, b, r, t = self.axes.bbox.extents
- widthDisplay = (round(r) + 0.5) - (round(l) - 0.5)
- heightDisplay = (round(t) + 0.5) - (round(b) - 0.5)
- widthDisplay *= magnification
- heightDisplay *= magnification
- im.apply_translation(tx, ty)
-
- # resize viewport to display
- rx = widthDisplay / numcols
- ry = heightDisplay / numrows
- im.apply_scaling(rx*sx, ry*sy)
- im.resize(int(widthDisplay+0.5), int(heightDisplay+0.5),
- norm=self._filternorm, radius=self._filterrad)
- return im
-
@allow_rasterization
def draw(self, renderer, *args, **kwargs):
if not self.get_visible(): return
@@ -314,20 +213,6 @@
- def set_extent(self, extent):
- """
- extent is data axes (left, right, bottom, top) for making image plots
- """
- self._extent = extent
-
- xmin, xmax, ymin, ymax = extent
- corners = (xmin, ymin), (xmax, ymax)
- self.axes.update_datalim(corners)
- if self.axes._autoscaleXon:
- self.axes.set_xlim((xmin, xmax))
- if self.axes._autoscaleYon:
- self.axes.set_ylim((ymin, ymax))
-
def get_interpolation(self):
"""
Return the interpolation method the image uses when resizing.
@@ -367,19 +252,6 @@
'return the image resample boolean'
return self._resample
- def get_extent(self):
- 'get the image extent: left, right, bottom, top'
- if self._extent is not None:
- return self._extent
- else:
- sz = self.get_size()
- #print 'sz', sz
- numrows, numcols = sz
- if self.origin == 'upper':
- return (-0.5, numcols-0.5, numrows-0.5, -0.5)
- else:
- return (-0.5, numcols-0.5, -0.5, numrows-0.5)
-
def set_filternorm(self, filternorm):
"""
Set whether the resize filter norms the weights -- see
@@ -412,6 +284,182 @@
return self._filterrad
+
+class AxesImage(_AxesImageBase):
+ def __str__(self):
+ return "AxesImage(%g,%g;%gx%g)" % tuple(self.axes.bbox.bounds)
+
+ def __init__(self, ax,
+ cmap = None,
+ norm = None,
+ interpolation=None,
+ origin=None,
+ extent=None,
+ filternorm=1,
+ filterrad=4.0,
+ resample = False,
+ **kwargs
+ ):
+
+ """
+ interpolation and cmap default to their rc settings
+
+ cmap is a colors.Colormap instance
+ norm is a colors.Normalize instance to map luminance to 0-1
+
+ extent is data axes (left, right, bottom, top) for making image plots
+ registered with data plots. Default is to label the pixel
+ centers with the zero-based row and column indices.
+
+ Additional kwargs are matplotlib.artist properties
+
+ """
+
+ self._extent = extent
+
+ _AxesImageBase.__init__(self, ax,
+ cmap = cmap,
+ norm = norm,
+ interpolation=interpolation,
+ origin=origin,
+ filternorm=filternorm,
+ filterrad=filterrad,
+ resample = resample,
+ **kwargs
+ )
+
+
+ def make_image(self, magnification=1.0):
+ if self._A is None:
+ raise RuntimeError('You must first set the image array or the image attribute')
+
+ xmin, xmax, ymin, ymax = self.get_extent()
+ dxintv = xmax-xmin
+ dyintv = ymax-ymin
+
+ # the viewport scale factor
+ sx = dxintv/self.axes.viewLim.width
+ sy = dyintv/self.axes.viewLim.height
+ numrows, numcols = self._A.shape[:2]
+ if sx > 2:
+ x0 = (self.axes.viewLim.x0-xmin)/dxintv * numcols
+ ix0 = max(0, int(x0 - self._filterrad))
+ x1 = (self.axes.viewLim.x1-xmin)/dxintv * numcols
+ ix1 = min(numcols, int(x1 + self._filterrad))
+ xslice = slice(ix0, ix1)
+ xmin_old = xmin
+ xmin = xmin_old + ix0*dxintv/numcols
+ xmax = xmin_old + ix1*dxintv/numcols
+ dxintv = xmax - xmin
+ sx = dxintv/self.axes.viewLim.width
+ else:
+ xslice = slice(0, numcols)
+
+ if sy > 2:
+ y0 = (self.axes.viewLim.y0-ymin)/dyintv * numrows
+ iy0 = max(0, int(y0 - self._filterrad))
+ y1 = (self.axes.viewLim.y1-ymin)/dyintv * numrows
+ iy1 = min(numrows, int(y1 + self._filterrad))
+ if self.origin == 'upper':
+ yslice = slice(numrows-iy1, numrows-iy0)
+ else:
+ yslice = slice(iy0, iy1)
+ ymin_old = ymin
+ ymin = ymin_old + iy0*dyintv/numrows
+ ymax = ymin_old + iy1*dyintv/numrows
+ dyintv = ymax - ymin
+ sy = dyintv/self.axes.viewLim.height
+ else:
+ yslice = slice(0, numrows)
+
+ if xslice != self._oldxslice or yslice != self._oldyslice:
+ self._imcache = None
+ self._oldxslice = xslice
+ self._oldyslice = yslice
+
+ if self._imcache is None:
+ if self._A.dtype == np.uint8 and len(self._A.shape) == 3:
+ im = _image.frombyte(self._A[yslice,xslice,:], 0)
+ im.is_grayscale = False
+ else:
+ if self._rgbacache is None:
+ x = self.to_rgba(self._A, self._alpha)
+ self._rgbacache = x
+ else:
+ x = self._rgbacache
+ im = _image.fromarray(x[yslice,xslice], 0)
+ if len(self._A.shape) == 2:
+ im.is_grayscale = self.cmap.is_gray()
+ else:
+ im.is_grayscale = False
+ self._imcache = im
+
+ if self.origin=='upper':
+ im.flipud_in()
+ else:
+ im = self._imcache
+
+ fc = self.axes.patch.get_facecolor()
+ bg = mcolors.colorConverter.to_rgba(fc, 0)
+ im.set_bg( *bg)
+
+ # image input dimensions
+ im.reset_matrix()
+ numrows, numcols = im.get_size()
+
+ im.set_interpolation(self._interpd[self._interpolation])
+
+ im.set_resample(self._resample)
+
+ # the viewport translation
+ tx = (xmin-self.axes.viewLim.x0)/dxintv * numcols
+ ty = (ymin-self.axes.viewLim.y0)/dyintv * numrows
+
+ l, b, r, t = self.axes.bbox.extents
+ widthDisplay = (round(r) + 0.5) - (round(l) - 0.5)
+ heightDisplay = (round(t) + 0.5) - (round(b) - 0.5)
+ widthDisplay *= magnification
+ heightDisplay *= magnification
+ im.apply_translation(tx, ty)
+
+ # resize viewport to display
+ rx = widthDisplay / numcols
+ ry = heightDisplay / numrows
+ im.apply_scaling(rx*sx, ry*sy)
+ im.resize(int(widthDisplay+0.5), int(heightDisplay+0.5),
+ norm=self._filternorm, radius=self._filterrad)
+ return im
+
+
+ def set_extent(self, extent):
+ """
+ extent is data axes (left, right, bottom, top) for making image plots
+ """
+ self._extent = extent
+
+ xmin, xmax, ymin, ymax = extent
+ corners = (xmin, ymin), (xmax, ymax)
+ self.axes.update_datalim(corners)
+ if self.axes._autoscaleXon:
+ self.axes.set_xlim((xmin, xmax))
+ if self.axes._autoscaleYon:
+ self.axes.set_ylim((ymin, ymax))
+
+ def get_extent(self):
+ 'get the image extent: left, right, bottom, top'
+ if self._extent is not None:
+ return self._extent
+ else:
+ sz = self.get_size()
+ #print 'sz', sz
+ numrows, numcols = sz
+ if self.origin == 'upper':
+ return (-0.5, numcols-0.5, numrows-0.5, -0.5)
+ else:
+ return (-0.5, numcols-0.5, -0.5, numrows-0.5)
+
+
+
class NonUniformImage(AxesImage):
def __init__(self, ax, **kwargs):
"""
@@ -747,7 +795,7 @@
_png.write_png(buffer, cols, rows, fname)
-class BboxImage(AxesImage):
+class BboxImage(_AxesImageBase):
"""
The Image class whose size is determined by the given bbox.
"""
@@ -770,16 +818,16 @@
kwargs are an optional list of Artist keyword args
"""
- AxesImage.__init__(self, ax=None,
- cmap = cmap,
- norm = norm,
- interpolation=interpolation,
- origin=origin,
- filternorm=filternorm,
- filterrad=filterrad,
- resample = resample,
- **kwargs
- )
+ _AxesImageBase.__init__(self, ax=None,
+ cmap = cmap,
+ norm = norm,
+ interpolation=interpolation,
+ origin=origin,
+ filternorm=filternorm,
+ filterrad=filterrad,
+ resample = resample,
+ **kwargs
+ )
self.bbox = bbox
@@ -842,11 +890,6 @@
else:
im = self._imcache
- if 0:
- fc = self.axes.patch.get_facecolor()
- bg = mcolors.colorConverter.to_rgba(fc, 0)
- im.set_bg( *bg)
-
# image input dimensions
im.reset_matrix()
@@ -859,7 +902,6 @@
heightDisplay = (round(t) + 0.5) - (round(b) - 0.5)
widthDisplay *= magnification
heightDisplay *= magnification
- #im.apply_translation(tx, ty)
numrows, numcols = self._A.shape[:2]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jo...@us...> - 2009-08-09 18:50:24
|
Revision: 7438
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7438&view=rev
Author: jouni
Date: 2009-08-09 18:50:15 +0000 (Sun, 09 Aug 2009)
Log Message:
-----------
Fix the spelling of my name
(the rst files are processed as UTF-8 anyway)
Modified Paths:
--------------
trunk/matplotlib/doc/users/credits.rst
trunk/matplotlib/doc/users/whats_new.rst
Modified: trunk/matplotlib/doc/users/credits.rst
===================================================================
--- trunk/matplotlib/doc/users/credits.rst 2009-08-09 04:50:12 UTC (rev 7437)
+++ trunk/matplotlib/doc/users/credits.rst 2009-08-09 18:50:15 UTC (rev 7438)
@@ -148,7 +148,8 @@
Charlie Moad
contributed work to matplotlib's Cocoa support and has done a lot of work on the OSX and win32 binary releases.
-Jouni K. Seppaenen wrote the PDF backend and contributed numerous
+Jouni K. Seppänen
+ wrote the PDF backend and contributed numerous
fixes to the code, to tex support and to the get_sample_data handler
Paul Kienzle
@@ -172,4 +173,4 @@
Jae-Joon Lee implemented fancy arrows and boxes, rewrote the legend
support to handle multiple columns and fancy text boxes, wrote the
axes grid toolkit, and has made numerous contributions to the code
- and documentation
\ No newline at end of file
+ and documentation
Modified: trunk/matplotlib/doc/users/whats_new.rst
===================================================================
--- trunk/matplotlib/doc/users/whats_new.rst 2009-08-09 04:50:12 UTC (rev 7437)
+++ trunk/matplotlib/doc/users/whats_new.rst 2009-08-09 18:50:15 UTC (rev 7438)
@@ -72,7 +72,7 @@
and 3.0 will not be available until numpy is available on those
releases). Thanks to the many developers who contributed to this
release, with contributions from Jae-Joon Lee, Michael Droettboom,
-Ryan May, Eric Firing, Manuel Metz, Jouni K. Seppaenen, Jeff Whitaker,
+Ryan May, Eric Firing, Manuel Metz, Jouni K. Seppänen, Jeff Whitaker,
Darren Dale, David Kaplan, Michiel de Hoon and many others who
submitted patches
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|