[GRASS-dev] resolving more menu issues

I’ve come across a couple more menu issues that I’d like to propose solving in a general way that will work with multiple GUI’s

  1. Currently, there are scripts that are only used (or only easily used) by the GUI. These reside in $GISBASE/etc/gm/script. The reason for these scripts is to overcome some inherent limitations of the interface to several important GRASS commands. For example, one script (r.colors.rules) allows you to chose the file for which you want to manage colors interactively through the GUI, then launches r.colors so that it opens an interactive xterm for setting color rules. Another provides a functional GUI interface to v.type without needing an interactive xmon. Yet another allows you to use the GUI to specify a reclassification file to send to r.reclass. You get the idea.

Having them buried in $GISBASE/etc/gm/script makes them more difficult for anything but the TclTk GUI to access these scripts. Some are primarily for the GUI, but others might be more broadly useful.

I propose either moving these to a new directory $GISBASE/scripts/gui and adding this as a path in init.sh OR simply moving them to $GISBASE/scripts. Several are now obsolete (e.g., d.text.sh and v.in.asciipoints) and could be removed. I’d change the reference to them in the GUI (i.e., no longer necessary to specify a full path).

Is this OK with everyone?

  1. Related to this, I’d like to make a couple more of the scripts obsolete if someone can help.

r.reclass and r.recode can use input files for reclass/recode rules. But the only way to get the file into either command is via a redirect. (e.g., [path to file] > r.reclass). Can a file= argument be added to both of these like it was recently added to r.colors? This would dispense with these scripts.

Thanks
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

Michael Barton wrote:

I¹ve come across a couple more menu issues that I¹d like to propose
solving in a general way that will work with multiple GUI¹s

1. Currently, there are scripts that are only used (or only easily
used) by the GUI. These reside in $GISBASE/etc/gm/script. The reason
for these scripts is to overcome some inherent limitations of the
interface to several important GRASS commands.

..

Having them buried in $GISBASE/etc/gm/script makes them more difficult
for anything but the TclTk GUI to access these scripts. Some are
primarily for the GUI, but others might be more broadly useful.

I propose either moving these to a new directory $GISBASE/scripts/gui
and adding this as a path in init.sh OR simply moving them to
$GISBASE/scripts. Several are now obsolete (e.g., d.text.sh and
v.in.asciipoints) and could be removed. I¹d change the reference to
them in the GUI (i.e., no longer necessary to specify a full path).

Yes, it would be nice to move generic wrapper scripts which are just
needed for a GUI/core interaction (ie nothing to do with tcl or wx)
from gui/tcltk/gis.m/script/ to gui/script/ or somesuch place.

right now we have:

d.colors.sh
d.path.sh
d.shadedmap
d.text.sh
d.title.sh
print.sh
r.colors.rules
r.reclass.file
r.reclass.rules
r.recode.file
r.recode.rules
r.support.sh
v.in.asciipoints
v.type.sh

d.shademap is the only one I see there which might move to scripts/.

for the others, probably one of:
$GISBASE/etc/gui/scripts/
$GISBASE/scripts/gui/
$GISBASE/scripts/

Personally, I favour $GISBASE/etc/gui/scripts/. You shouldn't add
anything init.sh, just change the existing references to
$GB/etc/gm/scripts/ to the new place. I don't think there is anything
complicated there to worry about losing the CVS history by moving the
file in CVS to grass6/gui/scripts/. The history was already cropped when
copied from d.m. Maybe add a comment in the CVS checkin message about
their migration from d.m/scripts/ to gis.m/scripts/ to the new spot, so
there is a trail to follow if someone wants to track a history.

And of course these all exist due to deficiencies in modules, which
should be fixed directly; and any outdated scripts should be removed.

Note r.support.sh works around a very weird bug where the module quits
after only the first few [y/N] questions in the xterm.
  https://intevation.de/rt/webrt?serial_num=5094

Hamish

Michael Barton wrote:

1. Currently, there are scripts that are only used (or only easily used) by
the GUI. These reside in $GISBASE/etc/gm/script. The reason for these
scripts is to overcome some inherent limitations of the interface to several
important GRASS commands. For example, one script (r.colors.rules) allows
you to chose the file for which you want to manage colors interactively
through the GUI, then launches r.colors so that it opens an interactive
xterm for setting color rules. Another provides a functional GUI interface
to v.type without needing an interactive xmon. Yet another allows you to use
the GUI to specify a reclassification file to send to r.reclass. You get the
idea.

