Skip to content

Commit f13920b

Browse files
committed
First steps in resurrecting script algorithms
1 parent 60f80f9 commit f13920b

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

python/plugins/processing/algs/qgis/QGISAlgorithmProvider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def getAlgs(self):
293293
scripts = ScriptUtils.loadFromFolder(folder)
294294
for script in scripts:
295295
script.allowEdit = False
296-
#algs.extend(scripts)
296+
algs.extend(scripts)
297297

298298
return algs
299299

python/plugins/processing/script/ScriptAlgorithm.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@
3535
QgsProject,
3636
QgsApplication,
3737
QgsMessageLog,
38-
QgsProcessingUtils)
38+
QgsProcessingUtils,
39+
QgsProcessingAlgorithm)
40+
41+
from qgis.PyQt.QtCore import (QCoreApplication)
3942

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

4851

49-
class ScriptAlgorithm(GeoAlgorithm):
52+
class ScriptAlgorithm(QgsProcessingAlgorithm):
5053

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

59-
GeoAlgorithm.__init__(self)
62+
super().__init__()
6063
self._icon = QgsApplication.getThemeIcon("/processingScript.svg")
6164
self._name = ''
6265
self._display_name = ''
@@ -236,3 +239,8 @@ def getParameterDescriptions(self):
236239
except:
237240
return descs
238241
return descs
242+
243+
def tr(self, string, context=''):
244+
if context == '':
245+
context = self.__class__.__name__
246+
return QCoreApplication.translate(context, string)

0 commit comments

Comments
 (0)