Severql bug fixes qnd smqll improvements in qgis bindings

git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@43 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
This commit is contained in:
volayaf 2012-03-17 23:10:46 +00:00
parent 18650971be
commit e4554d5c53
42 changed files with 574 additions and 300 deletions

View File

@ -2,6 +2,9 @@
<?eclipse-pydev version="1.0"?>
<pydev_project>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
<path>/sextante/src</path>
</pydev_pathproperty>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
</pydev_project>

View File

@ -13,6 +13,8 @@ from sextante.core.SextanteUtils import SextanteUtils
from sextante.gui.ConfigDialog import ConfigDialog
from sextante.modeler.ModelerDialog import ModelerDialog
from sextante.gui.ResultsDialog import ResultsDialog
from sextante.about.AboutDialog import AboutDialog
import subprocess
cmd_folder = os.path.split(inspect.getfile( inspect.currentframe() ))[0]
if cmd_folder not in sys.path:
@ -63,6 +65,20 @@ class SextantePlugin:
QObject.connect(self.resultsAction, SIGNAL("triggered()"), self.openResults)
self.menu.addAction(self.resultsAction)
icon = QIcon(os.path.dirname(__file__) + "/images/help.png")
self.helpAction = QAction(icon, \
"&SEXTANTE help", self.iface.mainWindow())
QObject.connect(self.helpAction, SIGNAL("triggered()"), self.openHelp)
self.menu.addAction(self.helpAction)
icon = QIcon(os.path.dirname(__file__) + "/images/info.png")
self.aboutAction = QAction(icon, \
"&About SEXTANTE", self.iface.mainWindow())
QObject.connect(self.aboutAction, SIGNAL("triggered()"), self.openAbout)
self.menu.addAction(self.aboutAction)
menuBar = self.iface.mainWindow().menuBar()
menuBar.insertMenu(menuBar.actions()[-1], self.menu)
@ -102,4 +118,15 @@ class SextantePlugin:
dlg = ConfigDialog(self.toolbox)
dlg.exec_()
def openAbout(self):
dlg = AboutDialog()
dlg.exec_()
def openHelp(self):
filename = os.path.dirname(__file__) + "/manual.pdf"
if os.name == "nt":
os.startfile(filename)
else:
subprocess.call(('xdg-open', filename))

View File

@ -0,0 +1,28 @@
from PyQt4 import QtCore, QtGui, QtWebKit
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import os
class AboutDialog(QtGui.QDialog):
def __init__(self):
QtGui.QDialog.__init__(self)
self.setModal(True)
self.setupUi()
def setupUi(self):
self.setObjectName("AboutDialog")
self.resize(500, 400)
self.webView = QtWebKit.QWebView()
self.webView.setObjectName("webView")
self.setWindowTitle("About SEXTANTE")
self.horizontalLayout= QtGui.QHBoxLayout()
self.horizontalLayout.setSpacing(2)
self.horizontalLayout.setMargin(0)
self.horizontalLayout.setObjectName("horizontalLayout")
self.horizontalLayout.addWidget(self.webView)
self.setLayout(self.horizontalLayout)
filename = os.path.dirname(__file__) + "/about.htm"
url = QtCore.QUrl(filename)
self.webView.load(url)

View File

View File

@ -0,0 +1,13 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
<title>SEXTANTE Spatial Data Analysis Library</title>
</head>
<body>
<img src="sextante_logo.png" />
<h2>SEXTANTE for QGIS</h2>
<p>SEXTANTE, a geoprocessing platform for QGIS</p>
<p>A development by Victor Olaya (volayaf@gmail.com)</p>
<p>You are currently using SEXTANTE v1.0</p>
<p>For more information, please visit our website at <a href="http://sextantegis.com">http://sextantegis.com</a></p>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -78,6 +78,12 @@ class GeoAlgorithm:
if out.name == outputName:
out.value = value
def getOutputValuesAsDictionary(self):
d = {}
for out in self.outputs:
d[out.name] = out.value
return d
def canBeExecuted(self, layersCount):
return True
@ -108,12 +114,14 @@ class GeoAlgorithm:
def getParameterValue(self, name):
for param in self.parameters:
if param.name == name:
if isinstance(param, ParameterNumber):
return float(param.value)
elif isinstance(param, ParameterBoolean):
return param.value == str(True)
else:
return param.value
#===============================================================
# if isinstance(param, ParameterNumber):
# return float(param.value)
# elif isinstance(param, ParameterBoolean):
# return param.value == str(True)
# else:
#===============================================================
return param.value
return None
def getOutputValue(self, name):

View File

@ -201,7 +201,7 @@ class Sextante:
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
AlgorithmExecutor.runalg(alg, SilentProgress())
QApplication.restoreOverrideCursor()
return alg.getOuputsValuesAsMap()
return alg.getOutputValuesAsDictionary()
except GeoAlgorithmExecutionException, e:
print "*****Error executing algorithm*****"
print e.msg
@ -218,7 +218,6 @@ class Sextante:
def getObject(string):
QGisLayers.getObjectFromUri(string)
@staticmethod
def runandload(name, *args):
#a quick fix to call algorithms from the history dialog

View File

@ -28,7 +28,7 @@ class SextanteLog():
if isinstance(msg, list):
text=""
for i in range(0, len(msg)):
text+=msg[i] + "|"
text+=msg[i].strip("\n") + "|"
text = text[:-1]
else:
text = str(msg).replace("\n", "|")

View File

@ -0,0 +1,77 @@
from sextante.core.GeoAlgorithm import GeoAlgorithm
import os.path
from PyQt4 import QtGui
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
from sextante.parameters.ParameterVector import ParameterVector
from sextante.core.QGisLayers import QGisLayers
from sextante.outputs.OutputVector import OutputVector
class ExtentFromLayer(GeoAlgorithm):
INPUT = "INPUT"
OUTPUT = "OUTPUT"
def getIcon(self):
return QtGui.QIcon(os.path.dirname(__file__) + "/icons/layer_extent.png")
def processAlgorithm(self, progress):
settings = QSettings()
systemEncoding = settings.value( "/UI/encoding", "System" ).toString()
output = self.getOutputValue(ExtentFromLayer.OUTPUT)
vlayer = QGisLayers.getObjectFromUri(self.getParameterValue(ExtentFromLayer.INPUT))
fields = {
0 : QgsField( "MINX", QVariant.Double ),
1 : QgsField( "MINY", QVariant.Double ),
2 : QgsField( "MAXX", QVariant.Double ),
3 : QgsField( "MAXY", QVariant.Double ),
4 : QgsField( "CNTX", QVariant.Double ),
5 : QgsField( "CNTY", QVariant.Double ),
6 : QgsField( "AREA", QVariant.Double ),
7 : QgsField( "PERIM", QVariant.Double ),
8 : QgsField( "HEIGHT", QVariant.Double ),
9 : QgsField( "WIDTH", QVariant.Double ) }
writer = QgsVectorFileWriter(output, systemEncoding, fields, QGis.WKBPolygon, vlayer.crs() )
rect = vlayer.extent()
minx = rect.xMinimum()
miny = rect.yMinimum()
maxx = rect.xMaximum()
maxy = rect.yMaximum()
height = rect.height()
width = rect.width()
cntx = minx + ( width / 2.0 )
cnty = miny + ( height / 2.0 )
area = width * height
perim = ( 2 * width ) + (2 * height )
rect = [
QgsPoint( minx, miny ),
QgsPoint( minx, maxy ),
QgsPoint( maxx, maxy ),
QgsPoint( maxx, miny ),
QgsPoint( minx, miny ) ]
geometry = QgsGeometry().fromPolygon( [ rect ] )
feat = QgsFeature()
feat.setGeometry( geometry )
feat.setAttributeMap( {
0 : QVariant( minx ),
1 : QVariant( miny ),
2 : QVariant( maxx ),
3 : QVariant( maxy ),
4 : QVariant( cntx ),
5 : QVariant( cnty ),
6 : QVariant( area ),
7 : QVariant( perim ),
8 : QVariant( height ),
9 : QVariant( width ) } )
writer.addFeature( feat )
del writer
def defineCharacteristics(self):
self.name = "Extent from layer"
self.group = "Research tools"
self.addParameter(ParameterVector(ExtentFromLayer.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_ANY))
self.addOutput(OutputVector(ExtentFromLayer.OUTPUT, "Extent layer"))
#=========================================================

View File

@ -25,6 +25,10 @@ from sextante.ftools.Difference import Difference
from sextante.ftools.Intersection import Intersection
from sextante.ftools.Union import Union
from sextante.ftools.Clip import Clip
from sextante.ftools.ExtentFromLayer import ExtentFromLayer
from sextante.ftools.RandomSelection import RandomSelection
from sextante.ftools.SelectByLocation import SelectByLocation
from sextante.ftools.RandomSelectionWithinSubsets import RandomSelectionWithinSubsets
class FToolsAlgorithmProvider(AlgorithmProvider):
@ -41,7 +45,8 @@ class FToolsAlgorithmProvider(AlgorithmProvider):
SumLines(), BasicStatistics(), PointsInPolygon(),
NearestNeighbourAnalysis(), MeanCoords(), LinesIntersection(),
ConvexHull(), FixedDistanceBuffer(), VariableDistanceBuffer(),
Dissolve(), Difference(), Intersection(), Union(), Clip()]
Dissolve(), Difference(), Intersection(), Union(), Clip(), ExtentFromLayer(),
RandomSelection(), RandomSelectionWithinSubsets(), SelectByLocation()]
for alg in self.algs:
alg.provider = self

View File

@ -42,7 +42,7 @@ class PointsInPolygon(GeoAlgorithm):
index = polyProvider.fieldNameIndex(unicode(inField))
if index == -1:
index = polyProvider.fieldCount()
field = QgsField(unicode(inField), QVariant.Double, "real", 24, 15, self.tr("point count field"))
field = QgsField(unicode(inField), QVariant.Double, "real", 24, 15, "point count field")
fieldList[index] = field
sRs = polyProvider.crs()
check = QFile(self.shapefileName)

View File

@ -0,0 +1,46 @@
from sextante.core.GeoAlgorithm import GeoAlgorithm
import os.path
from PyQt4 import QtGui
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
from sextante.parameters.ParameterVector import ParameterVector
from sextante.core.QGisLayers import QGisLayers
from sextante.outputs.OutputVector import OutputVector
from sextante.parameters.ParameterSelection import ParameterSelection
from sextante.parameters.ParameterNumber import ParameterNumber
import random
class RandomSelection(GeoAlgorithm):
INPUT = "INPUT"
OUTPUT = "OUTPUT"
METHOD = "METHOD"
NUMBER = "NUMBER"
PERCENTAGE = "PERCENTAGE"
def getIcon(self):
return QtGui.QIcon(os.path.dirname(__file__) + "/icons/random_selection.png")
def processAlgorithm(self, progress):
filename = self.getParameterValue(RandomSelection.INPUT)
layer = QGisLayers.getObjectFromUri(filename)
method = self.getParameterValue(self.METHOD)
if method == 0:
value = int(self.getParameterValue(self.NUMBER))
else:
value = self.getParameterValue(self.PERCENTAGE)
value = int(round((value / 100.0000), 4) * layer.featureCount())
selran = random.sample(xrange(0, layer.featureCount()), value)
layer.setSelectedFeatures(selran)
self.setOutputValue(self.OUTPUT, filename)
def defineCharacteristics(self):
self.name = "Random selection"
self.group = "Research tools"
self.addParameter(ParameterVector(RandomSelection.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterSelection(RandomSelection.METHOD, "Method", ["Number of selected features", "Percentage of selected features"]))
self.addParameter(ParameterNumber(RandomSelection.NUMBER, "Number of selected features", 1, None, 10))
self.addParameter(ParameterNumber(RandomSelection.PERCENTAGE, "Percentage of selected features", 0, 100, 50))
self.addOutput(OutputVector(RandomSelection.OUTPUT, "Selection", True))

View File

@ -0,0 +1,78 @@
from sextante.core.GeoAlgorithm import GeoAlgorithm
import os.path
from PyQt4 import QtGui
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
from sextante.parameters.ParameterVector import ParameterVector
from sextante.core.QGisLayers import QGisLayers
from sextante.outputs.OutputVector import OutputVector
from sextante.parameters.ParameterSelection import ParameterSelection
from sextante.parameters.ParameterNumber import ParameterNumber
import random
from sextante.parameters.ParameterTableField import ParameterTableField
from sextante.ftools import ftools_utils
class RandomSelectionWithinSubsets(GeoAlgorithm):
INPUT = "INPUT"
OUTPUT = "OUTPUT"
METHOD = "METHOD"
NUMBER = "NUMBER"
PERCENTAGE = "PERCENTAGE"
FIELD = "FIELD"
def getIcon(self):
return QtGui.QIcon(os.path.dirname(__file__) + "/icons/random_selection.png")
def processAlgorithm(self, progress):
method = self.getParameterValue(self.METHOD)
field = self.getParameterValue(RandomSelectionWithinSubsets.FIELD)
filename = self.getParameterValue(RandomSelectionWithinSubsets.INPUT)
vlayer = QGisLayers.getObjectFromUri(filename)
vlayer.removeSelection(True)
vprovider = vlayer.dataProvider()
allAttrs = vprovider.attributeIndexes()
vprovider.select(allAttrs)
index = vprovider.fieldNameIndex(field)
unique = ftools_utils.getUniqueValues(vprovider, int(index))
inFeat = QgsFeature()
selran = []
nFeat = vprovider.featureCount() * len(unique)
nElement = 0
if not len(unique) == vlayer.featureCount():
for i in unique:
vprovider.rewind()
FIDs= []
while vprovider.nextFeature(inFeat):
atMap = inFeat.attributeMap()
if atMap[index] == QVariant(i):
FID = inFeat.id()
FIDs.append(FID)
nElement += 1
progress.setPercentage(nElement/nFeat * 100)
if method == 0:
value = int(self.getParameterValue(self.NUMBER))
else:
value = self.getParameterValue(self.PERCENTAGE)
value = int(round((value / 100.0000) * len(FIDs), 0))
if value >= len(FIDs):
selFeat = FIDs
else:
selFeat = random.sample(FIDs, value)
selran.extend(selFeat)
vlayer.setSelectedFeatures(selran)
else:
vlayer.setSelectedFeatures(range(0, vlayer.featureCount()))
self.setOutputValue(RandomSelectionWithinSubsets.OUTPUT, filename)
def defineCharacteristics(self):
self.name = "Random selection within subsets"
self.group = "Research tools"
self.addParameter(ParameterVector(RandomSelectionWithinSubsets.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterTableField(RandomSelectionWithinSubsets.FIELD, "ID Field", RandomSelectionWithinSubsets.INPUT))
self.addParameter(ParameterSelection(RandomSelectionWithinSubsets.METHOD, "Method", ["Number of selected features", "Percentage of selected features"]))
self.addParameter(ParameterNumber(RandomSelectionWithinSubsets.NUMBER, "Number of selected features", 1, None, 10))
self.addParameter(ParameterNumber(RandomSelectionWithinSubsets.PERCENTAGE, "Percentage of selected features", 0, 100, 50))
self.addOutput(OutputVector(RandomSelectionWithinSubsets.OUTPUT, "Selection", True))

View File

@ -0,0 +1,85 @@
from sextante.core.GeoAlgorithm import GeoAlgorithm
import os.path
from PyQt4 import QtGui
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
from sextante.parameters.ParameterVector import ParameterVector
from sextante.core.QGisLayers import QGisLayers
from sextante.outputs.OutputVector import OutputVector
from sextante.parameters.ParameterSelection import ParameterSelection
from sextante.parameters.ParameterBoolean import ParameterBoolean
from sextante.ftools import ftools_utils
class SelectByLocation(GeoAlgorithm):
INPUT = "INPUT"
INTERSECT = "INTERSECT"
METHOD = "METHOD"
USE_SELECTED = "USE_SELECTED"
OUTPUT = "OUTPUT"
def getIcon(self):
return QtGui.QIcon(os.path.dirname(__file__) + "/icons/select_location.png")
def processAlgorithm(self, progress):
method = self.getParameterValue(self.METHOD)
selection = self.getParameterValue(self.USE_SELECTED)
filename = self.getParameterValue(SelectByLocation.INPUT)
inputLayer = QGisLayers.getObjectFromUri(filename)
filename = self.getParameterValue(SelectByLocation.INTERSECT)
selectLayer = QGisLayers.getObjectFromUri(filename)
inputProvider = inputLayer.dataProvider()
allAttrs = inputProvider.attributeIndexes()
inputProvider.select(allAttrs, QgsRectangle())
selectProvider = selectLayer.dataProvider()
allAttrs = selectProvider.attributeIndexes()
selectProvider.select(allAttrs, QgsRectangle())
feat = QgsFeature()
infeat = QgsFeature()
geom = QgsGeometry()
selectedSet = []
index = ftools_utils.createIndex(inputProvider)
if selection:
features = selectLayer.selectedFeatures()
featurescount = len(features)
i = 0
for feat in features:
geom = QgsGeometry(feat.geometry())
intersects = index.intersects(geom.boundingBox())
for id in intersects:
inputProvider.featureAtId(int(id), infeat, True)
tmpGeom = QgsGeometry(infeat.geometry())
if geom.intersects(tmpGeom):
selectedSet.append(infeat.id())
i += 1
progress.setPercentage(i/featurescount * 100)
else:
featurescount = selectProvider.featureCount()
while selectProvider.nextFeature(feat):
geom = QgsGeometry(feat.geometry())
intersects = index.intersects(geom.boundingBox())
i = 0
for iid in intersects:
inputProvider.featureAtId(int(iid), infeat, True)
tmpGeom = QgsGeometry( infeat.geometry() )
if geom.intersects(tmpGeom):
selectedSet.append(infeat.id())
i += 1
progress.setPercentage(i/featurescount * 100)
if method == 1:
selectedSet = list(set(inputLayer.selectedFeaturesIds()).union(selectedSet))
elif method == 2:
selectedSet = list(set(inputLayer.selectedFeaturesIds()).difference(selectedSet))
inputLayer.setSelectedFeatures(selectedSet)
self.setOutputValue(self.OUTPUT, filename)
def defineCharacteristics(self):
self.name = "Select by location"
self.group = "Research tools"
self.addParameter(ParameterVector(SelectByLocation.INPUT, "Layer to select from", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterVector(SelectByLocation.INTERSECT, "Additional layer (intersection layer)", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterSelection(SelectByLocation.METHOD, "Modify current selection by", ["creating new selection","adding to current selection", "removing from current selection"]))
self.addParameter(ParameterBoolean(SelectByLocation.USE_SELECTED, "Use only selected features", False))
self.addOutput(OutputVector(SelectByLocation.OUTPUT, "Selection", True))

View File

@ -27,7 +27,7 @@ class SimplifyGeometries(GeoAlgorithm):
settings = QSettings()
systemEncoding = settings.value( "/UI/encoding", "System" ).toString()
output = self.getOutputValue(SimplifyGeometries.OUTPUT)
tolerance = int(self.getParameterValue(SimplifyGeometries.TOLERANCE))
tolerance =self.getParameterValue(SimplifyGeometries.TOLERANCE)
useSelection = self.getParameterValue(SimplifyGeometries.USE_SELECTION)
vlayer = QGisLayers.getObjectFromUri(self.getParameterValue(SimplifyGeometries.INPUT))
self.generalize(vlayer, useSelection, tolerance, output, systemEncoding)

View File

@ -16,13 +16,15 @@ class FixedTableDialog(QtGui.QDialog):
self.setObjectName("Dialog")
self.resize(600, 350)
self.setWindowTitle("Fixed Table")
self.buttonBox = QtGui.QDialogButtonBox(self)
self.buttonBox.setGeometry(QtCore.QRect(490, 10, 81, 61))
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setSpacing(2)
self.horizontalLayout.setMargin(0)
self.horizontalLayout.setObjectName("horizontalLayout")
self.buttonBox = QtGui.QDialogButtonBox()
self.buttonBox.setOrientation(QtCore.Qt.Vertical)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.table = QtGui.QTableWidget(self)
self.table.setGeometry(QtCore.QRect(10, 10, 470, 300))
self.table = QtGui.QTableWidget()
self.table.setObjectName("table")
self.table.setColumnCount(len(self.param.cols))
for i in range(len(self.param.cols)):
@ -33,14 +35,24 @@ class FixedTableDialog(QtGui.QDialog):
for i in range(len(self.rettable)):
self.table.setRowHeight(i,22)
self.table.verticalHeader().setVisible(False)
self.addRowButton = QtGui.QPushButton(self)
self.addRowButton.setGeometry(QtCore.QRect(490, 290, 81, 23))
self.addRowButton = QtGui.QPushButton()
self.addRowButton.setObjectName("addRowButton")
self.addRowButton.setText("Add row")
self.addRowButton.setEnabled(not self.param.fixedNumOfRows)
self.removeRowButton = QtGui.QPushButton()
self.removeRowButton.setObjectName("removeRowButton")
self.removeRowButton.setText("Remove row")
self.removeRowButton.setEnabled(not self.param.fixedNumOfRows)
self.buttonBox.addButton(self.addRowButton, QtGui.QDialogButtonBox.ActionRole)
self.buttonBox.addButton(self.removeRowButton, QtGui.QDialogButtonBox.ActionRole)
self.setTableContent()
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), self.okPressed)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), self.cancelPressed)
self.horizontalLayout.addWidget(self.table)
self.horizontalLayout.addWidget(self.buttonBox)
self.setLayout(self.horizontalLayout)
QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), self.okPressed)
QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), self.cancelPressed)
QObject.connect(self.addRowButton, QtCore.SIGNAL("clicked()"), self.addRow)
QObject.connect(self.removeRowButton, QtCore.SIGNAL("clicked()"), self.removeRow)
QtCore.QMetaObject.connectSlotsByName(self)
def setTableContent(self):
@ -60,8 +72,12 @@ class FixedTableDialog(QtGui.QDialog):
self.rettable = None
self.close()
def removeRow(self):
if self.table.rowCount() > 2:
self.table.setRowCount(self.table.rowCount()-1)
def addRow(self):
self.table.setRowCount(self.table.rowCount()+1)
self.table.setRowHeight(self.table.rowCount()-1, 22)
for i in range(self.table.columnCount()):
self.table.setItem(self.table.rowCount()-1,i,QtGui.QTableWidgetItem("0"))
self.table.setItem(self.table.rowCount()-1,i,QtGui.QTableWidgetItem("0"))

View File

@ -17,8 +17,6 @@ class FixedTablePanel(QtGui.QWidget):
for j in range(len(param.cols)):
self.table[i].append("0")
self.setObjectName(_fromUtf8("MSPanel"))
#self.contents = QtGui.QWidget(self)
#self.contents.setObjectName(_fromUtf8("contents"))
self.horizontalLayout = QtGui.QHBoxLayout(self)
self.horizontalLayout.setSpacing(2)
self.horizontalLayout.setMargin(0)
@ -38,5 +36,5 @@ class FixedTablePanel(QtGui.QWidget):
def showFixedTableDialog(self):
dlg = FixedTableDialog(self.param, self.table)
dlg.exec_()
if dlg.table != None:
self.table = dlg.table
if dlg.rettable != None:
self.table = dlg.rettable

View File

@ -2,78 +2,75 @@ from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import *
from PyQt4.QtGui import *
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
class MultipleInputDialog(QtGui.QDialog):
def __init__(self, options, selectedoptions):
self.options = options
self.selectedoptions = selectedoptions
QtGui.QDialog.__init__(self)
self.setModal(True)
self.ui = Ui_MultipleInputDialog()
self.ui.setupUi(self)
self.setupUi()
self.selectedoptions = None
class Ui_MultipleInputDialog(object):
def setupUi(self, dialog):
self.dialog = dialog
dialog.setObjectName(_fromUtf8("Dialog"))
dialog.resize(381, 320)
dialog.setWindowTitle("Multiple selection")
self.buttonBox = QtGui.QDialogButtonBox(dialog)
self.buttonBox.setGeometry(QtCore.QRect(290, 10, 81, 61))
def setupUi(self):
self.setObjectName("Dialog")
self.resize(381, 320)
self.setWindowTitle("Multiple selection")
self.horizontalLayout = QtGui.QHBoxLayout(self)
self.horizontalLayout.setSpacing(2)
self.horizontalLayout.setMargin(0)
self.horizontalLayout.setObjectName("hLayout")
self.buttonBox = QtGui.QDialogButtonBox()
self.buttonBox.setOrientation(QtCore.Qt.Vertical)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.table = QtGui.QTableWidget(dialog)
self.table.setGeometry(QtCore.QRect(10, 10, 270, 300))
self.table.setObjectName(_fromUtf8("table"))
self.buttonBox.setObjectName("buttonBox")
self.table = QtGui.QTableWidget()
self.table.setObjectName("table")
self.table.setColumnCount(1)
self.table.setColumnWidth(0,270)
self.table.verticalHeader().setVisible(False)
self.table.horizontalHeader().setVisible(False)
self.selectAllButton = QtGui.QPushButton(dialog)
self.selectAllButton.setGeometry(QtCore.QRect(290, 290, 81, 23))
self.selectAllButton.setObjectName(_fromUtf8("selectAllButton"))
self.table.horizontalHeader().setResizeMode(QtGui.QHeaderView.Stretch)
self.selectAllButton = QtGui.QPushButton()
self.selectAllButton.setObjectName("selectAllButton")
self.selectAllButton.setText("(de)Select all")
self.setTableContent()
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), self.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), self.reject)
QtCore.QObject.connect(self.selectAllButton, QtCore.SIGNAL(_fromUtf8("clicked()")), self.selectAll)
QtCore.QMetaObject.connectSlotsByName(dialog)
self.buttonBox.addButton(self.selectAllButton, QtGui.QDialogButtonBox.ActionRole)
self.horizontalLayout.addWidget(self.table)
self.horizontalLayout.addWidget(self.buttonBox)
self.setLayout(self.horizontalLayout)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), self.okPressed)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), self.cancelPressed)
QtCore.QObject.connect(self.selectAllButton, QtCore.SIGNAL("clicked()"), self.selectAll)
QtCore.QMetaObject.connectSlotsByName(self)
def setTableContent(self):
self.table.setRowCount(len(self.dialog.options))
for i in range(len(self.dialog.options)):
self.table.setRowCount(len(self.options))
for i in range(len(self.options)):
item = QtGui.QCheckBox()
item.setText(self.dialog.options[i])
if i in self.dialog.selectedoptions:
item.setText(self.options[i])
if i in self.selectedoptions:
item.setChecked(True)
self.table.setCellWidget(i,0, item)
def accept(self):
self.dialog.selectedoptions = []
for i in range(len(self.dialog.options)):
def okPressed(self):
self.selectedoptions = []
for i in range(len(self.options)):
widget = self.table.cellWidget(i, 0)
if widget.isChecked():
self.dialog.selectedoptions.append(i)
self.dialog.close()
self.selectedoptions.append(i)
self.close()
def reject(self):
self.dialog.selectedoptions = None
self.dialog.close()
def cancelPressed(self):
self.selectedoptions = None
self.close()
def selectAll(self):
checked = False
for i in range(len(self.dialog.options)):
for i in range(len(self.options)):
widget = self.table.cellWidget(i, 0)
if not widget.isChecked():
checked = True
break
for i in range(len(self.dialog.options)):
for i in range(len(self.options)):
widget = self.table.cellWidget(i, 0)
widget.setChecked(checked)

View File

@ -178,7 +178,14 @@ class Ui_ParametersDialog(object):
params = self.alg.parameters
outputs = self.alg.outputs
numParams = len(self.alg.parameters)
numOutputs = len(self.alg.outputs)
#numOutputs = len(self.alg.outputs)
numOutputs = 0
for output in outputs:
if isinstance(output, OutputVector):
if not output.hidden:
numOutputs += 1
else:
numOutputs += 1
self.tableWidget.setRowCount(numParams + numOutputs)
i=0
@ -193,6 +200,9 @@ class Ui_ParametersDialog(object):
i+=1
for output in outputs:
if isinstance(output, OutputVector):
if output.hidden:
continue
item = QtGui.QTableWidgetItem(output.description + "<" + output.__module__.split(".")[-1] + ">")
item.setFlags(QtCore.Qt.ItemIsEnabled)
self.tableWidget.setItem(i,0, item)
@ -211,12 +221,14 @@ class Ui_ParametersDialog(object):
return False
for output in outputs:
if isinstance(output, OutputVector):
if output.hidden:
continue
output.value = self.valueItems[output.name].getValue()
return True
def setParamValue(self, param, widget):
if isinstance(param, ParameterRaster):
return param.setValue(widget.itemData(widget.currentIndex()).toPyObject())
elif isinstance(param, ParameterVector):
@ -243,7 +255,8 @@ class Ui_ParametersDialog(object):
value.append(options[index])
return param.setValue(value)
else:
return param.setValue(widget.text())
return param.setValue(str(widget.text()))
def accept(self):

View File

@ -11,6 +11,9 @@ class SextantePostprocessing:
showResults = False;
for out in alg.outputs:
if isinstance(out, (OutputRaster, OutputVector)):
if isinstance(out, OutputVector):
if out.hidden:
continue
QGisLayers.load(out.value, out.description, alg.crs)
elif isinstance(out, OutputTable):
pass #TODO*****

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

View File

@ -8,7 +8,7 @@
[general]
name=SEXTANTE
description=SEXTANTE for QGIS
version=0.1
version=1.0
qgisMinimumVersion=1.0
class_name=SextantePlugin
website=www.sextantegis.com

View File

@ -19,6 +19,7 @@ class ModelerAlgorithm(GeoAlgorithm):
newone.paramValues = copy.deepcopy(self.paramValues,memo)
newone.parameters = copy.deepcopy(self.parameters, memo)
newone.outputs = copy.deepcopy(self.outputs, memo)
newone.provider = self.provider
return newone
def __init__(self):
@ -138,7 +139,6 @@ class ModelerAlgorithm(GeoAlgorithm):
BOX_HEIGHT = 80
return QtCore.QPointF(MARGIN + BOX_WIDTH / 2 + len(self.algPos) * (BOX_WIDTH + MARGIN), BOX_HEIGHT + 2 * MARGIN + BOX_HEIGHT / 2 + len(self.algs) * (BOX_HEIGHT + MARGIN))
def getPositionForParameterItem(self):
MARGIN = 20
BOX_WIDTH = 200
@ -165,7 +165,6 @@ class ModelerAlgorithm(GeoAlgorithm):
s+="ALGORITHM:" + alg.commandLineName()+"\n"
pt = self.algPos[i]
s += str(pt.x()) + "," + str(pt.y()) + "\n"
#alg = ModelerUtils.getAlgorithm(self.algs[i])
for param in alg.parameters:
value = self.algParameters[i][param.name]
if value:
@ -184,8 +183,10 @@ class ModelerAlgorithm(GeoAlgorithm):
def prepareAlgorithm(self, alg, iAlg):
for param in alg.parameters:
aap = self.algParameters[iAlg][param.name]
if aap == None:
continue
if isinstance(param, ParameterMultipleInput):
aap = self.algParameters[iAlg][param.name]
value = self.getValueFromAlgorithmAndParameter(aap)
tokens = value.split(";")
layerslist = []
@ -198,17 +199,16 @@ class ModelerAlgorithm(GeoAlgorithm):
if not param.setValue(value):
raise GeoAlgorithmExecutionException("Wrong value: " + str(value))
else:
aap = self.algParameters[iAlg][param.name]
value = self.getValueFromAlgorithmAndParameter(aap)
if not param.setValue(value):
raise GeoAlgorithmExecutionException("Wrong value: " + str(value))
for out in alg.outputs:
val = self.algOutputs[iAlg][out.name]
if val:
name = str(iAlg) + out.name
out.value = self.getOutputFromName(name).value
else:
out.value = None
val = self.algOutputs[iAlg][out.name]
if val:
name = str(iAlg) + out.name
out.value = self.getOutputFromName(name).value
else:
out.value = None
def getValueFromAlgorithmAndParameter(self, aap):
@ -247,6 +247,7 @@ class ModelerAlgorithm(GeoAlgorithm):
for param in self.parameters:
s.append(str(param.getAsScriptCode()))
for alg in self.algs:
runline = "Sextante.runalg(\"" + alg.commandLineName() + "\n"
#TODO*****
pass
return "\n".join(s)

