[GRASS5] [bug #2488] (grass) GRASS 5.7 WISH - improve string reading ability in g.parser

Hamish hamish_nospam at yahoo.com
Wed Aug 4 02:54:54 EDT 2004


> > > It may (or may not) also be related to NVIZ not starting from the
> > > autogenerated GUI. Currently, you have to start NVIZ from the
> > > command line using the -q switch, then add data after it is
> > > running. That is, you can't specify initial raster, vector, ect.
> > > files in the startup GUI dialog. If you try to start NVIZ this
> > > way, it will crash.
> > 
> > still broken:
> > can not find channel named "couldn't execute "nviz2.2_script": no
> > such file or directory"
> 
> Oh. That *is* a Tcl issue.
> 
> The immediate error arises from this code in G_gui():
> 
>  	catch {open $cmd r} msg
> 	fconfigure $msg -blocking 0
> 	fileevent $msg readable [ list prnout $msg  ]
> 
> If the open command succeeds, catch will set msg to the result from
> the command (i.e. the channel ID) and return 0. If the command fails,
> catch will set msg to the error message and return non-zero.
> 
> IOW, msg will only contain a valid channel ID if catch returns zero,
> so the above code should probably look something like:
> 
> 	if {[catch {open $cmd r} msg]} {
> 		error $msg
> 	} {
> 		fconfigure $msg -blocking 0
> 		fileevent $msg readable [ list prnout $msg  ]
> 	}

Ok, committed.  [better error handling, not nviz working from GUI]


[...]
> > It was a problem in 5.3, but without the SQL queries it only affects
> > the d.text modules AFAIK. Fixed in CVS. Both the 5.3 and 5.7 changes
> > make the shell command preview un-cut&paste-able for things with
> > spaces in them, but this never worked before either.. some fancy
> > formatting before printing the text string could probably move &
> > replace the {}s to "s if someone was keen to try.
> 
> 	set string {}
> 	foreach word $cmd {
> 		regsub -all -- {'} $word {'\''} newword
> 		append string {'} $newword {' }
> 	}


Modified version committed for 5.7. I'm not sure where this goes in
5.3's gui.tcl, so not done there.




Hamish




More information about the grass-dev mailing list