[Pythonmac-SIG] Accessing front window in IDE
Jack Jansen
jack@oratrix.nl
Mon, 11 Oct 1999 11:33:11 +0200
> >Hmm, it would be nice to have a bit of an API for this that IDE extension
> >scripts could use. If there was an easier interface than mucking around with
> >the Window, PyEdit and waste internals that might prompt more people to write
> >nifty little utilities.
>
> That's a good point. Seems like most of the time, you'd want to
> either change the text, or change the selection (e.g., if doing some
> sort of automatic search thing), or both. That's pretty easy.
>
> But then, what if somebody wants to write the "Reveal In Finder"
> script? That requires access to the window path; text and selection
> range aren't enough. So we add access to the path too; but what if
> there are other things we haven't thought of?
More-or-less. I'm thinking along the lines of how other applications export
functionality through AppleEvents. We would do it through Python objects, of
course, but with a similar functionality. The object hierarchy would be
something like
IDE_application
frontwindow() -> IDE_window
getwindowbyname(name) -> IDE_window
openwindow(filename) -> IDE_window
...
IDE_window
getselection() -> IDE_text
gettextrange(from, to) ->IDE_text
setselection(from, to)
...
IDE_text
get() -> string
set(string)
setcolor(r, g, b)
...
--
Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm