[GRASS5] Re: bugs in 5.7's tcltkgrass

Maciek,

The couple items I can fix are fixed. However, you note a couple other bugs
that will need to be fixed by one of the folks who does programming for the
command modules.

On 10/14/04 2:55 PM, "Maciek Sieczka" <werchowyna@pf.pl> wrote:

Hello Michael,

this reports refer to the precompiled 5.7 09_10_2004, installed on Mandrake
9.2

1. r.contour
when invoked r.contour& from the grass terminal I get:
(...)
Continue?(y/n) [y]

This is left over from porting this from 5.3. It needs to be changed in the
command module. Probably pretty easy to fix now it has been reported.

and it stops
(in 5.3 there was a separate terminal called for this)

even worse when r.contour is invoked from within the tcltkgrass menu - it
hangs completely and freezes the tcltkgrass menu for good

ditto

2. BTW one similar bug in s.surf.rst in 5.3's tcltkgrass:
WARNING: old data format detected.
Convert site file to new format?
Answering yes will modify your site list file.(y/n)

I fixed this very recently and committed it to the CVS. I hope it is still
fixed.

and it stops here

3. all modules I tried in 5.7 display this instead of percents only:
Percent complete: 2% 5% 8% (...) 100%

On my computer, it goes:

Percent complete: 2%/b/b/b/b5%/b/b/b and so forth...most of the time. Other
times, it stops after a few increments, then does nothing until 100%

4. r.surf.contour menu entry is still called "(...) spline with tension
(...)"

This is fixed in the update I'm about to commit to the CVS

5. v.surf.rst menu fails to start (gives a big "Application error" window)
when invoked from the tcltkgrass but pops up fine when invoked using
v.surf.rst& in the Grass terminal

This is also fixed

6. d.measure sometimes displays such things:

Warning - no response from graphics monitor <x0>.
Check to see if the mouse is still active.

You need to have a monitor open and selected, with a map.

and such a message after:

