Re: [Pyobjc-dev] Attempt at writing Cocoa services with pyobjc
Brought to you by:
ronaldoussoren
From: Ronald O. <ous...@ci...> - 2003-01-06 21:12:19
|
On Monday, Jan 6, 2003, at 20:08 Europe/Amsterdam, Dinu Gherman wrote: > > Here is what I have so far or mentioned before: > > http://python.net/~gherman/tmp/PythonServices.tgz > http://python.net/~gherman/tmp/URLServices.tgz > http://python.net/~gherman/tmp/reloadservices > > Bill, if you can give the first a quick look, great, otherwise I'll > delve a bit deeper in frustration... At least part of your problem is the method signature for simpleEncrypt_userData_error_. In Objective-C the last argument is a pointer to an id. Because not all arguments are an object and your not overriding a method from a superclass you'll have to provide a correct signature. In the service I posted earlier I used: import objc def NSServiceFunc(meth): return objc.selector(meth, signature="v@:@@o^@") and in class ServiceTest: def doFoo_userData_error_(self, pboard, data): # Note: No argument error # ... return (None, None) doFoo_userData_error_ = NSServiceFunc(doFoo_userData_error_) The program still tries to start in the foreground. My example used '<key>NSBGOnly</key><string>1</string>' in the Info.plist. That didn't work here, but at the service is working (using the first alternative in __main__.py, and without importing MyAppDelegate). Bill^H^H^H^HRonald ;-) |