Skip to content

Commit

Permalink
changed str() with unicode(), to avoid problems with files in non-asc…
Browse files Browse the repository at this point in the history
…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 dc86682
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/sextante/core/GeoAlgorithm.py
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion src/sextante/ftools/Union.py
Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions src/sextante/modeler/ModelerAlgorithm.py
Expand Up @@ -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():

Expand Down
5 changes: 2 additions & 3 deletions src/sextante/parameters/ParameterDataObject.py
@@ -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):

Expand All @@ -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("\\", "\\\\") + "\""
14 changes: 7 additions & 7 deletions src/sextante/parameters/ParameterMultipleInput.py
Expand Up @@ -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):
Expand Down Expand Up @@ -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


Expand Down
6 changes: 3 additions & 3 deletions src/sextante/parameters/ParameterRaster.py
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions src/sextante/parameters/ParameterTable.py
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/sextante/parameters/ParameterVector.py
Expand Up @@ -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

Expand Down

0 comments on commit dc86682

Please sign in to comment.