Improved code separation in TVTK and Mayavi2

Prabhu Ramachandran posted the following note to the enthought-dev mailing list. The result is that TVTK Scene in Pyface is now GUI-toolkit-independent, and Mayavi2 is independent of Envisage.

Just a quick note. I’ve refactored the pyface.tvtk scene in the
branches. I’ve “abstracted” the core TVTK functionality of a generic
scene in enthought.pyface.tvtk.tvtk_scene.TVTKScene. This scene basically uses
a TVTK renderwindow interactor and is usable by itself. It does not
really use anything from Pyface or wxPython. The
enthought.pyface.tvtk.scene.Scene class derives from it and creates a wxPython
specific widget that the pyface wx backend can use. So it should be
easy to create a QT backend.

I’ve changed mayavi a little bit to separate out the core Engine from
the EnvisageEngine and also use the new refactored pyface code. With
this, if you run examples/ you won’t see any envisage
workbench messages. There should be no envisage imports at all. I
even checked with python -v. Apart from some setuptools namespace
stuff which I don’t control there are no envisage imports.

In addition I’ve checked in an in the examples that shows
how you can do offscreen rendering with mayavi and the TVTKScene. The
key here is that you write mayavi scripts that can be rendered off
screen. In theory it should be possible to now do a visualization
on the full UI version, save (possibly a specialized) visualization
and then have that all rendered out offscreen. I am not going to
implement that until the persistence issues are sorted out. The thing
I am happy about is that this is now definitely possible to implement.

There should be no major API breakage unless you are using the mayavi
engine directly.

When updating mayavi2 from SVN you will have to install pyface from
branches as well.

Leave a Reply

Your email address will not be published. Required fields are marked *

Please leave these two fields as-is:

Protected by Invisible Defender. Showed 403 to 120,030 bad guys.