Skip to content
Permalink
Browse files

Merge pull request #3105 from volaya/processing_cleanup

[processing] cleanup and improvements
  • Loading branch information
alexbruy committed May 25, 2016
2 parents d19767d + 997a368 commit 322da8b2cf522bc0d6e5d1ba03f4f0597cdf09d2
Showing with 376 additions and 704 deletions.
  1. +3 −3 python/plugins/processing/ProcessingPlugin.py
  2. +38 −0 python/plugins/processing/algs/examplescripts/ProcessingExampleScriptsPlugin.py
  3. +31 −0 python/plugins/processing/algs/examplescripts/__init__.py
  4. +18 −0 python/plugins/processing/algs/examplescripts/metadata.txt
  5. +3 −0 python/plugins/processing/algs/examplescripts/scripts/examplescript.py
  6. +2 −0 python/plugins/processing/algs/grass/GrassUtils.py
  7. +3 −1 python/plugins/processing/algs/qgis/QGISAlgorithmProvider.py
  8. +6 −0 python/plugins/processing/core/GeoAlgorithm.py
  9. +54 −115 python/plugins/processing/core/Processing.py
  10. +79 −0 python/plugins/processing/core/alglist.py
  11. +33 −0 python/plugins/processing/core/defaultproviders.py
  12. +0 −80 python/plugins/processing/gui/AlgorithmClassification.py
  13. +1 −2 python/plugins/processing/gui/AlgorithmDialogBase.py
  14. +3 −4 python/plugins/processing/gui/CommanderWindow.py
  15. +0 −8 python/plugins/processing/gui/ContextAction.py
  16. +3 −2 python/plugins/processing/gui/CreateNewScriptAction.py
  17. +3 −3 python/plugins/processing/gui/DeleteScriptAction.py
  18. +3 −3 python/plugins/processing/gui/EditScriptAction.py
  19. +7 −7 python/plugins/processing/gui/GetScriptsAndModels.py
  20. +13 −13 python/plugins/processing/gui/ProcessingToolbox.py
  21. +5 −6 python/plugins/processing/gui/ScriptEditorDialog.py
  22. +0 −396 python/plugins/processing/gui/algclasssification.txt
  23. +5 −4 python/plugins/processing/gui/menus.py
  24. +2 −1 python/plugins/processing/modeler/AddModelFromFileAction.py
  25. +2 −1 python/plugins/processing/modeler/CreateNewModelAction.py
  26. +2 −2 python/plugins/processing/modeler/DeleteModelAction.py
  27. +2 −2 python/plugins/processing/modeler/EditModelAction.py
  28. +13 −12 python/plugins/processing/modeler/ModelerAlgorithm.py
  29. +0 −3 python/plugins/processing/modeler/ModelerAlgorithmProvider.py
  30. +15 −18 python/plugins/processing/modeler/ModelerDialog.py
  31. +0 −9 python/plugins/processing/modeler/ModelerUtils.py
  32. +2 −2 python/plugins/processing/preconfigured/DeletePreconfiguredAlgorithmAction.py
  33. +2 −2 python/plugins/processing/preconfigured/PreconfiguredAlgorithm.py
  34. +4 −1 python/plugins/processing/preconfigured/PreconfiguredAlgorithmDialog.py
  35. +2 −1 python/plugins/processing/script/AddScriptFromFileAction.py
  36. +14 −0 python/plugins/processing/tests/AlgorithmsTestBase.py
  37. +1 −1 python/plugins/processing/tools/general.py
  38. +2 −2 python/plugins/processing/tools/translation.py
@@ -43,6 +43,7 @@
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 @@ def openModeler(self):
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"))
@@ -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()
@@ -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 @@ def grassPath():
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 @@ def __init__(self):
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 @@ def getIcon(self):
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 @@ def getAsCommand(self):
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__

0 comments on commit 322da8b

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