Re: [Pyobjc-dev] F-script may be worth a look
Brought to you by:
ronaldoussoren
From: Peter M. <zig...@po...> - 2002-11-25 13:29:22
|
On Tuesday, November 26, 2002, at 12:02 AM, Ronald Oussoren wrote: > On Monday, Nov 25, 2002, at 13:01 Europe/Amsterdam, Peter Montagner > wrote: > >> On Monday, November 25, 2002, at 10:24 PM, Ronald Oussoren wrote: >> >>> That might be usefull for PyObjC as well. I have something like this >>> on my private wishlist: I'd like to be able to write (system) >>> prefpanes in Python. >> >> Interesting. Well, if you want to take a crack at it, F-Script >> Anywhere uses libPatch to force itself into a running application. >> libPatch seems to be a very hard to get bit of code. >> http://www.phasic.com/~arwyn/libPatch-1.2.tgz > > Some time in the future I will probably try to write whatever is > needed to get prefpanes to work. That is probably simular to what is > needed to write plugins for programs that use Objective-C classes as > plugins (e.g. which is basicly what the system preferences application > is doing). I probably won't work on forcing this onto unwilling > applications. > > Finding a way to automaticly execute a function when 'our' shared > library is loaded will probably the most problematic part of this. > That is: Whenever the 'pyobjcextension' shared libary is loaded > 'initPyObjCExtension' in that library should run. I haven't looked > into this yet and this may well be either trivial or impossible. Well, you could override +alloc on the Principal Class and when the plugin is loaded you could do what ever is needed to do the python stuff. I'm not sure how you are going to get a python interpreter into a running third party app (ie, SysPrefs). One solution would be to use Distributed Objects. The bundle loaded could launch a python interpreter and start listening for a DO connection. The python interpreter would then connect to the loaded bundle. When the connection is made, the loaded module would return the DO proxy (from the +alloc method). Returning from +alloc before a connection is made would be pretty pointless. The Principal Class would never really exist as an instance because a remote object would take its place. I haven't exactly thought this through but it seems possible. It is a bit of a kludge but I don't see any other way to do it, especially with Apple's non-embeddable python. It would be fun if someone killed the python interpreter while System Preferences was still open! Also, this method relies on DO working in PyObjC which it currently doesn't seem to. Peter |