Navigation Menu

Skip to content

Commit

Permalink
fixed encoding problem in log
Browse files Browse the repository at this point in the history
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@228 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
volayaf committed Jun 7, 2012
1 parent bbefe6d commit 9718b9f
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 16 deletions.
15 changes: 8 additions & 7 deletions src/sextante/core/SextanteLog.py
@@ -1,6 +1,7 @@
import datetime
import os
from sextante.core.SextanteUtils import SextanteUtils
import codecs
class SextanteLog():

LOG_ERROR = "ERROR"
Expand Down Expand Up @@ -32,16 +33,16 @@ def addToLog(msgtype, msg):
text+=msg[i].strip("\n") + "|"
text = text[:-1]
else:
text = str(msg).replace("\n", "|")
text = unicode(msg).replace("\n", "|")
line = msgtype + "|" + datetime.datetime.now().strftime("%a %b %d %Y %H:%M:%S") + "|" + text + "\n"
logfile = open(SextanteLog.logFilename(), "a")
logfile = codecs.open(SextanteLog.logFilename(), "a", encoding='utf-8')
logfile.write(line)
logfile.close()
if msgtype==SextanteLog.LOG_ALGORITHM:
algname = text[len("Sextante.runalg(\""):]
algname = algname[:algname.index("\"")]
if algname not in SextanteLog.recentAlgs:
SextanteLog.recentAlgs.append(algname)
algname = text[len("Sextante.runalg(\""):]
algname = algname[:algname.index("\"")]
if algname not in SextanteLog.recentAlgs:
SextanteLog.recentAlgs.append(algname)


@staticmethod
Expand All @@ -51,7 +52,7 @@ def getLogEntries():
algorithms=[]
warnings=[]
info=[]
lines = open(SextanteLog.logFilename())
lines = codecs.open(SextanteLog.logFilename(), encoding='utf-8')
line = lines.readline()
while line != "":
line = line.strip("\n").strip()
Expand Down
3 changes: 2 additions & 1 deletion src/sextante/grass/GrassAlgorithm.py
Expand Up @@ -302,4 +302,5 @@ def getTempFilename(self):
filename = "tmp" + str(time.time()).replace(".","") + str(SextanteUtils.getNumExportedLayers())
return filename


def commandLineName(self):
return "grass:" + self.name[:self.name.find(" ")]
6 changes: 3 additions & 3 deletions src/sextante/grass/description/i.rgb.his.txt
@@ -1,9 +1,9 @@
i.rgb.his
i.rgb.his - Transforms raster maps from RGB (Red-Green-Blue) color space to HIS (Hue-Intensity-Saturation) color space.
Imagery (i.*)
ParameterRaster|red_output|Name for input raster map (red)
ParameterRaster|green_output|Name for input raster map (green)
ParameterRaster|blue_output|Name for input raster map (blue)
ParameterRaster|red_output|Name for input raster map (red)|True
ParameterRaster|green_output|Name for input raster map (green)|True
ParameterRaster|blue_output|Name for input raster map (blue)|True
OutputRaster|hue_input|Name of output raster map (hue)|False
OutputRaster|intensity_input|Name of output raster map (intensity)|False
OutputRaster|saturation_input|Name of output raster map (saturation)|False
4 changes: 2 additions & 2 deletions src/sextante/grass/description/r.resamp.rst.txt
Expand Up @@ -2,8 +2,8 @@ r.resamp.rst
r.resamp.rst - Reinterpolates and optionally computes topographic analysis using regularized spline with tension and smoothing.
Raster (r.*)
ParameterRaster|input|Name of input raster map|False
ParameterNumber|ew_res|Desired east-west resolution|0.0|None|
ParameterNumber|ns_res|Desired north-south resolution|0.0|None|
ParameterNumber|ew_res|Desired east-west resolution|0.0|None|1
ParameterNumber|ns_res|Desired north-south resolution|0.0|None|1
ParameterBoolean|-t|Use dnorm independent tension|False
ParameterBoolean|-d|Output partial derivatives instead of topographic parameters|False
OutputRaster|elev|Output z-file (elevation) map
6 changes: 3 additions & 3 deletions src/sextante/grass/description/v.out.pov.txt
Expand Up @@ -3,7 +3,7 @@ v.out.pov - Converts to POV-Ray format, GRASS x,y,z -> POV-Ray x,z,y
Vector (v.*)
ParameterVector|input|Name of input vector map|-1|False
ParameterString|type|Feature type|point,line,area,face
OutputFile|output|Output file|
ParameterString|size|Radius of sphere for points and tube for lines|10
ParameterNumer|size|Radius of sphere for points and tube for lines|0|None|10.0
ParameterString|zmod|Modifier for z coordinates, this string is appended to each z coordinate|
ParameterString|objmod|Object modifier (OBJECT_MODIFIER in POV-Ray documentation)
ParameterString|objmod|Object modifier (OBJECT_MODIFIER in POV-Ray documentation)|
OutputFile|output|Output file
2 changes: 2 additions & 0 deletions src/sextante/gui/ParametersDialog.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python
# -*- coding: latin-1 -*-
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4 import QtCore, QtGui, QtWebKit
Expand Down

0 comments on commit 9718b9f

Please sign in to comment.