Skip to content
Permalink
Browse files

moving to qgis-plugin

git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@10 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
volayaf@gmail.com
volayaf@gmail.com committed Jan 10, 2012
1 parent 593ef32 commit 75b77d04c418a47926d11ea8bf4eeed501828b3f
Showing with 1,411 additions and 0 deletions.
  1. +17 −0 .project
  2. +10 −0 .pydevproject
  3. +5 −0 .settings/org.eclipse.core.resources.prefs
  4. +15 −0 build.xml
  5. +49 −0 src/sextante/SextanteToolboxPlugin.py
  6. +15 −0 src/sextante/__init__.py
  7. +5 −0 src/sextante/core/AlgorithmProvider.py
  8. +85 −0 src/sextante/core/GeoAlgorithm.py
  9. +37 −0 src/sextante/core/QGisLayers.py
  10. +41 −0 src/sextante/core/Sextante.py
  11. +11 −0 src/sextante/core/SextanteTest.py
  12. +36 −0 src/sextante/core/SextanteUtils.py
  13. 0 src/sextante/core/__init__.py
  14. +13 −0 src/sextante/gui/ParametersDialog.py
  15. +109 −0 src/sextante/gui/ParametersDialog.ui
  16. +10 −0 src/sextante/gui/SextanteToolbox.py
  17. 0 src/sextante/gui/__init__.py
  18. +94 −0 src/sextante/gui/ui_ParametersDialog.py
  19. +82 −0 src/sextante/gui/ui_SextanteToolbox.py
  20. BIN src/sextante/icon.png
  21. +17 −0 src/sextante/metadata.txt
  22. +40 −0 src/sextante/outputs/Output.py
  23. +5 −0 src/sextante/outputs/OutputRaster.py
  24. +4 −0 src/sextante/outputs/OutputTable.py
  25. +4 −0 src/sextante/outputs/OutputVector.py
  26. 0 src/sextante/outputs/__init__.py
  27. +31 −0 src/sextante/parameters/Parameter.py
  28. +4 −0 src/sextante/parameters/ParameterBoolean.py
  29. +14 −0 src/sextante/parameters/ParameterDataObject.py
  30. +30 −0 src/sextante/parameters/ParameterFixedTable.py
  31. +21 −0 src/sextante/parameters/ParameterMultipleInput.py
  32. +4 −0 src/sextante/parameters/ParameterNumber.py
  33. +4 −0 src/sextante/parameters/ParameterRaster.py
  34. +16 −0 src/sextante/parameters/ParameterSelection.py
  35. +4 −0 src/sextante/parameters/ParameterString.py
  36. +5 −0 src/sextante/parameters/ParameterTable.py
  37. +14 −0 src/sextante/parameters/ParameterTableField.py
  38. +19 −0 src/sextante/parameters/ParameterVector.py
  39. 0 src/sextante/parameters/__init__.py
  40. +110 −0 src/sextante/resources.py
  41. +5 −0 src/sextante/resources.qrc
  42. +335 −0 src/sextante/saga/SagaAlgorithm.py
  43. +27 −0 src/sextante/saga/SagaAlgorithmProvider.py
  44. +13 −0 src/sextante/saga/SagaBlackList.py
  45. +4 −0 src/sextante/saga/SagaExecutionException.py
  46. +45 −0 src/sextante/saga/SagaUtils.py
  47. +2 −0 src/sextante/saga/UnwrappableSagaAlgorithmException.py
  48. 0 src/sextante/saga/__init__.py
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>sextante</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse-pydev version="1.0"?>

<pydev_project>
<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>
@@ -0,0 +1,5 @@
#Mon Jan 09 20:28:29 CET 2012
eclipse.preferences.version=1
encoding//src/sextante/gui/ui_ParametersDialog.py=utf-8
encoding//src/sextante/gui/ui_SextanteToolbox.py=utf-8
encoding//src/sextante/resources.py=utf-8
@@ -0,0 +1,15 @@
<project name="SEXTANTE_LIB" default="copy" basedir=".">
<description>
SEXTANTE
</description>
<property name="version.number" value="0.1"/>

<target name="copy"
description="copy files">

<copy todir="C:/Users/volaya/.qgis/python/plugins/sextante">
<fileset dir="src/sextante" includes="**"/>
</copy>

</target>
</project>
@@ -0,0 +1,49 @@
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
# Initialize Qt resources from file resources.py
import resources
# Import the code for the dialog


import os, sys
import inspect
from sextante.core.Sextante import Sextante
from sextante.gui.SextanteToolbox import SextanteToolbox
from sextante.core.QGisLayers import QGisLayers

cmd_folder = os.path.split(inspect.getfile( inspect.currentframe() ))[0]
if cmd_folder not in sys.path:
sys.path.insert(0, cmd_folder)

class SextanteToolboxPlugin:

def __init__(self, iface):
self.iface = iface
QGisLayers.setInterface(iface)
Sextante.initialize()

def initGui(self):

self.toolboxAction = QAction(QIcon(":/plugins/sextante/toolbox.png"), \
"SEXTANTE Toolbox", self.iface.mainWindow())
QObject.connect(self.toolboxAction, SIGNAL("triggered()"), self.openToolbox)
self.iface.addPluginToMenu("&SEXTANTE", self.toolboxAction)