View File

@ -115,10 +115,10 @@ class ModelerParameterDefinitionDialog(QtGui.QDialog):
self.horizontalLayout2.addWidget(self.yesNoCombo)
self.horizontalLayout3.addWidget(QtGui.QLabel("Data type"))
self.datatypeCombo = QtGui.QComboBox()
self.datatypeCombo.addItem("Vector (any)")
self.datatypeCombo.addItem("Vector (point)")
self.datatypeCombo.addItem("Vector (line)")
self.datatypeCombo.addItem("Vector (polygon)")
self.datatypeCombo.addItem("Vector (any)")
self.datatypeCombo.addItem("Raster")
self.datatypeCombo.addItem("Table")
self.horizontalLayout3.addWidget(self.datatypeCombo)
@ -172,7 +172,7 @@ class ModelerParameterDefinitionDialog(QtGui.QDialog):
elif self.paramType == ModelerParameterDefinitionDialog.PARAMETER_TABLE:
self.param = ParameterTable(name, description, self.yesNoCombo.currentIndex() == 1)
elif self.paramType == ModelerParameterDefinitionDialog.PARAMETER_VECTOR:
self.param = ParameterVector(name, description, self.shapetypeCombo.currentIndex(), self.yesNoCombo.currentIndex() == 1)
self.param = ParameterVector(name, description, self.shapetypeCombo.currentIndex()-1, self.yesNoCombo.currentIndex() == 1)
elif self.paramType == ModelerParameterDefinitionDialog.PARAMETER_MULTIPLE:
self.param = ParameterMultipleInput(name, description, self.datatypeCombo.currentIndex(), self.yesNoCombo.currentIndex() == 1)
elif self.paramType == ModelerParameterDefinitionDialog.PARAMETER_NUMBER:

View File

@ -233,7 +233,13 @@ class ModelerParametersDialog(QtGui.QDialog):
params = self.alg.parameters
outputs = self.alg.outputs
numParams = len(self.alg.parameters)
numOutputs = len(self.alg.outputs)
numOutputs = 0
for output in outputs:
if isinstance(output, OutputVector):
if not output.hidden:
numOutputs += 1
else:
numOutputs += 1
self.tableWidget.setRowCount(numParams + numOutputs)
i=0
@ -248,6 +254,9 @@ class ModelerParametersDialog(QtGui.QDialog):
i+=1
for output in outputs:
if isinstance(output, OutputVector):
if output.hidden:
continue
item = QtGui.QTableWidgetItem(output.description + "<" + output.__module__.split(".")[-1] + ">")
item.setFlags(QtCore.Qt.ItemIsEnabled)
self.tableWidget.setItem(i,0, item)
@ -269,6 +278,9 @@ class ModelerParametersDialog(QtGui.QDialog):
if not self.setParamValue(param, self.valueItems[param.name]):
return False
for output in outputs:
if isinstance(output, OutputVector):
if output.hidden:
continue
name= str(self.valueItems[output.name].text())
if name.strip()!="" and name != ModelerParametersDialog.ENTER_NAME:
self.outputs[output.name]=name
@ -327,9 +339,10 @@ class ModelerParametersDialog(QtGui.QDialog):
value = AlgorithmAndParameter(AlgorithmAndParameter.PARENT_MODEL_ALGORITHM, name)
self.params[param.name] = value
s = str(widget.currentText())
if s.isdigit():
self.values[name] = str(widget.currentText())
else:
try:
float(s)
self.values[name] = s
except:
return False
else:
value = widget.itemData(widget.currentIndex()).toPyObject()
@ -387,12 +400,10 @@ class ModelerParametersDialog(QtGui.QDialog):
value = AlgorithmAndParameter(AlgorithmAndParameter.PARENT_MODEL_ALGORITHM, name)
self.params[param.name] = value
self.values[name] = ";".join(values)
return False
return True
def okPressed(self):
if self.setParamValues():
self.close()
else:

View File

@ -11,4 +11,7 @@ class OutputFactory():
for clazz in classes:
if s.startswith(clazz().outputTypeName()):
tokens = s[len(clazz().outputTypeName())+1:].split("|")
return clazz(tokens[0], tokens[1])
if len(tokens) == 2:
return clazz(tokens[0], tokens[1])
else:
return clazz(tokens[0], tokens[1], tokens[2]==str(True))

View File

@ -2,6 +2,12 @@ from sextante.outputs.Output import Output
class OutputVector(Output):
def __init__(self, name="", description="", hidden=False):
self.name = name
self.description = description
self.value = None
self.hidden = hidden
def getFileFilter(self,alg):
exts = alg.provider.getSupportedOutputVectorLayerExtensions()
for i in range(len(exts)):

View File

@ -2,12 +2,16 @@ from sextante.parameters.Parameter import Parameter
class ParameterBoolean(Parameter):
def __init__(self, name="", description="", default="True"):
def __init__(self, name="", description="", default=True):
self.name = name
self.description = description
self.default = default
self.value = None
def setValue(self, value):
self.value = value
return True
def serialize(self):
return self.__module__.split(".")[-1] + "|" + self.name + "|" + self.description + "|" + str(self.default)

