[GRASS5] Tcltkgrass and dm merged for GRASS 5.7
Glynn Clements
glynn.clements at virgin.net
Mon Sep 6 08:39:25 EDT 2004
Michael Barton wrote:
> I'm attaching a fully functional prototype for this with the hopes that some
> of you will give it a test drive. Everything in the *.tgz file goes into the
> $GISBASE/etc/dm directory. Starting tcltkgrass is unnecessary. In fact, I
> commented out the tcltkgrass startup line in init.sh and renamed the
> tcltkgrass directory (to make it invisible to GRASS), and everything worked
> fine.
I have a few patches.
The first replaces the use of "string compare -length ..." with
"string match"; the former doesn't work with earlier versions of
Tcl/Tk (it isn't in 8.0, but is in 8.3.4).
The second fixes an overzealous replacement of "&" with "and" (which
replaced a couple of "&"s which were being used to run commands in the
background). Although, in retrospect, this should probably use
"spawn". Actually, there should be a defined procedure for displaying
an HTML file.
The third dynamically generates the monitor menus.
> 1. Given that putting all the menus into d.m.tcl makes it much larger, it
> might be a good idea to split off this part of the d.m system into a
> separate file (i.e. A menu.tcl) as is done with tool.tcl for example. I
> might need a bit of advice on how to do this, but it is probably very easy.
source $dmpath/menu.tcl
> 3. Glynn: The procedure to generate the monitor start, stop, select submenus
> didn't work in this new setup. I worked with it a bit without success, so I
> went ahead and coded the commands like before you did these. But I'm sure
> that the procedure could be made to work.
It needs to be converted to generate the new (MainFrame-compatible)
menu format. Patch attached.
--
Glynn Clements <glynn.clements at virgin.net>
-------------- next part --------------
--- d.m.tcl~ Mon Sep 6 11:47:14 2004
+++ d.m.tcl Mon Sep 6 12:09:55 2004
@@ -623,19 +623,19 @@
if { [string compare $node "root"] == 0 } {
return "group"
}
- if { [string compare -length 5 $node "group"] == 0 } {
+ if { [string match group* $node] } {
return "group"
}
- if { [string compare -length 6 $node "raster"] == 0 } {
+ if { [string match raster* $node] } {
return "raster"
}
- if { [string compare -length 6 $node "labels"] == 0 } {
+ if { [string match labels* $node] } {
return "labels"
}
- if { [string compare -length 6 $node "vector"] == 0 } {
+ if { [string match vector* $node] } {
return "vector"
}
- if { [string compare -length 3 $node "cmd"] == 0 } {
+ if { [string match cmd* $node] } {
return "cmd"
}
-------------- next part --------------
--- d.m.tcl~ Mon Sep 6 12:43:03 2004
+++ d.m.tcl Mon Sep 6 12:56:59 2004
@@ -642,8 +642,8 @@
{command "Manage PostGIS database" {} "" {} -command {execute pg.postgisdb }}
}
"&Help" all options 1 {
- {command "GRASS help" {} "g.manual" {} -command { exec $env(GRASS_HTML_BROWSER) $env(GISBASE)/docs/html/index.html and } }
- {command "d.m &help" {} "d.m help" {} -command { exec $env(GRASS_HTML_BROWSER) $env(GISBASE)/docs/html/d.m.html and } }
+ {command "GRASS help" {} "g.manual" {} -command { exec $env(GRASS_HTML_BROWSER) $env(GISBASE)/docs/html/index.html & } }
+ {command "d.m &help" {} "d.m help" {} -command { exec $env(GRASS_HTML_BROWSER) $env(GISBASE)/docs/html/d.m.html & } }
{command "About &GRASS" {} "About GRASS" {} -command { source $env(GISBASE)/etc/dm/grassabout.tcl} }
{command "About &System" {} "About System" {} -command { exec $env(GRASS_WISH) $env(GISBASE)/etc/dm/tksys.tcl --tcltk } }
}
-------------- next part --------------
--- d.m.tcl~ Mon Sep 6 12:56:59 2004
+++ d.m.tcl Mon Sep 6 13:27:15 2004
@@ -102,10 +102,9 @@
lappend submenu {separator}
}
set last_driver $driver
- lappend submenu $name "" [list "run d.mon $op=$name"]
+ lappend submenu [list command $name {} "" {} -command "run d.mon $op=$name"]
}
-
- return $submenu
+ return [list $submenu]
}
###############################################################################
@@ -128,7 +127,7 @@
# eval "exec sleep 20"
- set descmenu {
+ set descmenu [subst -novariables {
"&File" all file 1 {
{cascad "Import" {} "" 1 {
{cascad "Raster map" {} "" 1 {
@@ -196,7 +195,7 @@
{command "New" {} "Create new workspace file" {} -accelerator Ctrl-N -command { Dm::new}}
{command "Open..." {} "Open workspace file" {} -accelerator Ctrl-O -command { Dm::OpenFileBox {}}}
{command "Save" {} "Save workspace file" {} -accelerator Ctrl-S -command { Dm::SaveFileBox {}}}
- {command "Save as..." {} "Save workspace file as name" {} -command { if {[catch {unset ::Dm::filename}]} {}; Dm::SaveFileBox {}}}
+ {command "Save as..." {} "Save workspace file as name" {} -command { catch {unset ::Dm::filename} ; Dm::SaveFileBox {}}}
{command "Close" {} "Close workspace" {} -accelerator Ctrl-W -command { Dm::FileClose {}}}
}}
{separator}
@@ -252,39 +251,9 @@
{command "Start NVIZ (n-dimensional visualization module)" {} "nviz -q" {} -command {spawn nviz -q }}
{command "Create fly-through animation path for NVIZ" {} "" {} -command {execute d.nviz }}
{separator}
- {cascad "Start displays" {} "" 1 {
- {command "X0" {} "" {} -command {run d.mon start=x0 }}
- {command "X1" {} "" {} -command {run d.mon start=x1 }}
- {command "X2" {} "" {} -command {run d.mon start=x2 }}
- {command "X3" {} "" {} -command {run d.mon start=x3 }}
- {command "X4" {} "" {} -command {run d.mon start=x4 }}
- {command "X5" {} "" {} -command {run d.mon start=x5 }}
- {command "X6" {} "" {} -command {run d.mon start=x6 }}
- {separator}
- {command "PNG" {} "" {} -command {run d.mon start=PNG }}
- }}
- {cascad "Select displays" {} "" 1 {
- {command "X0" {} "" {} -command {run d.mon select=x0 }}
- {command "X1" {} "" {} -command {run d.mon select =x1 }}
- {command "X2" {} "" {} -command {run d.mon select =x2 }}
- {command "X3" {} "" {} -command {run d.mon select =x3 }}
- {command "X4" {} "" {} -command {run d.mon select =x4 }}
- {command "X5" {} "" {} -command {run d.mon select =x5 }}
- {command "X6" {} "" {} -command {run d.mon select =x6 }}
- {separator}
- {command "PNG" {} "" {} -command {run d.mon select =PNG }}
- }}
- {cascad "Stop displays" {} "" 1 {
- {command "X0" {} "" {} -command {run d.mon stop=x0 }}
- {command "X1" {} "" {} -command {run d.mon stop =x1 }}
- {command "X2" {} "" {} -command {run d.mon stop =x2 }}
- {command "X3" {} "" {} -command {run d.mon stop =x3 }}
- {command "X4" {} "" {} -command {run d.mon stop =x4 }}
- {command "X5" {} "" {} -command {run d.mon stop =x5 }}
- {command "X6" {} "" {} -command {run d.mon stop =x6 }}
- {separator}
- {command "PNG" {} "" {} -command {run d.mon stop =PNG }}
- }}
+ {cascad "Start displays" {} "" 1 [monitor_menu start]}
+ {cascad "Select displays" {} "" 1 [monitor_menu select]}
+ {cascad "Stop displays" {} "" 1 [monitor_menu stop]}
{command "Start/restart display at specified window size" {} "" {} -command {execute d.monsize }}
{command "Set active display to specified size" {} "" {} -command {execute d.resize }}
{separator}
@@ -648,7 +617,7 @@
{command "About &System" {} "About System" {} -command { exec $env(GRASS_WISH) $env(GISBASE)/etc/dm/tksys.tcl --tcltk } }
}
- }
+ }]
set prgtext "Creating MainFrame..."
set mainframe [MainFrame .mainframe \
More information about the grass-dev
mailing list