e[He[2Je[He[2Je[He[2J

This is a bug, but is not (I hope) a problem from the GIS Manager any
longer. From the command line/command module, you need use d.measure -s to
avoid this problem. It would be nice to have this fixed, but there is a
pretty easy workaround (the -s flag).

Michael

____________________
C. Michael Barton, Professor of Anthropology
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>

> 3. all modules I tried in 5.7 display this instead of percents only:
> Percent complete: 2% 5% 8% (...) 100%

On my computer, it goes:

Percent complete: 2%/b/b/b/b5%/b/b/b and so forth...most of the time.
Other times, it stops after a few increments, then does nothing until
100%

To fix this basically we need a G_is_ui() function which could be called
in G_percent():

printf("%3d%%", percent_done);
if( G_is_ui() )
   printf("\n"); // newline
else
   printf("\b\b\b\b"); // 4x backspaces

easier said than done though.

Hamish

On Friday 15 October 2004 08:38, Hamish wrote:

> > 3. all modules I tried in 5.7 display this instead of percents only:
> > Percent complete: 2% 5% 8% (...) 100%
>
> On my computer, it goes:
>
> Percent complete: 2%/b/b/b/b5%/b/b/b and so forth...most of the time.
> Other times, it stops after a few increments, then does nothing until
> 100%

To fix this basically we need a G_is_ui() function which could be called
in G_percent():

printf("%3d%%", percent_done);
if( G_is_ui() )
   printf("\n"); // newline
else
   printf("\b\b\b\b"); // 4x backspaces

easier said than done though.

I think that we should define format of messages printed
when module is run from GUI. For example
PERCENT: %d
which can be parsed by GUI and displayed in progress bar.

The format could be switched on by enviroment variable.

Radim

On Thu, Oct 14, 2004 at 10:45:43PM -0700, Michael Barton wrote:

On 10/14/04 2:55 PM, "Maciek Sieczka" <werchowyna@pf.pl> wrote:
> 1. r.contour
> when invoked r.contour& from the grass terminal I get:
> (...)
> Continue?(y/n) [y]

This is left over from porting this from 5.3. It needs to be changed in the
command module. Probably pretty easy to fix now it has been reported.

Fixed now in 5.7-CVS.
I have changed to:

+ if (!isatty(0)) {
+ if (!G_yes ("Continue?", 1)) exit (0);
+ }

> and it stops
> (in 5.3 there was a separate terminal called for this)
>
> even worse when r.contour is invoked from within the tcltkgrass menu - it
> hangs completely and freezes the tcltkgrass menu for good

ditto

Please try again with a fresh 5.7-CVS.

...

> 3. all modules I tried in 5.7 display this instead of percents only:
> Percent complete: 2% 5% 8% (...) 100%

Yes, this is ugly. No idea how to polish the G_percent() output, though.

On my computer, it goes:

Percent complete: 2%/b/b/b/b5%/b/b/b and so forth...most of the time. Other
times, it stops after a few increments, then does nothing until 100%

Do you mean [s|v].surf.rst? Might be normal behaviour of this module.

Markus

Michael Barton wrote:

> 3. all modules I tried in 5.7 display this instead of percents only:
> Percent complete: 2% 5% 8% (...) 100%

On my computer, it goes:

Percent complete: 2%/b/b/b/b5%/b/b/b and so forth...most of the time. Other
times, it stops after a few increments, then does nothing until 100%

The prnout function in gui.tcl already tries to handle this, but
there's a bug:

--- gui.tcl~ Thu Oct 14 12:40:18 2004
+++ gui.tcl Fri Oct 15 14:46:59 2004
@@ -56,7 +56,7 @@
     close $fh
   } else {
     set str [read $fh]
- while {[set idx [string first {\b} $str]] != -1} {
+ while {[set idx [string first "\b" $str]] != -1} {
       set last [expr $idx - 1]
       set str1 [string range $str 1 $last]
       set first [expr $idx + 1]

Using quotes instead of braces results in the backspaces being
removed.

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

Radim Blazek wrote:

> > > 3. all modules I tried in 5.7 display this instead of percents only:
> > > Percent complete: 2% 5% 8% (...) 100%
> >
> > On my computer, it goes:
> >
> > Percent complete: 2%/b/b/b/b5%/b/b/b and so forth...most of the time.
> > Other times, it stops after a few increments, then does nothing until
> > 100%
>
> To fix this basically we need a G_is_ui() function which could be called
> in G_percent():
>
>
> printf("%3d%%", percent_done);
> if( G_is_ui() )
> printf("\n"); // newline
> else
> printf("\b\b\b\b"); // 4x backspaces
>
> easier said than done though.

I think that we should define format of messages printed
when module is run from GUI. For example
PERCENT: %d
which can be parsed by GUI and displayed in progress bar.

It wouldn't be particularly hard to parse the existing progress
output, e.g.:

  proc set_progress {percent} {
    ...
  }
  
  set percent_re [subst -nocommands {([ 1][ 0-9][0-9])%\b\b\b\b\b}]
  
  proc prnout {dlg fh} {
    global opt percent_re
    set outtext $opt($dlg,outtext)
  
    if [eof $fh] {
      close $fh
    } else {
      set str [read $fh]
      set val {}
      while {[regexp $percent_re $str dummy val]} {
        regsub $percent_re $str {} str
      }
      if {$val != {}} {
        set_progress $val
      }
      $outtext insert end $str
      $outtext yview end
    }
  }

The BWidget library includes a progress bar.

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

Markus Neteler wrote:

> > 1. r.contour
> > when invoked r.contour& from the grass terminal I get:
> > (...)
> > Continue?(y/n) [y]
>
> This is left over from porting this from 5.3. It needs to be changed in the
> command module. Probably pretty easy to fix now it has been reported.

Fixed now in 5.7-CVS.
I have changed to:

+ if (!isatty(0)) {
+ if (!G_yes ("Continue?", 1)) exit (0);
+ }

Is there a reason why this can't be removed altogether?

Non-interactive commands should be completely non-interactive. Only
commands which are inherently interactive should be prompting.

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

On Fri, Oct 15, 2004 at 03:13:15PM +0100, Glynn Clements wrote:

Markus Neteler wrote:

> > > 1. r.contour
> > > when invoked r.contour& from the grass terminal I get:
> > > (...)
> > > Continue?(y/n) [y]
> >
> > This is left over from porting this from 5.3. It needs to be changed in the
> > command module. Probably pretty easy to fix now it has been reported.
>
> Fixed now in 5.7-CVS.
> I have changed to:
>
> + if (!isatty(0)) {
> + if (!G_yes ("Continue?", 1)) exit (0);
> + }

Is there a reason why this can't be removed altogether?

Non-interactive commands should be completely non-interactive. Only
commands which are inherently interactive should be prompting.

As there is no reason, I have removed it as suggested.

Markus