Having them buried in $GISBASE/etc/gm/script makes them more difficult for
anything but the TclTk GUI to access these scripts. Some are primarily for
the GUI, but others might be more broadly useful.

I propose either moving these to a new directory $GISBASE/scripts/gui and
adding this as a path in init.sh OR simply moving them to $GISBASE/scripts.
Several are now obsolete (e.g., d.text.sh and v.in.asciipoints) and could be
removed. I¹d change the reference to them in the GUI (i.e., no longer
necessary to specify a full path).

Is this OK with everyone?

I suggest using $GISBASE/scripts for anything which isn't inherently
limited to the GUI.

2. Related to this, I¹d like to make a couple more of the scripts obsolete
if someone can help.

r.reclass and r.recode can use input files for reclass/recode rules. But the
only way to get the file into either command is via a redirect. (e.g., [path
to file] > r.reclass). Can a file= argument be added to both of these like
it was recently added to r.colors? This would dispense with these scripts.

An alternative is to add stdin= and stdout= pseudo-options to the
module's GUI dialog, so that the user can redirect stdin/stdout of any
command from/to a file. This can be done in addition to a file= option
for modules where it would be useful.

However: any module which is run from the GUI must behave in a
non-interactive manner regardless of which flags/options the user
selects. Having the module hang because the user chose a combination
of options which results in the module trying to read from stdin isn't
acceptable.

You can probably eliminate hanging by simply closing stdin (or
redirecting it from /dev/null), although that may just result in a
different form of misbehaviour.

Ultimately, the only complete solution is to adopt (and enforce) a
policy that "modules" are never interactive. No exceptions. Absolutely
no exceptions whatsoever.

The last point won't happen before the 7.x branch comes into
existence, but I guarantee[1] that it will happen immediately
thereafter.

[1] Well, so long as I'm still alive, sentient, and have commit
access; if I can make it happen, I will.

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

On 6/10/07 3:46 AM, "Hamish" <hamish_nospam@yahoo.com> wrote:

Michael Barton wrote:

I¹ve come across a couple more menu issues that I¹d like to propose
solving in a general way that will work with multiple GUI¹s

1. Currently, there are scripts that are only used (or only easily
used) by the GUI. These reside in $GISBASE/etc/gm/script. The reason
for these scripts is to overcome some inherent limitations of the
interface to several important GRASS commands.

..

Having them buried in $GISBASE/etc/gm/script makes them more difficult
for anything but the TclTk GUI to access these scripts. Some are
primarily for the GUI, but others might be more broadly useful.

I propose either moving these to a new directory $GISBASE/scripts/gui
and adding this as a path in init.sh OR simply moving them to
$GISBASE/scripts. Several are now obsolete (e.g., d.text.sh and
v.in.asciipoints) and could be removed. I¹d change the reference to
them in the GUI (i.e., no longer necessary to specify a full path).

Yes, it would be nice to move generic wrapper scripts which are just
needed for a GUI/core interaction (ie nothing to do with tcl or wx)
from gui/tcltk/gis.m/script/ to gui/script/ or somesuch place.

Here is my assessment FWIW. This applies to current GUI and new wxPython one
(d.m could stay like it is)

right now we have:

d.colors.sh - Obsolete

d.path.sh - Of general use (more useful for GUI, but also for scripting)

d.shadedmap - Of general use (simple way to do same thing with d.his)

d.text.sh - Obsolete

d.title.sh - Obsolete

print.sh _ ???

r.colors.rules - Of general use (GUI for picking map; will be obsolete with
wxgrass)

r.reclass.file- Of general use, but would be unnessary with a file= option
r.reclass.rules- Of general use (GUI for picking map; will be obsolete with
wxgrass)

r.recode.file- Of general use, but would be unnessary with a file= option

r.recode.rules- Of general use (GUI for picking map; will be obsolete with
wxgrass)

r.support.sh - Obsoletes (maybe not??)

v.in.asciipoints - Obsolete

v.type.sh- Of general use (should effectively replace GUI for v.type)

d.shademap is the only one I see there which might move to scripts/.

for the others, probably one of:
$GISBASE/etc/gui/scripts/
$GISBASE/scripts/gui/
$GISBASE/scripts/

Personally, I favour $GISBASE/etc/gui/scripts/. You shouldn't add
anything init.sh, just change the existing references to
$GB/etc/gm/scripts/ to the new place.

One objective would be to allow any of these to be run by simply typing
their name, without the full path. To do this, they would need to go into a
directory already listed in the PATH in init.sh or to add the new directory
to the PATH in init.sh.

