mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Merge pull request #3105 from volaya/processing_cleanup
[processing] cleanup and improvements
This commit is contained in:
commit
322da8b2cf
@ -43,6 +43,7 @@ from processing.gui.CommanderWindow import CommanderWindow
|
||||
from processing.modeler.ModelerDialog import ModelerDialog
|
||||
from processing.tools.system import tempFolder
|
||||
from processing.gui.menus import removeMenus, initializeMenus, createMenus
|
||||
from processing.core.alglist import algList
|
||||
|
||||
|
||||
cmd_folder = os.path.split(inspect.getfile(inspect.currentframe()))[0]
|
||||
@ -54,10 +55,9 @@ class ProcessingPlugin:
|
||||
|
||||
def __init__(self, iface):
|
||||
self.iface = iface
|
||||
|
||||
def initGui(self):
|
||||
Processing.initialize()
|
||||
|
||||
def initGui(self):
|
||||
self.commander = None
|
||||
self.toolbox = ProcessingToolbox()
|
||||
self.iface.addDockWidget(Qt.RightDockWidgetArea, self.toolbox)
|
||||
@ -160,7 +160,7 @@ class ProcessingPlugin:
|
||||
dlg = ModelerDialog()
|
||||
dlg.exec_()
|
||||
if dlg.update:
|
||||
self.toolbox.updateProvider('model')
|
||||
algList.reloadProvider('model')
|
||||
|
||||
def openResults(self):
|
||||
dlg = ResultsDialog()
|
||||
|
@ -0,0 +1,38 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
***************************************************************************
|
||||
__init__.py
|
||||
---------------------
|
||||
Date : May 2016
|
||||
Copyright : (C) 2016 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__ = 'May 2016'
|
||||
__copyright__ = '(C) 2016, Victor Olaya'
|
||||
|
||||
# This will get replaced with a git SHA1 when you do a git archive
|
||||
|
||||
__revision__ = '$Format:%H$'
|
||||
|
||||
import os
|
||||
|
||||
from processing.core.Processing import Processing
|
||||
|
||||
class ProcessingExampleScriptsPlugin:
|
||||
|
||||
def initGui(self):
|
||||
Processing.addScripts(os.path.join(os.path.dirname(__file__), "scripts"))
|
||||
|
||||
def unload(self):
|
||||
Processing.removeScripts(os.path.join(os.path.dirname(__file__), "scripts"))
|
31
python/plugins/processing/algs/examplescripts/__init__.py
Normal file
31
python/plugins/processing/algs/examplescripts/__init__.py
Normal file
@ -0,0 +1,31 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
***************************************************************************
|
||||
__init__.py
|
||||
---------------------
|
||||
Date : July 2013
|
||||
Copyright : (C) 2013 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. *
|
||||
* *
|
||||
***************************************************************************
|
||||
"""
|
||||
from .ProcessingExampleScriptsPlugin import ProcessingExampleScriptsPlugin
|
||||
|
||||
__author__ = 'Victor Olaya'
|
||||
__date__ = 'July 2013'
|
||||
__copyright__ = '(C) 2013, Victor Olaya'
|
||||
|
||||
# This will get replaced with a git SHA1 when you do a git archive
|
||||
|
||||
__revision__ = '$Format:%H$'
|
||||
|
||||
|
||||
def classFactory(iface):
|
||||
return ProcessingExampleScriptsPlugin()
|
18
python/plugins/processing/algs/examplescripts/metadata.txt
Normal file
18
python/plugins/processing/algs/examplescripts/metadata.txt
Normal file
@ -0,0 +1,18 @@
|
||||
[general]
|
||||
name=Processing Example Scripts
|
||||
description=An example plugin that adds algorithms to Processing as plugins
|
||||
category=Analysis
|
||||
version=1.0
|
||||
qgisMinimumVersion=2.0
|
||||
|
||||
author=Victor Olaya
|
||||
email=volayaf@gmail.com
|
||||
|
||||
tags=analysis,processing
|
||||
|
||||
homepage=
|
||||
tracker=
|
||||
repository=
|
||||
|
||||
experimental=False
|
||||
deprecated=False
|
@ -0,0 +1,3 @@
|
||||
##text=string
|
||||
|
||||
print text
|
@ -106,6 +106,8 @@ class GrassUtils:
|
||||
if not os.path.isdir(folder):
|
||||
folder = '/Applications/GRASS-6.4.app/Contents/MacOS'
|
||||
|
||||
if folder:
|
||||
ProcessingConfig.setSettingValue(GrassUtils.GRASS_FOLDER, folder)
|
||||
return folder or ''
|
||||
|
||||
@staticmethod
|
||||
|
@ -222,6 +222,8 @@ class QGISAlgorithmProvider(AlgorithmProvider):
|
||||
from .ExecuteSQL import ExecuteSQL
|
||||
self.alglist.extend([ExecuteSQL()])
|
||||
|
||||
self.externalAlgs = [] #to store algs added by 3rd party plugins as scripts
|
||||
|
||||
folder = os.path.join(os.path.dirname(__file__), 'scripts')
|
||||
scripts = ScriptUtils.loadFromFolder(folder)
|
||||
for script in scripts:
|
||||
@ -246,7 +248,7 @@ class QGISAlgorithmProvider(AlgorithmProvider):
|
||||
return self._icon
|
||||
|
||||
def _loadAlgorithms(self):
|
||||
self.algs = self.alglist
|
||||
self.algs = list(self.alglist) + self.externalAlgs
|
||||
|
||||
def supportsNonFileBasedOutput(self):
|
||||
return True
|
||||
|
@ -541,6 +541,12 @@ class GeoAlgorithm:
|
||||
s = s[:-1] + ')'
|
||||
return s
|
||||
|
||||
def displayName(self):
|
||||
return self.i18n_name or self.name
|
||||
|
||||
def displayNames(self):
|
||||
return self.name, self.i18n_name
|
||||
|
||||
def tr(self, string, context=''):
|
||||
if context == '':
|
||||
context = self.__class__.__name__
|
||||
|
@ -17,6 +17,7 @@
|
||||
***************************************************************************
|
||||
"""
|
||||
|
||||
|
||||
__author__ = 'Victor Olaya'
|
||||
__date__ = 'August 2012'
|
||||
__copyright__ = '(C) 2012, Victor Olaya'
|
||||
@ -26,6 +27,7 @@ __copyright__ = '(C) 2012, Victor Olaya'
|
||||
__revision__ = '$Format:%H$'
|
||||
|
||||
import sys
|
||||
import os
|
||||
import traceback
|
||||
|
||||
from qgis.PyQt.QtCore import Qt, QCoreApplication, QObject, pyqtSignal
|
||||
@ -36,8 +38,8 @@ from qgis.utils import iface
|
||||
from qgis.core import QgsMessageLog
|
||||
|
||||
import processing
|
||||
from processing.gui import AlgorithmClassification
|
||||
from processing.modeler.ModelerUtils import ModelerUtils
|
||||
from processing.core.AlgorithmProvider import AlgorithmProvider
|
||||
from processing.script.ScriptUtils import ScriptUtils
|
||||
from processing.core.ProcessingConfig import ProcessingConfig
|
||||
from processing.core.GeoAlgorithm import GeoAlgorithm
|
||||
from processing.core.ProcessingLog import ProcessingLog
|
||||
@ -45,6 +47,9 @@ from processing.gui.MessageBarProgress import MessageBarProgress
|
||||
from processing.gui.RenderingStyles import RenderingStyles
|
||||
from processing.gui.Postprocessing import handleAlgorithmResults
|
||||
from processing.gui.AlgorithmExecutor import runalg
|
||||
from processing.tools import dataobjects
|
||||
from processing.core.alglist import algList
|
||||
|
||||
from processing.modeler.ModelerAlgorithmProvider import ModelerAlgorithmProvider
|
||||
from processing.modeler.ModelerOnlyAlgorithmProvider import ModelerOnlyAlgorithmProvider
|
||||
from processing.algs.qgis.QGISAlgorithmProvider import QGISAlgorithmProvider
|
||||
@ -59,49 +64,32 @@ from processing.script.ScriptAlgorithmProvider import ScriptAlgorithmProvider
|
||||
from processing.algs.taudem.TauDEMAlgorithmProvider import TauDEMAlgorithmProvider
|
||||
from processing.preconfigured.PreconfiguredAlgorithmProvider import PreconfiguredAlgorithmProvider
|
||||
|
||||
from processing.tools import dataobjects
|
||||
|
||||
|
||||
class AlgListWatcher(QObject):
|
||||
|
||||
providerAdded = pyqtSignal(str)
|
||||
providerRemoved = pyqtSignal(str)
|
||||
|
||||
algListWatcher = AlgListWatcher()
|
||||
|
||||
|
||||
class Processing:
|
||||
|
||||
listeners = []
|
||||
providers = []
|
||||
|
||||
# A dictionary of algorithms. Keys are names of providers
|
||||
# and values are list with all algorithms from that provider
|
||||
algs = {}
|
||||
|
||||
# Same structure as algs
|
||||
# Same structure as algs in algList
|
||||
actions = {}
|
||||
|
||||
# All the registered context menu actions for the toolbox
|
||||
contextMenuActions = []
|
||||
|
||||
modeler = ModelerAlgorithmProvider()
|
||||
|
||||
@staticmethod
|
||||
def addProvider(provider, updateList=True):
|
||||
"""Use this method to add algorithms from external providers.
|
||||
"""
|
||||
|
||||
# Note: this might slow down the initialization process if
|
||||
# there are many new providers added. Should think of a
|
||||
# different solution
|
||||
if provider.getName() in [p.getName for p in algList.providers]:
|
||||
return
|
||||
try:
|
||||
provider.initializeSettings()
|
||||
Processing.providers.append(provider)
|
||||
ProcessingConfig.readSettings()
|
||||
if updateList:
|
||||
Processing.updateAlgsList()
|
||||
algListWatcher.providerAdded.emit(provider.getName())
|
||||
provider.loadAlgorithms()
|
||||
Processing.actions[provider.getName()] = provider.actions
|
||||
Processing.contextMenuActions.extend(provider.contextMenuActions)
|
||||
algList.addProvider(provider)
|
||||
except:
|
||||
ProcessingLog.addToLog(
|
||||
ProcessingLog.LOG_ERROR,
|
||||
@ -119,47 +107,57 @@ class Processing:
|
||||
try:
|
||||
provider.unload()
|
||||
Processing.providers.remove(provider)
|
||||
del Processing.algs[provider.getName()]
|
||||
algListWatcher.providerRemoved.emit(provider.getName())
|
||||
algList.remove(provider.getName())
|
||||
del Processing.actions[provider.getName()]
|
||||
for act in provider.contextMenuActions:
|
||||
Processing.contextMenuActions.remove(act)
|
||||
except:
|
||||
# This try catch block is here to avoid problems if the
|
||||
# plugin with a provider is unloaded after the Processing
|
||||
# framework itself has been unloaded. It is a quick fix
|
||||
# before I found out how to properly avoid that.
|
||||
# before I find out how to properly avoid that.
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def getProviderFromName(name):
|
||||
"""Returns the provider with the given name."""
|
||||
for provider in Processing.providers:
|
||||
if provider.getName() == name:
|
||||
return provider
|
||||
return Processing.modeler
|
||||
return algList.getProviderFromName(name)
|
||||
|
||||
@staticmethod
|
||||
def initialize():
|
||||
if Processing.providers:
|
||||
return
|
||||
# Add the basic providers
|
||||
Processing.addProvider(QGISAlgorithmProvider(), updateList=False)
|
||||
Processing.addProvider(ModelerOnlyAlgorithmProvider(), updateList=False)
|
||||
Processing.addProvider(GdalOgrAlgorithmProvider(), updateList=False)
|
||||
Processing.addProvider(LidarToolsAlgorithmProvider(), updateList=False)
|
||||
Processing.addProvider(OTBAlgorithmProvider(), updateList=False)
|
||||
Processing.addProvider(RAlgorithmProvider(), updateList=False)
|
||||
Processing.addProvider(SagaAlgorithmProvider(), updateList=False)
|
||||
Processing.addProvider(GrassAlgorithmProvider(), updateList=False)
|
||||
Processing.addProvider(Grass7AlgorithmProvider(), updateList=False)
|
||||
Processing.addProvider(ScriptAlgorithmProvider(), updateList=False)
|
||||
Processing.addProvider(TauDEMAlgorithmProvider(), updateList=False)
|
||||
Processing.addProvider(PreconfiguredAlgorithmProvider(), updateList=False)
|
||||
Processing.addProvider(Processing.modeler, updateList=False)
|
||||
Processing.modeler.initializeSettings()
|
||||
|
||||
for c in AlgorithmProvider.__subclasses__():
|
||||
Processing.addProvider(c())
|
||||
# And initialize
|
||||
AlgorithmClassification.loadClassification()
|
||||
ProcessingConfig.initialize()
|
||||
ProcessingConfig.readSettings()
|
||||
RenderingStyles.loadStyles()
|
||||
Processing.loadFromProviders()
|
||||
|
||||
@staticmethod
|
||||
def addScripts(folder):
|
||||
Processing.initialize()
|
||||
provider = Processing.getProviderFromName("qgis")
|
||||
scripts = ScriptUtils.loadFromFolder(folder)
|
||||
print scripts
|
||||
for script in scripts:
|
||||
script.allowEdit = False
|
||||
script._icon = provider._icon
|
||||
script.provider = provider
|
||||
provider.externalAlgs.extend(scripts)
|
||||
Processing.reloadProvider("qgis")
|
||||
|
||||
|
||||
@staticmethod
|
||||
def removeScripts(folder):
|
||||
provider = Processing.getProviderFromName("qgis")
|
||||
for alg in provider.externalAlgs[::-1]:
|
||||
path = os.path.dirname(alg.descriptionFile)
|
||||
if path == folder:
|
||||
provider.externalAlgs.remove(alg)
|
||||
Processing.reloadProvider("qgis")
|
||||
|
||||
|
||||
@staticmethod
|
||||
def updateAlgsList():
|
||||
@ -168,80 +166,21 @@ class Processing:
|
||||
algorithm providers.
|
||||
"""
|
||||
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
|
||||
Processing.loadFromProviders()
|
||||
for p in Processing.providers:
|
||||
Processing.reloadProvider(p)
|
||||
QApplication.restoreOverrideCursor()
|
||||
|
||||
@staticmethod
|
||||
def loadFromProviders():
|
||||
Processing.loadAlgorithms()
|
||||
Processing.loadActions()
|
||||
Processing.loadContextMenuActions()
|
||||
|
||||
@staticmethod
|
||||
def updateProviders():
|
||||
providers = [p for p in Processing.providers if p.getName() != "model"]
|
||||
for provider in providers:
|
||||
provider.loadAlgorithms()
|
||||
|
||||
@staticmethod
|
||||
def loadAlgorithms():
|
||||
Processing.algs = {}
|
||||
Processing.updateProviders()
|
||||
providers = [p for p in Processing.providers if p.getName() != "model"]
|
||||
for provider in providers:
|
||||
providerAlgs = provider.algs
|
||||
algs = {}
|
||||
for alg in providerAlgs:
|
||||
algs[alg.commandLineName()] = alg
|
||||
Processing.algs[provider.getName()] = algs
|
||||
|
||||
provs = {}
|
||||
for provider in Processing.providers:
|
||||
provs[provider.getName()] = provider
|
||||
|
||||
ModelerUtils.allAlgs = Processing.algs
|
||||
ModelerUtils.providers = provs
|
||||
|
||||
Processing.modeler.loadAlgorithms()
|
||||
|
||||
algs = {}
|
||||
for alg in Processing.modeler.algs:
|
||||
algs[alg.commandLineName()] = alg
|
||||
Processing.algs[Processing.modeler.getName()] = algs
|
||||
|
||||
@staticmethod
|
||||
def loadActions():
|
||||
for provider in Processing.providers:
|
||||
providerActions = provider.actions
|
||||
actions = list()
|
||||
for action in providerActions:
|
||||
actions.append(action)
|
||||
Processing.actions[provider.getName()] = actions
|
||||
|
||||
Processing.actions[provider.getName()] = actions
|
||||
|
||||
@staticmethod
|
||||
def loadContextMenuActions():
|
||||
Processing.contextMenuActions = []
|
||||
for provider in Processing.providers:
|
||||
providerActions = provider.contextMenuActions
|
||||
for action in providerActions:
|
||||
Processing.contextMenuActions.append(action)
|
||||
def reloadProvider(providerName):
|
||||
algList.reloadProvider(providerName)
|
||||
|
||||
@staticmethod
|
||||
def getAlgorithm(name):
|
||||
for provider in Processing.algs.values():
|
||||
if name in provider:
|
||||
return provider[name]
|
||||
return None
|
||||
return algList.getAlgorithm(name)
|
||||
|
||||
@staticmethod
|
||||
def getAlgorithmFromFullName(name):
|
||||
for provider in Processing.algs.values():
|
||||
for alg in provider.values():
|
||||
if alg.name == name:
|
||||
return alg
|
||||
return None
|
||||
return algList.getAlgorithmFromFullName(name)
|
||||
|
||||
@staticmethod
|
||||
def getObject(uri):
|
||||
|
79
python/plugins/processing/core/alglist.py
Normal file
79
python/plugins/processing/core/alglist.py
Normal file
@ -0,0 +1,79 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
***************************************************************************
|
||||
alglist.py
|
||||
---------------------
|
||||
Date : May 2016
|
||||
Copyright : (C) 2016 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__ = 'May 2016'
|
||||
__copyright__ = '(C) 2016, Victor Olaya'
|
||||
|
||||
# This will get replaced with a git SHA1 when you do a git archive
|
||||
|
||||
__revision__ = '$Format:%H$'
|
||||
|
||||
from qgis.PyQt.QtCore import QObject, pyqtSignal
|
||||
|
||||
class AlgorithmList(QObject):
|
||||
|
||||
providerAdded = pyqtSignal(str)
|
||||
providerRemoved = pyqtSignal(str)
|
||||
providerUpdated = pyqtSignal(str)
|
||||
|
||||
# A dictionary of algorithms. Keys are names of providers
|
||||
# and values are list with all algorithms from that provider
|
||||
algs = {}
|
||||
|
||||
providers = []
|
||||
|
||||
def removeProvider(self, providerName):
|
||||
for p in self.providers:
|
||||
if p.getName() == providerName:
|
||||
self.providers.remove(p)
|
||||
break
|
||||
self.algs.remove(providerName)
|
||||
self.providerRemoved.emit(providerName)
|
||||
|
||||
def reloadProvider(self, providerName):
|
||||
for p in self.providers:
|
||||
if p.getName() == providerName:
|
||||
p.loadAlgorithms()
|
||||
self.algs[p.getName()] = {a.commandLineName(): a for a in p.algs}
|
||||
self.providerUpdated.emit(p.getName())
|
||||
break
|
||||
|
||||
def addProvider(self, provider):
|
||||
self.providers.append(provider)
|
||||
self.algs[provider.getName()] = {a.commandLineName(): a for a in provider.algs}
|
||||
self.providerAdded.emit(provider.getName())
|
||||
|
||||
def getProviderFromName(self, name):
|
||||
for provider in self.providers:
|
||||
if provider.getName() == name:
|
||||
return provider
|
||||
|
||||
def getAlgorithm(self, name):
|
||||
for provider in self.algs.values():
|
||||
if name in provider:
|
||||
return provider[name]
|
||||
|
||||
def getAlgorithmFromFullName(self, name):
|
||||
for provider in self.algs.values():
|
||||
for alg in provider.values():
|
||||
if alg.name == name:
|
||||
return alg
|
||||
|
||||
algList = AlgorithmList()
|
33
python/plugins/processing/core/defaultproviders.py
Normal file
33
python/plugins/processing/core/defaultproviders.py
Normal file
@ -0,0 +1,33 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
***************************************************************************
|
||||
defaultproviders.py
|
||||
---------------------
|
||||
Date : May 2016
|
||||
Copyright : (C) 2016 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__ = 'May 2016'
|
||||
__copyright__ = '(C) 2016, Victor Olaya'
|
||||
|
||||
# This will get replaced with a git SHA1 when you do a git archive
|
||||
|
||||
__revision__ = '$Format:%H$'
|
||||
|
||||
|
||||
|
||||
def loadDefaultProviders():
|
||||
# this is here just to "trigger" the above imports so providers are loaded
|
||||
# and can be found by the Processing.initialize() method
|
||||
pass
|
@ -1,80 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
***************************************************************************
|
||||
AlgorithmClassification.py
|
||||
---------------------
|
||||
Date : November 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__ = 'November 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 qgis.PyQt.QtCore import QCoreApplication
|
||||
|
||||
classification = {}
|
||||
|
||||
|
||||
def loadClassification():
|
||||
global classification
|
||||
if not os.path.isfile(classificationFile()):
|
||||
return
|
||||
lines = open(classificationFile())
|
||||
line = lines.readline().strip('\n')
|
||||
while line != '':
|
||||
tokens = line.split(',')
|
||||
subtokens = tokens[1].split('/')
|
||||
try:
|
||||
classification[tokens[0]] = subtokens
|
||||
except:
|
||||
raise Exception(line)
|
||||
line = lines.readline().strip('\n')
|
||||
lines.close()
|
||||
|
||||
|
||||
def classificationFile():
|
||||
return os.path.join(os.path.dirname(__file__), 'algclasssification.txt')
|
||||
|
||||
|
||||
def getClassificationEn(alg):
|
||||
if alg.commandLineName().lower() in classification:
|
||||
group, subgroup = classification[alg.commandLineName()]
|
||||
return group, subgroup
|
||||
else:
|
||||
return None, None
|
||||
|
||||
|
||||
def getClassification(alg):
|
||||
group, subgroup = getClassificationEn(alg)
|
||||
if not group and not subgroup:
|
||||
return None, None
|
||||
return (QCoreApplication.translate('AlgorithmClassification', group),
|
||||
QCoreApplication.translate('AlgorithmClassification', subgroup))
|
||||
|
||||
|
||||
def getDisplayNameEn(alg):
|
||||
return alg.name
|
||||
|
||||
|
||||
def getDisplayName(alg):
|
||||
return alg.i18n_name or alg.name
|
||||
|
||||
|
||||
def getDisplayNames(alg):
|
||||
return alg.name, alg.i18n_name
|
@ -36,7 +36,6 @@ from qgis.utils import iface
|
||||
from qgis.core import QgsNetworkAccessManager
|
||||
|
||||
from processing.core.ProcessingConfig import ProcessingConfig
|
||||
from processing.gui import AlgorithmClassification
|
||||
|
||||
pluginPath = os.path.split(os.path.dirname(__file__))[0]
|
||||
WIDGET, BASE = uic.loadUiType(
|
||||
@ -62,7 +61,7 @@ class AlgorithmDialogBase(BASE, WIDGET):
|
||||
|
||||
self.btnClose = self.buttonBox.button(QDialogButtonBox.Close)
|
||||
|
||||
self.setWindowTitle(AlgorithmClassification.getDisplayName(self.alg))
|
||||
self.setWindowTitle(self.alg.displayName())
|
||||
|
||||
desktop = QDesktopWidget()
|
||||
if desktop.physicalDpiX() > 96:
|
||||
|
@ -32,6 +32,7 @@ from qgis.PyQt.QtWidgets import QDialog, QLabel, QSpacerItem, QHBoxLayout, QVBox
|
||||
from qgis.PyQt.QtCore import QSortFilterProxyModel
|
||||
from qgis.utils import iface
|
||||
from processing.core.Processing import Processing
|
||||
from processing.core.alglist import algList
|
||||
from processing.gui.MessageDialog import MessageDialog
|
||||
from processing.gui.AlgorithmDialog import AlgorithmDialog
|
||||
from processing.tools.system import userFolder, mkdir
|
||||
@ -99,9 +100,7 @@ class CommanderWindow(QDialog):
|
||||
self.combo.clear()
|
||||
|
||||
# Add algorithms
|
||||
for providerName in Processing.algs.keys():
|
||||
provider = Processing.algs[providerName]
|
||||
algs = provider.values()
|
||||
for algs in algList.algs.values():
|
||||
for alg in algs:
|
||||
self.combo.addItem('Processing algorithm: ' + alg.name)
|
||||
|
||||
@ -111,7 +110,7 @@ class CommanderWindow(QDialog):
|
||||
types.FunctionType):
|
||||
self.combo.addItem('Command: ' + command)
|
||||
|
||||
#Add menu entries
|
||||
# Add menu entries
|
||||
menuActions = []
|
||||
actions = iface.mainWindow().menuBar().actions()
|
||||
for action in actions:
|
||||
|
@ -35,14 +35,6 @@ class ContextAction:
|
||||
self.itemData = itemData
|
||||
self.toolbox = toolbox
|
||||
|
||||
def updateToolbox(self):
|
||||
'''
|
||||
Updates the list of algorithms and then the toolbox.
|
||||
It only update the item corresponding to the provider of the algorithm.
|
||||
To be called after the action is executed, if needed
|
||||
'''
|
||||
self.toolbox.updateProvider(self.alg.provider.getName())
|
||||
|
||||
def tr(self, string, context=''):
|
||||
if context == '':
|
||||
context = 'ContextAction'
|
||||
|
@ -31,6 +31,7 @@ from qgis.PyQt.QtGui import QIcon
|
||||
|
||||
from processing.gui.ToolboxAction import ToolboxAction
|
||||
from processing.gui.ScriptEditorDialog import ScriptEditorDialog
|
||||
from processing.core.alglist import algList
|
||||
|
||||
pluginPath = os.path.split(os.path.dirname(__file__))[0]
|
||||
|
||||
@ -62,6 +63,6 @@ class CreateNewScriptAction(ToolboxAction):
|
||||
dlg.exec_()
|
||||
if dlg.update:
|
||||
if self.scriptType == self.SCRIPT_PYTHON:
|
||||
self.toolbox.updateProvider('script')
|
||||
algList.reloadProvider('script')
|
||||
elif self.scriptType == self.SCRIPT_R:
|
||||
self.toolbox.updateProvider('r')
|
||||
algList.reloadProvider('r')
|
||||
|
@ -33,7 +33,7 @@ from processing.gui.ContextAction import ContextAction
|
||||
|
||||
from processing.algs.r.RAlgorithm import RAlgorithm
|
||||
from processing.script.ScriptAlgorithm import ScriptAlgorithm
|
||||
|
||||
from processing.core.alglist import algList
|
||||
|
||||
class DeleteScriptAction(ContextAction):
|
||||
|
||||
@ -60,6 +60,6 @@ class DeleteScriptAction(ContextAction):
|
||||
if reply == QMessageBox.Yes:
|
||||
os.remove(self.itemData.descriptionFile)
|
||||
if self.scriptType == self.SCRIPT_PYTHON:
|
||||
self.toolbox.updateProvider('script')
|
||||
algList.reloadProvider('script')
|
||||
elif self.scriptType == self.SCRIPT_R:
|
||||
self.toolbox.updateProvider('r')
|
||||
algList.reloadProvider('r')
|
||||
|
@ -29,7 +29,7 @@ from processing.gui.ContextAction import ContextAction
|
||||
from processing.gui.ScriptEditorDialog import ScriptEditorDialog
|
||||
from processing.algs.r.RAlgorithm import RAlgorithm
|
||||
from processing.script.ScriptAlgorithm import ScriptAlgorithm
|
||||
|
||||
from processing.core.alglist import algList
|
||||
|
||||
class EditScriptAction(ContextAction):
|
||||
|
||||
@ -52,6 +52,6 @@ class EditScriptAction(ContextAction):
|
||||
dlg.exec_()
|
||||
if dlg.update:
|
||||
if self.scriptType == ScriptEditorDialog.SCRIPT_PYTHON:
|
||||
self.toolbox.updateProvider('script')
|
||||
algList.reloadProvider('script')
|
||||
elif self.scriptType == ScriptEditorDialog.SCRIPT_R:
|
||||
self.toolbox.updateProvider('r')
|
||||
algList.reloadProvider('r')
|
||||
|
@ -64,8 +64,8 @@ class GetScriptsAction(ToolboxAction):
|
||||
def execute(self):
|
||||
dlg = GetScriptsAndModelsDialog(GetScriptsAndModelsDialog.SCRIPTS)
|
||||
dlg.exec_()
|
||||
if dlg.updateToolbox:
|
||||
self.toolbox.updateProvider('script')
|
||||
if dlg.updateProvider:
|
||||
algList.reloadProvider('script')
|
||||
|
||||
|
||||
class GetRScriptsAction(ToolboxAction):
|
||||
@ -80,7 +80,7 @@ class GetRScriptsAction(ToolboxAction):
|
||||
def execute(self):
|
||||
dlg = GetScriptsAndModelsDialog(GetScriptsAndModelsDialog.RSCRIPTS)
|
||||
dlg.exec_()
|
||||
if dlg.updateToolbox:
|
||||
if dlg.updateProvider:
|
||||
self.toolbox.updateProvider('r')
|
||||
|
||||
|
||||
@ -96,8 +96,8 @@ class GetModelsAction(ToolboxAction):
|
||||
def execute(self):
|
||||
dlg = GetScriptsAndModelsDialog(GetScriptsAndModelsDialog.MODELS)
|
||||
dlg.exec_()
|
||||
if dlg.updateToolbox:
|
||||
self.toolbox.updateProvider('model')
|
||||
if dlg.updateProvider:
|
||||
algList.reloadProvider('model')
|
||||
|
||||
|
||||
class GetScriptsAndModelsDialog(BASE, WIDGET):
|
||||
@ -141,7 +141,7 @@ class GetScriptsAndModelsDialog(BASE, WIDGET):
|
||||
self.icon = QIcon(os.path.join(pluginPath, 'images', 'r.svg'))
|
||||
|
||||
self.lastSelectedItem = None
|
||||
self.updateToolbox = False
|
||||
self.updateProvider = False
|
||||
self.populateTree()
|
||||
self.buttonBox.accepted.connect(self.okPressed)
|
||||
self.buttonBox.rejected.connect(self.cancelPressed)
|
||||
@ -305,7 +305,7 @@ class GetScriptsAndModelsDialog(BASE, WIDGET):
|
||||
if os.path.exists(path):
|
||||
os.remove(path)
|
||||
|
||||
self.updateToolbox = len(toDownload) + len(toDelete) > 0
|
||||
self.updateProvider = len(toDownload) + len(toDelete) > 0
|
||||
super(GetScriptsAndModelsDialog, self).accept()
|
||||
|
||||
|
||||
|
@ -34,17 +34,17 @@ from qgis.PyQt.QtWidgets import QMenu, QAction, QTreeWidgetItem, QLabel, QMessag
|
||||
from qgis.utils import iface
|
||||
|
||||
from processing.gui.Postprocessing import handleAlgorithmResults
|
||||
from processing.core.Processing import Processing, algListWatcher
|
||||
from processing.core.Processing import Processing
|
||||
from processing.core.ProcessingLog import ProcessingLog
|
||||
from processing.core.ProcessingConfig import ProcessingConfig, settingsWatcher
|
||||
from processing.gui.MessageDialog import MessageDialog
|
||||
from processing.gui import AlgorithmClassification
|
||||
from processing.gui.AlgorithmDialog import AlgorithmDialog
|
||||
from processing.gui.BatchAlgorithmDialog import BatchAlgorithmDialog
|
||||
from processing.gui.EditRenderingStylesDialog import EditRenderingStylesDialog
|
||||
from processing.gui.ConfigDialog import ConfigDialog
|
||||
from processing.gui.MessageBarProgress import MessageBarProgress
|
||||
from processing.gui.AlgorithmExecutor import runalg
|
||||
from processing.core.alglist import algList
|
||||
|
||||
pluginPath = os.path.split(os.path.dirname(__file__))[0]
|
||||
WIDGET, BASE = uic.loadUiType(
|
||||
@ -81,8 +81,9 @@ class ProcessingToolbox(BASE, WIDGET):
|
||||
|
||||
self.fillTree()
|
||||
|
||||
algListWatcher.providerRemoved.connect(self.removeProvider)
|
||||
algListWatcher.providerAdded.connect(self.addProvider)
|
||||
algList.providerRemoved.connect(self.removeProvider)
|
||||
algList.providerAdded.connect(self.addProvider)
|
||||
algList.providerUpdated.connect(self.updateProvider)
|
||||
settingsWatcher.settingsChanged.connect(self.fillTree)
|
||||
|
||||
def showDisabled(self):
|
||||
@ -96,7 +97,7 @@ class ProcessingToolbox(BASE, WIDGET):
|
||||
if not showTip or self.tipWasClosed:
|
||||
return False
|
||||
|
||||
for providerName in Processing.algs.keys():
|
||||
for providerName in algList.algs.keys():
|
||||
name = 'ACTIVATE_' + providerName.upper().replace(' ', '_')
|
||||
if not ProcessingConfig.getSetting(name):
|
||||
return True
|
||||
@ -110,7 +111,7 @@ class ProcessingToolbox(BASE, WIDGET):
|
||||
if text:
|
||||
self.algorithmTree.expandAll()
|
||||
self.disabledWithMatchingAlgs = []
|
||||
for providerName, provider in Processing.algs.iteritems():
|
||||
for providerName, provider in algList.algs.iteritems():
|
||||
name = 'ACTIVATE_' + providerName.upper().replace(' ', '_')
|
||||
if not ProcessingConfig.getSetting(name):
|
||||
for alg in provider.values():
|
||||
@ -308,9 +309,7 @@ class ProcessingToolbox(BASE, WIDGET):
|
||||
def addProvider(self, providerName):
|
||||
name = 'ACTIVATE_' + providerName.upper().replace(' ', '_')
|
||||
providerItem = TreeProviderItem(providerName, None, self)
|
||||
if ProcessingConfig.getSetting(name):
|
||||
providerItem.setHidden(providerItem.childCount() == 0)
|
||||
else:
|
||||
if not ProcessingConfig.getSetting(name):
|
||||
providerItem = TreeProviderItem(providerName, None, self)
|
||||
providerItem.setHidden(True)
|
||||
self.disabledProviderItems[providerName] = providerItem
|
||||
@ -326,11 +325,10 @@ class ProcessingToolbox(BASE, WIDGET):
|
||||
self.algorithmTree.clear()
|
||||
self.disabledProviderItems = {}
|
||||
disabled = []
|
||||
for providerName in Processing.algs.keys():
|
||||
for providerName in algList.algs.keys():
|
||||
name = 'ACTIVATE_' + providerName.upper().replace(' ', '_')
|
||||
if ProcessingConfig.getSetting(name):
|
||||
providerItem = TreeProviderItem(providerName, self.algorithmTree, self)
|
||||
providerItem.setHidden(providerItem.childCount() == 0)
|
||||
else:
|
||||
disabled.append(providerName)
|
||||
self.algorithmTree.sortItems(0, Qt.AscendingOrder)
|
||||
@ -346,7 +344,7 @@ class TreeAlgorithmItem(QTreeWidgetItem):
|
||||
QTreeWidgetItem.__init__(self)
|
||||
self.alg = alg
|
||||
icon = alg.getIcon()
|
||||
nameEn, name = AlgorithmClassification.getDisplayNames(alg)
|
||||
nameEn, name = alg.displayNames()
|
||||
name = name if name != '' else nameEn
|
||||
self.setIcon(0, icon)
|
||||
self.setToolTip(0, name)
|
||||
@ -383,7 +381,7 @@ class TreeProviderItem(QTreeWidgetItem):
|
||||
def populate(self):
|
||||
groups = {}
|
||||
count = 0
|
||||
provider = Processing.algs[self.providerName]
|
||||
provider = algList.algs[self.providerName]
|
||||
algs = provider.values()
|
||||
|
||||
name = 'ACTIVATE_' + self.providerName.upper().replace(' ', '_')
|
||||
@ -436,3 +434,5 @@ class TreeProviderItem(QTreeWidgetItem):
|
||||
self.setToolTip(0, self.text(0))
|
||||
for groupItem in groups.values():
|
||||
self.addChild(groupItem)
|
||||
|
||||
self.setHidden(self.childCount() == 0)
|
||||
|
@ -17,7 +17,6 @@
|
||||
***************************************************************************
|
||||
"""
|
||||
|
||||
|
||||
__author__ = 'Alexander Bruy'
|
||||
__date__ = 'December 2012'
|
||||
__copyright__ = '(C) 2012, Alexander Bruy'
|
||||
@ -39,7 +38,7 @@ from qgis.PyQt.QtWidgets import QMenu, QAction, QMessageBox, QFileDialog, QAppli
|
||||
from qgis.core import QgsApplication
|
||||
from qgis.utils import iface
|
||||
|
||||
from processing.modeler.ModelerUtils import ModelerUtils
|
||||
from processing.core.alglist import algList
|
||||
from processing.gui.AlgorithmDialog import AlgorithmDialog
|
||||
from processing.gui.HelpEditionDialog import HelpEditionDialog
|
||||
from processing.algs.r.RAlgorithm import RAlgorithm
|
||||
@ -63,8 +62,8 @@ class ScriptEditorDialog(BASE, WIDGET):
|
||||
super(ScriptEditorDialog, self).__init__(None)
|
||||
self.setupUi(self)
|
||||
|
||||
self.setWindowFlags(Qt.WindowMinimizeButtonHint |
|
||||
Qt.WindowMaximizeButtonHint |
|
||||
self.setWindowFlags(Qt.WindowMinimizeButtonHint |
|
||||
Qt.WindowMaximizeButtonHint |
|
||||
Qt.WindowCloseButtonHint)
|
||||
# Set icons
|
||||
self.btnOpen.setIcon(
|
||||
@ -274,10 +273,10 @@ class ScriptEditorDialog(BASE, WIDGET):
|
||||
def runAlgorithm(self):
|
||||
if self.algType == self.SCRIPT_PYTHON:
|
||||
alg = ScriptAlgorithm(None, unicode(self.editor.text()))
|
||||
alg.provider = ModelerUtils.providers['script']
|
||||
alg.provider = algList.getProviderFromName('script')
|
||||
if self.algType == self.SCRIPT_R:
|
||||
alg = RAlgorithm(None, unicode(self.editor.text()))
|
||||
alg.provider = ModelerUtils.providers['r']
|
||||
alg.provider = algList.getProviderFromName('r')
|
||||
|
||||
dlg = alg.getCustomParametersDialog()
|
||||
if not dlg:
|
||||
|
@ -1,396 +0,0 @@
|
||||
gdalogr:overviews,Raster/Creation
|
||||
gdalogr:executesql,Vector/General tools
|
||||
gdalogr:rasterinfo,Raster/General tools
|
||||
gdalogr:merge,Raster/General tools
|
||||
gdalogr:nearblack,Raster/Analysis
|
||||
gdalogr:ogr2ogr,Vector/General tools
|
||||
gdalogr:vectorinfo,Vector/Statistics
|
||||
gdalogr:pcttorgb,Images/Image Manipulation
|
||||
gdalogr:proximity,Raster/Analysis
|
||||
gdalogr:rgbtopct,Images/Image Manipulation
|
||||
gdalogr:sieve,Raster/Edition
|
||||
gdalogr:translate,Raster/General tools
|
||||
gdalogr:warpreproject,Raster/General tools
|
||||
gdalogr:slope,Domain specific/Terrain analysis and geomorphometry
|
||||
gdalogr:aspect,Domain specific/Terrain analysis and geomorphometry
|
||||
gdalogr:hillshade,Domain specific/Viewsheds\Lighting
|
||||
gdalogr:polygonize,Raster - vector/Raster -> Vector
|
||||
gdalogr:gridrasterize,Raster - vector/Vector -> Raster
|
||||
gdalogr:gridnearestneighbor,Raster - vector/Vector -> Raster
|
||||
gdalogr:griddatametrics,Raster - vector/Vector -> Raster
|
||||
gdalogr:gridinvdist,Raster - vector/Vector -> Raster
|
||||
gdalogr:gridaverage,Raster - vector/Vector -> Raster
|
||||
gdalogr:contour,Raster - vector/Raster -> Vector
|
||||
gdalogr:importvectorintopostgisdatabaseavailableconnections,Vector/General tools
|
||||
otb:bandmath,Images/Miscellaneous
|
||||
otb:binarymorphologicaloperation,Images/Image Filtering
|
||||
otb:bundletoperfectsensor,Images/Geometry
|
||||
otb:cartographictogeographiccoordinatesconversion,Images/Geometry
|
||||
otb:classificationregularization,Images/Learning
|
||||
otb:colormapping,Images/Image Manipulation
|
||||
otb:computeconfusionmatrix,Images/Learning
|
||||
otb:computeimagessecondorderstatistics,Images/Learning
|
||||
otb:computepolylinefeaturefromimage,Images/Feature Extraction
|
||||
otb:concatenate,Images/Vector Data Manipulation
|
||||
otb:connectedcomponentsegmentation,Images/Segmentation
|
||||
otb:convertsensorpointtogeographicpoint,Images/Geometry
|
||||
otb:dimensionalityreductionapplication,Images/Image Filtering
|
||||
otb:disparitymaptoelevationmap,Images/Stereo
|
||||
otb:edgeextraction,Images/Feature Extraction
|
||||
otb:edisonmeanshiftsegmentationlabeledrasteroutput,Images/Segmentation
|
||||
otb:edisonmeanshiftsegmentationlargescalevectoroutput,Images/Segmentation
|
||||
otb:extractroi,Images/Image Manipulation
|
||||
otb:fineregistration,Images/Stereo
|
||||
otb:fusionofclassifications,Images/Learning
|
||||
otb:fuzzymodelestimation,Images/Feature Extraction
|
||||
otb:grayscalemorphologicaloperation,Images/Image Filtering
|
||||
otb:gridbasedimageresampling,Images/Geometry
|
||||
otb:haralicktextureextraction,Images/Feature Extraction
|
||||
otb:hoovercomparesegmentation,Images/Segmentation
|
||||
otb:hyperspectraldataunmixing,Images/Miscellaneous
|
||||
otb:imageconversion,Images/Image Manipulation
|
||||
otb:imageenvelope,Images/Geometry
|
||||
otb:imageresamplingwitharigidtransform,Images/Geometry
|
||||
otb:imagescomparison,Images/Miscellaneous
|
||||
otb:imagesconcatenation,Images/Image Manipulation
|
||||
otb:imagesvmclassification,Images/Learning
|
||||
otb:imagetokmzexport,Images/Miscellaneous
|
||||
otb:linesegmentdetection,Images/Feature Extraction
|
||||
otb:localstatisticextraction,Images/Feature Extraction
|
||||
otb:maximumautocorrelationfactordecomposition,Images/Image Filtering
|
||||
otb:meanshiftfiltering,Images/Image Filtering
|
||||
otb:meanshiftsegmentationlabeledrasteroutput,Images/Segmentation
|
||||
otb:meanshiftsegmentationlargescalevectoroutput,Images/Segmentation
|
||||
otb:morphologicalprofilesbasedsegmentationlabeledrasteroutput,Images/Segmentation
|
||||
otb:morphologicalprofilesbasedsegmentationlargescalevectoroutput,Images/Segmentation
|
||||
otb:multiresolutionpyramid,Images/Image Manipulation
|
||||
otb:multivariatealterationdetector,Images/Feature Extraction
|
||||
otb:obtainutmzonefromgeopoint,Images/Miscellaneous
|
||||
otb:openstreetmaplayersimportationsapplications,Images/Miscellaneous
|
||||
otb:opticalcalibration,Images/Calibration
|
||||
otb:orthorectification,Images/Geometry
|
||||
otb:pansharpening,Images/Image Manipulation
|
||||
otb:pixelvalue,Images/Miscellaneous
|
||||
otb:pixelwiseblockmatching,Images/Stereo
|
||||
otb:pixelwiseblockmatching,Images/Stereo
|
||||
otb:quicklook,Images/Image Manipulation
|
||||
otb:radiometricindices,Images/Feature Extraction
|
||||
otb:rasterization,Images/Vector Data Manipulation
|
||||
otb:readimageinformation,Images/Image Manipulation
|
||||
otb:rescaleimage,Images/Image Manipulation
|
||||
otb:sarradiometriccalibration,Images/Calibration
|
||||
otb:sfstextureextraction,Images/Feature Extraction
|
||||
otb:simpleconnectedcomponentssegmentationlabeledrasteroutput,Images/Segmentation
|
||||
otb:simpleconnectedcomponentssegmentationlargescalevectoroutput,Images/Segmentation
|
||||
otb:smoothing,Images/Image Filtering
|
||||
otb:somclassification,Images/Learning
|
||||
otb:splitimage,Images/Image Manipulation
|
||||
otb:stereorectificationdeformationgridgenerator,Images/Geometry
|
||||
otb:stereosensormodeltoelevationmap,Images/Stereo
|
||||
otb:superimposesensor,Images/Geometry
|
||||
otb:trainsvmclassifierfrommultipleimages,Images/Learning
|
||||
otb:unsupervisedkmeansimageclassification,Images/Learning
|
||||
otb:validatesvmimagesclassifier,Images/Learning
|
||||
otb:vectordataextractroi,Images/Vector Data Manipulation
|
||||
otb:vectordatareprojection,Images/Vector Data Manipulation
|
||||
otb:vectordatasetfield,Images/Vector Data Manipulation
|
||||
otb:vectordatatransformation,Images/Vector Data Manipulation
|
||||
otb:vectordatavalidation,Images/Feature Extraction
|
||||
otb:vertexcomponentanalysis,Images/Miscellaneous
|
||||
otb:watershedsegmentationlabeledrasteroutput,Images/Segmentation
|
||||
otb:watershedsegmentationlargescalevectoroutput,Images/Segmentation
|
||||
qgis:addautoincrementalfield,Vector/Table tools
|
||||
qgis:addfieldtoattributestable,Vector/Table tools
|
||||
qgis:advancedpythonfieldcalculator,Vector/Table tools
|
||||
qgis:basicstatisticsfornumericfields,Vector/Statistics
|
||||
qgis:basicstatisticsfortextfields,Vector/Statistics
|
||||
qgis:clip,Vector/Overlay
|
||||
qgis:convertgeometrytype,Vector/General tools
|
||||
qgis:convexhull,Vector/Geometry operations
|
||||
qgis:countpointsinpolygon,Vector/Statistics
|
||||
qgis:countpointsinpolygonweighted,Vector/Statistics
|
||||
qgis:countuniquepointsinpolygon,Vector/Statistics
|
||||
qgis:createequivalentnumericalfield,Vector/Table tools
|
||||
qgis:creategrid,Vector/Creation
|
||||
qgis:delaunaytriangulation,Vector/Geometry operations
|
||||
qgis:deletecolumn,Vector/Table tools
|
||||
qgis:deleteduplicategeometries,Vector/General tools
|
||||
qgis:densifygeometries,Vector/Geometry operations
|
||||
qgis:densifygeometriesgivenaninterval,Vector/Geometry operations
|
||||
qgis:difference,Vector/Overlay
|
||||
qgis:dissolve,Vector/Geometry operations
|
||||
qgis:distancetonearesthub,Vector/Analysis
|
||||
qgis:explodelines,Vector/Lines
|
||||
qgis:exportaddgeometrycolumns,Vector/Table tools
|
||||
qgis:extractnodes,Vector/General tools
|
||||
qgis:fieldcalculator,Vector/Table tools
|
||||
qgis:fixeddistancebuffer,Vector/Geometry operations
|
||||
qgis:hublines,Vector/Analysis
|
||||
qgis:intersection,Vector/Overlay
|
||||
qgis:joinattributestable,Vector/Table tools
|
||||
qgis:lineintersections,Vector/Lines
|
||||
qgis:linestopolygons,Vector/Lines
|
||||
qgis:listuniquevalues,Vector/Table tools
|
||||
qgis:meancoordinates,Vector/Statistics
|
||||
qgis:mergevectorlayers,Vector/General tools
|
||||
qgis:multiparttosingleparts,Vector/General tools
|
||||
qgis:nearestneighbouranalysis,Vector/Points
|
||||
qgis:pointslayerfromtable,Vector/Creation
|
||||
qgis:polygonfromlayerextent,Vector/Creation
|
||||
qgis:polygonstolines,Vector/Polygons
|
||||
qgis:polygoncentroids,Vector/Polygons
|
||||
qgis:randomselection,Vector/Selection
|
||||
qgis:randomselectionwithinsubsets,Vector/Selection
|
||||
qgis:rasterlayerhistogram,Raster/Statistics
|
||||
qgis:rasterlayerstatistics,Raster/Statistics
|
||||
qgis:reprojectlayer,Vector/General tools
|
||||
qgis:saveselectedfeatures,Vector/General tools
|
||||
qgis:selectbyattribute,Vector/Selection
|
||||
qgis:selectbylocation,Vector/Selection
|
||||
qgis:simplifygeometries,Vector/Geometry operations
|
||||
qgis:singlepartstomultipart,Vector/General tools
|
||||
qgis:snappointstogrid,Vector/General tools
|
||||
qgis:statisticsbycategories,Vector/Statistics
|
||||
qgis:sumlinelengths,Vector/Lines
|
||||
qgis:texttofloat,Vector/Table tools
|
||||
qgis:union,Vector/Overlay
|
||||
qgis:variabledistancebuffer,Vector/Geometry operations
|
||||
qgis:vectorlayerhistogram,Vector/Statistics
|
||||
qgis:vectorlayerscatterplot,Vector/Statistics
|
||||
qgis:voronoipolygons,Vector/Geometry operations
|
||||
saga:accumulatedcostanisotropic,Domain specific/Cost analysis
|
||||
saga:accumulatedcostisotropic,Domain specific/Cost analysis
|
||||
saga:addcoordinatestopoints,Vector/Points
|
||||
saga:addgridvaluestopoints,Raster - vector/Raster - vector operations
|
||||
saga:addgridvaluestoshapes,Raster - vector/Raster - vector operations
|
||||
saga:addpolygonattributestopoints,Vector/Points
|
||||
saga:aggregate,Raster/Edition
|
||||
saga:aggregatepointobservations,Vector/Points
|
||||
saga:aggregationindex,Raster/Miscellaneous
|
||||
saga:analyticalhierarchyprocess,Raster/Miscellaneous
|
||||
saga:basicterrainanalysis,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:bsplineapproximation,Raster - vector/Raster -> Vector
|
||||
saga:burnstreamnetworkintodem,Domain specific/Hydrology
|
||||
saga:catchmentarea,Domain specific/Hydrology
|
||||
saga:cellbalance,Domain specific/Hydrology
|
||||
saga:changedateformat,Vector/Table tools
|
||||
saga:changedetection,Raster/Analysis
|
||||
saga:changegridvalues,Raster/Edition
|
||||
saga:changetimeformat,Vector/Table tools
|
||||
saga:changevectoranalysis,Raster/Analysis
|
||||
saga:channelnetwork,Domain specific/Hydrology
|
||||
saga:channelnetworkanddrainagebasins,Domain specific/Hydrology
|
||||
saga:clipgridwithpolygon,Raster - vector/Raster - vector operations
|
||||
saga:clippointswithpolygons,Vector/Overlay
|
||||
saga:closegaps,Raster/General tools
|
||||
saga:closegapswithspline,Raster/General tools
|
||||
saga:closeonecellgaps,Raster/General tools
|
||||
saga:clusteranalysis,Vector/General tools
|
||||
saga:clusteranalysisforgrids,Raster/Analysis
|
||||
saga:combinegrids,Raster/General tools
|
||||
saga:convergenceindex,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:convergenceindexsearchradius,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:convertdatastoragetype,Raster/General tools
|
||||
saga:convertlinestopoints,Vector/Lines
|
||||
saga:convertlinestopolygons,Vector/Lines
|
||||
saga:convertmultipointstopoints,Vector/Points
|
||||
saga:convertpointstolines,Vector/Points
|
||||
saga:convertpolygonlineverticestopoints,Vector/Polygons
|
||||
saga:convertpolygonstolines,Vector/Polygons
|
||||
saga:converttabletopoints,Vector/Table tools
|
||||
saga:coordinatetransformationgrid,Raster/General tools
|
||||
saga:coordinatetransformationgridlist,Raster/General tools
|
||||
saga:coordinatetransformationshapes,Vector/General tools
|
||||
saga:coordinatetransformationshapeslist,Vector/General tools
|
||||
saga:covereddistance,Raster/Analysis
|
||||
saga:creategraticule,Vector/Creation
|
||||
saga:croptodata,Raster/General tools
|
||||
saga:crossclassificationandtabulation,Raster/General tools
|
||||
saga:crossprofiles,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:cubicsplineapproximation,Raster - vector/Vector -> Raster
|
||||
saga:curvatureclassification,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:cutshapeslayer,Vector/Overlay
|
||||
saga:dailytohourlypet,Domain specific/Miscellaneous
|
||||
saga:directionalaverage1,Raster/Filters
|
||||
saga:directionalstatisticsforsinglegrid,Raster/Statistics
|
||||
saga:distancematrix,Vector/Points
|
||||
saga:diurnalanisotropicheating,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:downslopedistancegradient,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:dtmfilterslopebased,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:edgecontamination,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:effectiveairflowheights,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:enumeratetablefield,Vector/Table tools
|
||||
saga:fillgapsinrecords,Vector/Table tools
|
||||
saga:fillsinks,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:filterclumps,Raster/General tools
|
||||
saga:fitnpointstoshape,Vector/Points
|
||||
saga:flatdetection,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:flowpathlength,Domain specific/Hydrology
|
||||
saga:flowwidthandspecificcatchmentarea,Domain specific/Hydrology
|
||||
saga:fractaldimensionofgridsurface,Raster/Statistics
|
||||
saga:function,Raster/Creation
|
||||
saga:fuzzify,Raster/Analysis
|
||||
saga:fuzzyintersectionand,Raster/Analysis
|
||||
saga:fuzzyunionor,Raster/Analysis
|
||||
saga:gaussianfilter,Raster/Filters
|
||||
saga:gaussianlandscapes,Raster/Creation
|
||||
saga:geographicallyweightedmultipleregression,Raster/Statistics
|
||||
saga:geographicallyweightedmultipleregressionpoints,Raster/Statistics
|
||||
saga:geographicallyweightedmultipleregressionpoints/grids,Raster/Statistics
|
||||
saga:geographicallyweightedregression,Raster/Statistics
|
||||
saga:geographicallyweightedregressionpointsgrid,Raster/Statistics
|
||||
saga:geometricfigures,Vector/Miscellaneous
|
||||
saga:getshapesextents,Vector/General tools
|
||||
saga:globalmoransiforgrids,Domain specific/Geostatistics
|
||||
saga:gradientvectorfromcartesiantopolarcoordinates,Domain specific/Cost analysis
|
||||
saga:gradientvectorfrompolartocartesiancoordinates,Domain specific/Cost analysis
|
||||
saga:gradientvectorsfromdirectionalcomponents,Raster - vector/Raster -> Vector
|
||||
saga:gradientvectorsfromdirectionandlength,Raster - vector/Raster -> Vector
|
||||
saga:gradientvectorsfromsurface,Raster - vector/Raster -> Vector
|
||||
saga:gridbuffer,Raster/General tools
|
||||
saga:rastercalculator,Raster/General tools
|
||||
saga:griddifference,Raster/General tools
|
||||
saga:griddivision,Raster/General tools
|
||||
saga:gridmasking,Raster/General tools
|
||||
saga:gridnormalisation,Raster/General tools
|
||||
saga:gridorientation,Raster/General tools
|
||||
saga:gridproximitybuffer,Raster/General tools
|
||||
saga:gridsfromclassifiedgridandtable,Raster/Creation
|
||||
saga:gridshrinkexpand,Raster/General tools
|
||||
saga:gridskeletonization,Raster/General tools
|
||||
saga:gridsproduct,Raster/General tools
|
||||
saga:gridssum,Raster/General tools
|
||||
saga:gridstandardisation,Raster/Edition
|
||||
saga:gridstatisticsforpolygons,Raster - vector/Raster - vector statistics
|
||||
saga:gridvaluestopoints,Raster - vector/Raster -> Vector
|
||||
saga:gridvaluestopointsrandomly,Raster - vector/Raster -> Vector
|
||||
saga:gridvolume,Raster/Miscellaneous
|
||||
saga:hypsometry,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:invertdatanodata,Raster/General tools
|
||||
saga:kerneldensityestimation,Raster/Statistics
|
||||
saga:lakeflood,Raster/Miscellaneous
|
||||
saga:landsurfacetemperature,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:laplacianfilter,Raster/Filters
|
||||
saga:layerofextremevalue,Raster/General tools
|
||||
saga:leastcostpaths,Domain specific/Cost analysis
|
||||
saga:line-polygonintersection,Vector/Geometry operations
|
||||
saga:linedissolve,Vector/Lines
|
||||
saga:lineproperties,Vector/Lines
|
||||
saga:linesimplification,Vector/Lines
|
||||
saga:localminimaandmaxima,Raster - vector/Raster -> Vector
|
||||
saga:lsfactor,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:majorityfilter,Raster/Filters
|
||||
saga:massbalanceindex,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:mergeshapeslayers,Vector/General tools
|
||||
saga:metricconversions,Raster/Edition
|
||||
saga:minimumdistanceanalysis,Vector/Points
|
||||
saga:modifedquadraticshepard,Raster - vector/Vector -> Raster
|
||||
saga:morphologicalfilter,Raster/Filters
|
||||
saga:morphometricprotectionindex,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:multibandvariation,Raster/Analysis
|
||||
saga:multidirectionleefilter,Raster/Filters
|
||||
saga:multilevelbsplineinterpolation,Raster - vector/Vector -> Raster
|
||||
saga:multilevelbsplineinterpolationfromgrid,Raster - vector/Vector -> Raster
|
||||
saga:multipleregressionanalysisgridgrids,Raster/Statistics
|
||||
saga:multipleregressionanalysispointsgrid,Raster - vector/Raster - vector statistics
|
||||
saga:multiresolutionindexofvalleybottomflatnessmrvbf,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:naturalneighbour,Raster - vector/Vector -> Raster
|
||||
saga:orderedweightedaveragingowa,Raster/Analysis
|
||||
saga:ordinarykriging,Raster - vector/Vector -> Raster
|
||||
saga:ordinarykrigingglobal,Raster - vector/Vector -> Raster
|
||||
saga:overlandflowdistancetochannelnetwork,Domain specific/Hydrology
|
||||
saga:overlandflowkinematicwaved8,Domain specific/Hydrology
|
||||
saga:patching,Raster/General tools
|
||||
saga:patternanalysis,Raster/Analysis
|
||||
saga:pointsfilter,Vector/Points
|
||||
saga:pointstatisticsforpolygons,Raster - vector/Raster - vector statistics
|
||||
saga:pointsthinning,Vector/Points
|
||||
saga:polartocartesiancoordinates,Domain specific/Cost analysis
|
||||
saga:polygon-lineintersection,Vector/Geometry operations
|
||||
saga:polygondissolve,Vector/Polygons
|
||||
saga:polygondissolvebyattribute,Vector/Polygons
|
||||
saga:polygondissolveallpolygons,Vector/Polygons
|
||||
saga:intersect,Vector/Polygons
|
||||
saga:difference,Vector/Polygons
|
||||
saga:update,Vector/Polygons
|
||||
saga:identity,Vector/Polygons
|
||||
saga:union,Vector/Polygons
|
||||
saga:symmetricaldifference,Vector/Polygons
|
||||
saga:polygonpartstoseparatepolygons,Vector/Polygons
|
||||
saga:polygonproperties,Vector/Polygons
|
||||
saga:polygonshapeindices,Vector/Polygons
|
||||
saga:polygonstoedgesandnodes,Vector/Polygons
|
||||
saga:polynomialregression,Raster/Statistics
|
||||
saga:polynomialtrendfromgrids,Raster/Statistics
|
||||
saga:principlecomponentsanalysis,Raster/Analysis
|
||||
saga:profilefrompoints,Raster - vector/Raster - vector statistics
|
||||
saga:profilesfromlines,Raster - vector/Raster - vector statistics
|
||||
saga:proximitygrid,Raster/Analysis
|
||||
saga:pythagorastree,Vector/Miscellaneous
|
||||
saga:quadtreestructuretoshapes,Vector/Miscellaneous
|
||||
saga:radiusofvariancegrid,Raster/Statistics
|
||||
saga:randomfield,Raster/Creation
|
||||
saga:randomterraingeneration,Raster/Creation
|
||||
saga:rankfilter,Raster/Filters
|
||||
saga:realareacalculation,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:reclassifygridvalues,Raster/Edition
|
||||
saga:regressionanalysispointsgrid,Raster - vector/Raster - vector statistics
|
||||
saga:relativeheightsandslopepositions,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:removeduplicatepoints,Vector/Points
|
||||
saga:representativenessgrid,Domain specific/Geostatistics
|
||||
saga:resampling,Raster/General tools
|
||||
saga:residualanalysisgrid,Raster/Statistics
|
||||
saga:rgbcomposite,Images/Image tools
|
||||
saga:runningaverage,Vector/Table tools
|
||||
saga:sagawetnessindex,Domain specific/Hydrology
|
||||
saga:separatepointsbydirection,Vector/Points
|
||||
saga:shapesbuffer,Vector/Geometry operations
|
||||
saga:simplefilter,Raster/Filters
|
||||
saga:simulation,Domain specific/Miscellaneous
|
||||
saga:sinkdrainageroutedetection,Domain specific/Hydrology
|
||||
saga:sinkremoval,Domain specific/Hydrology
|
||||
saga:skyviewfactor,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:slopelength,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:sortgrid,Raster/General tools
|
||||
saga:spatialpointpatternanalysis,Vector/Points
|
||||
saga:splitrgbbands,Images/Image tools
|
||||
saga:splitshapesbyattribute,Vector/General tools
|
||||
saga:splitshapeslayer,Vector/General tools
|
||||
saga:splitshapeslayercompletely,Vector/General tools
|
||||
saga:splitshapeslayerrandomly,Vector/General tools
|
||||
saga:statisticsforgrids,Raster/Statistics
|
||||
saga:strahlerorder,Domain specific/Hydrology
|
||||
saga:streampowerindex,Domain specific/Hydrology
|
||||
saga:supervisedclassification,Raster/Analysis
|
||||
saga:surfacespecificpoints,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:terrainruggednessindextri,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:thiessenpolygons,Vector/Geometry operations
|
||||
saga:thinplatesplineglobal,Raster - vector/Vector -> Raster
|
||||
saga:thinplatesplinelocal,Raster - vector/Vector -> Raster
|
||||
saga:thinplatesplinetin,Raster - vector/Vector -> Raster
|
||||
saga:thresholdbuffer,Raster/General tools
|
||||
saga:topmodel,Domain specific/Hydrology
|
||||
saga:topographiccorrection,Domain specific/Viewsheds\Lighting
|
||||
saga:topographicpositionindextpi,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:topographicwetnessindextwi,Domain specific/Hydrology
|
||||
saga:tpibasedlandformclassification,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:transectthroughpolygonshapefile,Vector/Overlay
|
||||
saga:transformshapes,Vector/Geometry operations
|
||||
saga:triangulation,Raster - vector/Vector -> Raster
|
||||
saga:universalkriging,Raster - vector/Vector -> Raster
|
||||
saga:universalkrigingglobal,Raster - vector/Vector -> Raster
|
||||
saga:upslopearea,Domain specific/Hydrology
|
||||
saga:userdefinedfilter,Raster/Filters
|
||||
saga:variogramcloud,Domain specific/Geostatistics
|
||||
saga:variogramsurface,Domain specific/Geostatistics
|
||||
saga:vectorruggednessmeasurevrm,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:vegetationindexdistancebased,Images/Image analysis
|
||||
saga:vegetationindexslopebased,Images/Image analysis
|
||||
saga:verticaldistancetochannelnetwork,Domain specific/Hydrology
|
||||
saga:waterretentioncapacity,Domain specific/Hydrology
|
||||
saga:watershedbasins,Domain specific/Hydrology
|
||||
saga:windeffectwindwardleewardindex,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:zonalgridstatistics,Raster/Statistics
|
||||
modelertools:calculator,Modeler/Modeler tools
|
||||
modelertools:rasterlayerbounds,Modeler/Modeler tools
|
||||
modelertools:vectorlayerbounds,Modeler/Modeler tools
|
@ -1,7 +1,7 @@
|
||||
import os
|
||||
from qgis.PyQt.QtWidgets import QAction, QMenu
|
||||
from PyQt4.QtGui import QIcon
|
||||
from processing.core.Processing import Processing
|
||||
from processing.core.alglist import algList
|
||||
from processing.core.ProcessingConfig import ProcessingConfig, Setting
|
||||
from processing.gui.MessageDialog import MessageDialog
|
||||
from processing.gui.AlgorithmDialog import AlgorithmDialog
|
||||
@ -9,6 +9,7 @@ from qgis.utils import iface
|
||||
from processing.gui.MessageBarProgress import MessageBarProgress
|
||||
from processing.gui.AlgorithmExecutor import runalg
|
||||
from processing.gui.Postprocessing import handleAlgorithmResults
|
||||
from processing.core.Processing import Processing
|
||||
|
||||
algorithmsToolbar = None
|
||||
menusSettingsGroup = 'Menus'
|
||||
@ -108,7 +109,7 @@ defaultMenuEntries.update({'gdalogr:buildvirtualraster':miscMenu,
|
||||
|
||||
|
||||
def initializeMenus():
|
||||
for provider in Processing.providers:
|
||||
for provider in algList.providers:
|
||||
for alg in provider.algs:
|
||||
d = defaultMenuEntries.get(alg.commandLineName(), "")
|
||||
setting = Setting(menusSettingsGroup, "MENU_" + alg.commandLineName(),
|
||||
@ -130,7 +131,7 @@ def updateMenus():
|
||||
|
||||
|
||||
def createMenus():
|
||||
for provider in list(Processing.algs.values()):
|
||||
for provider in list(algList.algs.values()):
|
||||
for alg in list(provider.values()):
|
||||
menuPath = ProcessingConfig.getSetting("MENU_" + alg.commandLineName())
|
||||
addButton = ProcessingConfig.getSetting("BUTTON_" + alg.commandLineName())
|
||||
@ -145,7 +146,7 @@ def createMenus():
|
||||
|
||||
|
||||
def removeMenus():
|
||||
for provider in list(Processing.algs.values()):
|
||||
for provider in list(algList.algs.values()):
|
||||
for alg in list(provider.values()):
|
||||
menuPath = ProcessingConfig.getSetting("MENU_" + alg.commandLineName())
|
||||
if menuPath:
|
||||
|
@ -34,6 +34,7 @@ from processing.gui.ToolboxAction import ToolboxAction
|
||||
from processing.modeler.ModelerAlgorithm import ModelerAlgorithm
|
||||
from processing.modeler.WrongModelException import WrongModelException
|
||||
from processing.modeler.ModelerUtils import ModelerUtils
|
||||
from processing.core.alglist import algList
|
||||
|
||||
pluginPath = os.path.split(os.path.dirname(__file__))[0]
|
||||
|
||||
@ -72,4 +73,4 @@ class AddModelFromFileAction(ToolboxAction):
|
||||
return
|
||||
destFilename = os.path.join(ModelerUtils.modelsFolder(), os.path.basename(filename))
|
||||
shutil.copyfile(filename, destFilename)
|
||||
self.toolbox.updateProvider('model')
|
||||
algList.reloadProvider('model')
|
||||
|
@ -29,6 +29,7 @@ import os
|
||||
from qgis.PyQt.QtGui import QIcon
|
||||
from processing.gui.ToolboxAction import ToolboxAction
|
||||
from processing.modeler.ModelerDialog import ModelerDialog
|
||||
from processing.core.alglist import algList
|
||||
|
||||
pluginPath = os.path.split(os.path.dirname(__file__))[0]
|
||||
|
||||
@ -46,4 +47,4 @@ class CreateNewModelAction(ToolboxAction):
|
||||
dlg = ModelerDialog()
|
||||
dlg.exec_()
|
||||
if dlg.update:
|
||||
self.toolbox.updateProvider('model')
|
||||
algList.reloadProvider('model')
|
||||
|
@ -29,7 +29,7 @@ import os
|
||||
from qgis.PyQt.QtWidgets import QMessageBox
|
||||
from processing.gui.ContextAction import ContextAction
|
||||
from processing.modeler.ModelerAlgorithm import ModelerAlgorithm
|
||||
|
||||
from processing.core.alglist import algList
|
||||
|
||||
class DeleteModelAction(ContextAction):
|
||||
|
||||
@ -48,4 +48,4 @@ class DeleteModelAction(ContextAction):
|
||||
QMessageBox.No)
|
||||
if reply == QMessageBox.Yes:
|
||||
os.remove(self.itemData.descriptionFile)
|
||||
self.toolbox.updateProvider('model')
|
||||
algList.reloadProvider('model')
|
||||
|
@ -28,7 +28,7 @@ __revision__ = '$Format:%H$'
|
||||
from processing.gui.ContextAction import ContextAction
|
||||
from processing.modeler.ModelerAlgorithm import ModelerAlgorithm
|
||||
from processing.modeler.ModelerDialog import ModelerDialog
|
||||
|
||||
from processing.core.alglist import algList
|
||||
|
||||
class EditModelAction(ContextAction):
|
||||
|
||||
@ -42,4 +42,4 @@ class EditModelAction(ContextAction):
|
||||
dlg = ModelerDialog(self.itemData.getCopy())
|
||||
dlg.exec_()
|
||||
if dlg.update:
|
||||
self.toolbox.updateProvider('model')
|
||||
algList.reloadProvider('model')
|
||||
|
@ -16,7 +16,6 @@
|
||||
* *
|
||||
***************************************************************************
|
||||
"""
|
||||
from operator import attrgetter
|
||||
|
||||
__author__ = 'Victor Olaya'
|
||||
__date__ = 'August 2012'
|
||||
@ -35,13 +34,14 @@ import codecs
|
||||
import traceback
|
||||
from qgis.PyQt.QtCore import QCoreApplication, QPointF
|
||||
from qgis.PyQt.QtGui import QIcon
|
||||
from operator import attrgetter
|
||||
|
||||
from qgis.core import QgsRasterLayer, QgsVectorLayer
|
||||
from qgis.gui import QgsMessageBar
|
||||
from qgis.utils import iface
|
||||
from processing.core.GeoAlgorithm import GeoAlgorithm
|
||||
from processing.modeler.WrongModelException import WrongModelException
|
||||
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
|
||||
from processing.modeler.ModelerUtils import ModelerUtils
|
||||
from processing.core.parameters import (getParameterFromString,
|
||||
ParameterRaster,
|
||||
ParameterVector,
|
||||
@ -55,6 +55,7 @@ from processing.core.parameters import (getParameterFromString,
|
||||
ParameterMultipleInput)
|
||||
from processing.tools import dataobjects
|
||||
from processing.gui.Help2Html import getHtmlFromDescriptionsDict
|
||||
from processing.core.alglist import algList
|
||||
|
||||
pluginPath = os.path.split(os.path.dirname(__file__))[0]
|
||||
|
||||
@ -90,17 +91,17 @@ class Algorithm():
|
||||
self.name = None
|
||||
self.description = ""
|
||||
|
||||
#The type of the algorithm, indicated as a string, which corresponds
|
||||
#to the string used to refer to it in the python console
|
||||
# The type of the algorithm, indicated as a string, which corresponds
|
||||
# to the string used to refer to it in the python console
|
||||
self.consoleName = consoleName
|
||||
|
||||
self._algInstance = None
|
||||
|
||||
#A dict of Input object. keys are param names
|
||||
# A dict of Input object. keys are param names
|
||||
self.params = {}
|
||||
|
||||
#A dict of ModelerOutput with final output descriptions. Keys are output names.
|
||||
#Outputs not final are not stored in this dict
|
||||
# A dict of ModelerOutput with final output descriptions. Keys are output names.
|
||||
# Outputs not final are not stored in this dict
|
||||
self.outputs = {}
|
||||
|
||||
self.pos = None
|
||||
@ -117,7 +118,7 @@ class Algorithm():
|
||||
@property
|
||||
def algorithm(self):
|
||||
if self._algInstance is None:
|
||||
self._algInstance = ModelerUtils.getAlgorithm(self.consoleName).getCopy()
|
||||
self._algInstance = algList.getAlgorithm(self.consoleName).getCopy()
|
||||
return self._algInstance
|
||||
|
||||
def setName(self, model):
|
||||
@ -227,7 +228,7 @@ class ModelerAlgorithm(GeoAlgorithm):
|
||||
# Geoalgorithms in this model. A dict of Algorithm objects, with names as keys
|
||||
self.algs = {}
|
||||
|
||||
#Input parameters. A dict of Input objects, with names as keys
|
||||
# Input parameters. A dict of Input objects, with names as keys
|
||||
self.inputs = {}
|
||||
GeoAlgorithm.__init__(self)
|
||||
|
||||
@ -526,7 +527,7 @@ class ModelerAlgorithm(GeoAlgorithm):
|
||||
|
||||
def checkBeforeOpeningParametersDialog(self):
|
||||
for alg in self.algs.values():
|
||||
algInstance = ModelerUtils.getAlgorithm(alg.consoleName)
|
||||
algInstance = algList.getAlgorithm(alg.consoleName)
|
||||
if algInstance is None:
|
||||
return "The model you are trying to run contains an algorithm that is not available: <i>%s</i>" % alg.consoleName
|
||||
|
||||
@ -651,7 +652,7 @@ class ModelerAlgorithm(GeoAlgorithm):
|
||||
model.group = line[len('GROUP:'):]
|
||||
elif line.startswith('ALGORITHM:'):
|
||||
algLine = line[len('ALGORITHM:'):]
|
||||
alg = ModelerUtils.getAlgorithm(algLine)
|
||||
alg = algList.getAlgorithm(algLine)
|
||||
if alg is not None:
|
||||
modelAlg = Algorithm(alg.commandLineName())
|
||||
modelAlg.description = alg.name
|
||||
@ -702,7 +703,7 @@ class ModelerAlgorithm(GeoAlgorithm):
|
||||
modelAlgs.append(modelAlg.name)
|
||||
else:
|
||||
raise WrongModelException(
|
||||
_tr('Error in algorithm name: %s', ) % algLine)
|
||||
_tr('Error in algorithm name: %s',) % algLine)
|
||||
line = lines.readline().strip('\n').strip('\r')
|
||||
for modelAlg in model.algs.values():
|
||||
for name, value in modelAlg.params.iteritems():
|
||||
|
@ -57,9 +57,6 @@ class ModelerAlgorithmProvider(AlgorithmProvider):
|
||||
ModelerUtils.MODELS_FOLDER, self.tr('Models folder', 'ModelerAlgorithmProvider'),
|
||||
ModelerUtils.modelsFolder(), valuetype=Setting.FOLDER))
|
||||
|
||||
def setAlgsList(self, algs):
|
||||
ModelerUtils.allAlgs = algs
|
||||
|
||||
def modelsFolder(self):
|
||||
return ModelerUtils.modelsFolder()
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
* *
|
||||
***************************************************************************
|
||||
"""
|
||||
from processing.gui import AlgorithmClassification
|
||||
|
||||
__author__ = 'Victor Olaya'
|
||||
__date__ = 'August 2012'
|
||||
@ -45,6 +44,7 @@ from processing.modeler.ModelerParametersDialog import ModelerParametersDialog
|
||||
from processing.modeler.ModelerUtils import ModelerUtils
|
||||
from processing.modeler.ModelerScene import ModelerScene
|
||||
from processing.modeler.WrongModelException import WrongModelException
|
||||
from processing.core.alglist import algList
|
||||
|
||||
pluginPath = os.path.split(os.path.dirname(__file__))[0]
|
||||
WIDGET, BASE = uic.loadUiType(
|
||||
@ -61,8 +61,8 @@ class ModelerDialog(BASE, WIDGET):
|
||||
|
||||
self.zoom = 1
|
||||
|
||||
self.setWindowFlags(Qt.WindowMinimizeButtonHint |
|
||||
Qt.WindowMaximizeButtonHint |
|
||||
self.setWindowFlags(Qt.WindowMinimizeButtonHint |
|
||||
Qt.WindowMaximizeButtonHint |
|
||||
Qt.WindowCloseButtonHint)
|
||||
|
||||
settings = QSettings()
|
||||
@ -89,7 +89,7 @@ class ModelerDialog(BASE, WIDGET):
|
||||
if text in ModelerParameterDefinitionDialog.paramTypes:
|
||||
self.addInputOfType(text, event.pos())
|
||||
else:
|
||||
alg = ModelerUtils.getAlgorithm(text)
|
||||
alg = algList.getAlgorithm(text)
|
||||
if alg is not None:
|
||||
self._addAlgorithm(alg.getCopy(), event.pos())
|
||||
event.accept()
|
||||
@ -226,7 +226,7 @@ class ModelerDialog(BASE, WIDGET):
|
||||
def editHelp(self):
|
||||
if self.alg.provider is None:
|
||||
# Might happen if model is opened from modeler dialog
|
||||
self.alg.provider = ModelerUtils.providers['model']
|
||||
self.alg.provider = algList.getProviderFromName('model')
|
||||
alg = self.alg.getCopy()
|
||||
dlg = HelpEditionDialog(alg)
|
||||
dlg.exec_()
|
||||
@ -243,7 +243,7 @@ class ModelerDialog(BASE, WIDGET):
|
||||
|
||||
if self.alg.provider is None:
|
||||
# Might happen if model is opened from modeler dialog
|
||||
self.alg.provider = ModelerUtils.providers['model']
|
||||
self.alg.provider = algList.getProviderFromName('model')
|
||||
alg = self.alg.getCopy()
|
||||
dlg = AlgorithmDialog(alg)
|
||||
dlg.exec_()
|
||||
@ -390,7 +390,7 @@ class ModelerDialog(BASE, WIDGET):
|
||||
pos = QPointF(pos)
|
||||
self.alg.addParameter(ModelerParameter(dlg.param, pos))
|
||||
self.repaintModel()
|
||||
#self.view.ensureVisible(self.scene.getLastParameterItem())
|
||||
# self.view.ensureVisible(self.scene.getLastParameterItem())
|
||||
self.hasChanged = True
|
||||
|
||||
def getPositionForParameterItem(self):
|
||||
@ -420,7 +420,7 @@ class ModelerDialog(BASE, WIDGET):
|
||||
def addAlgorithm(self):
|
||||
item = self.algorithmTree.currentItem()
|
||||
if isinstance(item, TreeAlgorithmItem):
|
||||
alg = ModelerUtils.getAlgorithm(item.alg.commandLineName())
|
||||
alg = algList.getAlgorithm(item.alg.commandLineName())
|
||||
self._addAlgorithm(alg.getCopy())
|
||||
|
||||
def _addAlgorithm(self, alg, pos=None):
|
||||
@ -469,14 +469,13 @@ class ModelerDialog(BASE, WIDGET):
|
||||
def fillAlgorithmTreeUsingProviders(self):
|
||||
self.algorithmTree.clear()
|
||||
text = unicode(self.searchBox.text())
|
||||
allAlgs = ModelerUtils.allAlgs
|
||||
allAlgs = algList.algs
|
||||
for providerName in allAlgs.keys():
|
||||
name = 'ACTIVATE_' + providerName.upper().replace(' ', '_')
|
||||
if not ProcessingConfig.getSetting(name):
|
||||
continue
|
||||
groups = {}
|
||||
provider = allAlgs[providerName]
|
||||
algs = provider.values()
|
||||
algs = allAlgs[providerName].values()
|
||||
|
||||
# Add algorithms
|
||||
for alg in algs:
|
||||
@ -498,12 +497,10 @@ class ModelerDialog(BASE, WIDGET):
|
||||
|
||||
if len(groups) > 0:
|
||||
providerItem = QTreeWidgetItem()
|
||||
providerItem.setText(0,
|
||||
ModelerUtils.providers[providerName].getDescription())
|
||||
providerItem.setToolTip(0,
|
||||
ModelerUtils.providers[providerName].getDescription())
|
||||
providerItem.setIcon(0,
|
||||
ModelerUtils.providers[providerName].getIcon())
|
||||
provider = algList.getProviderFromName(providerName)
|
||||
providerItem.setText(0, provider.getDescription())
|
||||
providerItem.setToolTip(0, provider.getDescription())
|
||||
providerItem.setIcon(0, provider.getIcon())
|
||||
for groupItem in groups.values():
|
||||
providerItem.addChild(groupItem)
|
||||
self.algorithmTree.addTopLevelItem(providerItem)
|
||||
@ -521,7 +518,7 @@ class TreeAlgorithmItem(QTreeWidgetItem):
|
||||
QTreeWidgetItem.__init__(self)
|
||||
self.alg = alg
|
||||
icon = alg.getIcon()
|
||||
name = AlgorithmClassification.getDisplayName(alg)
|
||||
name = alg.displayName()
|
||||
self.setIcon(0, icon)
|
||||
self.setToolTip(0, name)
|
||||
self.setText(0, name)
|
||||
|
@ -32,9 +32,6 @@ from processing.core.ProcessingConfig import ProcessingConfig
|
||||
|
||||
class ModelerUtils:
|
||||
|
||||
allAlgs = {}
|
||||
providers = {}
|
||||
|
||||
MODELS_FOLDER = 'MODELS_FOLDER'
|
||||
ACTIVATE_MODELS = 'ACTIVATE_MODELS'
|
||||
|
||||
@ -47,9 +44,3 @@ class ModelerUtils:
|
||||
|
||||
return os.path.abspath(folder)
|
||||
|
||||
@staticmethod
|
||||
def getAlgorithm(name):
|
||||
for provider in ModelerUtils.allAlgs.values():
|
||||
if name in provider:
|
||||
return provider[name]
|
||||
return None
|
||||
|
@ -29,7 +29,7 @@ import os
|
||||
from PyQt4.QtGui import QMessageBox
|
||||
from processing.gui.ContextAction import ContextAction
|
||||
from processing.preconfigured.PreconfiguredAlgorithm import PreconfiguredAlgorithm
|
||||
|
||||
from processing.core.alglist import algList
|
||||
|
||||
class DeletePreconfiguredAlgorithmAction(ContextAction):
|
||||
|
||||
@ -48,4 +48,4 @@ class DeletePreconfiguredAlgorithmAction(ContextAction):
|
||||
QMessageBox.No)
|
||||
if reply == QMessageBox.Yes:
|
||||
os.remove(self.itemData.descriptionFile)
|
||||
self.toolbox.updateProvider('preconfigured')
|
||||
algList.reloadProvider('preconfigured')
|
||||
|
@ -27,8 +27,8 @@ __revision__ = '$Format:%H$'
|
||||
|
||||
|
||||
import os
|
||||
from processing.modeler.ModelerUtils import ModelerUtils
|
||||
from processing.core.GeoAlgorithm import GeoAlgorithm
|
||||
from processing.core.alglist import algList
|
||||
import json
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ class PreconfiguredAlgorithm(GeoAlgorithm):
|
||||
self.showInModeler = False
|
||||
|
||||
def execute(self, progress):
|
||||
self.alg = ModelerUtils.getAlgorithm(self.description["algname"]).getCopy()
|
||||
self.alg = algList.getAlgorithm(self.description["algname"]).getCopy()
|
||||
for name, value in self.description["parameters"].iteritems():
|
||||
self.alg.setParameterValue(name, value)
|
||||
for name, value in self.description["outputs"].iteritems():
|
||||
|
@ -28,10 +28,13 @@ __revision__ = '$Format:%H$'
|
||||
|
||||
import os
|
||||
import json
|
||||
|
||||
from processing.preconfigured.PreconfiguredUtils import algAsDict
|
||||
from processing.preconfigured.PreconfiguredUtils import preconfiguredAlgorithmsFolder
|
||||
from processing.gui.AlgorithmDialogBase import AlgorithmDialogBase
|
||||
from processing.gui.AlgorithmDialog import AlgorithmDialog
|
||||
from processing.core.alglist import algList
|
||||
|
||||
from PyQt4.QtGui import QMessageBox, QPalette, QColor, QVBoxLayout, QLabel, \
|
||||
QLineEdit, QWidget
|
||||
|
||||
@ -66,7 +69,7 @@ class PreconfiguredAlgorithmDialog(AlgorithmDialog):
|
||||
filepath = os.path.join(preconfiguredAlgorithmsFolder(), filename)
|
||||
with open(filepath, "w") as f:
|
||||
json.dump(description, f)
|
||||
self.toolbox.updateProvider('preconfigured')
|
||||
algList.reloadProvider('preconfigured')
|
||||
except AlgorithmDialogBase.InvalidParameterValue as e:
|
||||
try:
|
||||
self.buttonBox.accepted.connect(lambda:
|
||||
|
@ -35,6 +35,7 @@ from processing.script.ScriptAlgorithm import ScriptAlgorithm
|
||||
from processing.gui.ToolboxAction import ToolboxAction
|
||||
from processing.script.WrongScriptException import WrongScriptException
|
||||
from processing.script.ScriptUtils import ScriptUtils
|
||||
from processing.core.alglist import algList
|
||||
|
||||
pluginPath = os.path.split(os.path.dirname(__file__))[0]
|
||||
|
||||
@ -67,4 +68,4 @@ class AddScriptFromFileAction(ToolboxAction):
|
||||
destFilename = os.path.join(ScriptUtils.scriptsFolder(), os.path.basename(filename))
|
||||
with open(destFilename, 'w') as f:
|
||||
f.write(script.script)
|
||||
self.toolbox.updateProvider('script')
|
||||
algList.reloadProvider('script')
|
||||
|
@ -36,6 +36,20 @@ import tempfile
|
||||
from osgeo.gdalconst import GA_ReadOnly
|
||||
|
||||
import processing
|
||||
from processing.modeler.ModelerAlgorithmProvider import ModelerAlgorithmProvider
|
||||
from processing.modeler.ModelerOnlyAlgorithmProvider import ModelerOnlyAlgorithmProvider
|
||||
from processing.algs.qgis.QGISAlgorithmProvider import QGISAlgorithmProvider
|
||||
from processing.algs.grass.GrassAlgorithmProvider import GrassAlgorithmProvider
|
||||
from processing.algs.grass7.Grass7AlgorithmProvider import Grass7AlgorithmProvider
|
||||
from processing.algs.lidar.LidarToolsAlgorithmProvider import LidarToolsAlgorithmProvider
|
||||
from processing.algs.gdal.GdalOgrAlgorithmProvider import GdalOgrAlgorithmProvider
|
||||
from processing.algs.otb.OTBAlgorithmProvider import OTBAlgorithmProvider
|
||||
from processing.algs.r.RAlgorithmProvider import RAlgorithmProvider
|
||||
from processing.algs.saga.SagaAlgorithmProvider import SagaAlgorithmProvider
|
||||
from processing.script.ScriptAlgorithmProvider import ScriptAlgorithmProvider
|
||||
from processing.algs.taudem.TauDEMAlgorithmProvider import TauDEMAlgorithmProvider
|
||||
from processing.preconfigured.PreconfiguredAlgorithmProvider import PreconfiguredAlgorithmProvider
|
||||
|
||||
|
||||
from qgis.core import QgsVectorLayer, QgsRasterLayer, QgsMapLayerRegistry
|
||||
|
||||
|
@ -35,7 +35,7 @@ from processing.core.parameters import ParameterSelection
|
||||
|
||||
def alglist(text=None):
|
||||
s = ''
|
||||
for provider in Processing.algs.values():
|
||||
for provider in Processing.algList.algs.values():
|
||||
sortedlist = sorted(provider.values(), key=lambda alg: alg.name)
|
||||
for alg in sortedlist:
|
||||
if text is None or text.lower() in alg.name.lower():
|
||||
|
@ -26,7 +26,7 @@ __revision__ = '$Format:%H$'
|
||||
import os
|
||||
from processing.core.Processing import Processing
|
||||
from processing.gui.AlgorithmClassification import (
|
||||
loadClassification, getClassificationEn, getDisplayNameEn)
|
||||
loadClassification, getClassificationEn)
|
||||
|
||||
|
||||
def updateTranslations():
|
||||
@ -61,7 +61,7 @@ def translationShadow():
|
||||
"""{}"""
|
||||
'''.format(provider.__class__.__name__))
|
||||
for alg in provider.algs:
|
||||
display_name = getDisplayNameEn(alg)
|
||||
display_name = alg.name
|
||||
f.write(" QCoreApplication.translate(\"{}\", \"{}\")\n"
|
||||
.format(alg.__class__.__name__,
|
||||
display_name.replace('"', '\\"')))
|
||||
|
Loading…
x
Reference in New Issue
Block a user