Jason Tackaberry wrote: > See the attached, which implements it the way I think it should be > (roughly). I think this is an elegant implementation. I didn't inherit > ThreadCallback from your BackgroundTask class because I couldn't get it > to work. You'll see what I mean when I try to make it go. :)
One problem with BackgroundTask is that it has signals for completed and exception and the InProgress objects connects to these signals. That does not work with the idea that you can call the callback more than once. > class _CallableThread(threading.Thread, kaa.InProgress): > def __init__(self, callback): > super(_CallableThread, self).__init__() > super(kaa.InProgress, self).__init__() > > self._callback = callback > > def __call__(self, *args, **kwargs): > self._wrapped_callback = kaa.Callback(self._callback, *args, **kwargs) > self.start() > return self > > def run(self): > result = self._wrapped_callback() > # TODO: handle exception > kaa.MainThreadCallback(self.finished)(result) And handle thread.join() > class ThreadCallback(kaa.Callback): > def __init__(self, callback, *args, **kwargs): > kaa.Callback.__init__(self, callback, *args, **kwargs) why define an __init__ at all? I will play with this code.... Dischi -- Voodoo Programming: Things programmers do that they know shouldn't work but they try anyway, and which sometimes actually work, such as recompiling everything. -- Karl Lehenbauer
pgpyfXk5Qn870.pgp
Description: PGP signature
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________ Freevo-devel mailing list Freevo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freevo-devel