[GRASS-dev] Unix-isms in gis_set.tcl

gis_set.tcl (the location and mapset browser that appears when GRASS is started in GUI mode) contains "exec ls" in a few places that stops it from working on native Windows without Msys. Has anybody done any work on it and would know how to fix those? I'm sure there must be a Tcl command to list a directory but I can't find it by searching on Google.

Also gis_set.tcl seems to return the same exit status if either Enter GRASS or Exit is clicked - is this true? I was trying to check the %errorlevel% variable in a Windows batch script to avoid starting gis.m if enter was clicked, but it always seems to be 0.

Paul

On 05/12/06 13:34, Paul Kelly wrote:

gis_set.tcl (the location and mapset browser that appears when GRASS is started in GUI mode) contains "exec ls" in a few places that stops it from working on native Windows without Msys. Has anybody done any work on it and would know how to fix those? I'm sure there must be a Tcl command to list a directory but I can't find it by searching on Google.

How about 'glob' ?
(http://www.tcl.tk/man/tcl8.4/TclCmd/glob.htm)

Moritz

On 12/5/06 8:53 AM, "Moritz Lennert" <mlennert@club.worldonline.be> wrote:

On 05/12/06 13:34, Paul Kelly wrote:

gis_set.tcl (the location and mapset browser that appears when GRASS is
started in GUI mode) contains "exec ls" in a few places that stops it
from working on native Windows without Msys. Has anybody done any work
on it and would know how to fix those? I'm sure there must be a Tcl
command to list a directory but I can't find it by searching on Google.

How about 'glob' ?
(Tcl Built-In Commands - glob manual page)

This seems to work. I've replaced all exec ls with glob and some other tcltk
syntax. It works OK on my Mac/x11 system. I just put it into the CVS.
Please try on other systems and on Windows. This doesn't seem to break
anything. Keep you fingers crossed.

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

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

Paul Kelly wrote:

Also gis_set.tcl seems to return the same exit status if either Enter
GRASS or Exit is clicked - is this true?

both are successful, the program did what you asked it to.

I was trying to check the %errorlevel% variable in a Windows batch
script to avoid starting gis.m if enter was clicked, but it always
seems to be 0.

I don't understand what you are trying to do.
You want: the GUI startup screen -> [Enter GRASS] -> DOS prompt ???

?
Hamish

On Wed, 6 Dec 2006, Hamish wrote:

Paul Kelly wrote:

Also gis_set.tcl seems to return the same exit status if either Enter
GRASS or Exit is clicked - is this true?

both are successful, the program did what you asked it to.

I was trying to check the %errorlevel% variable in a Windows batch
script to avoid starting gis.m if enter was clicked, but it always
seems to be 0.

I don't understand what you are trying to do.
You want: the GUI startup screen -> [Enter GRASS] -> DOS prompt ???

Sorry, should have read over that before sending, meant to say "if exit was clicked"...

I'm calling it from a batch file, snippet:
   =================================
1|"%WINGISBASE%\etc\gis_set.tcl"
2|
3|rem if return ok, gis.m start:
4|if %errorlevel% == 1 exit /b
5|
6|"%WINGISBASE%\etc\gm\gm.tcl"
7|
8|"%WINGISBASE%\etc\clean_temp" > NUL:
   ==================================

so line 4 should detect if Exit was clicked and exit the batch file straight away, thus not starting gis.m. I can't see how Init.sh handles this. gis_set.tcl has
    puts stdout "exit"
but not sure how to detect that. I guess I'll eventually work it out though!

Paul

On 12/5/06 7:34 PM, "Paul Kelly" <paul-grass@stjohnspoint.co.uk> wrote:

so line 4 should detect if Exit was clicked and exit the batch file
straight away, thus not starting gis.m. I can't see how Init.sh handles
this. gis_set.tcl has
    puts stdout "exit"
but not sure how to detect that. I guess I'll eventually work it out
though!

I'd like to sort this out too so that TclTk can also exit GRASS *if* a user
wants to do so. There has already been some discussion along these lines a
month back or so.

When you exit the GIS Manager GUI it takes you back to the GRASS 'shell'.
But I *think* the 'shell' AND gis_set.tcl is operated inside a loop in
init.sh. When you type "exit" (or gis_set.tcl exits) it exits the loop and
also exits the 'shell'.

Michael

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

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

Paul wrote:

so line 4 should detect if Exit was clicked and exit the batch file
straight away, thus not starting gis.m. I can't see how Init.sh
handles this. gis_set.tcl has
    puts stdout "exit"
but not sure how to detect that. I guess I'll eventually work it out
though!

another thing to look at while we're here-

Clicking [Exit] from the GUI startup does not close down cleanly,
so does not remove /tmp/grass6-${USER}-$$/. I'm not sure but believe the
same happens if you create a new location from EPSG code. (and with
EPSG, is the restart *really* needed? It would be nice if we could code
some sort of refresh)

Hamish

Hamish wrote on 12/07/2006 04:14 AM:

Paul wrote:
  

so line 4 should detect if Exit was clicked and exit the batch file
straight away, thus not starting gis.m. I can't see how Init.sh
handles this. gis_set.tcl has
    puts stdout "exit"
but not sure how to detect that. I guess I'll eventually work it out
though!
    
another thing to look at while we're here-

Clicking [Exit] from the GUI startup does not close down cleanly,
so does not remove /tmp/grass6-${USER}-$$/. I'm not sure but believe the
same happens if you create a new location from EPSG code. (and with
EPSG, is the restart *really* needed? It would be nice if we could code
some sort of refresh)
  

I am also hoping that there is a refresh possibility to just re-read the
directory (long term wish for a few years now). Then we could get
rid of this annoying restart.

lib/init/epsg_option.tcl.in, line 158.

Markus