List Info

Thread: AE/PyObjC: how to use event loops to process AE




AE/PyObjC: how to use event loops to process AE
user name
2006-05-09 16:06:39
A PyObjC application using Appkit starts and event loop in
AppHelper  
thus:

	AppHelper.runEventLoop()

But, the examples I have seen using Apple Events in Python
(not  
PyObjC) install their own handlers and then call the event
loop:

	CarbonEvt.RunApplicationEventLoop()

Unfortunately and unsurprisingly, trying to inject the
handlers from  
different methods in my PyObjC class inheriting from  
NibClassBuilder.AutoBaseClass and then expecting them to be
called  
doesn't seem to work. I assume it is because: 1) the Carbon
Event   
Loop does not get called by the AppHelper event loop PyObjC
uses but  
one cannot easily mix event loops and 2) the more complex  
instantiation chain required for nib objects obfuscates the
call  
chain so I am not sure where to put things or how to extend
AppHelper  
it without breaking it.

I am sure most of this is due to my lack of detailed working
 
knowledge of AppKit and PyObjC and I'll hammer away at this
over  
time. But sometimes an example is faster than
trial-and-error  
learning. Anyone know of an example of how this is done? I
haven't  
seen an example of a PyObjC AE application. Is that because
it is  
complex to "pull off"? I assume I have to do
some clever chaining of  
the super class init coupled with looking for Apple Events
in the  
AppHelper event loop and dispatching them correctly to the
handlers  
or maybe there is another way I am too "green"
to know. I will keep  
digging on my own, but sometimes a direct reference is
better than a  
search in terms of time to an objective. I just don't want
to 'bark  
up the wrong tree for a long time"


Daniel

"Ever tried. Ever failed. No matter. Try again. Fail
again. Fail  
better."
–Samuel Beckett




_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )