Skip to content
Permalink
Browse files
added r histogram script
fixed bug in r script editor
fixed bug in modeler when using lagorithms with optional raster layers

git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@178 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
volayaf committed May 9, 2012
1 parent 6d6331d commit a8651bc8bdbab739849ae6a111c553455ff25c90
Showing with 10 additions and 6 deletions.
  1. +1 −2 src/sextante/modeler/ModelerAlgorithm.py
  2. +5 −3 src/sextante/r/EditRScriptDialog.py
  3. +1 −1 src/sextante/r/RAlgorithm.py
  4. +3 −0 src/sextante/r/scripts/Raster_histogram.rsx
@@ -281,8 +281,7 @@ def getAsPythonCode(self):
aap = self.algParameters[i][param.name]
if aap == None:
runline += ", None"

if isinstance(param, ParameterMultipleInput):
elif isinstance(param, ParameterMultipleInput):
value = self.paramValues[aap.param]
tokens = value.split(";")
layerslist = []
@@ -12,9 +12,11 @@ def __init__(self, alg):
self.setModal(True)
self.setupUi()
self.update = False
self.help = None

def setupUi(self):
self.setWindowTitle("Edit script")
self.resize(600, 350)
layout = QVBoxLayout()
self.text = QtGui.QTextEdit()
self.text.setObjectName("text")
@@ -48,20 +50,20 @@ def saveAlgorithm(self):
filename = QtGui.QFileDialog.getSaveFileName(self, "Save Script", RUtils.RScriptsFolder(), "R-SEXTANTE scripts (*.rsx)")

if filename:
self.alg.descriptionFile = filename
#self.alg.descriptionFile = filename
text = self.text.toPlainText()
fout = open(filename, "w")
fout.write(text)
fout.close()
self.update = True
#if help strings were defined before saving the model for the first time, we do it here
if self.help:
f = open(self.alg.descriptionFile + ".help", "wb")
f = open(filename + ".help", "wb")
pickle.dump(self.help, f)
f.close()
self.help = None
QtGui.QMessageBox.information(self, "Script saving", "Script was correctly saved.")
#self.close()
self.close()

def cancelPressed(self):
self.update = False
@@ -213,7 +213,7 @@ def getImportCommands(self):
if isinstance(param, ParameterRaster):
value = param.value
value = value.replace("\\", "/")
commands.append(param.name + " = " + "readGDAL(\"" + value + "\"")
commands.append(param.name + " = " + "readGDAL(\"" + value + "\")")
if isinstance(param, ParameterVector):
value = param.getSafeExportedLayer()
value = value.replace("\\", "/")
@@ -0,0 +1,3 @@
##layer = raster
##showplots
hist(as.matrix(layer))

0 comments on commit a8651bc

Please sign in to comment.