[GRASS-dev] grass and python

William Kyngesburye woklist at kyngchaos.com
Fri Aug 11 12:19:48 EDT 2006


I've been working on an alternative Mac GRASS.app startup - currently  
it uses the OnMyCommand droplet as an app template, but I'm looking  
for a more open source, buildable kind of startup, and found py2app.   
(Lorenzo's AppleScript Studio method could work, but I don't want to  
have to deal with Xcode.)

I have something that works, but it got me thinking about the  
wxpython gui developments.  I haven't been paying much attention to  
that and haven't had a chance to try it yet.  So, py2app offers a  
cool possibility - a completely selfcontained Mac application, and  
its cousin py2exe might do the same for Windows.

My question is, does, or is it possible in the future for, wxpython  
grass to start directly from python?  Or like the tcltk GUI, does it  
need the GRASS shell running first for the initial environment  
setup?  It would be nice for the wxpython GUI to setup and maintain  
the environment that init.sh does.  Then it could let the user open a  
Terminal or other shell (maybe a pseudo-terminal within python?) to  
run commands the old fashioned way if desired, but not require that.   
Also, it would keep a persistent 'GRASS.app' application in the Dock  
while 'GRASS' is running.

My current python startup app just fires up the normal init.sh  
startup and quits, leaving GRASS running in the Terminal and the GUI  
in TclTk X11, and disappears from the Dock.  While the OnMyCommand  
method at least stays around in the Dock until GRASS is quit from the  
Terminal (even tho it doesn't do anything after starting GRASS, it's  
nice to have that visual clue in the Dock that GRASS is running).

Another question about the wxpython GUI - does or will it handle  
multiple GRASS sessions at once, kind of like having multiple  
documents (ie mapsets) open in an application?  A Mac application  
normally can only open in one instance, unlike running different  
instances from multiple Terminal windows.  I just realized that my  
current OMC app can only run one at a time, since the app stays open,  
yet the python method I'm working on can open multiple instances of  
GRASS, since the app itself quits right away, leaving GRASS running  
(a bit confusing for a Mac user, and especially so since there is no  
hard connection between the GUI and the Terminal shell that opened it).

One nice thing about the py2app setup is that it can locate and  
create local copies of all dependencies (python modules and dynamic  
libraries and frameworks) needed plus a minimal copy of the python  
runtime environment.  Then the user doesn't have to worry about which  
Python they have installed, that might be too old or too new, or  
having all the needed modules installed.  With the current init.sh  
startup, it would have a hard time locating dependencies for this  
since it doesn't really 'see' the internals of the wxpython grass  
gui, though it might since it seems to be pretty rigourous in  
identifying stuff like that.

-----
William Kyngesburye <kyngchaos at kyngchaos.com>
http://www.kyngchaos.com/

[Trillian]  What are you supposed to do WITH a maniacally depressed  
robot?

[Marvin]  You think you have problems?  What are you supposed to do  
if you ARE a maniacally depressed robot?  No, don't try and answer,  
I'm 50,000 times more intelligent than you and even I don't know the  
answer...

- HitchHiker's Guide to the Galaxy




More information about the grass-dev mailing list