wxGRASS: New GRASS GUI – 1.

19.05.2007 – 12:01 pm

Background

In the year 2006, users and developers have decided to replace current
d.m graphical user interface,
which was shipped together with GRASS 6.0 and which was originally
written by Radim Blazek. This GUI introduces component of GRASS — so
called GIS Manager, which makes it possible to start GRASS modules from
menus and graphically manage the (old) GRASS monitors (based on X11
driver).

Several new demands were formulated by the user and developer
community and Michael Barton started to work on new, still Tcl/Tk
based GUI, which is available in current GRASS 6.2.x release. It
has completely rewritten display architecture (it creates several
PNM files from each displayed layer, which are than merged together
using g.pnmcomp module and displayed in Map Display),
as well as module menus, output window, graphical module forms
(which are generated on the fly by GRASS parser) and several other
improvements (e.g. replacement for XDRIVER driven
i.points module by it’s Tcl/Tk version, which is
integrated with current map display).

“!http://grass.itc.it/grass63/screenshots/images/grass63_gism_profile_small.jpg!”:http://grass.itc.it/grass63/screenshots/

New profiling tool in GIS Manager (screenshot by Markus
Neteler)

Despite of this improvements, several other demanded
functions could not be implemented using Tcl language together with
Tk graphical toolkit, or it would be too complicated. So we decided
to start to work on new GRASS Graphical User Interface from scratch
and reuse everything we learned (or Michael did) while
working on current version of GIS Manager.

Before we started to work on it, we decided to use Python
Programming Language as main programming language for the GUI.
The main reasons for this decision are:

  • It is easy-to-learn and fast language.
  • It has bindings to most graphical toolkits
  • It is very popular and ,,,modern“ language
  • It has many low-level functions, which enables us to write
    even more complicated things
  • It is object-oriented language

We hope, that more developers will join the development, than they
did while working on current Tcl/Tk based GUI.

Second important question, which we had to decide was, which
graphical toolkit to use. Basically, there are three choices in
current Linux world:

  • Gtk
  • Qt
  • wxWidgets

I’m not the one, who should write an article, which would compare
these three toolkits side by side. All of them have advantages and
disadvantages. The reasons for choosing one before
other can be rational and pure technical as well as that some
developers simply do not like the look’n’feel of some toolkit.

No matter of what toolkit we take, it had to fulfill
some basic requirements, which among others were (are):

  • There must be Python bindings for this toolkit
  • It must be a living project
  • It must be powerful enough, so we are able in the future
    to integrate more advanced functionality,
    like e.g. integration of NVIZ functionality to ,,common“ map
    displays
  • It must be running on all platforms supported by GRASS,
    which includes GNU/Linux, Mac OS X and MS Windows platforms (it
    is assumed, that other UNIXes will be able to run it too).

  • The developers have to like it

We decided to use wxPython library, which are Python bindings to
wxWidgets library. This library is originally C++ written and it
is trying to emulate the same functionality on every supported platform
using native graphical toolkits (on GNU/Linux for example, it uses
Gtk library). So it should have native look and feel on every
platform. It has also bindings to OpenGL, so nothing
hinders us to bind 3D functionality to map displays.

wxGRASS Developers

I use in this text ,,we“ for virtual GRASS GUI Development
Team
. Who are ,,we“:

  • Michael Barton author of current Tcl/Tk GUI. In
    wxGRASS development, he is the main coder and GUI designer.
  • Daniel Calvano . In wxGRASS development,
    he is the one, with clear imagination of code design.
  • Jachym Cepicky bottle-washer in the
    GRASS Development Team. He prototyped p.mon scripts,
    which was first usage of wxPython together with GRASS. I just try
    to help, where I can.
  • Martin Landa vector library cleaner in current GRASS
    version. Currently, he is mostly fixing and is trying to understand,
    what Michael and Jachym did and he is trying to understand – this is
    maybe the hardest task.
  • Glynn Clements – sorry, I can only hard express his
    role in GRASS Development Team. I can only say, that without Glynn,
    GRASS would not be, where it is now. He codes, advices and cleans
    all around.
  • You – this is change for general GRASS User, who is
    able to script his tasks. Python is easy to learn language and you
    can so help us with wxGRASS development to become easy-to-use GUI
    and so GRASS will be easy to use even for beginners.

