mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
68 lines
2.6 KiB
Python
68 lines
2.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
***************************************************************************
|
|
PymorphAlgorithmProvider.py
|
|
---------------------
|
|
Date : August 2012
|
|
Copyright : (C) 2012 by Victor Olaya
|
|
Email : volayaf at gmail dot com
|
|
***************************************************************************
|
|
* *
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
* it under the terms of the GNU General Public License as published by *
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
* (at your option) any later version. *
|
|
* *
|
|
***************************************************************************
|
|
"""
|
|
|
|
__author__ = 'Victor Olaya'
|
|
__date__ = 'August 2012'
|
|
__copyright__ = '(C) 2012, Victor Olaya'
|
|
# This will get replaced with a git SHA1 when you do a git archive
|
|
__revision__ = '$Format:%H$'
|
|
|
|
import os
|
|
from PyQt4.QtCore import *
|
|
from PyQt4.QtGui import *
|
|
from sextante.core.AlgorithmProvider import AlgorithmProvider
|
|
from sextante.script.WrongScriptException import WrongScriptException
|
|
from sextante.core.SextanteLog import SextanteLog
|
|
from sextante.gdal.GdalUtils import GdalUtils
|
|
from sextante.pymorph.PymorphAlgorithm import PymorphAlgorithm
|
|
|
|
class PymorphAlgorithmProvider(AlgorithmProvider):
|
|
|
|
def __init__(self):
|
|
AlgorithmProvider.__init__(self)
|
|
self.activate = False
|
|
self.createAlgsList()
|
|
|
|
def scriptsFolder(self):
|
|
return os.path.dirname(__file__) + "/scripts"
|
|
|
|
def getDescription(self):
|
|
return "Pymorph (Morphological image processing tools)"
|
|
|
|
def getName(self):
|
|
return "pymorph"
|
|
|
|
def _loadAlgorithms(self):
|
|
self.algs = self.preloadedAlgs
|
|
|
|
def createAlgsList(self):
|
|
self.preloadedAlgs = []
|
|
folder = self.scriptsFolder()
|
|
for descriptionFile in os.listdir(folder):
|
|
if descriptionFile.endswith("py"):
|
|
try:
|
|
fullpath = os.path.join(self.scriptsFolder(), descriptionFile)
|
|
alg = PymorphAlgorithm(fullpath)
|
|
alg.group = "Algorithms"
|
|
self.preloadedAlgs.append(alg)
|
|
except WrongScriptException,e:
|
|
SextanteLog.addToLog(SextanteLog.LOG_ERROR,e.msg)
|
|
|
|
def getSupportedOutputRasterLayerExtensions(self):
|
|
return GdalUtils.getSupportedRasterExtensions() |