mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
[processing] remove stuff related to R provider
This commit is contained in:
parent
30a7e7e514
commit
429e67e0f9
@ -55,7 +55,6 @@ from processing.modeler.ModelerAlgorithmProvider import ModelerAlgorithmProvider
|
||||
from processing.algs.qgis.QGISAlgorithmProvider import QGISAlgorithmProvider # NOQA
|
||||
from processing.algs.grass7.Grass7AlgorithmProvider import Grass7AlgorithmProvider # NOQA
|
||||
from processing.algs.gdal.GdalAlgorithmProvider import GdalAlgorithmProvider # NOQA
|
||||
from processing.algs.r.RAlgorithmProvider import RAlgorithmProvider # NOQA
|
||||
from processing.algs.saga.SagaAlgorithmProvider import SagaAlgorithmProvider # NOQA
|
||||
from processing.script.ScriptAlgorithmProvider import ScriptAlgorithmProvider # NOQA
|
||||
from processing.preconfigured.PreconfiguredAlgorithmProvider import PreconfiguredAlgorithmProvider # NOQA
|
||||
|
@ -38,7 +38,6 @@ pluginPath = os.path.split(os.path.dirname(__file__))[0]
|
||||
class CreateNewScriptAction(ToolboxAction):
|
||||
|
||||
SCRIPT_PYTHON = 0
|
||||
SCRIPT_R = 1
|
||||
|
||||
def __init__(self, actionName, scriptType):
|
||||
self.name, self.i18n_name = self.trAction(actionName)
|
||||
@ -49,13 +48,9 @@ class CreateNewScriptAction(ToolboxAction):
|
||||
def getIcon(self):
|
||||
if self.scriptType == self.SCRIPT_PYTHON:
|
||||
return QgsApplication.getThemeIcon("/processingScript.svg")
|
||||
elif self.scriptType == self.SCRIPT_R:
|
||||
return QgsApplication.getThemeIcon("/providerR.svg")
|
||||
|
||||
def execute(self):
|
||||
dlg = None
|
||||
if self.scriptType == self.SCRIPT_PYTHON:
|
||||
dlg = ScriptEditorDialog(ScriptEditorDialog.SCRIPT_PYTHON, None)
|
||||
if self.scriptType == self.SCRIPT_R:
|
||||
dlg = ScriptEditorDialog(ScriptEditorDialog.SCRIPT_R, None)
|
||||
dlg.show()
|
||||
|
@ -33,14 +33,12 @@ from qgis.core import QgsApplication
|
||||
|
||||
from processing.gui.ContextAction import ContextAction
|
||||
|
||||
from processing.algs.r.RAlgorithm import RAlgorithm
|
||||
from processing.script.ScriptAlgorithm import ScriptAlgorithm
|
||||
|
||||
|
||||
class DeleteScriptAction(ContextAction):
|
||||
|
||||
SCRIPT_PYTHON = 0
|
||||
SCRIPT_R = 1
|
||||
|
||||
def __init__(self, scriptType):
|
||||
self.name = self.tr('Delete script', 'DeleteScriptAction')
|
||||
@ -49,8 +47,6 @@ class DeleteScriptAction(ContextAction):
|
||||
def isEnabled(self):
|
||||
if self.scriptType == self.SCRIPT_PYTHON:
|
||||
return isinstance(self.itemData, ScriptAlgorithm) and self.itemData.allowEdit
|
||||
elif self.scriptType == self.SCRIPT_R:
|
||||
return isinstance(self.itemData, RAlgorithm)
|
||||
|
||||
def execute(self):
|
||||
reply = QMessageBox.question(None,
|
||||
@ -63,5 +59,3 @@ class DeleteScriptAction(ContextAction):
|
||||
os.remove(self.itemData.descriptionFile)
|
||||
if self.scriptType == self.SCRIPT_PYTHON:
|
||||
QgsApplication.processingRegistry().providerById('script').refreshAlgorithms()
|
||||
elif self.scriptType == self.SCRIPT_R:
|
||||
QgsApplication.processingRegistry().providerById('r').refreshAlgorithms()
|
||||
|
@ -27,14 +27,12 @@ __revision__ = '$Format:%H$'
|
||||
|
||||
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
|
||||
|
||||
|
||||
class EditScriptAction(ContextAction):
|
||||
|
||||
SCRIPT_PYTHON = 0
|
||||
SCRIPT_R = 1
|
||||
|
||||
def __init__(self, scriptType):
|
||||
self.name = self.tr('Edit script', 'EditScriptAction')
|
||||
@ -43,8 +41,6 @@ class EditScriptAction(ContextAction):
|
||||
def isEnabled(self):
|
||||
if self.scriptType == ScriptEditorDialog.SCRIPT_PYTHON:
|
||||
return isinstance(self.itemData, ScriptAlgorithm) and self.itemData.allowEdit
|
||||
elif self.scriptType == ScriptEditorDialog.SCRIPT_R:
|
||||
return isinstance(self.itemData, RAlgorithm)
|
||||
|
||||
def execute(self):
|
||||
dlg = ScriptEditorDialog(self.scriptType, self.itemData)
|
||||
|
@ -49,7 +49,6 @@ from processing.gui.ToolboxAction import ToolboxAction
|
||||
from processing.gui import Help2Html
|
||||
from processing.gui.Help2Html import getDescription, ALG_DESC, ALG_VERSION, ALG_CREATOR
|
||||
from processing.script.ScriptUtils import ScriptUtils
|
||||
from processing.algs.r.RUtils import RUtils
|
||||
from processing.modeler.ModelerUtils import ModelerUtils
|
||||
|
||||
pluginPath = os.path.split(os.path.dirname(__file__))[0]
|
||||
@ -79,29 +78,6 @@ class GetScriptsAction(ToolboxAction):
|
||||
QgsApplication.processingRegistry().providerById('script').refreshAlgorithms()
|
||||
|
||||
|
||||
class GetRScriptsAction(ToolboxAction):
|
||||
|
||||
def __init__(self):
|
||||
self.name, self.i18n_name = self.trAction('Get R scripts from on-line scripts collection')
|
||||
self.group, self.i18n_group = self.trAction('Tools')
|
||||
|
||||
def getIcon(self):
|
||||
return QgsApplication.getThemeIcon("/providerR.svg")
|
||||
|
||||
def execute(self):
|
||||
repoUrl = ProcessingConfig.getSetting(ProcessingConfig.MODELS_SCRIPTS_REPO)
|
||||
if repoUrl is None or repoUrl == '':
|
||||
QMessageBox.warning(None,
|
||||
self.tr('Repository error'),
|
||||
self.tr('Scripts and models repository is not configured.'))
|
||||
return
|
||||
|
||||
dlg = GetScriptsAndModelsDialog(GetScriptsAndModelsDialog.RSCRIPTS)
|
||||
dlg.exec_()
|
||||
if dlg.updateProvider:
|
||||
self.toolbox.updateProvider('r')
|
||||
|
||||
|
||||
class GetModelsAction(ToolboxAction):
|
||||
|
||||
def __init__(self):
|
||||
@ -140,11 +116,9 @@ class GetScriptsAndModelsDialog(BASE, WIDGET):
|
||||
'system</li></ul>')
|
||||
MODELS = 0
|
||||
SCRIPTS = 1
|
||||
RSCRIPTS = 2
|
||||
|
||||
tr_disambiguation = {0: 'GetModelsAction',
|
||||
1: 'GetScriptsAction',
|
||||
2: 'GetRScriptsAction'}
|
||||
1: 'GetScriptsAction'}
|
||||
|
||||
def __init__(self, resourceType):
|
||||
super(GetScriptsAndModelsDialog, self).__init__(iface.mainWindow())
|
||||
@ -166,10 +140,6 @@ class GetScriptsAndModelsDialog(BASE, WIDGET):
|
||||
self.folder = ScriptUtils.scriptsFolders()[0]
|
||||
self.urlBase = '{}/scripts/'.format(repoUrl)
|
||||
self.icon = QgsApplication.getThemeIcon("/processingScript.svg")
|
||||
else:
|
||||
self.folder = RUtils.RScriptsFolders()[0]
|
||||
self.urlBase = '{}/rscripts/'.format(repoUrl)
|
||||
self.icon = QgsApplication.getThemeIcon("/providerR.svg")
|
||||
|
||||
self.lastSelectedItem = None
|
||||
self.updateProvider = False
|
||||
|
File diff suppressed because one or more lines are too long
@ -42,8 +42,6 @@ from qgis.utils import iface
|
||||
|
||||
from processing.gui.AlgorithmDialog import AlgorithmDialog
|
||||
from processing.gui.HelpEditionDialog import HelpEditionDialog
|
||||
from processing.algs.r.RAlgorithm import RAlgorithm
|
||||
from processing.algs.r.RUtils import RUtils
|
||||
from processing.script.ScriptAlgorithm import ScriptAlgorithm
|
||||
from processing.script.ScriptUtils import ScriptUtils
|
||||
|
||||
@ -55,7 +53,6 @@ WIDGET, BASE = uic.loadUiType(
|
||||
class ScriptEditorDialog(BASE, WIDGET):
|
||||
|
||||
SCRIPT_PYTHON = 0
|
||||
SCRIPT_R = 1
|
||||
|
||||
hasChanged = False
|
||||
|
||||
@ -178,15 +175,11 @@ class ScriptEditorDialog(BASE, WIDGET):
|
||||
if self.update:
|
||||
if self.algType == self.SCRIPT_PYTHON:
|
||||
QgsApplication.processingRegistry().providerById('script').refreshAlgorithms()
|
||||
elif self.algType == self.SCRIPT_R:
|
||||
QgsApplication.processingRegistry().providerById('r').refreshAlgorithms()
|
||||
|
||||
def editHelp(self):
|
||||
if self.alg is None:
|
||||
if self.algType == self.SCRIPT_PYTHON:
|
||||
alg = ScriptAlgorithm(None, self.editor.text())
|
||||
elif self.algType == self.SCRIPT_R:
|
||||
alg = RAlgorithm(None, self.editor.text())
|
||||
else:
|
||||
alg = self.alg
|
||||
|
||||
@ -207,9 +200,6 @@ class ScriptEditorDialog(BASE, WIDGET):
|
||||
if self.algType == self.SCRIPT_PYTHON:
|
||||
scriptDir = ScriptUtils.scriptsFolders()[0]
|
||||
filterName = self.tr('Python scripts (*.py)')
|
||||
elif self.algType == self.SCRIPT_R:
|
||||
scriptDir = RUtils.RScriptsFolders()[0]
|
||||
filterName = self.tr('Processing R script (*.rsx)')
|
||||
|
||||
self.filename, fileFilter = QFileDialog.getOpenFileName(
|
||||
self, self.tr('Open script'), scriptDir, filterName)
|
||||
@ -238,9 +228,6 @@ class ScriptEditorDialog(BASE, WIDGET):
|
||||
if self.algType == self.SCRIPT_PYTHON:
|
||||
scriptDir = ScriptUtils.scriptsFolders()[0]
|
||||
filterName = self.tr('Python scripts (*.py)')
|
||||
elif self.algType == self.SCRIPT_R:
|
||||
scriptDir = RUtils.RScriptsFolders()[0]
|
||||
filterName = self.tr('Processing R script (*.rsx)')
|
||||
|
||||
self.filename, fileFilter = QFileDialog.getSaveFileName(
|
||||
self, self.tr('Save script'), scriptDir, filterName)
|
||||
@ -249,9 +236,6 @@ class ScriptEditorDialog(BASE, WIDGET):
|
||||
if self.algType == self.SCRIPT_PYTHON and \
|
||||
not self.filename.lower().endswith('.py'):
|
||||
self.filename += '.py'
|
||||
if self.algType == self.SCRIPT_R and \
|
||||
not self.filename.lower().endswith('.rsx'):
|
||||
self.filename += '.rsx'
|
||||
|
||||
text = self.editor.text()
|
||||
if self.alg is not None:
|
||||
@ -284,8 +268,6 @@ class ScriptEditorDialog(BASE, WIDGET):
|
||||
def runAlgorithm(self):
|
||||
if self.algType == self.SCRIPT_PYTHON:
|
||||
alg = ScriptAlgorithm(None, self.editor.text())
|
||||
if self.algType == self.SCRIPT_R:
|
||||
alg = RAlgorithm(None, self.editor.text())
|
||||
|
||||
dlg = alg.getCustomParametersDialog()
|
||||
if not dlg:
|
||||
|
@ -52,7 +52,6 @@ from processing.modeler.ModelerAlgorithmProvider import ModelerAlgorithmProvider
|
||||
from processing.algs.qgis.QGISAlgorithmProvider import QGISAlgorithmProvider # NOQA
|
||||
from processing.algs.grass7.Grass7AlgorithmProvider import Grass7AlgorithmProvider # NOQA
|
||||
from processing.algs.gdal.GdalAlgorithmProvider import GdalAlgorithmProvider # NOQA
|
||||
from processing.algs.r.RAlgorithmProvider import RAlgorithmProvider # NOQA
|
||||
from processing.algs.saga.SagaAlgorithmProvider import SagaAlgorithmProvider # NOQA
|
||||
from processing.script.ScriptAlgorithmProvider import ScriptAlgorithmProvider # NOQA
|
||||
from processing.preconfigured.PreconfiguredAlgorithmProvider import PreconfiguredAlgorithmProvider # NOQA
|
||||
|
Loading…
x
Reference in New Issue
Block a user