[GRASS5] gis.m output change, default tk gui configuration options

Hello,

Aside: I'll be away from computers for a week starting Friday afternoon :slight_smile:

I have committed a couple medium-sized user interface changes to CVS. gis.m
now has a different run and output interface. The beginning skeleton of an
options system is being made.

I have committed changes to gis.m so that it uses the shared run and output
code for output. I also changed around the run user interface a bit. Commands
run from the menus in gis.m will have their output displayed in the output
window.

gui.tcl now sources /lib/gtcltk/options.tcl which is installed in
$GISBASE/etc/gtcltk/. This file sets up color and font options as well as a
couple miscellaneous global variables. It uses the tk options database. This
database allows rules to be specified for tk widget options based on the name
of the option (ex: font), the name of the widget (ex:. .titlelabel), the
class of the widget (ex: Button), and a few others. These options are applied
to every widget created after the option is set unless it is overridden by
the command that creates the widget or a subsequent configure command. This
leads to a few good programming practices for tcl/tk programmers:

1. Don't set options like -foreground or -background or -font when creating
widgets, unless theres a really _really_ specific reason to have it that
color (like it's demonstrating that color).

2. If you want something like a label to look different than everything else
of that class (other labels) give it a distinctive name,
like .moduletitlelabel . If you have a bunch of them give them all the same
distinctive name. This allows them to have their options controlled by the
options database. If this isn't good enough then we'll write a proc for
handling special classes.

We can make options.tcl look for options files per mapset or user and load
them after setting the defaults. Eventually we could write a module for
changing these (after adding color and font selection to gisprompt somehow).

--Cedric

Cedric Shock wrote:

Hello,

Aside: I'll be away from computers for a week starting Friday afternoon :slight_smile:

I have committed a couple medium-sized user interface changes to CVS. gis.m
now has a different run and output interface. The beginning skeleton of an
options system is being made.

I have committed changes to gis.m so that it uses the shared run and output
code for output. I also changed around the run user interface a bit. Commands
run from the menus in gis.m will have their output displayed in the output
window.

gui.tcl now sources /lib/gtcltk/options.tcl which is installed in
$GISBASE/etc/gtcltk/. This file sets up color and font options as well as a
couple miscellaneous global variables. It uses the tk options database. This
database allows rules to be specified for tk widget options based on the name
of the option (ex: font), the name of the widget (ex:. .titlelabel), the
class of the widget (ex: Button), and a few others. These options are applied
to every widget created after the option is set unless it is overridden by
the command that creates the widget or a subsequent configure command. This
leads to a few good programming practices for tcl/tk programmers:

1. Don't set options like -foreground or -background or -font when creating
widgets, unless theres a really _really_ specific reason to have it that
color (like it's demonstrating that color).

2. If you want something like a label to look different than everything else
of that class (other labels) give it a distinctive name,
like .moduletitlelabel . If you have a bunch of them give them all the same
distinctive name. This allows them to have their options controlled by the
options database. If this isn't good enough then we'll write a proc for
handling special classes.

We can make options.tcl look for options files per mapset or user and load
them after setting the defaults. Eventually we could write a module for
changing these (after adding color and font selection to gisprompt somehow).

Cedric, all,

thanks for all your work on the GUI!

What about creating a new file SUBMITTING_TCLTK which gets populated
which such good practice hints as seen above?
We already have SUBMITTING (basically for C) and SUBMITTING_SCRIPTS (shell).

In the ML archive it will get sort of lost.

Markus

Cedric Shock wrote:

gui.tcl now sources /lib/gtcltk/options.tcl which is installed in
$GISBASE/etc/gtcltk/.

With the addition of lib/gtcltk, gui.tcl should probably be moved there.

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