Skip to content
Permalink
Browse files

fixed encoding problem in log

git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@228 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
volayaf
volayaf committed Jun 7, 2012
1 parent bbefe6d commit 9718b9fdb3d86e60bd8e05cca5b5137e8e83ee23
@@ -1,6 +1,7 @@
import datetime
import os
from sextante.core.SextanteUtils import SextanteUtils
import codecs
class SextanteLog():

LOG_ERROR = "ERROR"
@@ -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
@@ -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()
@@ -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(" ")]
@@ -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
@@ -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
@@ -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
@@ -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

0 comments on commit 9718b9f

Please sign in to comment.
You can’t perform that action at this time.