[GRASS5] GUI code cleanup patch

Hello,

This patch cleans up the calling convention between lib/gis/parser.c and
lib/gis/gui.tcl. It extends general/g.parser/main.c to cover all of the
string attributes available via the c interface. It adds a new char *
guisection attribute to options and flags in include/gis.h.

In detail:

Flag and module attributes are now passed from lib/gis/parser.c to
lib/gis/gui.tcl as the flattened list form of a tcl array, just like the
attributes for options.

I moved GUI logic regarding text to use for labels (label or description) from
lib/gis/parser.c to lib/gis/gui.tcl. This will allow a gui to decide, for
example, to display the description text as "tooltip" or balloon help when an
option has a label.

general/g.parser/main.c now parses all of the char* module, option, and flag
attributes from the #% notation, including the new guisection attribute
described below.

I added a new char* guisection attribute to struct Option and struct Flag.
This is a string that arranges the options and flags into a tree hierarchy to
allow for more organized user interfaces for commands with many options. This
has not been implemented anywhere else yet. It contains the full tree path
for where to place the option or flag, delimited by the ';' character. For
programs with very options inputs this should remain null or be "". For
example, an option for an input map might have just "Inputs" and an option
for the learning rate for perceptrons in a neural network classification
program might be "Neurons;Perceptrons". Examples of how this could be used in
layout were discussed in the thread "GUI sections and metadata or history
graphs."

These changes pave the way for work on more interesting or friendly generic
user interfaces to the commands that make up the bulk of grass.

--Cedric Shock

(attachments)

GUI_cleanup_patch_noOBJ (8.04 KB)

Cedric Shock wrote:

This patch cleans up the calling convention between lib/gis/parser.c and
lib/gis/gui.tcl. It extends general/g.parser/main.c to cover all of the
string attributes available via the c interface. It adds a new char *
guisection attribute to options and flags in include/gis.h.

In detail:

Flag and module attributes are now passed from lib/gis/parser.c to
lib/gis/gui.tcl as the flattened list form of a tcl array, just like the
attributes for options.

That seems reasonable.

I moved GUI logic regarding text to use for labels (label or description) from
lib/gis/parser.c to lib/gis/gui.tcl. This will allow a gui to decide, for
example, to display the description text as "tooltip" or balloon help when an
option has a label.

That seems reasonable, except that I would suggest leaving the
label/desc entries untouched, and either moving the choice to the
point where the value is actually used, or creating a separate entry
in opts() and copying the label/desc entry to that instead.

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

Glynn,

On Sunday 12 March 2006 22:18, Glynn Clements wrote:

That seems reasonable, except that I would suggest leaving the
label/desc entries untouched, and either moving the choice to the
point where the value is actually used, or creating a separate entry
in opts() and copying the label/desc entry to that instead.

I agree completely. This patch accomplishes nothing, really, except to
separate the changes needed to set up for having a better gui.tcl from the
new one when it comes. As such I was trying to keep the list of changes to a
minimum. The changes included here are just enough to clean up the calling
convention and add the guisection attribute which my plans for gui.tcl hinge
on. Anyway, I just copied the program logic straight across between languages
to have a nice clear and understandable commit.

I am working quite a bit on gui.tcl, which has a rather low cost of modifying.
Right now I've got notification in the output screen with icons when the
program starts and finishes running and display and update of the command to
be run while the options are edited. I'm playing with balloon help, separate
tabs for options and output, contemplating a help tab to go along with them,
and am somewhere in the midst of writing my first experimental layout rule.

--Cedric Shock

Cedric Shock wrote:

> That seems reasonable, except that I would suggest leaving the
> label/desc entries untouched, and either moving the choice to the
> point where the value is actually used, or creating a separate entry
> in opts() and copying the label/desc entry to that instead.

I agree completely. This patch accomplishes nothing, really, except to
separate the changes needed to set up for having a better gui.tcl from the
new one when it comes. As such I was trying to keep the list of changes to a
minimum. The changes included here are just enough to clean up the calling
convention and add the guisection attribute which my plans for gui.tcl hinge
on. Anyway, I just copied the program logic straight across between languages
to have a nice clear and understandable commit.

Right; I overlooked that this was the existing behaviour in that regard.

I've committed your patch as-is.

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

Cedric,

I am so glad to hear that you are working on the GUI. I have some cosmetic
changes to gui.tcl that made modules a little more visually consistent with
the GIS Manager, but I'd been holding off until the new GIS Manager is
finished with testing. I'll send these to you, but what you're doing is
much more sophisticated. Thanks very much.

Michael

On 3/13/06 2:38 AM, "Cedric Shock" <cedricgrass@shockfamily.net> wrote:

Glynn,

On Sunday 12 March 2006 22:18, Glynn Clements wrote:

That seems reasonable, except that I would suggest leaving the
label/desc entries untouched, and either moving the choice to the
point where the value is actually used, or creating a separate entry
in opts() and copying the label/desc entry to that instead.

I agree completely. This patch accomplishes nothing, really, except to
separate the changes needed to set up for having a better gui.tcl from the
new one when it comes. As such I was trying to keep the list of changes to a
minimum. The changes included here are just enough to clean up the calling
convention and add the guisection attribute which my plans for gui.tcl hinge
on. Anyway, I just copied the program logic straight across between languages
to have a nice clear and understandable commit.

I am working quite a bit on gui.tcl, which has a rather low cost of modifying.
Right now I've got notification in the output screen with icons when the
program starts and finishes running and display and update of the command to
be run while the options are edited. I'm playing with balloon help, separate
tabs for options and output, contemplating a help tab to go along with them,
and am somewhere in the midst of writing my first experimental layout rule.

--Cedric Shock

___________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Arizona State University
Tempe, AZ 85287

WWW - http://www.public.asu.edu/~cmbarton
Phone: 480-965-6262
Fax: 480-965-7671