Howto use it

If you want to try new wxGRASS GUI, you have to install wxPython
library, at least in version 2.8.1 or
higher (current stable version is 2.8.3). You can obtain source
code on wxPython side. Several links to distribution-specific
packages are listed there too.

Since we are working on new GUI, we decided to use the latest and
greatest
version as a base for our developments, so we can use
all it’s features. We hope, that before we declare the GUI as
,,stable“, there will be packages for all main distributions already
available.

Several hints for distribution specific installation

  • Ubuntu is very well supported distro, you just
    have to add

    deb http://wxpython.wxcommunity.com/apt/ubuntu/dapper /
    deb-src http://wxpython.wxcommunity.com/apt/ubuntu/dapper /
    

    lines into your /etc/apt/sources.list file (NOTE: For
    Feisty Fawn, wxWidgets 2.8.1 should be included in this
    distribution).

    Than you just have to run

            sudo apt-get update
            sudo apt-get install python-wxgtk2.8
            

    and the necessary packages should be installed in your system.

  • Debian unfortunately, there are no precomplied
    Debian packages on wxPython sides. Please refer to http://www.bitpim.org/developer.html
    for details.

  • Mandriva fresh packages generated by Markus are available in his
    repository
    .
  • Other distros – I do not know. Maybe the
    spec file, created by Markus could be reused by
    Fedora users.

    We would also embrace, if somebody would test the
    GUI on MS Windows platform, and gave us feedback.
    Currently, we are testing the GUI on Mac OS X, Red Hat Linux
    and Ubuntu Dapper.

Installation

How I do it:

  1. Assumed, you have GRASS already installed.
  2. Download fresh GRASS Add-ons SVN repository. You can also have
    only gui directory from the whole repository:

    mkdir -p /usr/src/gis/grass/addons
    cd /usr/src/gis/grass/addons
    svn co https://grasssvn.itc.it/svn/grassaddons/trunk/grassaddons/gui gui
            
  3. Go to GISBASE directory (where GRASS
    is installed (could be /usr/local/grass or
    /usr/lib/grass)) and create a symbolic link called
    wx in etc directory to previously stored gui directory:

    cd /usr/src/gis/grass/grass6/dist.i686-pc-linux-gnu/etc
    ln -s /usr/src/gis/grass/addons/gui wx
            
  4. Copy (or make a symlink) of wxgrassscript to
    GISBASE/scripts directory:

    cd /usr/src/gis/grass/grass6/dist.i686-pc-linux-gnu/scripts
    ln -s /usr/src/gis/grass/addons/gui/wxgrass
            

Now you should be able to execute wxgrass command from
running GRASS session.

GRASS> wxgrass&
    

After this command, new GIS Manager together with new Map display
should appear.


Since 12. April 2007 it is possible to start GRASS with new flag
-wx in order to get new start manager:

It should be possible to start GRASS with -wx flag
now:

$ grass63 -wx
    
“!/images/111.png!”:/images/81.png

New GRASS start-up screen should appear. You should be able to select
GRASSDBASE (data directory), Location (project) and Mapset names. You
should be also able to create new mapsets, as well as location based on
selecting georeferenced file or on EPSG codes.

“!/images/121.png!”:/images/91.png

New wizard for Location-creation is also available, even if the
new location is not created yet. More about new location wizard next time.

After you select working Location and Mapset and click on the Run
GRASS
button, GIS Manager together with new Map Display
should be launched.

“!/images/131.png!”:/images/101.png
Share Button

Post a Comment