mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
First steps in resurrecting script algorithms
This commit is contained in:
parent
60f80f9355
commit
f13920bb19
@ -293,7 +293,7 @@ class QGISAlgorithmProvider(QgsProcessingProvider):
|
||||
scripts = ScriptUtils.loadFromFolder(folder)
|
||||
for script in scripts:
|
||||
script.allowEdit = False
|
||||
#algs.extend(scripts)
|
||||
algs.extend(scripts)
|
||||
|
||||
return algs
|
||||
|
||||
|
@ -35,7 +35,10 @@ from qgis.core import (QgsExpressionContextUtils,
|
||||
QgsProject,
|
||||
QgsApplication,
|
||||
QgsMessageLog,
|
||||
QgsProcessingUtils)
|
||||
QgsProcessingUtils,
|
||||
QgsProcessingAlgorithm)
|
||||
|
||||
from qgis.PyQt.QtCore import (QCoreApplication)
|
||||
|
||||
from processing.core.GeoAlgorithm import GeoAlgorithm
|
||||
from processing.gui.Help2Html import getHtmlFromHelpFile
|
||||
@ -46,7 +49,7 @@ from processing.script.WrongScriptException import WrongScriptException
|
||||
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
|
||||
@ -56,7 +59,7 @@ class ScriptAlgorithm(GeoAlgorithm):
|
||||
not be used in other cases.
|
||||
"""
|
||||
|
||||
GeoAlgorithm.__init__(self)
|
||||
super().__init__()
|
||||
self._icon = QgsApplication.getThemeIcon("/processingScript.svg")
|
||||
self._name = ''
|
||||
self._display_name = ''
|
||||
@ -236,3 +239,8 @@ class ScriptAlgorithm(GeoAlgorithm):
|
||||
except:
|
||||
return descs
|
||||
return descs
|
||||
|
||||
def tr(self, string, context=''):
|
||||
if context == '':
|
||||
context = self.__class__.__name__
|
||||
return QCoreApplication.translate(context, string)
|
||||
|
Loading…
x
Reference in New Issue
Block a user