[GRASS5] Tcltkgrass and dm merged for GRASS 5.7

With the recent cleanup of the tcltkgrass GUI, it has become possible to
easily merge the tcltkgrass menus with the GRASS 5.7 display manager. This
gives a single GUI to GRASS 5.7, putting all functions in a single location,
and making for a cleaner desktop, and (hopefully) better usability.

I'm attaching a fully functional prototype for this with the hopes that some
of you will give it a test drive. Everything in the *.tgz file goes into the
$GISBASE/etc/dm directory. Starting tcltkgrass is unnecessary. In fact, I
commented out the tcltkgrass startup line in init.sh and renamed the
tcltkgrass directory (to make it invisible to GRASS), and everything worked
fine.

A couple of cautions are in order:

CAUTION #1: Make backups of all the files in $GISBASE/etc/dm that will be
replaced by those I'm sending here so that you can get your functionality
back if you run into unforeseen problems.

CAUTION #2: This may only work with very recent versions of GRASS 5.7 (i.e.,
30 August 2004 and later) because of changes to $GISBASE/etc/gui.tcl

Here is a brief summary of what I've done:

1. All menus in the tcltkgrass GUI are now menus within d.m (which I've
renamed to GIS Manager to indicate its new role).

2. All submenus are tear-offs so that you can still clutter up your desktop
as much as you want with menu sets that you want to reuse during a working
session.

3. I made some changes (improvements I hope) to the tool bar. These include:
  a) new tools for 'erase to white' and 'pan',
  b) new icon for digitize; modified icons for 'add group', 'add raster',
'add vector', 'add command', 'add paint labels',
  c) a bit of rearrangement to put all the display tools together
  d) changed the query tool to use d.what.vect -x until the tcltkgrass frame
version is fixed (seems close, given recent discussions)

There are a couple issues to resolve, though none affect functionality.

1. Given that putting all the menus into d.m.tcl makes it much larger, it
might be a good idea to split off this part of the d.m system into a
separate file (i.e. A menu.tcl) as is done with tool.tcl for example. I
might need a bit of advice on how to do this, but it is probably very easy.
On the other hand, keeping everything within d.m.tcl means fewer files to
keep track of.

2. If everyone likes this, I or someone will need to make sure that the new
pieces (a couple new icons, a script directory [needed for some menu items],
and menu.tcl [if used]) get built correctly during compilation.

3. Glynn: The procedure to generate the monitor start, stop, select submenus
didn't work in this new setup. I worked with it a bit without success, so I
went ahead and coded the commands like before you did these. But I'm sure
that the procedure could be made to work.

4. I suppose that running the tools vertically down one side or the other
might make the GIS Manager frame a little narrower. I don't know if this is
or is not possible within the mainframe widget that builds it. There is
nothing explicit about toolbar placement options in the documentation, but
perhaps it is possible.

5. It would be nice to get back a couple features of d.dm in GRASS 5.3,
including the radio buttons that selected which monitor to draw to, and the
option for a raster to automatically create a legend in the same or
different monitor.

Many thanks to Glynn Clemments for helping with my many gaps in tcltk
knowledge. Also thanks to Nick Green, who made some nice suggestions for
streamlining the menus.

Enjoy!

Michael Barton
____________________
C. Michael Barton, Professor
School of Human Diversity and Social Change
PO Box 872402
Arizona State University
Tempe, AZ 85287-2402
USA

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

(attachments)

dm_tcltkgrass.tgz (19 KB)

Michael Barton wrote:

I'm attaching a fully functional prototype for this with the hopes that some
of you will give it a test drive. Everything in the *.tgz file goes into the
$GISBASE/etc/dm directory. Starting tcltkgrass is unnecessary. In fact, I
commented out the tcltkgrass startup line in init.sh and renamed the
tcltkgrass directory (to make it invisible to GRASS), and everything worked
fine.

I have a few patches.

The first replaces the use of "string compare -length ..." with
"string match"; the former doesn't work with earlier versions of
Tcl/Tk (it isn't in 8.0, but is in 8.3.4).

The second fixes an overzealous replacement of "&" with "and" (which
replaced a couple of "&"s which were being used to run commands in the
background). Although, in retrospect, this should probably use
"spawn". Actually, there should be a defined procedure for displaying
an HTML file.

The third dynamically generates the monitor menus.

1. Given that putting all the menus into d.m.tcl makes it much larger, it
might be a good idea to split off this part of the d.m system into a
separate file (i.e. A menu.tcl) as is done with tool.tcl for example. I
might need a bit of advice on how to do this, but it is probably very easy.

  source $dmpath/menu.tcl

3. Glynn: The procedure to generate the monitor start, stop, select submenus
didn't work in this new setup. I worked with it a bit without success, so I
went ahead and coded the commands like before you did these. But I'm sure
that the procedure could be made to work.

It needs to be converted to generate the new (MainFrame-compatible)
menu format. Patch attached.

--
Glynn Clements <glynn.clements@virgin.net>

(attachments)

d.m.diff1 (857 Bytes)
d.m.diff2 (1 KB)
d.m.diff3 (4.02 KB)

Glynn,

Thanks for the patches. I'll get them put in over the next couple days. I
also made a small patch to resolve access to the scripts needed for a couple
of entries.

BTW, I thought I'd update my v.in.asciipoints script to allow input of
column names for v.in.ascii.

However, it is still not parsing the string (e.g., xcoord int,ycoord int,id
int,name varchar(20)) correctly. The correct resultant syntax should be:

V.in.ascii ..... Columns=' xcoord int,ycoord int,id int,name varchar(20)'

I get

'Columns=xcoord int,ycoord int,id int,name varchar(20)'

Or

'Columns='\''xcoord int,ycoord int,id int,name varchar(20)'\''

Neither of which works.

I'll keep working on it.

Michael

On 9/6/04 5:39 AM, "Glynn Clements" <glynn.clements@virgin.net> wrote:

Michael Barton wrote:

I'm attaching a fully functional prototype for this with the hopes that some
of you will give it a test drive. Everything in the *.tgz file goes into the
$GISBASE/etc/dm directory. Starting tcltkgrass is unnecessary. In fact, I
commented out the tcltkgrass startup line in init.sh and renamed the
tcltkgrass directory (to make it invisible to GRASS), and everything worked
fine.

I have a few patches.

The first replaces the use of "string compare -length ..." with
"string match"; the former doesn't work with earlier versions of
Tcl/Tk (it isn't in 8.0, but is in 8.3.4).

The second fixes an overzealous replacement of "&" with "and" (which
replaced a couple of "&"s which were being used to run commands in the
background). Although, in retrospect, this should probably use
"spawn". Actually, there should be a defined procedure for displaying
an HTML file.

The third dynamically generates the monitor menus.

1. Given that putting all the menus into d.m.tcl makes it much larger, it
might be a good idea to split off this part of the d.m system into a
separate file (i.e. A menu.tcl) as is done with tool.tcl for example. I
might need a bit of advice on how to do this, but it is probably very easy.

source $dmpath/menu.tcl

3. Glynn: The procedure to generate the monitor start, stop, select submenus
didn't work in this new setup. I worked with it a bit without success, so I
went ahead and coded the commands like before you did these. But I'm sure
that the procedure could be made to work.

It needs to be converted to generate the new (MainFrame-compatible)
menu format. Patch attached.

____________________
C. Michael Barton, Professor
School of Human Diversity and Social Change
PO Box 872402
Arizona State University
Tempe, AZ 85287-2402
USA

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

Michael Barton wrote:

BTW, I thought I'd update my v.in.asciipoints script to allow input of
column names for v.in.ascii.

However, it is still not parsing the string (e.g., xcoord int,ycoord int,id
int,name varchar(20)) correctly. The correct resultant syntax should be:

V.in.ascii ..... Columns=' xcoord int,ycoord int,id int,name varchar(20)'

I get

'Columns=xcoord int,ycoord int,id int,name varchar(20)'

Or

'Columns='\''xcoord int,ycoord int,id int,name varchar(20)'\''

Neither of which works.

Note that v.in.ascii isn't expecting to see any quotes. I presume that
they are mentioned in the description as you would normally need to
type them when entering a literal string on the command line.

Within a script, you should probably be using something like:

  v.in.ascii ... columns="$GIS_OPT_columns" ...

--
Glynn Clements <glynn.clements@virgin.net>