From 73189752ab0fcbb4f5b3ac340346a865be1e1528 Mon Sep 17 00:00:00 2001 From: yorikvanhavre Date: Mon, 5 Dec 2011 20:03:43 +0000 Subject: [PATCH] + small cosmetric improvements to sphinx doc git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5222 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d --- src/Doc/sphinx/Draft.rst | 11 ++++++- src/Doc/sphinx/FreeCAD.rst | 1 + src/Doc/sphinx/Part.rst | 4 +-- src/Doc/sphinx/_static/freecad.css | 39 +++++++++++++++++++++--- src/Doc/sphinx/_templates/searchbox.html | 27 ++++++++++++++++ src/Doc/sphinx/conf.py | 23 +++++++++----- src/Doc/sphinx/index.rst | 2 ++ 7 files changed, 91 insertions(+), 16 deletions(-) create mode 100644 src/Doc/sphinx/_templates/searchbox.html diff --git a/src/Doc/sphinx/Draft.rst b/src/Doc/sphinx/Draft.rst index 63e577632..542acff0b 100644 --- a/src/Doc/sphinx/Draft.rst +++ b/src/Doc/sphinx/Draft.rst @@ -1,7 +1,16 @@ The Draft module ================ -The Draft module offer several convenient functions to work with simple objects. +The Draft module offer several convenient functions to work with simple 2D and 3D objects. +These functions can be used in scripts and macros or from the python interpreter, once the Draft module has been imported. + +Example:: + + import FreeCAD + from Draft import * + myrect = makeRectangle(4,3) + mydistance = FreeCAD.Vector(2,2,0) + move(myrect,mydistance) .. toctree:: :maxdepth: 4 diff --git a/src/Doc/sphinx/FreeCAD.rst b/src/Doc/sphinx/FreeCAD.rst index a2642f879..cb37b3c4d 100644 --- a/src/Doc/sphinx/FreeCAD.rst +++ b/src/Doc/sphinx/FreeCAD.rst @@ -6,6 +6,7 @@ The FreeCAD module .. automodule:: FreeCAD :members: + :show-inheritance: .. autoclass:: Vector :members: diff --git a/src/Doc/sphinx/Part.rst b/src/Doc/sphinx/Part.rst index 320afe9af..5c07ef9bd 100644 --- a/src/Doc/sphinx/Part.rst +++ b/src/Doc/sphinx/Part.rst @@ -6,6 +6,4 @@ The Part module .. automodule:: Part :members: - -.. automodule:: PartGui - :members: + :show-inheritance: diff --git a/src/Doc/sphinx/_static/freecad.css b/src/Doc/sphinx/_static/freecad.css index c53466666..e596ecb35 100644 --- a/src/Doc/sphinx/_static/freecad.css +++ b/src/Doc/sphinx/_static/freecad.css @@ -343,17 +343,46 @@ body[class*='page-Main_Page'] #content ul { margin-left: 30px; } -.api .function { - padding: 3px; - background: #dddddd; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; +.api .function, dl dt { + padding: 3px 2px 3px 20px; + border-radius: 3px; + } + +dl.class dt { + background: #dddddd url("http://sourceforge.net/apps/mediawiki/free-cad/nfs/project/f/fr/free-cad/0/0f/Class.png") left center no-repeat; + } + +dl.function dt, dl.method dt { + background: #dddddd url("http://sourceforge.net/apps/mediawiki/free-cad/nfs/project/f/fr/free-cad/2/20/Method.png") left center no-repeat; + } + +dl.attribute dt { + background: #dddddd url("http://sourceforge.net/apps/mediawiki/free-cad/nfs/project/f/fr/free-cad/4/47/Property.png") left center no-repeat; + } + +dl dt tt { + font-weight: bold; + } + +dl dt big { + margin: 0 3px 0 3px; + font-size: 0.8em; } .api .description { padding-left: 30px; } +.highlight { + background: #ffffff !important; + margin-bottom: 40px; + } + +.highlight pre { + margin-left: 30px; + padding: 5px; + } + /* Screenshots ************************ */ .screenthumbs { diff --git a/src/Doc/sphinx/_templates/searchbox.html b/src/Doc/sphinx/_templates/searchbox.html new file mode 100644 index 000000000..0c41389fc --- /dev/null +++ b/src/Doc/sphinx/_templates/searchbox.html @@ -0,0 +1,27 @@ +{# + basic/searchbox.html + ~~~~~~~~~~~~~~~~~~~~ + + Sphinx sidebar template: quick search box. + + :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +#} +{%- if pagename != "search" %} + + +{%- endif %} diff --git a/src/Doc/sphinx/conf.py b/src/Doc/sphinx/conf.py index 8a74ad056..895914d03 100644 --- a/src/Doc/sphinx/conf.py +++ b/src/Doc/sphinx/conf.py @@ -11,15 +11,24 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os +import sys, os, commands # 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.insert(0, os.path.abspath('.')) -sys.path.append(os.path.abspath('/home/yorik/Apps/FreeCAD/lib/')) -sys.path.append(os.path.abspath(os.path.join(os.environ["HOME"],"FreeCAD/lib"))) +# first look for local (home-compiled) FreeCAD in its default location: + +if os.path.exists(os.path.abspath(os.path.join(os.environ["HOME"],"FreeCAD/lib"))): + sys.path.append(os.path.abspath(os.path.join(os.environ["HOME"],"FreeCAD/lib"))) + +# otherwise try to locate FreeCAD lib somewhere else: + +elif commands.getstatusoutput("locate FreeCAD/lib")[0] == 0: + path = commands.getstatusoutput("locate FreeCAD/lib")[1].split()[0] + sys.path.append(path) + import FreeCAD, FreeCADGui FreeCADGui.showMainWindow() # this is needed for complete import of GUI modules @@ -79,7 +88,7 @@ exclude_patterns = ['_build'] # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +add_module_names = False # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. @@ -110,7 +119,7 @@ html_style = 'freecad.css' # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -#html_title = None +html_title = "FreeCAD API documentation" # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None @@ -138,11 +147,11 @@ html_static_path = ['_static'] #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True diff --git a/src/Doc/sphinx/index.rst b/src/Doc/sphinx/index.rst index 715da5714..bcb2a9599 100644 --- a/src/Doc/sphinx/index.rst +++ b/src/Doc/sphinx/index.rst @@ -25,3 +25,5 @@ This is the complete python API reference of the FreeCAD appication * :ref:`genindex` * :ref:`modindex` * :ref:`search` + +* `Go back to the FreeCAD wiki `_