[mayavi] poll_file.py example

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[mayavi] poll_file.py example

fred-2
Hi,

I'm trying to do something similar to that poll_file.py does.

I don't really understand how this example is supposed to work.

In poll_file method, I added the line

  print 'file polled!'

at the very beginning.

I run poll_file.py and then, if I touch heart.vtk (touch unix command)
no message is displayed.

What am I doing wrong?


TIA



Cheers,

--
Fred
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: [mayavi] poll_file.py example

fred-2
Hi all,

Any news about this issue?

http://tinyurl.com/y8yuc7k

TIA.

Cheers,

--
Fred
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: [mayavi] poll_file.py example

Jonathan Guyer
In reply to this post by fred-2

On Mar 8, 2010, at 6:03 AM, fred wrote:

> I'm trying to do something similar to that poll_file.py does.
>
> I don't really understand how this example is supposed to work.
>
> In poll_file method, I added the line
>
>  print 'file polled!'
>
> at the very beginning.
>
> I run poll_file.py and then, if I touch heart.vtk (touch unix command)
> no message is displayed.
>
> What am I doing wrong?

It doesn't work for me, either. At one time, I think I figured out why not, but all I can remember now is that it doesn't. For FiPy, I implemented a Mayavi Viewer based on poll_file.py, which you can find here:

  http://matforge.org/fipy/browser/trunk/fipy/viewers/mayaviViewer/

There are a a lot of aspects to mayaviDaemon.py that are peculiar to our needs, but the only difference in the polling seems to be that I didn't use Pollster, but just have Timer call a poll_file method.


Ah, no, wait... I found the version of poll_file.py that I hacked to get things working. The problem is that timer is declared in the local scope of poll_file.py:main() at

  https://svn.enthought.com/enthought/browser/Mayavi/trunk/examples/mayavi/interactive/poll_file.py#L112

and that as soon as the timer is declared it goes out of scope. My hack to poll_file.py was to add

    mayavi.savedtimerbug = timer

in the next line so that the Timer() is not garbage collected.

In our own mayaviDaemon.py, I made the MayaviDaemon an instance of enthought.mayavi.plugins.app.Mayavi and moved the timer declaration to MayaviDaemon.__init__() and declared the timer as data member of the class, thus keeping everything in scope and the timer firing.




_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev