[Pythonmac-SIG] Re: Couple of issues with Unix Python on Mac
Jack Jansen
Jack.Jansen@oratrix.nl
Sun, 27 Jan 2002 20:51:29 +0100
On Sunday, January 27, 2002, at 07:01 AM, Manoj Plakal wrote:
>>> - The installed Python.app has a dock
>>> icon when it runs but no (blank)
>>> menubars. Is this normal? I get
>>> menubars fine with MacPython 2.2 Carbon.
>> Right, because the interpreter is currently only that, an
>> interpreter with the .app glue around it (and a main program
>> that understands enough AppleEvents to do drag and drop). The
>> script is currently responsible for doing menu bar stuff.
>> What I envision is that later (for 2.3?) the default main
>> program, i.e. if you doubleclick the .app, is going to be the
>> IDE.
>
>
> You mean the script has to explicitly
> create a menubar? I tried running
> EasyDialogs.py as well as some
> console-I/O scripts and the menubar
> remained blank. Moreover, the whole
> left side of the menubar is blank,
> *including* the Apple menu which disappears ...
Well, one of the things I would like to fix for MachoPython,
which has always been a problem with MacPython, is the
menubar/event handling code.
MacPython did (in C) some minimal event handling, which meant
that Python-coded frameworks (Framework, W, the IDE) always had
to cater for this. MacPython didn't have much choice, really:
because it had the console window it needed an event loop.
For MachoPython the situation is different. console-based
scripts can be run with the commandline interpreter, so there's
little reason to have something similar to the MacPython
PythonInterpreter. And if people do want to run scripts in a
windowing environment they're much better off with the IDE. And
if someone really really wants the functionality of
PythonInterpreter in MachoPython it shouldn't be more than a 200
line Python program to get the functionality.
There are however two issues that need some thought. One is the
creation of the menubar (only the creation, not the handling of
it), it could be argued that Python.app should do this. Another
one is the handling of the Quit AppleEvent. It might be a good
idea if Python.app registered a handler for this, so that at
least command-Q (and shutdown, and other similar situations)
would work. But for this latter one I don't know how doable this
is if Python.app doesn't have a fullblown event loop. Maybe
doable, with Carbon Events, maybe not. If someone wants to look
into this that would be nice.
And even for these two things I think they shouold be handled by
Python code, not C code. It's easy enough to add an init script
to Python.app, and by doing it that way applets that want to do
their own menubar handling could simply not include the init
script.
--
- Jack Jansen <Jack.Jansen@oratrix.com>
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution --
Emma Goldman -