Skip to content

Commit 1549f09

Browse files
committed
fixed #6376
partially fixed #6374
1 parent 9d8b9fc commit 1549f09

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

python/plugins/sextante/modeler/ModelerAlgorithm.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
class ModelerAlgorithm(GeoAlgorithm):
2323

2424
CANVAS_SIZE = 4000
25+
LINE_BREAK_STRING="%%%"
2526

2627
def getCopy(self):
2728
newone = ModelerAlgorithm()
@@ -89,8 +90,9 @@ def openModel(self, filename):
8990
self.paramPos.append(QtCore.QPointF(float(tokens[0]), float(tokens[1])))
9091
elif line.startswith("VALUE:"):
9192
valueLine = line[len("VALUE:"):]
92-
tokens = valueLine.split("=")
93-
self.paramValues[tokens[0]] = tokens[1]
93+
tokens = valueLine.split("===")
94+
95+
self.paramValues[tokens[0]] = tokens[1].replace(ModelerAlgorithm.LINE_BREAK_STRING, '\n')
9496
elif line.startswith("NAME:"):
9597
self.name = line[len("NAME:"):]
9698
elif line.startswith("GROUP:"):
@@ -289,7 +291,7 @@ def serialize(self):
289291
s += str(pt.x()) + "," + str(pt.y()) + "\n"
290292
i+=1
291293
for key in self.paramValues.keys():
292-
s += "VALUE:" + key + "=" + str(self.paramValues[key]) + "\n"
294+
s += "VALUE:" + key + "===" + str(self.paramValues[key]).replace('\n', ModelerAlgorithm.LINE_BREAK_STRING) + "\n"
293295
for i in range(len(self.algs)):
294296
alg = self.algs[i]
295297
s+="ALGORITHM:" + alg.commandLineName()+"\n"

python/plugins/sextante/parameters/ParameterFixedTable.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ def __init__(self, name="", description="", cols=["value"], numRows=3, fixedNumO
99
self.fixedNumOfRows = fixedNumOfRows
1010
self.value = None
1111

12-
def setValue(self, obj):
13-
##TODO: check that it contains a correct number of elements
14-
if isinstance(obj, str):
12+
def setValue(self, obj):
13+
##TODO: check that it contains a correct number of elements
14+
if isinstance(obj, (str,unicode)):
1515
self.value = obj
1616
else:
1717
self.value = ParameterFixedTable.tableToString(obj)
@@ -21,7 +21,7 @@ def getValueAsCommandLineParameter(self):
2121
return "\"" + str(self.value) + "\""
2222

2323
@staticmethod
24-
def tableToString(table):
24+
def tableToString(table):
2525
tablestring = ""
2626
for i in range(len(table)):
2727
for j in range(len(table[0])):

python/plugins/sextante/saga/SagaAlgorithm.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from sextante.parameters.ParameterFactory import ParameterFactory
2020
from sextante.outputs.OutputFactory import OutputFactory
2121
from sextante.core.SextanteConfig import SextanteConfig
22+
from sextante.core.SextanteLog import SextanteLog
2223
from sextante.core.QGisLayers import QGisLayers
2324
from sextante.parameters.ParameterNumber import ParameterNumber
2425
from sextante.parameters.ParameterSelection import ParameterSelection
@@ -195,7 +196,7 @@ def processAlgorithm(self, progress):
195196
if layer:
196197
filename = LayerExporter.exportVectorLayer(layer)
197198
self.exportedLayers[layerfile]=filename
198-
elif (not value.endswith("shp")):
199+
elif (not layerfile.endswith("shp")):
199200
raise GeoAlgorithmExecutionException("Unsupported file format")
200201

201202
#2: set parameters and outputs
@@ -225,7 +226,7 @@ def processAlgorithm(self, progress):
225226
tempTableFile = SextanteUtils.getTempFilename("txt")
226227
f = open(tempTableFile, "w")
227228
f.write('\t'.join([col for col in param.cols]) + "\n")
228-
values = param.value.split(",")
229+
values = param.value.split(",")
229230
for i in range(0, len(values), 3):
230231
s = values[i] + "\t" + values[i+1] + "\t" + values[i+2] + "\n"
231232
f.write(s)

python/plugins/sextante/saga/help/PotentialIncomingSolarRadiation.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ <h2>Parameters</h2>
3636
<dt>Time Span [h] <div class='type'>Value range</div></dt><dd>Time span used for the calculation of daily radiation sums. <div class='constraints'>Minimum: 1.39579710889e-316; Maximum: 1.395734659e-316</div></dd>
3737
<dt>Time Resolution [h]: Day <div class='type'>Floating point</div></dt><dd>Time step size for a day's calculation given in hours. <div class='constraints'>Maximum: 24.0</div></dd>
3838
<dt>Time Resolution [d]: Range of Days <div class='type'>Integer</div></dt><dd>Time step size for a range of days calculation given in days. <div class='constraints'>Minimum: 1.0</div></dd>
39-
<dt>Update <div class='type'>Choice</div></dt><dd>show direct insolation for each time step. <div class='constraints'>Available choices: do not update, update, color stretch for each time step, update, fixed color stretch</div></dd>
39+
<dt>Update <div class='type'>Choice</div></dt><dd>show direct insolation for each time step. <div class='constraints'>Available choices: do not update, update, colour stretch for each time step, update, fixed colour stretch</div></dd>
4040
<dt>Day of Year <div class='type'>Node</div></dt><dd> <div class='constraints'></div></dd>
4141
<dt>Day of Month <div class='type'>Choice</div></dt><dd> <div class='constraints'>Available choices: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31</div></dd>
4242
<dt>Month <div class='type'>Choice</div></dt><dd> <div class='constraints'>Available choices: January, February, March, April, May, June, July, August, September, October, November, December</div></dd>

0 commit comments

Comments
 (0)