Prechádzať zdrojové kódy

pygrass doc: improved pygrass documentation

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@60443 15284696-431f-4ddb-bdfa-cd5b030d7da7
Luca Delucchi 11 rokov pred
rodič
commit
185662f8dc

+ 2 - 2
lib/python/pygrass/docs/Makefile

@@ -77,9 +77,9 @@ latexpdf:
 	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex/"
 
 man:
-	$(call run_grass,$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man)
+	$(call run_grass,$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(MANDIR))
 	@echo
-	@echo "Build finished. The manual pages are in $(BUILDDIR)/man/"
+	@echo "Build finished. The manual pages are in $(MANDIR)/"
 
 doctest:
 	$(call run_grass,$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest)

+ 74 - 0
lib/python/pygrass/docs/_static/pygrass.css

@@ -0,0 +1,74 @@
+/* GRASS documentation site style sheet
+ *
+ * send improvements to GRASS Developers list
+ * 
+ *  (eg how to reach the same result on netscape, mozilla konqueror?)
+ *
+ * Fonts:
+ *	http://www.w3.org/TR/REC-CSS2/fonts.html
+ * Tables:
+ *	http://www.w3.org/TR/REC-CSS2/tables.html
+ */
+
+body{
+    background: white;
+    color: black;
+    font-family: arial,sans-serif;
+    width: 99%;
+    margin: 8px;
+}
+
+hr.header {
+    height: 3px;
+    color: gray;
+    background-color: gray;
+    width: 100%;
+}
+
+h1{
+    background-color: transparent;
+    color: rgb(25%, 60%, 25%);
+    font-family: arial,sans-serif;
+    font-weight: bold;
+    font-size: x-large;
+}
+
+h2{
+    background-color: transparent;
+    color: rgb(25%, 60%, 25%);
+    font-family: arial,sans-serif;
+    font-weight: bold;
+    font-size: large;
+}
+
+h3{
+    background-color: transparent;
+    color: rgb(25%, 60%, 25%);
+    font-family: arial,sans-serif;
+    font-weight: bold;
+    font-size: large;
+}
+
+h4{
+    background-color: transparent;
+    color: rgb(25%, 60%, 25%);
+    font-family: arial,sans-serif;
+    font-weight: bold;
+    font-size: medium;
+}
+
+table.border {
+    border-collapse:collapse;
+}
+
+table.border td {
+    border: 1px solid rgb(25%, 60%, 25%);
+}
+
+td {
+    padding: 5px;
+}
+
+div.related {
+    background-color: transparent;
+}

+ 9 - 0
lib/python/pygrass/docs/_templates/layout.html.template

@@ -0,0 +1,9 @@
+{% extends "!layout.html" %}
+{% block extrahead %}
+<link rel="stylesheet" href="{{ pathto('_static/pygrass.css', 1) }}" type="text/css" />
+{% endblock %}
+
+{% block header %}
+<img src="../grass_logo.png" alt="GRASS logo">
+<hr class="header">
+{% endblock %}

+ 25 - 4
lib/python/pygrass/docs/conf.py

@@ -12,6 +12,9 @@
 # serve to show the default.
 
 import sys, os
+from datetime import date
+import string
+from shutil import copy
 
 # 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
@@ -20,6 +23,24 @@ if not os.getenv('GISBASE'):
     sys.exit("GISBASE not defined")
 sys.path.insert(0, os.path.abspath(os.path.join(os.environ['GISBASE'], 'etc', 'python', 'grass')))
 
+from grass.script import core
+
+footer_tmpl = string.Template(\
+r"""
+{% block footer %}<hr class="header">
+<p><a href="../index.html">Help Index</a> | <a href="../topics.html">Topics Index</a> | <a href="../keywords.html">Keywords Index</a> | <a href="../full_index.html">Full Index</a></p>
+<p>&copy; 2003-${year} <a href="http://grass.osgeo.org">GRASS Development Team</a>, GRASS GIS ${grass_version} Reference Manual</p>
+{% endblock %}
+""")
+
+grass_version = core.version()['version']
+today = date.today()
+
+copy("_templates/layout.html.template", "_templates/layout.html")
+with open("_templates/layout.html", "a+b") as f:
+    f.write(footer_tmpl.substitute(grass_version=grass_version, year=today.year))
+    f.close()
+
 # -- General configuration -----------------------------------------------------
 
 # If your documentation needs a minimal Sphinx version, state it here.
@@ -50,9 +71,9 @@ copyright = u'2012-2014, Pietro Zambelli'
 # built documents.
 #
 # The short X.Y version.
-version = '0.2'
+#version = '0.2'
 # The full version, including alpha/beta/rc tags.
-release = 'beta'
+#release = 'beta'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
@@ -100,7 +121,7 @@ intersphinx_mapping = {'python': ('http://docs.python.org/2.7', None)}
 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
-html_theme = 'default'
+html_theme = 'traditional'
 
 # 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
@@ -140,7 +161,7 @@ html_static_path = ['_static']
 #html_use_smartypants = True
 
 # Custom sidebar templates, maps document names to template names.
-#html_sidebars = {}
+html_sidebars = {"**":["localtoc.html",'relations.html','searchbox.html']}
 
 # Additional templates that should be rendered to pages, maps page names to
 # template names.

+ 23 - 13
lib/python/pygrass/docs/index.rst

@@ -3,26 +3,27 @@
    You can adapt this file completely to your liking, but it should at least
    contain the root `toctree` directive.
 
-Welcome to PyGrass documentation!
+PyGRASS documentation!
 ===================================
 
-In 2006, GRASS GIS developers started to adopt Python for the new GUI. Due
-to this Python became more and more important and developers converted all
-shell scripts from GRASS GIS 6 to Python for GRASS GIS 7.
-
-``pygrass`` improves the integration between GRASS GIS and Python, making
+``PyGRASS`` improves the integration between GRASS GIS and Python, making
 the use of Python under GRASS more consistent with the language itself. Furthermore,
 it simplifies GRASS scripting and programming and more natural for the user.
 
-This project has been funded with support from the Google Summer of Code 2012.
+Background: In 2006, GRASS GIS developers started to adopt Python for the new GUI. Due
+to this Python became more and more important and developers converted all
+shell scripts from GRASS GIS 6 to Python for GRASS GIS 7.
 
+To work with ``PyGRASS`` you need an up-to-date version of GRASS GIS 7.
+The only action before starting to work with ``PyGRASS`` is to launch 
+GRASS GIS 7 and from the console launch ``python`` or ``ipython`` 
+(the second one is the recommended way)
 
 Contents:
 
 .. toctree::
    :maxdepth: 2
 
-   intro
    gis
    raster
    vector
@@ -30,10 +31,19 @@ Contents:
    modules
 
 
-Indices and tables
-==================
+References
+============
+
+Zambelli P, Gebbert S, Ciolli M., 2013. *Pygrass: An Object Oriented Python Application Programming Interface (API) for Geographic Resources Analysis Support System (GRASS) Geographic Information System (GIS)*. ISPRS International Journal of Geo-Information. 2(1):201-219. `doi:10.3390/ijgi2010201 <http://dx.doi.org/10.3390/ijgi2010201>`_
+
+This project has been funded with support from the `Google Summer of Code 2012 <http://trac.osgeo.org/grass/wiki/GSoC#PythonhighlevelmapinteractionforGRASSGIS>`_
+
+
+..
+    Indices and tables
+    ==================
 
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
+    * :ref:`genindex`
+    * :ref:`modindex`
+    * :ref:`search`