[Pythonmac-SIG] Knock me over with a spoon! [was: getting at
the XML in nib files]
Steven Majewski
sdm7g@Virginia.EDU
Fri, 18 Jan 2002 09:52:32 -0500 (EST)
On Fri, 18 Jan 2002, Bob Savage wrote:
> So you think we can create an interface in IB, then create a class in python
> which has methods and properties with names which will match the actions and
> outlets of the nib file. Then
>
> theNibFile.nibInstantiateWithOwner_( thePythonObject )
>
> will run the application? Or did you mean that we would do something to the
> sharedApplication to set thePythonObject as its delegate, then instantiate
> as you described?
This is the part I'm not so sure about!
In IB I linked the GUI elements to my (objective-c) classes --
one of them had an initialization routine in awakeFromNib,
which is supposed to get called when the nib is loaded and
instantiated, and from the error message, that's what it tried
to do. There probably needs to be a proxy class to forward
the method call from obj-c to python. That's what the plumbing
in pyobjc already does, but since this seems to be a "call by name",
it might take adding a special bridge class just to handle this
kind of forwarding. I'll have to think about this.
But possibly, delegates might work -- I'll have to look at the
delegation protocol again. But even when I made an NSApplication
the nib owner, it looks like it's still looking for the defined
target classes and methods by name.
Possibly, the new design for 2.2 type/classes might help (except
that I'm finished figuring out how to do it! )
-- Steve.
BTW: I did these tests with Python2.1.2. The pyobjc on SourceForge
( either the .so or building from tar ) still works with 2.1.x .
It doesn't work with 2.2 (intentionally -- a version mismatch)
and when I try to build using 2.2, it builds, but on import, I get a:
ImportError: Failure linking new module
so something has to be different in the build. Anyone have a guess?
I've stepped thru in gdb and found where it's getting an error
but I'm not sure what that means.
Jack -- I looked thru the Makefiles for both versions of Python
looking for a difference in library link options -- I couldn't
find a likely culprit, but maybe I was looking in the wrong place.
Do you have any notion about what needs to change ? Maybe this
is an issue with the newer developer tools?