self.modelerAction = QAction(QIcon(":/plugins/sextante/modeler.png"), \
"SEXTANTE Modeler", self.iface.mainWindow())
QObject.connect(self.modelerAction, SIGNAL("triggered()"), self.openModeler)
self.iface.addPluginToMenu("&SEXTANTE", self.modelerAction)

def unload(self):
# Remove the plugin menu items
self.iface.removePluginMenu("&SEXTANTE",self.toolboxAction)
self.iface.removePluginMenu("&SEXTANTE",self.modelerAction)

def openToolbox(self):

dlg = SextanteToolbox()
dlg.exec_()

def openModeler(self):
pass
@@ -0,0 +1,15 @@
from sextante.SextanteToolboxPlugin import SextanteToolboxPlugin

def name():
return "SEXTANTE"
def description():
return "SEXTANTE Geoprocessing platform for QGIS"
def version():
return "Version 0.1"
def icon():
return "icon.png"
def qgisMinimumVersion():
return "1.0"
def classFactory(iface):
# load SextantePlugin class from file SextantePlugin
return SextanteToolboxPlugin(iface)
@@ -0,0 +1,5 @@
class AlgorithmProvider():

@property
def algs(self):
return self._algs
@@ -0,0 +1,85 @@
from sextante.outputs.Output import Output
from sextante.parameters.Parameter import Parameter

class GeoAlgorithm:

def __init__(self):
self.parameters = {}
self.outputs = {}
self.name = ""
self.group = ""
self.defineCharacteristics()
self.providerName = ""

def execute(self):
if self.checkParameters():
self.proccessAlgorithm()


def checkParameters(self):
#TODO!!!!!!
return True

def defineCharacteristics(self):
pass

def processAlgorithm(self):
pass
#===============================================================================
#
# @property
# def outputs(self):
# return self._outputs
#
# @property
# def parameters(self):
# return self._parameters
#
# @property
# def group(self):
# return self._group
#
# @group.setter
# def group(self, g):
# self._group = g
#
# @property
# def name(self):
# return self._name
#
# @name.setter
# def name(self, name):
# self._name = name
#===============================================================================

def putOutput(self, output):
if isinstance(output, Output):
self.outputs[output.name] = output


def putParameter(self, param):
if isinstance(param, Parameter):
self.parameters[param.name] = param

def setParameterValue(self, paramName, value):
param = self.parameters[paramName]
if param != None:
param.value = value

def canBeExecuted(self, layersCount):
return True

def __str__(self):
s = "ALGORITHM: " + self.name + "\n"
s+=self._descriptionfile + "\n"
for param in self.parameters.values():
s+=(str(param) + "\n")
for out in self.outputs.values():
s+=(str(out) + "\n")
s+=("\n")
return s

def commandLineName(self):
return self.providerName + self.name.lower().replace(" ", "")


@@ -0,0 +1,37 @@
from qgis.core import *

class QGisLayers:

iface = None;

@staticmethod
def getLayers():
layers = QGisLayers.iface.legendInterface().layers()
layerNames = list()
for l in layers:
layerNames.append(l.name())
return layerNames


@staticmethod
def setInterface(iface):
QGisLayers.iface = iface


@staticmethod
def getLayersCount():
count = LayersCount()
return count



class LayersCount:

def __init__(self):
self.raster = 0
self.vector_point=0
self.vector_line=0
self.vector_polygon=0



@@ -0,0 +1,41 @@
from sextante.saga.SagaAlgorithmProvider import SagaAlgorithmProvider

class Sextante:

providers = [SagaAlgorithmProvider()]
algs = {}


def __init__(self):
pass

@staticmethod
def initialize():
Sextante.loadAlgorithms()

@staticmethod
def loadAlgorithms():
for provider in Sextante.providers:
algs = provider.algs
for alg in algs:
Sextante.algs[alg.commandLineName()] = alg

@staticmethod
def getAlgorithm(name):
return Sextante.algs[name]


@staticmethod
def asStr():
s=""
for alg in Sextante.algs.values():
s+=(str(alg) + "\n")
s+=str(len(Sextante.algs)) + " algorithms"
return s







@@ -0,0 +1,11 @@
from sextante.core.Sextante import Sextante


def main():
Sextante.initialize()
print(Sextante.asStr())



if __name__ == '__main__':
main()
@@ -0,0 +1,36 @@
import os
class SextanteUtils:

@staticmethod
def userFolder():
userfolder = os.getenv('HOME') + os.sep + "sextante"
mkdir(userfolder)

return userfolder


@staticmethod
def isWindows():
return True


@staticmethod
def setTempOutput(out):
pass







def mkdir(newdir):
if os.path.isdir(newdir):
pass
else:
head, tail = os.path.split(newdir)
if head and not os.path.isdir(head):
mkdir(head)
if tail:
os.mkdir(newdir)

No changes.
@@ -0,0 +1,13 @@

from PyQt4 import QtGui

from sextante.gui.ui_ParametersDialog import Ui_ParametersDialog

class ParametersDialog(QtGui.QDialog):
def __init__(self, alg):
QtGui.QDialog.__init__(self)
self.setModal(True)
self.alg = alg
self.ui = Ui_ParametersDialog()
self.ui.setupUi(self)

0 comments on commit 75b77d0

Please sign in to comment.
You can’t perform that action at this time.