View File

@ -1,11 +1,12 @@
from sextante.parameters.Parameter import Parameter
from PyQt4 import QtGui
class ParameterFixedTable(Parameter):
def __init__(self, name="", description="", cols=["value"], numRows=3, fixedNumOfRows = False):
self.cols = cols
self.numRows = numRows
self.fixedNumOfRows = False
self.fixedNumOfRows = fixedNumOfRows
self.name = name
self.description = description
self.value = None

View File

@ -1,4 +1,5 @@
from sextante.parameters.Parameter import Parameter
from PyQt4.QtGui import *
class ParameterNumber(Parameter):
@ -11,8 +12,11 @@ class ParameterNumber(Parameter):
self.value = None
def setValue(self, n):
try:
value = float(n)
##try:
if (float(n) - int(float(n)) == 0):
value = int(n)
else:
value = float(n)
if self.min:
if value < self.min:
return False
@ -21,8 +25,10 @@ class ParameterNumber(Parameter):
return False
self.value = value
return True
except:
return False
#=======================================================================
# except:
# return False
#=======================================================================
def serialize(self):
return self.__module__.split(".")[-1] + "|" + self.name + "|" + self.description +\

View File

@ -29,7 +29,7 @@ class ParameterTable(ParameterDataObject):
return True
else:
return False
return False
return True
def serialize(self):
return self.__module__.split(".")[-1] + "|" + self.name + "|" + self.description +\

View File

@ -23,11 +23,12 @@ class ParameterVector(ParameterDataObject):
return True
else:
self.value = str(obj)
layers = QGisLayers.getVectorLayers(shapetype)
layers = QGisLayers.getVectorLayers(self.shapetype)
for layer in layers:
if layer.name() == self.value:
self.value = str(layer.source())
return True
return True
def serialize(self):
return self.__module__.split(".")[-1] + "|" + self.name + "|" + self.description +\

View File

@ -17,12 +17,18 @@ from sextante.parameters.ParameterTableField import ParameterTableField
from sextante.outputs.OutputHTML import OutputHTML
from sextante.r.RUtils import RUtils
from sextante.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from sextante.core.SextanteLog import SextanteLog
class RAlgorithm(GeoAlgorithm):
R_CONSOLE_OUTPUT = "R_CONSOLE_OUTPUT"
RPLOTS = "RPLOTS"
def __deepcopy__(self,memo):
newone = RAlgorithm(self.descriptionFile)
newone.provider = self.provider
return newone
def __init__(self, descriptionfile):
GeoAlgorithm.__init__(self)
self.descriptionFile = descriptionfile
@ -138,6 +144,13 @@ class RAlgorithm(GeoAlgorithm):
raise WrongScriptException("Could not load R script:" + self.descriptionFile + ".\n Problem with line \"" + line + "\"")
def processAlgorithm(self, progress):
path = RUtils.RFolder()
if path == "":
raise GeoAlgorithmExecutionException("R folder is not configured.\nPlease configure it before running R script.")
loglines = []
loglines.append("R execution commands")
loglines += self.getFullSetOfRCommands()
SextanteLog.addToLog(SextanteLog.LOG_INFO, loglines)
RUtils.executeRAlgorithm(self)
if self.showPlots:
htmlfilename = self.getOutputValue(RAlgorithm.RPLOTS)
@ -151,7 +164,6 @@ class RAlgorithm(GeoAlgorithm):
f.close()
def getFullSetOfRCommands(self):
commands = []
commands += self.getImportCommands()
commands += self.getRCommands()
@ -160,9 +172,7 @@ class RAlgorithm(GeoAlgorithm):
return commands
def getExportCommands(self):
commands = []
for out in self.outputs:
if isinstance(out, OutputRaster):
value = out.value
@ -187,7 +197,6 @@ class RAlgorithm(GeoAlgorithm):
def getImportCommands(self):
commands = []
commands.append("library(\"rgdal\")");
for param in self.parameters:
@ -210,8 +219,7 @@ class RAlgorithm(GeoAlgorithm):
if isinstance(param, ParameterNumber):
commands.append(param.name + "=" + str(param.value))
if isinstance(param, ParameterBoolean):
b = (param.value == str(True))
if b:
if param.value:
commands.append(param.name + "=TRUE")
else:
commands.append(param.name + "=FALSE")

View File

@ -2,6 +2,7 @@ from sextante.core.SextanteConfig import SextanteConfig
import os
from sextante.core.SextanteUtils import mkdir, SextanteUtils
import subprocess
from sextante.core.SextanteLog import SextanteLog
class RUtils:
@ -56,7 +57,10 @@ class RUtils:
proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE,stderr=subprocess.STDOUT, universal_newlines=True)
proc.wait()
RUtils.createConsoleOutput()
loglines = []
loglines.append("R execution console output")
loglines += RUtils.consoleResults
SextanteLog.addToLog(SextanteLog.LOG_INFO, loglines)
@staticmethod
def createConsoleOutput():

View File

