[GRASS-SVN] r38296 - grass/branches/develbranch_6/gui/tcltk/gis.m
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Jul 7 10:53:30 EDT 2009
Author: marisn
Date: 2009-07-07 10:53:30 -0400 (Tue, 07 Jul 2009)
New Revision: 38296
Modified:
grass/branches/develbranch_6/gui/tcltk/gis.m/cmd.tcl
grass/branches/develbranch_6/gui/tcltk/gis.m/gm.tcl
grass/branches/develbranch_6/gui/tcltk/gis.m/raster.tcl
grass/branches/develbranch_6/gui/tcltk/gis.m/runandoutput.tcl
grass/branches/develbranch_6/gui/tcltk/gis.m/vector.tcl
Log:
Fix displaying vector attribute table in gis.m if db path contains spaces (fixes #637); Don't run commands on map (info, attributes) if map is not selected.
Modified: grass/branches/develbranch_6/gui/tcltk/gis.m/cmd.tcl
===================================================================
--- grass/branches/develbranch_6/gui/tcltk/gis.m/cmd.tcl 2009-07-07 14:44:48 UTC (rev 38295)
+++ grass/branches/develbranch_6/gui/tcltk/gis.m/cmd.tcl 2009-07-07 14:53:30 UTC (rev 38296)
@@ -10,13 +10,13 @@
##########################################################################
namespace eval GmCmd {
- variable array opt # cmd current options
+ variable array opt ;# cmd current options
variable count 1
- variable array tree # mon
- variable array lfile # command
- variable array lfilemask # command
+ variable array tree ;# mon
+ variable array lfile ;# command
+ variable array lfilemask ;# command
variable optlist
- variable array dup # layer
+ variable array dup ;# layer
}
Modified: grass/branches/develbranch_6/gui/tcltk/gis.m/gm.tcl
===================================================================
--- grass/branches/develbranch_6/gui/tcltk/gis.m/gm.tcl 2009-07-07 14:44:48 UTC (rev 38295)
+++ grass/branches/develbranch_6/gui/tcltk/gis.m/gm.tcl 2009-07-07 14:53:30 UTC (rev 38296)
@@ -19,23 +19,23 @@
#
##########################################################################
-lappend auto_path $env(GISBASE)/bwidget
+lappend auto_path [file join "$env(GISBASE)" "bwidget"]
package require -exact BWidget 1.2.1
# Load up all the gis.m layers and things.
# pkgIndex.tcl only loads the files when they are first called.
-lappend auto_path $env(GISBASE)/etc/gm
+lappend auto_path [file join "$env(GISBASE)" "etc" "gm"]
package require -exact GisM 1.0
# path to GIS Manager files
-set gmpath $env(GISBASE)/etc/gm
+set gmpath [file join "$env(GISBASE)" "etc" "gm"]
# Load GUI stuff required for error reporting etc.
-source $env(GISBASE)/etc/gui.tcl
+source [file join "$env(GISBASE)" "etc" "gui.tcl"]
# Load common procedure library
-source $gmpath/gmlib.tcl
+source [file join "$gmpath" "gmlib.tcl"]
# gisenv errors are fatal.
if {[catch {set env(GISDBASE) [exec g.gisenv get=GISDBASE]} error]} {
@@ -72,7 +72,7 @@
# path to icons for GIS Manager
-set iconpath $env(GISBASE)/etc/gui/icons/grass
+set iconpath [file join "$env(GISBASE)" "etc" "gui" "icons" "grass"]
global iconpath
global gmpath
@@ -116,7 +116,7 @@
#fetch GRASS Version number:
-catch {set fp [open $env(GISBASE)/etc/VERSIONNUMBER r]}
+catch {set fp [open [file join "$env(GISBASE)" "etc" "VERSIONNUMBER"] r]}
set GRASSVERSION [read -nonewline $fp]
if {[catch {close $fp} error]} {
@@ -132,7 +132,7 @@
# $env(GISBASE)/etc/gtcltk/gronsole.tcl
# Load a console user interface
-source $gmpath/runandoutput.tcl
+source [file join "$gmpath" "runandoutput.tcl"]
namespace eval Gm {
variable gm_mainframe
Modified: grass/branches/develbranch_6/gui/tcltk/gis.m/raster.tcl
===================================================================
--- grass/branches/develbranch_6/gui/tcltk/gis.m/raster.tcl 2009-07-07 14:44:48 UTC (rev 38295)
+++ grass/branches/develbranch_6/gui/tcltk/gis.m/raster.tcl 2009-07-07 14:53:30 UTC (rev 38296)
@@ -10,13 +10,13 @@
##########################################################################
namespace eval GmRaster {
- variable array opt # raster current options
+ variable array opt ;# raster current options
variable count 1
- variable array tree # mon
- variable array lfile # raster
- variable array lfilemask # raster
+ variable array tree ;# mon
+ variable array lfile ;# raster
+ variable array lfilemask ;# raster
variable optlist
- variable array dup # vector
+ variable array dup ;# vector
}
###############################################################################
@@ -137,6 +137,14 @@
proc GmRaster::show_info { id } {
variable opt
set mapname $opt($id,1,map)
+ if {[string length $mapname] == 0} {
+ GmRaster::select_map $id
+ set mapname $opt($id,1,map)
+ if {[string length $mapname] == 0} {
+ GmLib::errmsg [G_msg "This action requires map name to be set"]
+ return
+ }
+ }
set cmd "r.info map=$mapname"
run_panel $cmd
}
@@ -145,6 +153,14 @@
proc GmRaster::show_info_drape { id } {
variable opt
set mapname $opt($id,1,drapemap)
+ if {[string length $mapname] == 0} {
+ GmRaster::select_drapemap $id
+ set mapname $opt($id,1,drapemap)
+ if {[string length $mapname] == 0} {
+ GmLib::errmsg [G_msg "This action requires map name to be set"]
+ return
+ }
+ }
set cmd "r.info map=$mapname"
run_panel $cmd
}
Modified: grass/branches/develbranch_6/gui/tcltk/gis.m/runandoutput.tcl
===================================================================
--- grass/branches/develbranch_6/gui/tcltk/gis.m/runandoutput.tcl 2009-07-07 14:44:48 UTC (rev 38295)
+++ grass/branches/develbranch_6/gui/tcltk/gis.m/runandoutput.tcl 2009-07-07 14:53:30 UTC (rev 38296)
@@ -50,7 +50,7 @@
set opt($dlg,run_button) $buttonframe.run
# Turn off help button if the help file doesn't exist
- if {! [file exists $env(GISBASE)/docs/html/$pgm_name.html]} {
+ if {! [file exists [file join "$env(GISBASE)" "docs" "html" "$pgm_name.html"]]} {
$buttonframe.help configure -state disabled
}
Modified: grass/branches/develbranch_6/gui/tcltk/gis.m/vector.tcl
===================================================================
--- grass/branches/develbranch_6/gui/tcltk/gis.m/vector.tcl 2009-07-07 14:44:48 UTC (rev 38295)
+++ grass/branches/develbranch_6/gui/tcltk/gis.m/vector.tcl 2009-07-07 14:53:30 UTC (rev 38296)
@@ -235,7 +235,19 @@
proc GmVector::show_columns { id } {
variable opt
set mapname $opt($id,1,vect)
+ if {[string length $mapname] == 0} {
+ GmVector::select_map $id
+ set mapname $opt($id,1,vect)
+ if {[string length $mapname] == 0} {
+ GmLib::errmsg [G_msg "This action requires map name to be set"]
+ return
+ }
+ }
set layernum $opt($id,1,layer)
+ if {[string is integer -strict $layernum] == 0 } {
+ GmLib::errmsg [G_msg "You must provide valid vector layer number"]
+ return
+ }
set cmd "v.info -c map=$mapname layer=$layernum"
run_panel $cmd
}
@@ -245,7 +257,19 @@
proc GmVector::show_data { id } {
variable opt
set mapname $opt($id,1,vect)
+ if {[string length $mapname] == 0} {
+ GmVector::select_map $id
+ set mapname $opt($id,1,vect)
+ if {[string length $mapname] == 0} {
+ GmLib::errmsg [G_msg "This action requires map name to be set"]
+ return
+ }
+ }
set layernum $opt($id,1,layer)
+ if {[string is integer -strict $layernum] == 0 } {
+ GmLib::errmsg [G_msg "You must provide valid vector layer number"]
+ return
+ }
if {![catch {open "|v.db.connect map=$mapname layer=$layernum -g" r} vdb]} {
set vectdb [read $vdb]
if {[catch {close $vdb} error]} {
@@ -253,10 +277,10 @@
}
set vdblist [split $vectdb " "]
- set tbl [lindex $vdblist 1]
- set db [lindex $vdblist 3]
- set drv [lindex $vdblist 4]
- set cmd "db.select table=$tbl database=$db driver=dbf"
+ set tbl [string trim [lindex $vdblist 1]]
+ set db [file normalize [join [lrange $vdblist 3 end-1]]]
+ set drv [string trim [lindex $vdblist end]]
+ set cmd [list db.select "table=$tbl" "database=$db" "driver=$drv"]
run_panel $cmd
}
}
@@ -266,7 +290,19 @@
proc GmVector::show_info { id } {
variable opt
set mapname $opt($id,1,vect)
+ if {[string length $mapname] == 0} {
+ GmVector::select_map $id
+ set mapname $opt($id,1,vect)
+ if {[string length $mapname] == 0} {
+ GmLib::errmsg [G_msg "This action requires map name to be set"]
+ return
+ }
+ }
set layernum $opt($id,1,layer)
+ if {[string is integer -strict $layernum] == 0 } {
+ GmLib::errmsg [G_msg "You must provide valid vector layer number"]
+ return
+ }
set cmd "v.info map=$mapname layer=$layernum"
run_panel $cmd
}
More information about the grass-commit
mailing list