PyGantt
PyGantt reads a project description from a xml formatted file and outputs a Gantt diagram in different formats (html, svg, png...). The main difference between PyGantt and other similar project is its ability to schedule the project for you, trying to satisfy all constraints given in your project description.
Download
http://www.logilab.org/projects/pygantt/project_download
Documentation
http://www.logilab.org/projects/pygantt/documentation
GANTT.py
This processor reads the xml code for pygantt and executes it by pygantt. The result is written to an attachment file and then displayed.
""" MoinMoin - Processor for GANTT data Copyright (c) 2003 by Reimar Bauer <R.Bauer@fz-juelich.de> All rights reserved. This routine is published under the GNU Library General Public License """ import string, os from MoinMoin.Page import Page from MoinMoin import config from MoinMoin.action import AttachFile htdocs_access = isinstance(config.attachments, type({})) def process(request, formatter, lines): # parse bangpath for arguments exclude = [] image = 'gantt' renderer = 'png' txt='' arg=string.split(lines[0]) for test in arg: if test == '-name' : i=string.index(arg,test) image=arg[i+1] if test == '-renderer' : i=string.index(arg,test) renderer = arg[i+1] if test == '-csp': txt = txt + ' --csp ' if test == '-usdates': txt = txt + ' --usdates ' if test == '-datesinbars': txt = txt + ' --datesinbars ' if test == '-rappel': txt = txt + ' --rappel ' if test == '-display-resources': txt = txt + ' --display-resources ' if test == '-display-id' : i=string.index(arg,test) txt = txt + ' --display-id ' + arg[i+1] if test == '-resource': i=string.index(arg,test) txt = txt + ' --resourcep ' + arg[i+1] if test == '-timestep': i=string.index(arg,test) txt = txt + ' --timestep ' + arg[i+1] if test == '-detail': i=string.index(arg,test) txt = txt + ' --detail ' + arg[i+1] if test == '-datesinbars': txt = txt + ' --datesinbars ' if test == '-depth': i=string.index(arg,test) txt = txt + ' --depth ' + arg[i+1] if test == '-view-begin': i=string.index(arg,test) txt=txt + ' --view-begin=' + arg[i+1] if test == '-view-end': i=string.index(arg,test) txt=txt + ' --view-end=' + arg[i+1] # remove bang path, create output list del lines[0] pagename=formatter.page.page_name attach_dir=AttachFile.getAttachDir(pagename,create=1) url=AttachFile.getAttachUrl(pagename,image + '.' + renderer) file_name=attach_dir+ '/' + image + '.' + renderer cmd='pygantt --renderer '+renderer +' ' + txt + ' - > ' + file_name f=os.popen(cmd,'w') for line in lines: print >>f, line f.flush() link='<img src="'+url+'" >' request.write(link)
supported Syntax
This is a subset from the help page of pygantt. All commands which are not implemented by the processor were removed. To use the comannds please look at the example:
#!GANTT -name gantt -renderer png -detail 1 -timestep 1 -display-resources
Take a xml project description file and output a Gantt diagram Home page: http://www.logilab.org/pygantt This code is released under the GNU Public Licence v2. See www.gnu.org. USAGE: pygantt [--arg=value]... <xml_input_file> [output_file] You can give "-" as input file name to read the project description from stdin. If the output file is omitted, write output on stdout. --renderer <ouput_format> output rendering. Maybe _ html [default] _ svg _ png, jpeg, tiff... (require PIL) --display-id <taskid> Schedule the all project but only render task with the given id and its children --display-resources Display resources on the Gantt chart. --resource <resourceid> / -r <resourceid> Schedule the all project but only render task using resource <resourceid> You can specify this option multiple times. --timestep <integer> timeline increment in days for diagram [default=1]. --depth <integer> depth of the tree to draw [default=all tree]. --detail <integer> detail level [0=no 1=duration/status 2=begin/end 3=all]. --datesinbars write begin/end dates in task bars. --usdates US can't help write dates backwards... --rappel recall tasks'title on the left hand side of the diagram --view-begin <date> view begin date, as in --view-begin=2000/12/24. --view-end <date> view end date, as in --view-end=2000/12/24. CREDITS: Mark J. Scheller <scheller@u1.net> - various improvements James A. Roberts <jroberts@csnsys.com> - windows strptime fix.
Examples
If pygantt is installed you will see an image here instead of the following XML code. Probably it could look like this example:
<project xmlns:pg="http://www.logilab.org/namespaces/pygantt_docbook" id="monprojet"> <label>Specification</label> <task id="modules"> <label>Modules fonctionnels</label> <task id="func1"> <label>Implmentation fonctions 1 et 2</label> <duration>2</duration> <constraint type="begin-after-date">2003/11/01</constraint> </task> <task id="func2"> <label>Implmentation fonctions 3 et 4</label> <duration>4</duration> <constraint type="begin-after-date">2003/11/01</constraint> </task> </task> <task id="documentation"> <label>Documentation</label> <task id="doc_func1"> <label>Documentation module 1</label> <duration>1</duration> <constraint type="begin-after-end">func1</constraint> </task> <task id="doc_func2"> <label>Documentation module 2</label> <duration>1</duration> <constraint type="begin-after-end">func2</constraint> </task> </task> </project>