@ -29,7 +29,6 @@ from sextante.core.SextanteLog import SextanteLog
from sextante.parameters.ParameterFactory import ParameterFactory
from sextante.outputs.OutputFactory import OutputFactory
from sextante.core.SextanteConfig import SextanteConfig
import math
class SagaAlgorithm(GeoAlgorithm):
@ -209,6 +208,10 @@ class SagaAlgorithm(GeoAlgorithm):
def processAlgorithm(self, progress):
path = SagaUtils.sagaPath()
if path == "":
raise GeoAlgorithmExecutionException("SAGA folder is not configured.\nPlease configure it before running SAGA algorithms.")
commands = list()
self.exportedLayers = {}
self.numExportedLayers = 0;
@ -257,7 +260,7 @@ class SagaAlgorithm(GeoAlgorithm):
continue
if param.datatype == ParameterMultipleInput.TYPE_RASTER:
for layer in layers:
if not value.endswith("sgrd"):
if not layer.endswith("sgrd"):
commands.append(self.exportRasterLayer(layer))
if self.resample:
commands.append(self.resampleRasterLayer(layer));
@ -284,7 +287,7 @@ class SagaAlgorithm(GeoAlgorithm):
s = s.replace(layer, self.exportedLayers[layer])
command+=(" -" + param.name + " " + s);
elif isinstance(param, ParameterBoolean):
if param.value == str(True):
if param.value:
command+=(" -" + param.name);
else:
command+=(" -" + param.name + " " + str(param.value));
@ -321,7 +324,7 @@ class SagaAlgorithm(GeoAlgorithm):
if filename.endswith("asc"):
commands.append("io_grid 0 -GRID " + filename2 + " -FORMAT 1 -FILE " + filename);
else:
commands.append("io_gdal 1 -GRIDS " + filename2 + " -FORMAT 1 -FILE " + filename);
commands.append("io_gdal 1 -GRIDS " + filename2 + " -FORMAT 1 -TYPE 0 -FILE " + filename);
#4 Run SAGA
SagaUtils.createSagaBatchJobFileFromSagaCommands(commands)
@ -346,15 +349,19 @@ class SagaAlgorithm(GeoAlgorithm):
return s
def exportRasterLayer(self,layer):
if not layer.lower().endswith("tif") and not layer.lower().endswith("asc"):
raise GeoAlgorithmExecutionException("Unsupported input file format: " + layer)
ext = os.path.splitext(layer)[1][1:].strip()
#=======================================================================
# if not layer.lower().endswith("tif") and not layer.lower().endswith("asc"):
# raise GeoAlgorithmExecutionException("Unsupported input file format: " + layer)
#=======================================================================
#ext = os.path.splitext(layer)[1][1:].strip()
destFilename = self.getTempFilename()
self.exportedLayers[layer]= destFilename
if ext.lower() == "tif":
return "io_grid_image 1 -OUT_GRID " + destFilename + " -FILE " + layer + " -METHOD 0"
else:
return "io_grid 1 -GRID " + destFilename + " -FILE " + layer
#=======================================================================
# if ext.lower() == "tif":
# return "io_grid_image 1 -OUT_GRID " + destFilename + " -FILE " + layer + " -METHOD 0"
# else:
#=======================================================================
return "io_gdal 0 -GRIDS " + destFilename + " -FILES " + layer
def getTempFilename(self):

View File

@ -2,6 +2,8 @@ import os
from sextante.core.SextanteUtils import SextanteUtils
import subprocess
from sextante.core.SextanteConfig import SextanteConfig
from sextante.core.SextanteLog import SextanteLog
class SagaUtils:
SAGA_AUTO_RESAMPLING = "SAGA_AUTO_RESAMPLING"
@ -65,12 +67,16 @@ class SagaUtils:
else:
#TODO linux
pass
loglines = []
loglines.append("SAGA execution console output")
proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE,stderr=subprocess.STDOUT, universal_newlines=True).stdout
for line in iter(proc.readline, ""):
if "%" in line:
s = "".join([x for x in line if x.isdigit()])
progress.setPercentage(int(s))
else:
loglines.append(line)
SextanteLog.addToLog(SextanteLog.LOG_INFO, loglines)

View File

@ -1,5 +1,5 @@
Split Shapes by Attribute
shapes_tools
ParameterVector|TABLE|Table / Shapes|False
ParameterVector|TABLE|Table/Shapes|-1|False
ParameterTableField|FIELD|Attribute|TABLE
OutputTable|CUTS|Cuts

View File

@ -2,5 +2,5 @@ User Defined Filter
grid_filter
ParameterRaster|INPUT|Grid|False
ParameterTable|FILTER|Filter Matrix|True
ParameterFixedTable|FILTER_3X3|Default Filter Matrix (3x3)|3| 1; 2; 3|False
ParameterFixedTable|FILTER_3X3|Default Filter Matrix (3x3)|3| 1; 2; 3|True
OutputRaster|RESULT|Filtered Grid

View File

@ -1,122 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<height>100</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>10</x>
<y>600</y>
<width>461</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>-1</x>
<y>-1</y>
<width>481</width>
<height>591</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="maximumSize">
<size>
<width>1000</width>
<height>1000</height>
</size>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Tab 1</string>
</attribute>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Tab 2</string>
</attribute>
<widget class="QTextEdit" name="textEdit">
<property name="geometry">
<rect>
<x>60</x>
<y>270</y>
<width>104</width>
<height>64</height>
</rect>
</property>
</widget>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -1,58 +0,0 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'D:\projects\sextante\workspaces\qgis-plugin\sextante\src\sextante\untitled.ui'
#
# Created: Thu Feb 09 09:16:13 2012
# by: PyQt4 UI code generator 4.9
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName(_fromUtf8("Dialog"))
Dialog.setWindowModality(QtCore.Qt.ApplicationModal)
Dialog.resize(100, 100)
Dialog.setMaximumSize(QtCore.QSize(100, 100))
self.buttonBox = QtGui.QDialogButtonBox(Dialog)
self.buttonBox.setGeometry(QtCore.QRect(10, 600, 461, 32))
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.horizontalLayoutWidget = QtGui.QWidget(Dialog)
self.horizontalLayoutWidget.setGeometry(QtCore.QRect(-1, -1, 481, 591))
self.horizontalLayoutWidget.setObjectName(_fromUtf8("horizontalLayoutWidget"))
self.horizontalLayout = QtGui.QHBoxLayout(self.horizontalLayoutWidget)
self.horizontalLayout.setMargin(0)
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.tabWidget = QtGui.QTabWidget(self.horizontalLayoutWidget)
self.tabWidget.setMaximumSize(QtCore.QSize(1000, 1000))
self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
self.tab = QtGui.QWidget()
self.tab.setObjectName(_fromUtf8("tab"))
self.tabWidget.addTab(self.tab, _fromUtf8(""))
self.tab_2 = QtGui.QWidget()
self.tab_2.setObjectName(_fromUtf8("tab_2"))
self.textEdit = QtGui.QTextEdit(self.tab_2)
self.textEdit.setGeometry(QtCore.QRect(60, 270, 104, 64))
self.textEdit.setObjectName(_fromUtf8("textEdit"))
self.tabWidget.addTab(self.tab_2, _fromUtf8(""))
self.horizontalLayout.addWidget(self.tabWidget)
self.retranslateUi(Dialog)
self.tabWidget.setCurrentIndex(0)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), Dialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), Dialog.reject)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QtGui.QApplication.translate("Dialog", "Tab 1", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QtGui.QApplication.translate("Dialog", "Tab 2", None, QtGui.QApplication.UnicodeUTF8))