On 1/12/10 2:13 PM, has wrote:
Kevin Walzer wrote:
You don't pass self to a bound method in Python. Delete the ('----', 'self',
...) tuple.
HTH
One more follow-up:
The code now works! I run this code in Script Editor:
tell application "QuickWho"
get domain "codebykevin.com"
end tell
and my application fires up, and does what the code intends it to do.
Awesome!
As noted before, aemreceive doesn't seem to play nice with "self" passed
in as a parameter--or at least I can't get it to. So some minor
refactoring of my code worked around that issue. I used to stuff all of
my app code in a main module, "QuickWho.py," for instance, that I then
wrapped in an app bundle. I pulled out the main app class and put that
into a different module, quickwho_main, which I then imported into
QuickWho.py. Then, in the QuickWho.py module, I ran the
"installeventhandler" function as outlined in the docs and sample code,
with the parameters correctly set.
For posterity's sake, here's my final code layout:
---
import aem
import aemreceive
from quickwho_main import quickwhoApp
app = quickwhoApp(None)
#expose basic functionality to AppleScript
def getDomain(domain):
app.searchfield.insert(0, domain)
app.servertree.selection_set('Default')
app.getInfo()
aemreceive.installeventhandler(getDomain,
'CoKvdman',
('----', 'domain', aemreceive.kae.typeUnicodeText)
)
app.mainloop()
--
Thanks again to has for the help and the great package!
--Kevin
--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
_______________________________________________
Pythonmac-SIG maillist - Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig