[GRASS5] Need testers for tcltkgrass update for 5.7

At Hamish's suggestion, I've gone through gui.tcl in tcltkgrass for GRASS
5.7 and cleaned out a great deal of code. This code is unused by tcltkgrass
now that GRASS 5.7 generates interactive dialogs for all commands on the
fly.

It all seems to work fine on my Mac, but I'd appreciate it if some other
folks test it on other platforms to make sure I haven't removed some
essential procedure. For those who want to look at what I've done, I've
left in the procedure names--commented out--for all procedures I removed.
There is probably more cleaning that can be done, but this takes care of a
great deal for starters.

The only thing that doesn't work is scripting. I'm not sure whether this is
a function of GRASS 5.7 (and that I should take it out of the menu
altogether) or it is simply broken at the moment. If anyone has a clue, let
me know.

Finally, I'd like to add a 'quit GRASS' item to the menu, but can't figure
out how to do this. Nothing I do seems to work. It either just quits tcltk
or does nothing. Maybe it's not possible. Any suggestions?

I am attaching the text files gui.tcl and menu.tcl. To test these, make
copies of the existing gui.tcl and menu.tcl (located in
$GISBASE/tcltkgrass/main) and replace them with the ones here. Let me know
if everything works OK. I am using a new text editor that is supposed to
save these with standard Unix line feeds. They work fine in my version of
GRASS. However, if anyone has a problem reading these files, let me know.

Thanks in advance
Michael Barton

____________________
C. Michael Barton, Professor
School of Human Origins, Cultures, & Societies
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)

tcltkgrass_test.tgz (11.6 KB)

Michael Barton wrote:

Finally, I'd like to add a 'quit GRASS' item to the menu, but can't figure
out how to do this. Nothing I do seems to work. It either just quits tcltk
or does nothing. Maybe it's not possible. Any suggestions?

I'm not sure that it's feasible. You could just kill the shell process
with a signal, but that might inhibit the usual shutdown sequence
(e.g. writing out the .bash_history file).

If you were willing to do without the shell altogether, you could
change Init.sh to run tcltkgrass in the foreground in place of the
shell. Then, exiting from tcltkgrass would automatically terminate the
GRASS session.

Otherwise, the only reliable way to run an interactive shell such that
tcltkgrass could terminate it cleanly would be for tcltkgrass to
create a pseudo-tty and start the shell on the slave. Then, closing
the master will cause the shell to receive EOF. However, I don't think
that vanilla Tcl/Tk includes support for creating ptys.

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

At Hamish's suggestion, I've gone through gui.tcl in tcltkgrass for GRASS
5.7 and cleaned out a great deal of code. This code is unused by
tcltkgrass
now that GRASS 5.7 generates interactive dialogs for all commands on the
fly.

[...]

I am attaching the text files gui.tcl and menu.tcl. To test these, make
copies of the existing gui.tcl and menu.tcl (located in
$GISBASE/tcltkgrass/main) and replace them with the ones here. Let me know
if everything works OK.

First superficial testing doesn't show any problems.

Only issue: r.sunmask misses the "&" operator in menu.tcl (but apparently
this was already so in the old version.

Moritz

Michael Barton wrote:

At Hamish's suggestion, I've gone through gui.tcl in tcltkgrass for GRASS
5.7 and cleaned out a great deal of code. This code is unused by tcltkgrass
now that GRASS 5.7 generates interactive dialogs for all commands on the
fly.

It all seems to work fine on my Mac, but I'd appreciate it if some other
folks test it on other platforms to make sure I haven't removed some
essential procedure. For those who want to look at what I've done, I've
left in the procedure names--commented out--for all procedures I removed.
There is probably more cleaning that can be done, but this takes care of a
great deal for starters.

The only thing that doesn't work is scripting. I'm not sure whether this is
a function of GRASS 5.7 (and that I should take it out of the menu
altogether) or it is simply broken at the moment. If anyone has a clue, let
me know.

The old tcltkgrass constructed and handled the dialogs itself, so it
got to see the actual command line. The new version simply runs the
command without arguments; the command generates the dialog, reads the
arguments, then re-executes itself, without tcltkgrass ever getting to
see the arguments.

To make tcltkgrass scripting work, G_gui() would need to e.g. write
the Tcl/Tk code to stdout so that it could be executed by tcltkgrass.
I.e. something like --html-description but which generates Tcl/Tk code
rather than HTML.

I am attaching the text files gui.tcl and menu.tcl. To test these, make
copies of the existing gui.tcl and menu.tcl (located in
$GISBASE/tcltkgrass/main) and replace them with the ones here. Let me know
if everything works OK. I am using a new text editor that is supposed to
save these with standard Unix line feeds. They work fine in my version of
GRASS. However, if anyone has a problem reading these files, let me know.

I have attached modified versions.

I found that the formatting of menu.tcl (specifically, having the
commands on the following line, indented at the same level as the
labels) obscures the structure, so I changed this.

I replaced most commands of the form "exec <cmd> &" with "execute
cmd". This only applies where the command was called without arguments
(where the command will typically call G_gui()). Ultimately, I suspect
that you will need to provide more information than just the name of
the command.

I simplified the menu_build procedure; the main change was to add
dummy arguments to -separator, so every item consists of exactly three
entries. This allows the use of a multi-variable foreach statement,
with each menu item processed in one pass.

BTW, I notice that it's executing r3.mapcalc directly. This program
doesn't use G_parser(), so calling it without arguments isn't going to
work.

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

(attachments)

tcltkgrass_test.tar.gz (11.5 KB)