Details Ticket 4747


Comment | Reply | Take | Resolve


Serial Number 4747
Subject modules that build vector topology: progress bar is not rendered in tcl/tk GUI
Area grass6
Queue grass
Requestors maris.gis@gmail.com,tutey@o2.pl
Owner none
Status open
Last User Contact Thu Aug 17 00:34:01 2006 (2 yr ago)
Current Priority 30
Final Priority 70
Due No date assigned
Last Action Thu Aug 17 16:18:43 2006 (2 yr ago)
Created Tue Jun 27 11:32:43 2006 (2 yr ago)

Transaction History Ticket 4747


Tue, Jun 27 2006 11:32:43    Request created by guest  
Subject: v.to.points: G_percent() is missing

Platform: GNU/Linux/x86
grass obtained from: CVS
grass binary for platform: Compiled from Sources
GRASS Version: 2006-05-23

G_percent() is missing, thus no progress bar, only \b\b\b\b\b\b\.
Maciek
Sat, Jul 1 2006 22:29:39    Mail sent by mneteler  
Hi,

this is an issue in the underlying 
    Vect_build (&Out, stderr);
function - so several modules should be affected.
No idea how to fix that...

Markus
Wed, Jul 26 2006 18:52:55    User changed to tutey@o2.pl by msieczka  
Wed, Aug 16 2006 11:27:11    Request created by guest (as #5007)  
Subject: Formating output with \b doesn't work in tcl/tk

Platform: GNU/Linux/x86
grass obtained from: Trento Italy site
grass binary for platform: Compiled from Sources
GRASS Version: 6.1.0

Some GRASS modules still use "\b" trick to format output. Of course, it 
doesn't work in tcl/tk.

Examples:
./lib/vector/Vlib/build_nat.c line 502:
"prnmsg ("%7d\b\b\b\b\b\b\b", j);"

./lib/vector/Vlib/build_ogr.c line 344:
"prnmsg ("%7d\b\b\b\b\b\b\b", iFeature);"

Wed, Aug 16 2006 18:09:03    Mail sent by msieczka (as #5007)  
> Some GRASS modules still use "\b" trick to format output. Of course, it 
> doesn't work in tcl/tk.

Which modules, exactly?

Isn't your report a duplicate of
http://intevation.de/rt/webrt?serial_num=4747

(If so, I will merge them and give a better name.)

Please CC me tutey at o2.pl when replying!

Maciek
Wed, Aug 16 2006 23:39:07    Mail sent by maris.gis@gmail.com (as #5007)  
Return-Path <maris.gis@gmail.com>
Delivered-To grass-bugs@lists.intevation.de
DomainKey-Signature a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:user-agent:references:in-reply-to:cc:mime-version:content-type:message-id; b=XgZSvopUlq+JXXdzIMN2zM5SiPTbPnMJa0Gu+iVckmXq//kGCMvi7XAh+bdxTVkWnisCvNkI6qLYfN4lB1dR8xCBnumaBE9Yw0YT0WTsPzd8JCxwpO8MnNrBpvrz1xlzWoK1nh79hEjI9+YHuNwMKNsDtZ3/zHbFRz22GswxYBw=
From =?utf-8?q?M=C4=81ris_Narti=C5=A1s?= <maris.gis@gmail.com>
To Maciek Sieczka via RT <grass-bugs@intevation.de>
Subject Re: [bug #5007] (grass) Formating output with \b doesn't work in tcl/tk
Date Thu, 17 Aug 2006 00:38:45 +0300
User-Agent KMail/1.9.1
References <20060816160903.E21DE100160@lists.intevation.de>
In-Reply-To <20060816160903.E21DE100160@lists.intevation.de>
Cc tutey@o2.pl
MIME-Version 1.0
Content-Type Multipart/Mixed; boundary="Boundary-00=_mB54E/NAOPwCKao"
Message-Id <200608170038.46240.maris.gis@gmail.com>
X-Virus-Scanned by amavisd-new at intevation.de
X-Spam-Status No, hits=-4.94 tagged_above=-999 required=3 tests=[AWL=-0.007, BAYES_00=-5, RCVD_BY_IP=0.067]
X-Spam-Level
--Boundary-00=_mB54E/NAOPwCKao
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

W0ps! It is really same thing. Feel free to merge them.
As problem is in vect lib code, all modules that build vector topology are 
affected. (I tested v.build, v.in.ogr)

I attached small vect lib cosmetic changes. If somebody could take look on 
them and possibly commit them, then this bug could be considered as resolved.
But still some general changes in emitting/capturing i/o in gis.m are 
required, as tricks with fprintf for progress output does not seem to be 
working in current tcl/tk based gis.m interface.


Sorry, if I did smtn wrong,
Maris. (Time to sleep)

On Wednesday 16 August 2006 19:09, Maciek Sieczka via RT wrote:
> > Some GRASS modules still use "\b" trick to format output. Of course, it
> >
> > doesn't work in tcl/tk.
>
> Which modules, exactly?
>
>
>
> Isn't your report a duplicate of
>
> http://intevation.de/rt/webrt?serial_num=4747
>
>
>
> (If so, I will merge them and give a better name.)
>
>
>
> Please CC me tutey at o2.pl when replying!
>
>
>
> Maciek
>
>
>
> -------------------------------------------- Managed by Request Tracker

--Boundary-00=_mB54E/NAOPwCKao
Content-Type: text/x-diff;
  charset="utf-8";
  name="vect_lib_cosmetics.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="vect_lib_cosmetics.diff"

Index: grass6/lib/vector/Vlib/build_nat.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/lib/vector/Vlib/build_nat.c,v
retrieving revision 1.32
diff -b -u -r1.32 build_nat.c
--- grass6/lib/vector/Vlib/build_nat.c	9 Feb 2006 03:08:58 -0000	1.32
+++ grass6/lib/vector/Vlib/build_nat.c	16 Aug 2006 21:23:36 -0000
@@ -135,7 +135,7 @@
     plus = &(Map->plus);

     if (  plus->Isle[isle] == NULL ) {
-	G_warning ("Request to find area outside nonexisting isle");
+	G_warning (_("Request to find area outside nonexisting isle"));
 	return 0;
     }

@@ -247,7 +247,7 @@
     if ( sel_area > 0 ) {
 	Isle = plus->Isle[isle];
 	if ( Isle->area > 0 ) {
-	    G_debug (3, "Attempt to attach isle %d to more areas (=>topology is not
clean)");
+	    G_debug (3, "Attempt to attach isle %d to more areas (=>topology is not
clean)", isle);
 	} else {
 	    Isle->area = sel_area;
 	    dig_area_add_isle ( plus, sel_area, isle );
@@ -463,14 +463,14 @@

 	/* register lines, create nodes */
 	Vect_rewind ( Map );
-	prnmsg (_("Registering lines: "));
+	G_message (_("Registering lines: "));
 	i = 1; j = 1;
 	while ( 1 ) {
 	    /* register line */
 	    type = Vect_read_next_line (Map, Points, Cats);
 	    /* Note: check for dead lines is not needed, because they are skipped by
V1_read_next_line_nat() */
 	    if ( type == -1 ) {
-		fprintf (stderr, "\nERROR: vector file - can't read\n" );
+		G_warning (_("ERROR: vector file - can't read")); /* Can this be replaced
with G_fatal_error?? */
 		return 0;
 	    } else if ( type == -2 ) {
 		break;
@@ -499,12 +499,12 @@

 	    /* print progress */
 	    if ( i == 1000 ) {
-		prnmsg ("%7d\b\b\b\b\b\b\b", j);
+		prnmsg ("\r%7d ", j); /* Do we need such mass of output in non-debug mode?
*/
 		i = 0;
 	    }
 	    i++; j++;
 	}
-	prnmsg (_("\r%d primitives registered      \n"), plus->n_lines);
+	G_message (_(" %d primitives registered"), plus->n_lines);

 	plus->built = GV_BUILD_BASE;
     }
@@ -514,7 +514,7 @@
     if ( plus->built < GV_BUILD_AREAS ) {
 	/* Build areas */
 	/* Go through all bundaries and try to build area for both sides */
-	prnmsg ("Building areas: ");
+	G_message(_("Building areas: "));
 	for (i = 1; i <= plus->n_lines; i++) {
 	    G_percent2 ( i, plus->n_lines, 1, msgout );

@@ -531,7 +531,7 @@
 		Vect_build_line_area ( Map, i, side );
 	    }
 	}
-	prnmsg (_("\r%d areas built      \n%d isles built\n"), plus->n_areas, plus->n_isles
);
+	G_message (_("%d areas built      \n%d isles built\n"), plus->n_areas, plus->n_isles
);
 	plus->built = GV_BUILD_AREAS;
     }

@@ -539,7 +539,7 @@

     /* Attach isles to areas */
     if ( plus->built < GV_BUILD_ATTACH_ISLES ) {
-	prnmsg (_("Attaching islands: "));
+	G_message (_("Attaching islands: "));
 	for (i = 1; i <= plus->n_isles; i++) {
 	    G_percent2 ( i, plus->n_isles, 1, msgout );
 	    Vect_attach_isle ( Map, i ) ;
@@ -554,7 +554,7 @@
     if ( plus->built < GV_BUILD_CENTROIDS ) {
 	int nlines;

-	prnmsg (_("Attaching centroids: "));
+	G_message (_("Attaching centroids: "));

 	nlines = Vect_get_num_lines (Map);
 	for ( line = 1; line <= nlines; line++ ) {
Index: grass6/lib/vector/Vlib/build_ogr.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/lib/vector/Vlib/build_ogr.c,v
retrieving revision 1.12
diff -b -u -r1.12 build_ogr.c
--- grass6/lib/vector/Vlib/build_ogr.c	14 Jun 2006 21:32:05 -0000	1.12
+++ grass6/lib/vector/Vlib/build_ogr.c	16 Aug 2006 21:23:36 -0000
@@ -311,7 +311,7 @@
     OGRFeatureH  hFeature;
     OGRGeometryH hGeom;

-    if ( build != GV_BUILD_ALL ) G_fatal_error ("Partial build for OGR is not
supported.");
+    if ( build != GV_BUILD_ALL ) G_fatal_error (_("Partial build for OGR is
not supported."));

     Msgout = msgout;

@@ -322,7 +322,7 @@

     /* test layer capabilities */
     if ( !OGR_L_TestCapability ( Map->fInfo.ogr.layer, OLCRandomRead ) ) {
-	G_warning ("Random read is not supported by OGR for this layer, cannot build
support." );
+	G_warning (_("Random read is not supported by OGR for this layer, cannot build
support." ));
 	return 0;
     }

@@ -341,7 +341,7 @@

 	/* print progress */
 	if ( count == 1000 ) {
-	    prnmsg ("%7d\b\b\b\b\b\b\b", iFeature);
+	    prnmsg ("\r%7d ", iFeature);
 	    count = 0;
 	}

--Boundary-00=_mB54E/NAOPwCKao--


Thu, Aug 17 2006 00:01:12    Request 5007 merged into 4747 by msieczka (as #5007)  
Thu, Aug 17 2006 00:05:07    Mail sent by msieczka  
Markus,

Maris has posted a patch that could fix bug in vect lib code that modules
building vector topology fail to render progress bar correctly in tcl/tk GUI.
Could you take a look at it?

Best,
Maciek
Thu, Aug 17 2006 00:34:01    Mail sent by mneteler  
Maciek,

can you test it please?

Markus
Thu, Aug 17 2006 16:18:43    Subject changed to modules that build vector topology: progress bar is not rendered in tcl/tk GUI by msieczka  
Comment | Reply | Take | Resolve

You are currently authenticated as guest.
[Show Configuration] [Login as another user]

Users Guide - Mail Commands - Homepage of RequestTracker 1.0.7 - list any request