Gantt Calendar plugin for Trac

2008/12/17 Update : Thanks to Achim Spangler for providing a patch to fix some unicode issues!

I didn’t write this!

This is basically an English version of the Japanese plugin developed by the Shibuya Trac project – I’ve translated the source & cleaned up a few things but the bulk of the work is theirs.
Tidus
shibuya-trac

What is it?

The GanttCalendar plugin adds ticket Gantt chart and calendar functionality to Trac:



Requirements

This plugin is only compatible with Trac version 0.11 and above – 0.10 users will need to upgrade. The install instructions provided will only work if you have ez_setup installed – see the Trac Plugins page if you have any problems.

Installation

Use subversion to checkout the plugin, then install it using easy_install

> svn co http://recurser.com/svn/ganttcalendar/trunk/ ganttcalendar
> cd ganttcalendar
> python setup.py bdist_egg
> sudo easy_install dist/TracGanttCalendarPlugin-0.1-py2.4.egg

If you don’t have easy_install installed, see the Trac Plugins page for installation instructions

Configuration

To configure the plugin, you first need to add it to the [components] section
in trac.ini :

[components]
ganttcalendar.ticketcalendar.ticketcalendarplugin = enabled                                                                              
ganttcalendar.ticketgantt.ticketganttchartplugin = enabled

Next, you need to configure Trac to display a couple of extra fields in the
ticket page :

[ticket-custom]
complete = select
complete.label = % Complete
complete.options = 0|5|10|15|20|25|30|35|40|45|50|55|60|65|70|75|80|85|90|95|100
complete.order = 3
due_assign = text
due_assign.label = Start (YYYY/MM/DD)
due_assign.order = 1
due_close = text
due_close.label = End (YYYY/MM/DD)
due_close.order = 2

The start & end date fields should be inputted in the format YYYY/MM/DD. You can make these fields a little more user-friendly using the datefield plugin



18 Responses to “Gantt Calendar plugin for Trac”  

  1. 1 Chris

    looks great, but it doesn’t seem to work. I install the plugin and enable it as per your instructions, the custom ticket fields and the calender and gantt chart are all there, but the ticket information doesn’t appear in the calender or chart

    this is on Trac 0.11.2.1

    any ideas what might be stopping it from working?

    I’d really like to use it as I need to use Gantt charts with my project, and tying it into the ticket system would be ideal

  2. 2 echarp

    For information, the date parser seem to be wrong.

    I corrected it in ticketcalendar.py and ticketgantt.py.

    For information here is the change to apply (in 4 different lines):

    t = time.strptime(due_close,”%d.%m.%Y”)

    should be written as

    t = time.strptime(due_assign,”%Y/%m/%d”)

    (sorry if the display is ugly, I don’t know if there is any wiki syntax available here)

    Resulting screens look real great!!!

  3. 3 Chris

    hmmm, I made the changes, but it’s still not working.

    I also downloaded the source from the Shibuya Trac project and that also doesn’t work with my version.

    I shows milestones on the calender, but none of the tickets display

    looks like I’ll have to do it by hand :(

  4. 4 echarp

    hum, my comment was a bit fast: be careful that due_close does remain due_close in the correction, same with due_assign.

    t = time.strptime(due_assign,ā€%Y/%m/%dā€)

    t = time.strptime(due_close,ā€%Y/%m/%dā€)

    … depending on what was there before.

    Otherwise, ensuring ticket dates are formatted according to YYYY/MM/DD, it should go all right.

    Hum, are you using something else than sqlite?

  5. 5 Chris

    no, I’m using sqlite.

    and yes, I only changed the %Y/%m/%d (I didn’t actually notice the difference with due_assign and due_close)

    I’m wondering if it’s an incompatibility with my particular version of trac, but as I’m not familiar with python or developing trac plugins I don’t know how to go about fixing it

  6. 6 echarp

    Just a possibility, do you have open milestones?

  7. 7 Chris

    Yep, currently have 5 milestone, covering the next 3 months of our project

  8. 8 dave

    Hi guys, thanks for the feedback! I’ve fixed up the date format in SVN – it makes sense to use the more standardized format you’re using.

    @Chris – strange, I can’t think of any obvious reason for it not to work. We were using it with sqlite at work before with milestones etc without any problems, on Trac-0.11-py2.4. Could you check if you are running with UTF8 enabled (LANG=en_US.UTF-8) ? I imagine if encoding was the problem you’d get some fairly obvious error messages though.

  9. 9 Chris

    I’m afraid I don’t know where to find out about the encoding, there’s nothing obvious in trac.ini

    However, you have reminded me that my site is running on python 2.5, rather than 2.4, although I have no idea if that would make a difference… I’m reluctant to go reinstalling things as the site’s being used

  10. 10 MDaniel

    Chris,
    The same as you happen to me following the instructions in this wiki. I also have python 2.5 and trac 0.11.2.1 on an Ubuntu 8.10 server. I found that if after following them, you also go to the admin screen, then to the plugin screen, you can choose to upload and install the plugin file: TracGanttCalendarPlugin-0.1-py2.5.egg. After this is done your trac should now have added the calendar and gantt ticket options. I am not quite sure why trac needs this extra step, as the regular python shell does see the plugin after issuing the sudo easy_install dist/TracGanttCalendarPlugin-0.1-py2.5.egg and also the instructions add the components ganttcalendar

  11. 11 Chris

    Thanks MDaniel, installing the egg by uploading it via the plugin admins screen did the trick :)

  12. 12 echarp

    For information: do you plan to introduce this plugin on the trac hacks website?

    Do you follow it in its Japanese origins? Are there interesting development being done?

    You read Japanese? :)

  13. 13 Baybora Oren

    Looks great but how can we make upgrade for Trac 0.10 ?

  14. 14 steve

    Great work !! I have one problem with the print function. It is not possible to print the chart. I get a empty print page. I use Trac 0.11.2.1.

  15. 15 Vanderstraeten Marc

    where can I find the code? where is the link to the svn rep?

  16. 16 Chris

    The repository URL is in the first code block in the installation section.

    The address is: http://recurser.com/svn/ganttcalendar/trunk/

    enjoy :)

  17. 17 Simon

    Is there a way to set the permissions for this plugin? I noticed that I can view the ticketcalndar and the ganttcalendar when I’m not logged into trac (anonymous).

    Any help would be appreciated.
    Thanks,
    Simon

  18. 18 Christian Herrera

    Hi there,

    I followed the instructions and everything was ok except because at the end, the Plug In doesn’t appear listed on the Plug Ins Sections :-\, I installed it from the admin plug in section, If I try to re-install it it says that it is already installed. The log file shows this:

    DEBUG: Loading ganttcalendar.ticketgantt from c:\python25\lib\site-packages\tracganttcalendarplugin-0.1-py2.5.egg ERROR: Skipping “ganttcalendar.ticketgantt = ganttcalendar.ticketgantt”: (can’t import “ImportError: No module named ganttcalendar.ticketgantt”)
    DEBUG: Loading ganttcalendar.ticketcalendar from c:\python25\lib\site-packages\tracganttcalendarplugin-0.1-py2.5.egg ERROR: Skipping “ganttcalendar.ticketcalendar = ganttcalendar.ticketcalendar”: (can’t import “ImportError: No module named ganttcalendar.ticketcalendar”)

    Any ideas?? Thanks for your Help.

Leave a Reply