[GRASS5] New gui.tcl generic user interface

Cedric Shock cedricgrass at shockfamily.net
Tue Mar 14 12:24:45 EST 2006


Benjamin, Michael, everyone,

> I also think that, as many new convenienve functions get added to the
> GUI forms, it will probably prove a better approach to not add icons or
> buttons for all of them but rather have a regular menu bar at the
> top of each form that can be conveniently enhanced with new functions
> without having to think about form layout and GUI size each time.
>

The short answer: I think this belongs in the program that runs the grass 
command, i.e. gis.m, bash, a shell script, etc.

This can't be done here. gui.tcl is designed to be called from inside other 
GUIs. When it's called from parser.c it gets the default toplevel window that 
wish already made for it. When its called from other programs, like gis.m, it 
gets a window that the program makes and hands to it. I made a couple small 
changes to gui.tcl that check before trying to set the window title, and now 
it's perfectly happy being handed an arbitrary container instead of just a 
toplevel window:

http://www.shockfamily.net/cedric/grass/sidebyside.png

On the plus side, a GUI like gis.m can make a window for a program and set the 
menus in that window to get really tight integration. So I have added a few 
tcl side interface commands to get and set the current command (as an argv 
style list) that such a manager could use for loading and setting options.

I also modified parser.c so the call of G_gui from the existing --ui switch is 
deferred until after setting answers from parsing the option on the command 
line. I also added answer for flags to what is given to the tcl gui. This 
means you can do something like g.region --ui -p rast=elevation and the user 
interface will come up with Print already selected and rast set to elevation. 
As a command line user myself I find this just about perfect for presets. It 
makes scripts that bring up preset UIs very easy too.

Even though the parser.c stuff is independent I'll hold off on tossing out a 
patch for either of these until the current patch hits CVS.


> Actually, this would probably be the time to create a module
> that let's users choose their prefered screen fonts (GUI and
> console output), GUI colours and other things such as
> tear-off menus True/False in gis.m.
> This will also be useful once Tcl/Tk 8.5 comes out with a
> lot more options on how to customize GUI look and feel.

Right now these are, except for the bubble help text which bwidgets would 
default to 5 px,  the defaults for tk. If we want to change them we'd need to 
agree on a set of named fonts and make an include for gui.tcl that sets these 
fonts if they arn't already set. The file to include could be an environment 
variable so users can set their own. A GUI running gui.tcl would be wise to 
set the fonts and colors up with its own style. I'll think about this, but 
we'd be wise to get lots of Michael's input.

--Cedric Shock




More information about the grass-dev mailing list