[GRASS-SVN] r31283 - grass/branches/develbranch_6/lib/init

svn_grass at osgeo.org svn_grass at osgeo.org
Wed May 7 07:20:57 EDT 2008


Author: marisn
Date: 2008-05-07 07:20:57 -0400 (Wed, 07 May 2008)
New Revision: 31283

Modified:
   grass/branches/develbranch_6/lib/init/epsg_option.tcl
   grass/branches/develbranch_6/lib/init/file_option.tcl
   grass/branches/develbranch_6/lib/init/gis_set.tcl
Log:
Fixing PERMANENT mapset check in tcl/tk startup screen (as suggested by Glynn Clements) and bogous comments

Modified: grass/branches/develbranch_6/lib/init/epsg_option.tcl
===================================================================
--- grass/branches/develbranch_6/lib/init/epsg_option.tcl	2008-05-07 10:31:07 UTC (rev 31282)
+++ grass/branches/develbranch_6/lib/init/epsg_option.tcl	2008-05-07 11:20:57 UTC (rev 31283)
@@ -49,18 +49,18 @@
 #############################################################################
 
 namespace eval epsgOpt {
-	variable browsedepsg #path to EPSG code file
-	variable epsgLocation #name of new location to be created
-	variable epsg_code  #EPSG code number
-	variable searchterm #text string searched in EPSG file
+	variable browsedepsg ;#path to EPSG code file
+	variable epsgLocation ;#name of new location to be created
+	variable epsg_code  ;#EPSG code number
+	variable searchterm ;#text string searched in EPSG file
 	variable dir 
-	variable start #starting index for searching EPSG text widget
-	variable epsgtxt #text widget with EPSG definitions and codes
-	variable dtnum #datum transformation number
+	variable start ;#starting index for searching EPSG text widget
+	variable epsgtxt ;#text widget with EPSG definitions and codes
+	variable dtnum ;#datum transformation number
 	global env
 	global database 
 	global refresh
-	global mingw #test to see if we are running a windows version in mingw
+	global mingw ;#test to see if we are running a windows version in mingw
 
 
 }

Modified: grass/branches/develbranch_6/lib/init/file_option.tcl
===================================================================
--- grass/branches/develbranch_6/lib/init/file_option.tcl	2008-05-07 10:31:07 UTC (rev 31282)
+++ grass/branches/develbranch_6/lib/init/file_option.tcl	2008-05-07 11:20:57 UTC (rev 31283)
@@ -43,11 +43,11 @@
 # 
 #############################################################################
 namespace eval fileOpt {
-	variable fileLocation #name of new location to be created
-	variable filepath  #path to georeferenced file
+	variable fileLocation ;#name of new location to be created
+	variable filepath  ;#path to georeferenced file
 	global env
 	global database 
-	global mingw #test to see if we are running a windows version in mingw
+	global mingw ;#test to see if we are running a windows version in mingw
 	global refresh
 }
 

Modified: grass/branches/develbranch_6/lib/init/gis_set.tcl
===================================================================
--- grass/branches/develbranch_6/lib/init/gis_set.tcl	2008-05-07 10:31:07 UTC (rev 31282)
+++ grass/branches/develbranch_6/lib/init/gis_set.tcl	2008-05-07 11:20:57 UTC (rev 31283)
@@ -118,7 +118,6 @@
 
 proc CheckLocation {} {
 	# Returns 0, if location is invalid, 1 othervise.
-	# Are hardcoded / in path's OK? They where here before me :) Maris.
     global database location
     
     set found 0
@@ -138,14 +137,9 @@
     } else {
         cdir $dir
         .frame0.frameNMS.second.entry configure -state disabled
-        foreach filename [lsort [glob -nocomplain *]] {
-            if {[string compare $filename "PERMANENT"] == 0} {
-                # All good locations have valid PERMANENT mapset.
-                if {[file exists "$dir/PERMANENT/DEFAULT_WIND"] != 0} {
-                    set found 1
-                    .frame0.frameNMS.second.entry configure -state normal
-                }
-            }
+        if {[file isdirectory "PERMANENT"] && [file exists "$dir/PERMANENT/DEFAULT_WIND"]} {
+            set found 1
+            .frame0.frameNMS.second.entry configure -state normal
         }
     }
     
@@ -153,6 +147,16 @@
     return $found
 }
 
+proc CheckMapset {} {
+	global database location mapset
+	
+	if { $mapset == "" } { return 0; }
+	
+	if { [file exists "$database/$location/$mapset/WIND"] } {
+		return 1
+	}
+	return 0
+}
 
 #############################################################################
 proc gisSetWindow {} {
@@ -485,12 +489,11 @@
 				0 OK;
 			set mapset ""
             } else {
-                if {[file exists "$database/$location/$mapset/WIND"] == 0} {
+                if {[CheckMapset] == 0} {
                     DialogGen .wrnDlg [G_msg "WARNING: invalid mapset"] warning \
                     [format [G_msg "Warning: <%s> is not a valid mapset"] $mapset] \
                     0 OK;
-                }
-                if { $mapset != "" && [file exists "$database/$location/$mapset/WIND"] != 0} {
+                } else {
                     puts stdout "GISDBASE='$database';"
                     puts stdout "LOCATION_NAME='$location';"
                     puts stdout "MAPSET='$mapset';"
@@ -649,12 +652,11 @@
 				0 OK;
 			set mapset ""
             } else {
-                if {[file exists "$database/$location/$mapset/WIND"] == 0} {
+                if {[CheckMapset] == 0} {
                     DialogGen .wrnDlg [G_msg "WARNING: invalid mapset"] warning \
                     [format [G_msg "Warning: <%%s> is not a valid mapset"] $mapset] \
                     0 OK;
-                }
-                if { $mapset != "" && [file exists "$database/$location/$mapset/WIND"] != 0} {
+                } else {
                     puts stdout "GISDBASE='$database';"
                     puts stdout "LOCATION_NAME='$location';"
                     puts stdout "MAPSET='$mapset';"



More information about the grass-commit mailing list