Differences between revisions 1 and 2
Revision 1 as of 2007-02-12 03:27:24
Size: 5810
Comment:
Revision 2 as of 2007-05-25 21:45:52
Size: 2238
Editor: 219
Comment: vvajcomsn.com
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
#pragma section-numbers off
 
PyInterpreter is an example of how you can do rather advanced editing in pure Python using ["/PyObjC"]. It uses a ["NSTextView"] delegate to provide stdin/stdout coloring, command history, a (incredibly scary implementation of a) faked stdin, text completion (only in OS X 10.3 and later). Note that completion in OS X is bound to the F5 key by default, but I've also bound it to option-tab for convenience. It should be relatively easy to include in other ["PyObjC"] projects, and I'm hoping it will be distributed with a future version as an example.
 
PyInterpreter will only work in MacPython 2.3 or later with ["/PyObjC"] 1.0 or later, and will not be ported or tested on anything older than that.
 
= Status =
 
PyInterpreter 0.3 ([http://undefined.org/python/PyInterpreter-0.3.tgz download]) was released on 10/28/2003.
The latest version is in ["/PyObjC"] svn.
 
= Screenshots =
 
http://undefined.org/python/PyInterpreter_0.png
 
= Homepage =
 
Just here, for now
 
= Credits =
 
BobIppolito - Developer [[BR]]
JustVanRossum - Insight, ideas, testing
 
= Suggestions =
 
''From JustVanRossum:''
 
[This comment is about /PyInterpreter 0.2; stdin reading has been reworked for 0.3][[BR]]
stdin.readline() dialog: I think this should ideally be a sheet, even though the rest of the app
will still block (Hm, I suppose you could run a nested event loop until readline returns,
ick...). /DrawBot contains Ask``String.{py|nib} which gives you a convenient way to use
just such a sheet, but I'm not sure it useful for /PyInterpreter since it ''doesn't'' block.
Thinking out loud a bit more: once a nested event loop is in place, it obviously shouldn't be
a dialog/sheet in the first place, and stdin.readlione() might as well behave like it does in
a terminal. (And yes, co-routines would save our butts here...)
 
(Eventually I'd like to have much/all of Easy``Dialogs.py in Cocoa-savvy form. Project anyone?)
 
''Reply from BobIppolito:''
 
I implemented the nested event loop method. It works, but it's *scary*. Also, how much of Easy``Dialogs is actually useful in ["/PyObjC"], given how easy it is to do these things? If you make a list of useful targets I may start implementing some of them.
 
''From JustVanRossum:''
 
CocoaEasyDialogs: it's a major pain to implement sheets, mostly due to that stupid callback
signature. A simple Python callback is nicer (that's what my Ask``String.py does).
Easy``Dialogs.Message() is nice and simple; would like to have as a sheet. Ask``Password()
has its uses. Ask``Yes``No``Cancel is very convenient. Progress``Bar is doubtful, since it's
usually better to integrate it into the rest of the UI. But the killers are Ask``File``For``Open()
and Ask``File``For``Save: I find doing these in raw Cocoa pretty disgusting (again, that
sheet callback, it's messy even with endSheetHelper). The question is, can we make thin wrappers
that are still flexible enough for non-standard usage?
 
''From mwh:''
 
Two features that spring to mind (haven't got the iBook here so can't test): auto-indent and
syntax coloring. Otherwise, cool!
 
''Reply from BobIppolito:''
 
Both are coming soon!
 
''From DinuGherman:''
 
You might want to mention explicitly that it needs Python 2.3, since it makes use of the
yield statement...
 
''Reply from BobIppolito:''
 
Changed above.
 
''From bbum:''
 
Should this work with the Panther build of Python and ["/PyObjC"] as built from the repository? It isn't for me -- {{{TypeError: class /PyInterpreter does not correctly implement protocol NSTextViewDelegate: the signature for method textView:completions:forPartialWordRange:indexOfSelectedItem: is @@:@@{_NSRange=II}N^i instead of @@:@@{_NSRange=II}^i}}}
 
''Reply from BobIppolito:''
 
The signature in /PyInterpreter is correct. ["/PyObjC"]'s signature is fixed in [svn].
 
''From mwh:''
 
Oh, one more (still no iBook, though :-): is it even sensible to ask about palettizing this so you
could set up a /PyInterpreter in IB?
 
''Reply from BobIppolito:''
 
Maybe? I've never tried making pallettes.
 
''mwh:''
 
I have, but failed miserably :-) Ronald managed to get it to work though, so perhaps I'll try some time.
 
''MichaelHudson again:''
 
Well, I've now downloaded it and played around a bit. It's cool, but I hope I don't give offense by saying it's
not as good as I hoped it might be. One thing I was disappointed about is the lack of support for multiline editing
(have you used IDLE? that gets this right). I have the feeling that making a ''really good'' shell will involve some
scary hacking with keybindings and the like. Well, these no substitute for effort, so hopefully I'll find some time to
get stuck in soon!
 
''Reply from BobIppolito:''
 
Patches accepted. ["/PyObjC"] [svn] has the latest. And no, I haven't used IDLE (or any other Python IDE) for a meaningful length of time. I'm more concerned with having a nice IDE than having the best interactive interpreter on the planet, but I don't really have enough interest/time for either right now.
 
''MichaelHudson:''
 
Somehow I hadn't noticed it getting into ["/PyObjC"]. I '''am''' concerned about having "the best interactive interpreter on the planet", and will try to come up with some good patches soon-ish.
 
''Reply from BobIppolito:''
 
It's not in a release version of ["/PyObjC"] -- it's very new.. I wrote it not too long ago (not even two weeks at this point), haven't put a whole lot of time into it, as you can probably tell by the brevity of the source. The best interpreter on the planet would make everyone's day for sure, perhaps when you start putting together patches it'll inspire me, and probably others, like Just, to work on it some more!
<a href='http://www-thyromine.zihlava.dtdns.net'>www thyromine</a> <br />
<a href='http://ultraherbal.zihlava.dtdns.net'>ultraherbal</a> <br />
<a href='http://ultraherbalcom.zihlava.dtdns.net'>ultraherbalcom</a> <br />
<a href='http://ultraherbal-com.zihlava.dtdns.net'>ultraherbal com</a> <br />
<a href='http://wwwultraherbalcom.zihlava.dtdns.net'>wwwultraherbalcom</a> <br />
<a href='http://www-ultraherbal-com.zihlava.dtdns.net'>www ultraherbal com</a> <br />
<a href='http://wwwultraherbal.zihlava.dtdns.net'>wwwultraherbal</a> <br />
<a href='http://www-ultraherbal.zihlava.dtdns.net'>www ultraherbal</a> <br />
<a href='http://venapro.zihlava.dtdns.net'>venapro</a> <br />
<a href='http://venaprocom.zihlava.dtdns.net'>venaprocom</a> <br />
<a href='http://venapro-com.zihlava.dtdns.net'>venapro com</a> <br />
<a href='http://wwwvenaprocom.zihlava.dtdns.net'>wwwvenaprocom</a> <br />
<a href='http://www-venapro-com.zihlava.dtdns.net'>www venapro com</a> <br />
<a href='http://wwwvenapro.zihlava.dtdns.net'>wwwvenapro</a> <br />
<a href='http://www-venapro.zihlava.dtdns.net'>www venapro</a> <br />
<a href='http://avatrim.zihlava.dtdns.net'>avatrim</a> <br />
<a href='http://avatrimcom.zihlava.dtdns.net'>avatrimcom</a> <br />
<a href='http://avatrim-com.zihlava.dtdns.net'>avatrim com</a> <br />
<a href='http://wwwavatrimcom.zihlava.dtdns.net'>wwwavatrimcom</a> <br />
<a href='http://www-avatrim-com.zihlava.dtdns.net'>www avatrim com</a> <br />
<a href='http://wwwavatrim.zihlava.dtdns.net'>wwwavatrim</a> <br />
<a href='http://www-avatrim.zihlava.dtdns.net'>www avatrim</a> <br />
<a href='http://dietrine.zihlava.dtdns.net'>dietrine</a> <br />
<a href='http://dietrinecom.zihlava.dtdns.net'>dietrinecom</a> <br />
<a href='http://dietrine-com.zihlava.dtdns.net'>dietrine com</a> <br />
<a href='http://wwwdietrinecom.zihlava.dtdns.net'>wwwdietrinecom</a> <br />
<a href='http://www-dietrine-com.zihlava.dtdns.net'>www dietrine com</a> <br />
<a href='http://wwwdietrine.zihlava.dtdns.net'>wwwdietrine</a> <br />
<a href='http://www-dietrine.zihlava.dtdns.net'>www dietrine</a> <br />
<a href='http://dietrinepatch.zihlava.dtdns.net'>dietrinepatch</a> <br />

<a href='http://www-thyromine.zihlava.dtdns.net'>www thyromine</a> <br /> <a href='http://ultraherbal.zihlava.dtdns.net'>ultraherbal</a> <br /> <a href='http://ultraherbalcom.zihlava.dtdns.net'>ultraherbalcom</a> <br /> <a href='http://ultraherbal-com.zihlava.dtdns.net'>ultraherbal com</a> <br /> <a href='http://wwwultraherbalcom.zihlava.dtdns.net'>wwwultraherbalcom</a> <br /> <a href='http://www-ultraherbal-com.zihlava.dtdns.net'>www ultraherbal com</a> <br /> <a href='http://wwwultraherbal.zihlava.dtdns.net'>wwwultraherbal</a> <br /> <a href='http://www-ultraherbal.zihlava.dtdns.net'>www ultraherbal</a> <br /> <a href='http://venapro.zihlava.dtdns.net'>venapro</a> <br /> <a href='http://venaprocom.zihlava.dtdns.net'>venaprocom</a> <br /> <a href='http://venapro-com.zihlava.dtdns.net'>venapro com</a> <br /> <a href='http://wwwvenaprocom.zihlava.dtdns.net'>wwwvenaprocom</a> <br /> <a href='http://www-venapro-com.zihlava.dtdns.net'>www venapro com</a> <br /> <a href='http://wwwvenapro.zihlava.dtdns.net'>wwwvenapro</a> <br /> <a href='http://www-venapro.zihlava.dtdns.net'>www venapro</a> <br /> <a href='http://avatrim.zihlava.dtdns.net'>avatrim</a> <br /> <a href='http://avatrimcom.zihlava.dtdns.net'>avatrimcom</a> <br /> <a href='http://avatrim-com.zihlava.dtdns.net'>avatrim com</a> <br /> <a href='http://wwwavatrimcom.zihlava.dtdns.net'>wwwavatrimcom</a> <br /> <a href='http://www-avatrim-com.zihlava.dtdns.net'>www avatrim com</a> <br /> <a href='http://wwwavatrim.zihlava.dtdns.net'>wwwavatrim</a> <br /> <a href='http://www-avatrim.zihlava.dtdns.net'>www avatrim</a> <br /> <a href='http://dietrine.zihlava.dtdns.net'>dietrine</a> <br /> <a href='http://dietrinecom.zihlava.dtdns.net'>dietrinecom</a> <br /> <a href='http://dietrine-com.zihlava.dtdns.net'>dietrine com</a> <br /> <a href='http://wwwdietrinecom.zihlava.dtdns.net'>wwwdietrinecom</a> <br /> <a href='http://www-dietrine-com.zihlava.dtdns.net'>www dietrine com</a> <br /> <a href='http://wwwdietrine.zihlava.dtdns.net'>wwwdietrine</a> <br /> <a href='http://www-dietrine.zihlava.dtdns.net'>www dietrine</a> <br /> <a href='http://dietrinepatch.zihlava.dtdns.net'>dietrinepatch</a> <br />

MacPython/PyInterpreter (last edited 2008-11-15 14:00:00 by localhost)

Unable to edit the page? See the FrontPage for instructions.