I don't think there is anything

complicated there to worry about losing the CVS history by moving the
file in CVS to grass6/gui/scripts/. The history was already cropped when
copied from d.m. Maybe add a comment in the CVS checkin message about
their migration from d.m/scripts/ to gis.m/scripts/ to the new spot, so
there is a trail to follow if someone wants to track a history.

And of course these all exist due to deficiencies in modules, which
should be fixed directly; and any outdated scripts should be removed.

Note r.support.sh works around a very weird bug where the module quits
after only the first few [y/N] questions in the xterm.
  https://intevation.de/rt/webrt?serial_num=5094

Even the new and improved r.support?

Do I need PSC OK to make this kind of change to the cvs structure after
we've worked it out?

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

Michael Barton wrote:

>> I¹ve come across a couple more menu issues that I¹d like to propose
>> solving in a general way that will work with multiple GUI¹s
>>
>> 1. Currently, there are scripts that are only used (or only easily
>> used) by the GUI. These reside in $GISBASE/etc/gm/script.

..

>> I propose either moving these to a new directory
>> $GISBASE/scripts/gui and adding this as a path in init.sh OR simply
>> moving them to $GISBASE/scripts. Several are now obsolete (e.g.,
>> d.text.sh and v.in.asciipoints) and could be removed. I¹d change
>> the reference to them in the GUI (i.e., no longer necessary to
>> specify a full path).

Hamish:

> Yes, it would be nice to move generic wrapper scripts which are just
> needed for a GUI/core interaction (ie nothing to do with tcl or wx)
> from gui/tcltk/gis.m/script/ to gui/script/ or somesuch place.

Michael:

Here is my assessment FWIW. This applies to current GUI and new
wxPython one

(d.m could stay like it is)

right. (s/could/should/)

...

d.path.sh - Of general use (more useful for GUI, but also for
scripting)

It's a work around easily done by a script in a one-liner call to
d.vect. Better done as a new flag in the module, e.g.:
  -d: draw input map as backdrop

For scripts which exist to overcome module deficiencies, I think it is
better to fix the module, not entrench the work-around as a formal
script. Or another way, there shouldn't be multiple scripts to do the
same task in a slightly different way- we are already up to ~392
modules- I have been using grass for a while now and still there are
still modules I have never heard of (e.g. I never noticed r.bitpattern
existed before a few days ago). Less noise is better.

keeping them in $SOMEWHERE/gui/scripts/ makes them stick out badly (as
you've noticed), which helps to motivate us to fix the real problem in
the module, gui code, or the libgis glue between them, rather than
perpetuate a work-around. Also, moving them to grass6/scripts/, then
deleting them later, clutters the ViewCVS interface with empty
directories (kept to store old attic history).

d.shadedmap - Of general use (simple way to do same thing with d.his)

It performs a same technical task, but different conceptual task.
IMO send it to grass6/scripts/ like the v.centoids, v.dissolve,
v.what.vect scripts, as the module containing the functionality isn't
obvious.

d.text.sh - Obsolete

if so, drop it.

d.title.sh - Obsolete

We need to add a flag to d.title to call system(d.text) to make it
generally useful I think. Then we can drop this work-around script.
(regardless if it is used by the GRASS 6.x GUIs or is dropped for 7.x)

print.sh _ ???

No idea; if not used by the GUI I'd say drop it or if you have some need
for it then fully rewrite it.

r.colors.rules - Of general use (GUI for picking map; will be obsolete
with wxgrass)

it's redundant now with the new "r.colors rules=filename" and -i.
Can it be replaced by two menu items?

r.reclass.file- Of general use, but would be unnessary with a file=
option r.reclass.rules- Of general use (GUI for picking map; will be
obsolete with wxgrass)

it doesn't add new functionality, it just redirects from stdin.
Better handled by a new file= option as you say.

r.recode.file- Of general use, but would be unnessary with a file=
option

ditto.

r.recode.rules- Of general use (GUI for picking map; will be obsolete
with wxgrass)

ditto.

r.support.sh - Obsoletes (maybe not??)

still needed AFAIK-

> Note r.support.sh works around a very weird bug where the module
> quits after only the first few [y/N] questions in the xterm.
> https://intevation.de/rt/webrt?serial_num=5094

Even the new and improved r.support?

bug created 10 months ago, so yes AFAIK. (if you mean new by Brad)

v.in.asciipoints - Obsolete

ok. (does it even work? I see an unmatched quoting error)

v.type.sh- Of general use (should effectively replace GUI for v.type)

It's just there to work around GUI + parser issues, and just waits for
GRASS 7 to be solved. No new functionality, keep it out of the main
scripts/.

> d.shademap is the only one I see there which might move to scripts/.

After looking at them more, I still stand by that.

One objective would be to allow any of these to be run by simply
typing their name, without the full path. To do this, they would need
to go into a directory already listed in the PATH in init.sh or to add
the new directory to the PATH in init.sh.

if they only exist to make the GUI work inspite of misfeatures, then no,
don't put them in the general path. banish them elsewhere. they are
internal maintainance scripts not user scripts. aka if the misfeatures
didn't exist, neither would they.

Do I need PSC OK to make this kind of change to the cvs structure
after we've worked it out?

No. Technical decisions and implementation are explicitly the domain of
the developers and consensus reached by the devels on this here
grass-dev mailing list.

RFC1 wrought:
"In general, once write access has been granted, developers are allowed
to make changes to the codebase as they see fit. For controversial or
complicated changes consensus must be obtained on the developers'
mailing list as far as reasonably practicable. It is recognised that the
ultimate arbitration on technical issues should always lie with
consensus on the developers' mailing list. Specifically, it is not the
role of the PSC to impose technical solutions. Its role is in general
limited to enforcing the quality control mechanisms outlined above."

So the PSC's interest in the CVS server is primarily with making sure
that all commiters understand + heed the GPL, submitting guidelines,
etc.

Is everyone happy with putting the relevant gui scripts in
grass6/gui/scripts/ in the source code and then $GISBASE/etc/gui/scripts/
after "make"? Or have a better idea?

another thing to note is that wrapper scripts won't load the parent
module's help page. (eg v.type.sh, but there isn't much to say there)

