Skip to content

Commit

Permalink
fixed #6376
Browse files Browse the repository at this point in the history
partially fixed #6374
  • Loading branch information
volaya committed Oct 2, 2012
1 parent 9d8b9fc commit 1549f09
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
8 changes: 5 additions & 3 deletions python/plugins/sextante/modeler/ModelerAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
class ModelerAlgorithm(GeoAlgorithm):

CANVAS_SIZE = 4000
LINE_BREAK_STRING="%%%"

def getCopy(self):
newone = ModelerAlgorithm()
Expand Down Expand Up @@ -89,8 +90,9 @@ def openModel(self, filename):
self.paramPos.append(QtCore.QPointF(float(tokens[0]), float(tokens[1])))
elif line.startswith("VALUE:"):
valueLine = line[len("VALUE:"):]
tokens = valueLine.split("=")
self.paramValues[tokens[0]] = tokens[1]
tokens = valueLine.split("===")

self.paramValues[tokens[0]] = tokens[1].replace(ModelerAlgorithm.LINE_BREAK_STRING, '\n')
elif line.startswith("NAME:"):
self.name = line[len("NAME:"):]
elif line.startswith("GROUP:"):
Expand Down Expand Up @@ -289,7 +291,7 @@ def serialize(self):
s += str(pt.x()) + "," + str(pt.y()) + "\n"
i+=1
for key in self.paramValues.keys():
s += "VALUE:" + key + "=" + str(self.paramValues[key]) + "\n"
s += "VALUE:" + key + "===" + str(self.paramValues[key]).replace('\n', ModelerAlgorithm.LINE_BREAK_STRING) + "\n"
for i in range(len(self.algs)):
alg = self.algs[i]
s+="ALGORITHM:" + alg.commandLineName()+"\n"
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/sextante/parameters/ParameterFixedTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ def __init__(self, name="", description="", cols=["value"], numRows=3, fixedNumO
self.fixedNumOfRows = fixedNumOfRows
self.value = None

def setValue(self, obj):
##TODO: check that it contains a correct number of elements
if isinstance(obj, str):
def setValue(self, obj):
##TODO: check that it contains a correct number of elements
if isinstance(obj, (str,unicode)):
self.value = obj
else:
self.value = ParameterFixedTable.tableToString(obj)
Expand All @@ -21,7 +21,7 @@ def getValueAsCommandLineParameter(self):
return "\"" + str(self.value) + "\""

@staticmethod
def tableToString(table):
def tableToString(table):
tablestring = ""
for i in range(len(table)):
for j in range(len(table[0])):
Expand Down
5 changes: 3 additions & 2 deletions python/plugins/sextante/saga/SagaAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from sextante.parameters.ParameterFactory import ParameterFactory
from sextante.outputs.OutputFactory import OutputFactory
from sextante.core.SextanteConfig import SextanteConfig
from sextante.core.SextanteLog import SextanteLog
from sextante.core.QGisLayers import QGisLayers
from sextante.parameters.ParameterNumber import ParameterNumber
from sextante.parameters.ParameterSelection import ParameterSelection
Expand Down Expand Up @@ -195,7 +196,7 @@ def processAlgorithm(self, progress):
if layer:
filename = LayerExporter.exportVectorLayer(layer)
self.exportedLayers[layerfile]=filename
elif (not value.endswith("shp")):
elif (not layerfile.endswith("shp")):
raise GeoAlgorithmExecutionException("Unsupported file format")

#2: set parameters and outputs
Expand Down Expand Up @@ -225,7 +226,7 @@ def processAlgorithm(self, progress):
tempTableFile = SextanteUtils.getTempFilename("txt")
f = open(tempTableFile, "w")
f.write('\t'.join([col for col in param.cols]) + "\n")
values = param.value.split(",")
values = param.value.split(",")
for i in range(0, len(values), 3):
s = values[i] + "\t" + values[i+1] + "\t" + values[i+2] + "\n"
f.write(s)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ <h2>Parameters</h2>
<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>
<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>
<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>
<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>
<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>
<dt>Day of Year <div class='type'>Node</div></dt><dd> <div class='constraints'></div></dd>
<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>
<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>
Expand Down

0 comments on commit 1549f09

Please sign in to comment.