[GRASS-dev] WxPython prototype GRASS GUI. Version 2

Michael Barton michael.barton at asu.edu
Fri Aug 4 01:55:59 EDT 2006


Building on Jachym¹s work and doing a personal Œsummer of code¹ since I¹m
not in the field for a change, I¹ve completed a 2nd version of a wxPython
GUI for GRASS 6.

It was developed and tested with wxPython 2.6.3 (ANSI version) and Python
2.4.3 (ActiveStates binary) for Mac OS X. The wxPython site is at
<http://wiki.wxpython.org/index.cgi/wxPython> and has links to Python
downloads. Currently, the command line interface, display window, and
example menu items are functional. There is also a non-functional demo tree
control for GIS layers and notebook interface. I haven¹t yet done options
panels or their equivalents.

In the command console window, you can enter GRASS (or other) commands to be
parsed by the OS. Yes, you can even enter display commands and they will
magically create displays. You can chain together display commands,
separated by commas. For example, you can type...

d.rast elevation_dem, d.vect roads color=red

...to create a display of a DEM overlayed by a red road network from the
Spearfish60 demo data set. For some reason g.list bombs. But other commands
seem to work pretty well, and can also launch the current TclTk GUI dialogs.
You can open multiple display windows; the one on top and active (i.e.,
click it) is the one that will receive and process display commands from the
console.

Zoom in, zoom out, and pan controls are functional in the map display
window, though zooming is a bit ugly. A few demo menu items are included.
These could be redone as a toolbox, as several have suggested, using an icon
mode listcontrol. There is a simple treecontrol for layers. I haven't added
any icons. There is a nice custom treecontrol available that can have
checkboxes and other widgets that we might want to use.

Please give it a try and see what you think. It is especially important to
see if it runs well cross-platform. I'm sure there are bugs, and the error
trapping is minimal. I'm sure that the code could (and should) be
modularized and optimized more. However, it seems to do much of the basic UI
work that we need. While wxPython lacks a few items that we use in TclTk, it
has a number of other widgets or more sophisticated versions of widgets that
are lacking or underdeveloped in TclTk. Given that I knew ZERO Python in
May, to have come this far in a few months is a testament to the relative
ease of programming in this platform. I'm sold on it for GRASS UI
development because of its flexibility, versitility, power, and ease of
programming. For anyone interested, my references have been:

Rappin, Noel and Robin Dunn
    2006 wxPython in Action. Manning Publications, Greenwich, CT.

Hetland, Magnus
    2005 Beginning Python: from Novice to Professional.
Apress/Springer-Verlag, NY.

And the ActiveStates Python 2.4 documentation package.

I've used SPE (cross-platform, open source) as an integrated development.
environment (IDE) for coding.

After this has been evaluated a bit and (hopefully) works for everyone, the
next step could be to divide up the tasks of porting the GUI from TclTk to
wxPython, trying to follow the GUI roadmap. This is a very big job and could
use the coordinated work of several people. As we do that, and after we have
a relatively functional product, we can begin to implement some of the
updates, improvements, and wishes that can be better done more easily with
wxPython. If you are interested in helping but don't know Python or
wxPython, take heart. Even I could learn enough to do something useful in a
fairly short time.

If you want to download and try out gism.py, I made a section on the GRASS
WIKI for it in the development/python section and linked it to the tgz
package on my website for download. I also uploaded the tgz file to the
WIKI, but can't figure out how to link it to the text section I did (Can
someone advise me on this?)

Enjoy!

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton






More information about the grass-dev mailing list