Skip to content
Permalink
Browse files
changed str() with unicode(), to avoid problems with files in non-asc…
…ii paths

git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@166 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
volayaf committed May 6, 2012
1 parent cc90933 commit dc8668293758e9f76084cc7f15271e508eaa7e90
@@ -50,7 +50,7 @@ def getIcon(self):

def helpFile(self):
'''Returns the path to the help file with the description of this algorithm.
It should be an HTML file'''
It should be an HTML file. Returns None if there is no help file available'''
return None

def processAlgorithm(self):
@@ -11,7 +11,7 @@
from sextante.ftools import ftools_utils
from sextante.core.SextanteLog import SextanteLog

class Union(GeoAlgorithm):
class Union(GeoAlgorithm):

INPUT = "INPUT"
INPUT2 = "INPUT2"
@@ -390,6 +390,12 @@ def hasDependencies(self, element, elementIndex):

return False

def helpfile(self):
helpfile = self.descriptionFile + ".help"
if os.path.exists(helpfile):
return helpfile
else:
return None

class AlgorithmAndParameter():

@@ -1,6 +1,5 @@
from sextante.parameters.Parameter import Parameter
from sextante.core.SextanteUtils import SextanteUtils
from sextante.core.QGisLayers import QGisLayers

class ParameterDataObject(Parameter):

@@ -9,6 +8,6 @@ def getValueAsCommandLineParameter(self):
return str(None)
else:
if not SextanteUtils.isWindows():
return "\"" + str(self.value) + "\""
return "\"" + unicode(self.value) + "\""
else:
return "\"" + str(self.value).replace("\\", "\\\\") + "\""
return "\"" + unicode(self.value).replace("\\", "\\\\") + "\""
@@ -49,7 +49,7 @@ def setValue(self, obj):
self.value = s;
return True
else:
self.value = str(obj)
self.value = unicode(obj)
return True

def getSafeExportedLayers(self):
@@ -91,23 +91,23 @@ def getSafeExportedLayers(self):
def getAsString(self,value):
if self.datatype == ParameterMultipleInput.TYPE_RASTER:
if isinstance(value, QgsRasterLayer):
return str(value.dataProvider().dataSourceUri())
return unicode(value.dataProvider().dataSourceUri())
else:
s = str(value)
s = unicode(value)
layers = QGisLayers.getRasterLayers()
for layer in layers:
if layer.name() == s:
return str(layer.dataProvider().dataSourceUri())
return unicode(layer.dataProvider().dataSourceUri())
return s
else:
if isinstance(value, QgsVectorLayer):
return str(value.source())
return unicode(value.source())
else:
s = str(value)
s = unicode(value)
layers = QGisLayers.getVectorLayers(self.datatype)
for layer in layers:
if layer.name() == s:
return str(layer.source())
return unicode(layer.source())
return s


@@ -39,14 +39,14 @@ def setValue(self, obj):
else:
return False
if isinstance(obj, QgsRasterLayer):
self.value = str(obj.dataProvider().dataSourceUri())
self.value = unicode(obj.dataProvider().dataSourceUri())
return True
else:
self.value = str(obj)
self.value = unicode(obj)
layers = QGisLayers.getRasterLayers()
for layer in layers:
if layer.name() == self.value:
self.value = str(layer.dataProvider().dataSourceUri())
self.value = unicode(layer.dataProvider().dataSourceUri())
return True
return True

@@ -17,7 +17,7 @@ def setValue(self, obj):
else:
return False
if isinstance(obj, QgsVectorLayer):
source = str(obj.source())
source = unicode(obj.source())
if source.endswith("dbf") or source.endswith("csv"):
self.value = source
return True
@@ -27,11 +27,11 @@ def setValue(self, obj):
layers = QGisLayers.getVectorLayers()
for layer in layers:
if layer.name() == self.value:
source = str(layer.source())
source = unicode(layer.source())
if source.endswith("dbf") or source.endswith("csv"):
self.value = source
return True
val = str(obj)
val = unicode(obj)
if val.endswith("dbf") or val.endswith("csv"):
self.value = val
return True
@@ -26,14 +26,14 @@ def setValue(self, obj):
else:
return False
if isinstance(obj, QgsVectorLayer):
self.value = str(obj.source())
self.value = unicode(obj.source())
return True
else:
self.value = str(obj)
self.value = unicode(obj)
layers = QGisLayers.getVectorLayers(self.shapetype)
for layer in layers:
if layer.name() == self.value:
self.value = str(layer.source())
self.value = unicode(layer.source())
return True
return True

0 comments on commit dc86682

Please sign in to comment.