mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
added default value for ParameterSelection
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@114 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
This commit is contained in:
parent
84add0a7a1
commit
3765365254
@ -54,7 +54,7 @@ class GrassUtils:
|
|||||||
def grassHelpPath():
|
def grassHelpPath():
|
||||||
folder = SextanteConfig.getSetting(GrassUtils.GRASS_HELP_FOLDER)
|
folder = SextanteConfig.getSetting(GrassUtils.GRASS_HELP_FOLDER)
|
||||||
if folder == None:
|
if folder == None:
|
||||||
folder =""
|
folder = os.path.join(GrassUtils.grassPath(), "docs", "html")
|
||||||
|
|
||||||
return folder
|
return folder
|
||||||
|
|
||||||
|
@ -171,6 +171,7 @@ class Ui_ParametersDialog(object):
|
|||||||
elif isinstance(param, ParameterSelection):
|
elif isinstance(param, ParameterSelection):
|
||||||
item = QtGui.QComboBox()
|
item = QtGui.QComboBox()
|
||||||
item.addItems(param.options)
|
item.addItems(param.options)
|
||||||
|
item.setCurrentIndex(param.default)
|
||||||
elif isinstance(param, ParameterFixedTable):
|
elif isinstance(param, ParameterFixedTable):
|
||||||
item = FixedTablePanel(param)
|
item = FixedTablePanel(param)
|
||||||
elif isinstance(param, ParameterRange):
|
elif isinstance(param, ParameterRange):
|
||||||
|
@ -2,11 +2,12 @@ from sextante.parameters.Parameter import Parameter
|
|||||||
|
|
||||||
class ParameterSelection(Parameter):
|
class ParameterSelection(Parameter):
|
||||||
|
|
||||||
def __init__(self, name="", description="", options=[]):
|
def __init__(self, name="", description="", options=[], default = 0):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.description = description
|
self.description = description
|
||||||
self.options = options
|
self.options = options
|
||||||
self.value = None
|
self.value = None
|
||||||
|
self.default = default
|
||||||
|
|
||||||
def setValue(self, n):
|
def setValue(self, n):
|
||||||
try:
|
try:
|
||||||
@ -21,7 +22,10 @@ class ParameterSelection(Parameter):
|
|||||||
|
|
||||||
def deserialize(self, s):
|
def deserialize(self, s):
|
||||||
tokens = s.split("|")
|
tokens = s.split("|")
|
||||||
return ParameterSelection(tokens[0], tokens[1], tokens[2].split(";"))
|
if len(tokens) == 4:
|
||||||
|
return ParameterSelection(tokens[0], tokens[1], tokens[2].split(";"), int(tokens[3]))
|
||||||
|
else:
|
||||||
|
return ParameterSelection(tokens[0], tokens[1], tokens[2].split(";"))
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
return self.__module__.split(".")[-1] + "|" + self.name + "|" + self.description +\
|
return self.__module__.split(".")[-1] + "|" + self.name + "|" + self.description +\
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Slope, Aspect, Curvature
|
Slope, Aspect, Curvature
|
||||||
ta_morphometry
|
ta_morphometry
|
||||||
ParameterRaster|ELEVATION|Elevation|False
|
ParameterRaster|ELEVATION|Elevation|False
|
||||||
ParameterSelection|METHOD|Method|[0] Maximum Slope (Travis et al. 1975);[1] Maximum Triangle Slope (Tarboton 1997);[2] Least Squares Fitted Plane (Horn 1981, Costa-Cabral & Burgess 1996);[3] Fit 2.Degree Polynom (Bauer, Rohdenburg, Bork 1985);[4] Fit 2.Degree Polynom (Heerdegen & Beran 1982);[5] Fit 2.Degree Polynom (Zevenbergen & Thorne 1987);[6] Fit 3.Degree Polynom (Haralick 1983)
|
ParameterSelection|METHOD|Method|[0] Maximum Slope (Travis et al. 1975);[1] Maximum Triangle Slope (Tarboton 1997);[2] Least Squares Fitted Plane (Horn 1981, Costa-Cabral & Burgess 1996);[3] Fit 2.Degree Polynom (Bauer, Rohdenburg, Bork 1985);[4] Fit 2.Degree Polynom (Heerdegen & Beran 1982);[5] Fit 2.Degree Polynom (Zevenbergen & Thorne 1987);[6] Fit 3.Degree Polynom (Haralick 1983)|5
|
||||||
OutputRaster|SLOPE|Slope
|
OutputRaster|SLOPE|Slope
|
||||||
OutputRaster|ASPECT|Aspect
|
OutputRaster|ASPECT|Aspect
|
||||||
OutputRaster|CURV|Curvature
|
OutputRaster|CURV|Curvature
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from sextante.script.ScriptAlgorithm import ScriptAlgorithm
|
from sextante.script.ScriptAlgorithm import ScriptAlgorithm
|
||||||
from sextante.gui.ContextAction import ContextAction
|
from sextante.gui.ContextAction import ContextAction
|
||||||
|
import os
|
||||||
|
|
||||||
class DeleteScriptAction(ContextAction):
|
class DeleteScriptAction(ContextAction):
|
||||||
|
|
||||||
@ -10,4 +11,5 @@ class DeleteScriptAction(ContextAction):
|
|||||||
return isinstance(self.alg, ScriptAlgorithm)
|
return isinstance(self.alg, ScriptAlgorithm)
|
||||||
|
|
||||||
def execute(self, alg):
|
def execute(self, alg):
|
||||||
pass
|
os.remove(self.alg.descriptionFile)
|
||||||
|
self.toolbox.updateTree()
|
@ -104,10 +104,10 @@ class ScriptAlgorithm(GeoAlgorithm):
|
|||||||
out = OutputTable()
|
out = OutputTable()
|
||||||
elif tokens[1].lower().strip().startswith("output html"):
|
elif tokens[1].lower().strip().startswith("output html"):
|
||||||
out = OutputHTML()
|
out = OutputHTML()
|
||||||
elif tokens[1].lower().strip().startswith("output number"):
|
#=======================================================================
|
||||||
out = OutputNumber()
|
# elif tokens[1].lower().strip().startswith("output number"):
|
||||||
|
# out = OutputNumber()
|
||||||
|
#=======================================================================
|
||||||
|
|
||||||
if param != None:
|
if param != None:
|
||||||
self.addParameter(param)
|
self.addParameter(param)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user