Hamish

Hamish wrote:

Is everyone happy with putting the relevant gui scripts in
grass6/gui/scripts/ in the source code and then $GISBASE/etc/gui/scripts/
after "make"? Or have a better idea?

If there's even a remote possibility that the script would be useful
from the command line, it should be installed in $GISBASE/scripts
(which is in $PATH).

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

Hamish:

> it would be nice to move generic wrapper scripts which are just
> needed for a GUI/core interaction (ie nothing to do with tcl or wx)
> from gui/tcltk/gis.m/script/ to gui/scripts/

Now done for non-obsolete scripts. After install they live in
$GISBASE/etc/gui/scripts/.

d.shadedmap moved to the main script/ dir, now it's a normal module.

I added a -d flag to d.title to run G_system(d.text) automatically, so
d.title.sh is now obsolete.

the rest of the GUI wrapper scripts should be removed once the modules
they wrap become more GUI-friendly (ie sometime before GRASS 7):

- r.reclass, r.recode, r.colors, take input from a file= option as an
alternative to stdin; better- write a GUI to help make the input file
then run r.reclass with that)

- d.path has a coor= option now, so it can be used non-interactively.
i.e. the GUI can pick the two coords interactively and then run the
module non-interactively and display the result.

- The r.support bug is still weird. (breaks out after two [y/n]
questions if run directly in an xterm)

hopefully no problems,

Hamish

Thanks. Are the menu references to these changed too?

Now that I'm back, I hope to make r.reclass.rules and r.recode.rules
obsolete for TclTk like I did for wxPython. I'm hoping that r.reclass.file
and r.recode.file can be made obsolete with slight changes to the C-modules
too.

Michael

On 6/18/07 2:33 AM, "Hamish" <hamish_nospam@yahoo.com> wrote:

Hamish:

it would be nice to move generic wrapper scripts which are just
needed for a GUI/core interaction (ie nothing to do with tcl or wx)
from gui/tcltk/gis.m/script/ to gui/scripts/

Now done for non-obsolete scripts. After install they live in
$GISBASE/etc/gui/scripts/.

d.shadedmap moved to the main script/ dir, now it's a normal module.

I added a -d flag to d.title to run G_system(d.text) automatically, so
d.title.sh is now obsolete.

the rest of the GUI wrapper scripts should be removed once the modules
they wrap become more GUI-friendly (ie sometime before GRASS 7):

- r.reclass, r.recode, r.colors, take input from a file= option as an
alternative to stdin; better- write a GUI to help make the input file
then run r.reclass with that)

- d.path has a coor= option now, so it can be used non-interactively.
i.e. the GUI can pick the two coords interactively and then run the
module non-interactively and display the result.

- The r.support bug is still weird. (breaks out after two [y/n]
questions if run directly in an xterm)

hopefully no problems,

Hamish

__________________________________________
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