On 3/11/06, Phil Mayers <p.mayers@imperial.ac.uk> wrote:
Brian Granger wrote:
I probably should have given more details about what I am trying to do. Before I get going, I should mention that I have been using Twisted heavily for 1.5 years and I have, for the most part, learned to play the "Twisted Game."
If that is the case, you really ought to have known the answer was "you don't" ;o)
I respectfully disagree that what I am trying to do somehow violates the unwritten Twisted ethic. I am not using threads and I don't have blocking code anywhere. When I write things like:
myresult = a.computeSomethingThatUsesTwisted()
It does not really block - it only appears to block. What I mean by this is that is does not block execution, it only blocks the user from starting new commands. The full machinery of Twisted is free to proceed while the result is pending. I guess I think of it as a shorthand for making the callback of a Deferred an assignment of the result to a global variable myresult. Everything is asynchronous.
So here is what I am working on:
I am developing objects (for scientific computing) that 1) use Twisted to talk over the network and 2) need to be used interactively from a python prompt. This second point is really where the difficult and interesting things are.
That is not an unreasonable use-case in fact (IMHO of course).
The sad thing is that PyCrust is wxPython so by definition AWFUL. The many suggestions already are correct - stop the interpreter GUI for a certain time (say 10ms) then if the deferred calls back, restart with the result else return a "backgrounded" job
That said, possible someone can comment if this code is current:
http://svn.twistedmatrix.com/cvs/trunk/doc/core/examples/threadedselect/bloc...
The Manager class getDeferred method might be a start, if you can integrate it with the wx-style tsr.
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
-- Brian Granger Santa Clara University ellisonbg@gmail.com