[Pyobjc-dev] Re: PyShellView?
Brought to you by:
ronaldoussoren
From: Michael H. <mw...@py...> - 2003-10-17 10:58:57
|
From a while's back: I've now got around to trying to implement the PyShellView, and as usual with Cocoa it seems to be laughably easy. With appropriate swiping of code from IDLE, I expect to be able to get colorization, completion and history all going fairly easily. One problem, though: Dinu Gherman <gh...@da...> writes: > I wrote: > >> Sounds good to me! You may want to sniff into the following maybe: >> >> http://developer.apple.com/samplecode/Sample_Code/Cocoa/ >> TextViewDelegate.htm >> >> Have fun, > > Big fun, indeed!! The following conversion to PyObjC using an outlet > named 'committedLength' of type id in IB just crashes: > > #------------------------------------------------------------------ > # > # MyAppDelegate.py > # PyTextViewDelegate > # > > from objc import YES, NO > from Foundation import NSObject > from AppKit import NSColor, NSApplicationDelegate > from PyObjCTools import NibClassBuilder > > # create ObjC classes as defined in MainMenu.nib > NibClassBuilder.extractClasses("MainMenu") > > > class MyAppDelegate(NibClassBuilder.AutoBaseClass, > NSApplicationDelegate): > > def awakeFromNib(self): > "Set our committedLength outlet to the right start value." > > self.committedLength = 0 > > > def textView_shouldChangeTextInRange_replacementString_(self, > textView, charRange, replString): > "Allow editing only after the previously committed text." > > return charRange[0] >= self.committedLength If I implement this delgate method and press "backspace" in the text view, I get a core dump deep in Scary Internals Land. I've not got the latest PyObjC on my laptop, and my laptop is at home so I can't update, but does this sound familiar to anyone? Might it be cured by a new libffi (for example)? Cheers, mwh -- If you're talking "useful", I'm not your bot. -- Tim Peters, 08 Nov 2001 |