[Pythonmac-SIG] "All I want..." [was: IDE feature requests]

Steven D. Majewski sdm7g@virginia.edu
Sun, 19 Nov 2000 14:15:28 -0500 (EST)


On Sun, 19 Nov 2000, Murphy/Kostick wrote:

> Steven:
> 
> I am interested in the work you're doing with PyObjC. 
> I think it would be very nice to have access from Python to 
> the Cocoa API, in particular the Application Kit.
> 
> Although my skills and time are very limited (I estimate it would take
> me at least 2-3 months to get where you are now), I 
> nevertheless have also downloaded Lele's  project from codefab
> and 
> have started to play with it (I'm learning about make files now).
> 
> So you at least have one cheerleader! I'll keep my eye on SourceForge
> to see if there's anyway I can materially help.
> 

Bill Bumgarner has posted some patches to Python2.0 on the Python 
SourceForge site that enables building ObjC as a dynamically loadable
shared module -- makesetup needs to know about objc .m files, and
changes the link commands. One of the effects of this has been to
remove some of the errors I was getting trying to use AppKit. 

( Thanks Bill -- I had to edit the patches manually on my already
well hacked Python distribution, but they worked. )

 You want to get the '20001114' PyObjC snapshot from Codefab and 
patch Python2.0 with those SourceForge patches. ( I think we'll 
try to package these both up together soon to make it easier for
folks to try it out without having to hack the distribution. ) 

 Foundation classes seem to work well, but although I'm no longer getting
'missing theme file' errors from AppKit, and the methods all seem to
return the correct values or objects, I haven't yet been able to coax it
to display a window on the screen. ( But I'm learning Cocoa at the same
time, working from some objc examples that do seem to behave -- so it may
be a simple problem that I'm clueless about. ) I've tried to modify
some of the demos from an earlier snapshot, but none of those produce
anything visible. ( I'm linking to AppKit rather than loading the 
Bundle -- maybe I'll try it the other way and see if that makes a 
difference. ) 


 BTW to Bill: Is there a way to produce the nil object ? I don't
 see it available as a constant and methods that should return nil
 seem to produce Python None. Is the runtime smart enough to convert
 None to nil in the other direction ? 

 Also: This snapshot seems to have also fixed errors in using python
 array indexing on NSArray's. The following used to crash on me.
 Bill -- did you fix something here when you fixed the autorelease
 pool, or is this another side effect of finally getting it to link
 properly?

>>> from ObjC import *
>>> P = runtime.NSAutoreleasePool()
>>> P
<Objective-C `NSAutoreleasePool' instance at 229c20>
>>> all = runtime.NSBundle.allFrameworks()
>>> all
<Objective-C `NSCFArray' instance at 22b110>
>>> print all
(
    NSBundle </System/Library/Frameworks/Foundation.framework> (loaded), 
    NSBundle </System/Library/Frameworks/AppKit.framework> (loaded), 
    NSBundle </usr/local/lib/python2.0/lib-dynload> (loaded), 
    NSBundle </usr/lib> (loaded)
)
>>> all[0]			# This array access used to crash me! 
<Objective-C `NSBundle' instance at 232340>
>>> for x in all : print x	# not to mention this!
... 
NSBundle </System/Library/Frameworks/Foundation.framework> (loaded)
NSBundle </System/Library/Frameworks/AppKit.framework> (loaded)
NSBundle </usr/local/lib/python2.0/lib-dynload> (loaded)
NSBundle </usr/lib> (loaded)
>>> 

 

---|  Steven D. Majewski   (804-982-0831)  <sdm7g@Virginia.EDU>  |---
---|  Department of Molecular Physiology and Biological Physics  |---
---|  University of Virginia             Health Sciences Center  |---
---|  P.O. Box 10011            Charlottesville, VA  22906-0011  |---
		"All operating systems want to be unix, 
		 All programming languages want to be lisp."