Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
First steps in resurrecting script algorithms
  • Loading branch information
nyalldawson committed Jun 26, 2017
1 parent 60f80f9 commit f13920b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Expand Up @@ -293,7 +293,7 @@ def getAlgs(self):
scripts = ScriptUtils.loadFromFolder(folder)
for script in scripts:
script.allowEdit = False
#algs.extend(scripts)
algs.extend(scripts)

return algs

Expand Down
14 changes: 11 additions & 3 deletions python/plugins/processing/script/ScriptAlgorithm.py
Expand Up @@ -35,7 +35,10 @@
QgsProject,
QgsApplication,
QgsMessageLog,
QgsProcessingUtils)
QgsProcessingUtils,
QgsProcessingAlgorithm)

from qgis.PyQt.QtCore import (QCoreApplication)

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.gui.Help2Html import getHtmlFromHelpFile
Expand All @@ -46,7 +49,7 @@
pluginPath = os.path.split(os.path.dirname(__file__))[0]


class ScriptAlgorithm(GeoAlgorithm):
class ScriptAlgorithm(QgsProcessingAlgorithm):

def __init__(self, descriptionFile, script=None):
"""The script parameter can be used to directly pass the code
Expand All @@ -56,7 +59,7 @@ def __init__(self, descriptionFile, script=None):
not be used in other cases.
"""

GeoAlgorithm.__init__(self)
super().__init__()
self._icon = QgsApplication.getThemeIcon("/processingScript.svg")
self._name = ''
self._display_name = ''
Expand Down Expand Up @@ -236,3 +239,8 @@ def getParameterDescriptions(self):
except:
return descs
return descs

def tr(self, string, context=''):
if context == '':
context = self.__class__.__name__
return QCoreApplication.translate(context, string)

0 comments on commit f13920b

Please sign in to comment.