Tuesday, April 18, 2006

Hierarchy view

I've been playing with a hierarchy view recently, and got some interesting results already... In python an interesting aspect is that you have multiple inheritance, so given some class you can have a Tree of superclasses as well as a Tree of subclasses.

So, instead of using a Tree View as JDT does, I decided to try something such as showing it similar to a class diagram. After a long search in the net for 2d drawing toolkits, I've decided for Piccolo. It's a nice library, and I've had only few problems using it. A point that favored it a lot over other choices is that it supports SWT natively, without the need for any other library, and besides, its abstractions are pretty easy to follow.

The results I got so far are in the image below...



Note that the graphic part is actually the 'easy' part... doing a search for references (to get the subclasses) is the difficult thing, but it seems to be shaping up nicely. I hope to release it (at least in a beta state) for the next release of pydev extensions.

4 comments:

Dennis Benzinger said...

Why don't you use the Draw2D package from the Graph Editing Framework (http://www.eclipse.org/gef/)?

Fabio Zadrozny said...

Actually, I thought about it, but the abstractions from Piccolo seemed better...

It gives you zoom and pan by default, and a nice scene-abstraction, allowing me to handle things such as when a mouse passes over an object or is clicked.

I've already done lot's of work in Java 2D (a whole GIS application), and I think that Draw2D compares more to it, which is pretty nice, but I really wanted something not so low-level... So, if I was focusing on other things Draw2D could have been my choice.

Cheers,

Fabio

Ian said...

Has this made it into PyDev yet? We'd love to have a feature like this.

Fabio Zadrozny said...

This is currently only available in Pydev Extensions.