I want to allow the user to switch files, possibly changing the composition of
the scene, definitely needing updated surfaces to be displayed. I thought the
easiest solution would be to simply clear the scene and start again:
class Visualization(HasTraits):
...
@on_trait_change('surf_filename, cons_filename')
def update_data(self):
try:
if check_files(self.surf_filename, self.cons_filename):
self.update_plot()
...
def picker_callback(self, picker):
""" Picker callback: this get called when on pick events.
"""
print "Picking..."
...
@on_trait_change('scene.activated')
def update_plot(self):
print "Updating..."
self.scene.mlab.clf()
...
self.picker =
self.scene.mayavi_scene.on_mouse_pick(self.picker_callback)
self.picker.tolerance = 0.001
All is well for the first rendering of the scene: picker_callback() is getting
called appropriately, but when I subsequently call clf(), in the context of
update_data(), and rebuild the scene from the newly selected datasets my
callback no longer gets called. Note the default, 'p' activated, picker is
working.
Can anyone suggest what I might have done wrong? I was personally a little
suspicious about using a method instead of a plain function for picker_callback
but it worked, at least. until I started adding the change datasets feature.
--
Dave Flitney, IT Manager
Oxford Centre for Functional MRI of the Brain
E:[email protected] W:+44-1865-222713 F:+44-1865-222717
URL: http://www.fmrib.ox.ac.uk/~flitney
------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________
MayaVi-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mayavi-users