@@ -73,8 +73,8 @@ def createGrassScript(commands):
7373
7474 #temporary gisrc file
7575 output = open (gisrc , "w" )
76- mapset = "temp_mapset"
7776 location = "temp_location"
77+ mapset = "user"
7878 gisdbase = os .path .join (os .path .expanduser ("~" ), "sextante" , "tempdata" , "grassdata" )
7979 output .write ("GISDBASE: " + gisdbase + "\n " );
8080 output .write ("LOCATION_NAME: " + location + "\n " );
@@ -83,11 +83,10 @@ def createGrassScript(commands):
8383 output .close ();
8484
8585 output = open (script , "w" )
86- shToolsPath = os .path .basename (shell )
8786 output .write ("set HOME=" + os .path .expanduser ("~" ) + "\n " );
8887 output .write ("set GISRC=" + gisrc + "\n " )
89- output .write ("set GRASS_SH=" + shell + "\n " )
90- output .write ("set PATH=" + shToolsPath + os .sep + "bin;" + shToolsPath + os .sep + "lib;" + "%PATH%\n " )
88+ output .write ("set GRASS_SH=" + shell + "\\ bin \\ sh.exe \ n " )
89+ output .write ("set PATH=" + shell + os .sep + "bin;" + shell + os .sep + "lib;" + "%PATH%\n " )
9190 output .write ("set WINGISBASE=" + folder + "\n " )
9291 output .write ("set GISBASE=" + folder + "\n " );
9392 output .write ("set GRASS_PROJSHARE=" + folder + os .sep + "share" + os .sep + "proj" + "\n " )
@@ -104,9 +103,9 @@ def createGrassScript(commands):
104103 output .write ("set PATHEXT=%PATHEXT%;.PY\n " )
105104 output .write ("set PYTHONPATH=%PYTHONPATH%;%WINGISBASE%\\ etc\\ python;%WINGISBASE%\\ etc\\ wxpython\\ n" );
106105 output .write ("\n " )
107- output .write ("g.gisenv.exe set=\" MAPSET=" + mapset + " \ "\n " )
108- output .write ("g.gisenv.exe set=\" LOCATION=" + location + "\" \ n " )
109- output .write ("g.gisenv.exe set=\" LOCATION_NAME=" + location + "\" \ n " )
106+ output .write ("g.gisenv.exe set=\" MAPSET= " + mapset + "\n " )
107+ output .write ("g.gisenv.exe set=\" LOCATION=" + location + "\n " )
108+ output .write ("g.gisenv.exe set=\" LOCATION_NAME=" + location + "\n " )
110109 output .write ("g.gisenv.exe set=\" GISDBASE=" + gisdbase + "\" \n " )
111110 output .write ("g.gisenv.exe set=\" GRASS_GUI=text\" \n " )
112111 for command in commands :
@@ -125,7 +124,7 @@ def createGrassBatchJobFileFromGrassCommands(commands):
125124
126125 @staticmethod
127126 def grassMapsetFolder ():
128- tempfolder = os .path .join (os .path .expanduser ("~" ), "sextante" , "tempdata" , "grassdata" , "temp_location" , "temp_mapset" )
127+ tempfolder = os .path .join (os .path .expanduser ("~" ), "sextante" , "tempdata" , "grassdata" , "temp_location" )
129128 mkdir (tempfolder )
130129 return tempfolder
131130
@@ -141,7 +140,7 @@ def createTempMapset():
141140 mkdir (os .path .join (folder , "PERMANENT" ))
142141 mkdir (os .path .join (folder , "user" ))
143142 mkdir (os .path .join (folder , "PERMANENT" , ".tmp" ))
144- mkdir (os .path .join (folder , "PERMANENT" , "DEFAULT_WIND" ))
143+ GrassUtils . writeGrassWindow (os .path .join (folder , "PERMANENT" , "DEFAULT_WIND" ));
145144 outfile = open (os .path .join (folder , "PERMANENT" , "MYNAME" ), "w" )
146145 if not latlon :
147146 outfile .write ("SEXTANTE GRASS interface: temporary x/y data processing location.\n " );
@@ -229,10 +228,11 @@ def executeGrass(commands, progress):
229228 for line in iter (proc .readline , "" ):
230229 if "GRASS_INFO_PERCENT" in line :
231230 try :
232- progress .setPercentage (line [line . rfind ( ":" ) + 2 :])
231+ progress .setPercentage (int ( line [len ( "GRASS_INFO_PERCENT" ) + 2 :]) )
233232 except :
234233 pass
235- loglines .append (line )
234+ else :
235+ loglines .append (line )
236236 SextanteLog .addToLog (SextanteLog .LOG_INFO , loglines )
237237 shutil .rmtree (GrassUtils .grassMapsetFolder (), True )
238238
0 commit comments