[GRASS-dev] [bug #4604] (grass) tcl/tk GUI: v.digit can't create new vector in GUI mode

michael.barton@asu.edu wrote (Mon, Jul 24 2006 17:20:34):

So this is NOT a bug. It is the way that the GRASS CLI is supposed to work.
You can make it a wish, however.

Michael,

You are right that it is not a bug, that v.digit from CLI doesn't spawn a
monitor automatically. It shouldn't do that and this is clear.

However, there *is* a bug v.digit in tcl/tk GUI mode that prevents it from
creating a new vector. Try to reproduce it, like this:

$ d.mon x0
$ v.digit&

Now type in the new vector name and check the "Create new file..." button (so
that the whole command is eg. "v.digit map=new_vector -n"), press Run

The output is:

GRASS_INFO_MESSAGE(17052,1): New empty map created.
Application initialization failed: "-n" option requires an additional argument
Error in startup script: couldn't read file "map=new_vector": no such file or
directory

As Markus said, this works from CLI fine so this might be a GUI specific
issue. Can you look into this?

Eric,

The segfault in v.digit is a recent, unrelated bug. I have already posted to
dev list about that so hopefully someone will look into this. Let's not mix
things in BT.

Best to you All,
Maciek

-------------------------------------------- Managed by Request Tracker

Maciek Sieczka via RT wrote:

> So this is NOT a bug. It is the way that the GRASS CLI is supposed to work.
> You can make it a wish, however.

Michael,

You are right that it is not a bug, that v.digit from CLI doesn't spawn a
monitor automatically. It shouldn't do that and this is clear.

However, there *is* a bug v.digit in tcl/tk GUI mode that prevents it from
creating a new vector. Try to reproduce it, like this:

$ d.mon x0
$ v.digit&

Now type in the new vector name and check the "Create new file..." button (so
that the whole command is eg. "v.digit map=new_vector -n"), press Run

The output is:

GRASS_INFO_MESSAGE(17052,1): New empty map created.
Application initialization failed: "-n" option requires an additional argument
Error in startup script: couldn't read file "map=new_vector": no such file or
directory

Those error messages come from Tk; it's because v.digit is passing its
command-line options to Tk, which is trying to interpret them.

Note:
  $ wish map=new_vector -n
  Application initialization failed: "-n" option requires an additional argument
  Error in startup script: couldn't read file "map=new_vector": no such file or directory

v.digit needs to pass a "fake" command-line to Tk_Main().

As Markus said, this works from CLI fine so this might be a GUI specific
issue. Can you look into this?

That exact case shouldn't work from the command line either. However,
putting the -n first will eliminate the error message, as it will have
the argument which it requires (Tk treats -n as a shorthand for
-name).

--
Glynn Clements <glynn@gclements.plus.com>

I'm at home on my laptop. However, I just updated all gism files from the
cvs.

I had no problem editing an existing vector from the GUI before or after
updating.

Before updating all gism files, I could NOT create a new vector to digitize
by doing the following: 1) add a vector layer, 2) type a new name (i.e.,
vector name that does not currently exist) into the vector name entry field,
3) press the digitize button.

After updating, I COULD create a new vector to digitize by doing the steps
listed above. As of Friday, I completed a set of changes to the way that
TclTk parses GRASS commands, in line with Glynn's suggestions. This made
several things begin to work again on my Mac that had been behaving
strangely. Maybe it fixed the v.digit issue.

The TclTk code for creating a new vector is as Glynn indicates below
(v.digit -n map=[new map name]).

One complicating issue is that a couple months ago, Lorenzo Moretti began to
include a version of v.digit, specifically for the Mac, that fixed some of
the problems of the last several months. However, this only worked in TclTk
aqua. I don't know if this is in the binary version I'm running on my laptop
here at home (10 June 2006). However, I'm running gism in x11
mode--including v.digit (i.e., it does NOT open in TclTk aqua)--and v.digit
works OK.

So it works for me currently. Maybe it now works for you all too (as of
Friday). Update to the most recent versions of all TclTk interface files and
see. If it doesn't work for you all after this, there is still hope. I can
confirm that there IS a version that does work and it works on TclTk for x11
as well as aqua. I'm using it currently. This version needs to be submitted
to the GRASS cvs for testing. I'm copying Lorenzo to see if he has anything
to add to this, since I'm using his 6 June binary with my TclTk code
updates.

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

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

From: Glynn Clements <glynn@gclements.plus.com>
Date: Mon, 24 Jul 2006 17:54:19 +0100
To: Maciek Sieczka via RT <grass-bugs@intevation.de>
Cc: <epatton@nrcan.gc.ca>, <grass-dev@grass.itc.it>
Subject: Re: [GRASS-dev] [bug #4604] (grass) tcl/tk GUI: v.digit can't create
new vector in GUI mode

Maciek Sieczka via RT wrote:

So this is NOT a bug. It is the way that the GRASS CLI is supposed to work.
You can make it a wish, however.

Michael,

You are right that it is not a bug, that v.digit from CLI doesn't spawn a
monitor automatically. It shouldn't do that and this is clear.

However, there *is* a bug v.digit in tcl/tk GUI mode that prevents it from
creating a new vector. Try to reproduce it, like this:

$ d.mon x0
$ v.digit&

Now type in the new vector name and check the "Create new file..." button (so
that the whole command is eg. "v.digit map=new_vector -n"), press Run

The output is:

GRASS_INFO_MESSAGE(17052,1): New empty map created.
Application initialization failed: "-n" option requires an additional
argument
Error in startup script: couldn't read file "map=new_vector": no such file or
directory

Those error messages come from Tk; it's because v.digit is passing its
command-line options to Tk, which is trying to interpret them.

Note:
$ wish map=new_vector -n
Application initialization failed: "-n" option requires an additional argument
Error in startup script: couldn't read file "map=new_vector": no such file or
directory

v.digit needs to pass a "fake" command-line to Tk_Main().

As Markus said, this works from CLI fine so this might be a GUI specific
issue. Can you look into this?

That exact case shouldn't work from the command line either. However,
putting the -n first will eliminate the error message, as it will have
the argument which it requires (Tk treats -n as a shorthand for
-name).

--
Glynn Clements <glynn@gclements.plus.com>

Michael Barton wrote:

The TclTk code for creating a new vector is as Glynn indicates below
(v.digit -n map=[new map name]).

However, the Tcl/Tk code which is generated by G_parser() when the
--gui or --tcltk switches are used puts the options before the flags.

--
Glynn Clements <glynn@gclements.plus.com>