Skip to content

Commit 144492d

Browse files
authoredMay 2, 2017
Merge pull request #4481 from alexbruy/remove-r-provider
[processing][needs-docs] remove R provider from Processing core
2 parents 8792265 + cf5d1aa commit 144492d

15 files changed

+1
-1044
lines changed
 

‎python/plugins/processing/algs/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ ADD_SUBDIRECTORY(gdal)
55
ADD_SUBDIRECTORY(grass7)
66
ADD_SUBDIRECTORY(saga)
77
ADD_SUBDIRECTORY(qgis)
8-
ADD_SUBDIRECTORY(r)
98
ADD_SUBDIRECTORY(exampleprovider)
109

1110
PLUGIN_INSTALL(processing algs ${PY_FILES})

‎python/plugins/processing/algs/r/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎python/plugins/processing/algs/r/RAlgorithm.py

Lines changed: 0 additions & 458 deletions
This file was deleted.

‎python/plugins/processing/algs/r/RAlgorithmProvider.py

Lines changed: 0 additions & 153 deletions
This file was deleted.

‎python/plugins/processing/algs/r/RUtils.py

Lines changed: 0 additions & 245 deletions
This file was deleted.

‎python/plugins/processing/algs/r/__init__.py

Whitespace-only changes.

‎python/plugins/processing/core/Processing.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
from processing.algs.qgis.QGISAlgorithmProvider import QGISAlgorithmProvider # NOQA
5656
from processing.algs.grass7.Grass7AlgorithmProvider import Grass7AlgorithmProvider # NOQA
5757
from processing.algs.gdal.GdalAlgorithmProvider import GdalAlgorithmProvider # NOQA
58-
from processing.algs.r.RAlgorithmProvider import RAlgorithmProvider # NOQA
5958
from processing.algs.saga.SagaAlgorithmProvider import SagaAlgorithmProvider # NOQA
6059
from processing.script.ScriptAlgorithmProvider import ScriptAlgorithmProvider # NOQA
6160
from processing.preconfigured.PreconfiguredAlgorithmProvider import PreconfiguredAlgorithmProvider # NOQA

‎python/plugins/processing/gui/CreateNewScriptAction.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
class CreateNewScriptAction(ToolboxAction):
3939

4040
SCRIPT_PYTHON = 0
41-
SCRIPT_R = 1
4241

4342
def __init__(self, actionName, scriptType):
4443
self.name, self.i18n_name = self.trAction(actionName)
@@ -49,13 +48,9 @@ def __init__(self, actionName, scriptType):
4948
def getIcon(self):
5049
if self.scriptType == self.SCRIPT_PYTHON:
5150
return QgsApplication.getThemeIcon("/processingScript.svg")
52-
elif self.scriptType == self.SCRIPT_R:
53-
return QgsApplication.getThemeIcon("/providerR.svg")
5451

5552
def execute(self):
5653
dlg = None
5754
if self.scriptType == self.SCRIPT_PYTHON:
5855
dlg = ScriptEditorDialog(ScriptEditorDialog.SCRIPT_PYTHON, None)
59-
if self.scriptType == self.SCRIPT_R:
60-
dlg = ScriptEditorDialog(ScriptEditorDialog.SCRIPT_R, None)
6156
dlg.show()

‎python/plugins/processing/gui/DeleteScriptAction.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,12 @@
3333

3434
from processing.gui.ContextAction import ContextAction
3535

36-
from processing.algs.r.RAlgorithm import RAlgorithm
3736
from processing.script.ScriptAlgorithm import ScriptAlgorithm
3837

3938

4039
class DeleteScriptAction(ContextAction):
4140

4241
SCRIPT_PYTHON = 0
43-
SCRIPT_R = 1
4442

4543
def __init__(self, scriptType):
4644
self.name = self.tr('Delete script', 'DeleteScriptAction')
@@ -49,8 +47,6 @@ def __init__(self, scriptType):
4947
def isEnabled(self):
5048
if self.scriptType == self.SCRIPT_PYTHON:
5149
return isinstance(self.itemData, ScriptAlgorithm) and self.itemData.allowEdit
52-
elif self.scriptType == self.SCRIPT_R:
53-
return isinstance(self.itemData, RAlgorithm)
5450

5551
def execute(self):
5652
reply = QMessageBox.question(None,
@@ -63,5 +59,3 @@ def execute(self):
6359
os.remove(self.itemData.descriptionFile)
6460
if self.scriptType == self.SCRIPT_PYTHON:
6561
QgsApplication.processingRegistry().providerById('script').refreshAlgorithms()
66-
elif self.scriptType == self.SCRIPT_R:
67-
QgsApplication.processingRegistry().providerById('r').refreshAlgorithms()

‎python/plugins/processing/gui/EditScriptAction.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,12 @@
2727

2828
from processing.gui.ContextAction import ContextAction
2929
from processing.gui.ScriptEditorDialog import ScriptEditorDialog
30-
from processing.algs.r.RAlgorithm import RAlgorithm
3130
from processing.script.ScriptAlgorithm import ScriptAlgorithm
3231

3332

3433
class EditScriptAction(ContextAction):
3534

3635
SCRIPT_PYTHON = 0
37-
SCRIPT_R = 1
3836

3937
def __init__(self, scriptType):
4038
self.name = self.tr('Edit script', 'EditScriptAction')
@@ -43,8 +41,6 @@ def __init__(self, scriptType):
4341
def isEnabled(self):
4442
if self.scriptType == ScriptEditorDialog.SCRIPT_PYTHON:
4543
return isinstance(self.itemData, ScriptAlgorithm) and self.itemData.allowEdit
46-
elif self.scriptType == ScriptEditorDialog.SCRIPT_R:
47-
return isinstance(self.itemData, RAlgorithm)
4844

4945
def execute(self):
5046
dlg = ScriptEditorDialog(self.scriptType, self.itemData)

‎python/plugins/processing/gui/GetScriptsAndModels.py

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
from processing.gui import Help2Html
5050
from processing.gui.Help2Html import getDescription, ALG_DESC, ALG_VERSION, ALG_CREATOR
5151
from processing.script.ScriptUtils import ScriptUtils
52-
from processing.algs.r.RUtils import RUtils
5352
from processing.modeler.ModelerUtils import ModelerUtils
5453

5554
pluginPath = os.path.split(os.path.dirname(__file__))[0]
@@ -79,29 +78,6 @@ def execute(self):
7978
QgsApplication.processingRegistry().providerById('script').refreshAlgorithms()
8079

8180

82-
class GetRScriptsAction(ToolboxAction):
83-
84-
def __init__(self):
85-
self.name, self.i18n_name = self.trAction('Get R scripts from on-line scripts collection')
86-
self.group, self.i18n_group = self.trAction('Tools')
87-
88-
def getIcon(self):
89-
return QgsApplication.getThemeIcon("/providerR.svg")
90-
91-
def execute(self):
92-
repoUrl = ProcessingConfig.getSetting(ProcessingConfig.MODELS_SCRIPTS_REPO)
93-
if repoUrl is None or repoUrl == '':
94-
QMessageBox.warning(None,
95-
self.tr('Repository error'),
96-
self.tr('Scripts and models repository is not configured.'))
97-
return
98-
99-
dlg = GetScriptsAndModelsDialog(GetScriptsAndModelsDialog.RSCRIPTS)
100-
dlg.exec_()
101-
if dlg.updateProvider:
102-
self.toolbox.updateProvider('r')
103-
104-
10581
class GetModelsAction(ToolboxAction):
10682

10783
def __init__(self):
@@ -140,11 +116,9 @@ class GetScriptsAndModelsDialog(BASE, WIDGET):
140116
'system</li></ul>')
141117
MODELS = 0
142118
SCRIPTS = 1
143-
RSCRIPTS = 2
144119

145120
tr_disambiguation = {0: 'GetModelsAction',
146-
1: 'GetScriptsAction',
147-
2: 'GetRScriptsAction'}
121+
1: 'GetScriptsAction'}
148122

149123
def __init__(self, resourceType):
150124
super(GetScriptsAndModelsDialog, self).__init__(iface.mainWindow())
@@ -166,10 +140,6 @@ def __init__(self, resourceType):
166140
self.folder = ScriptUtils.scriptsFolders()[0]
167141
self.urlBase = '{}/scripts/'.format(repoUrl)
168142
self.icon = QgsApplication.getThemeIcon("/processingScript.svg")
169-
else:
170-
self.folder = RUtils.RScriptsFolders()[0]
171-
self.urlBase = '{}/rscripts/'.format(repoUrl)
172-
self.icon = QgsApplication.getThemeIcon("/providerR.svg")
173143

174144
self.lastSelectedItem = None
175145
self.updateProvider = False

‎python/plugins/processing/gui/LexerR.py

Lines changed: 0 additions & 111 deletions
This file was deleted.

‎python/plugins/processing/gui/ScriptEdit.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434

3535
from qgis.PyQt.Qsci import QsciScintilla, QsciLexerPython, QsciAPIs
3636

37-
from processing.gui.LexerR import LexerR
38-
3937

4038
class ScriptEdit(QsciScintilla):
4139

@@ -206,8 +204,5 @@ def initLexer(self):
206204
self.api.load(path)
207205
self.api.prepare()
208206
self.lexer.setAPIs(self.api)
209-
elif self.lexerType == self.LEXER_R:
210-
# R lexer
211-
self.lexer = LexerR()
212207

213208
self.setLexer(self.lexer)

‎python/plugins/processing/gui/ScriptEditorDialog.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@
4242

4343
from processing.gui.AlgorithmDialog import AlgorithmDialog
4444
from processing.gui.HelpEditionDialog import HelpEditionDialog
45-
from processing.algs.r.RAlgorithm import RAlgorithm
46-
from processing.algs.r.RUtils import RUtils
4745
from processing.script.ScriptAlgorithm import ScriptAlgorithm
4846
from processing.script.ScriptUtils import ScriptUtils
4947

@@ -55,7 +53,6 @@
5553
class ScriptEditorDialog(BASE, WIDGET):
5654

5755
SCRIPT_PYTHON = 0
58-
SCRIPT_R = 1
5956

6057
hasChanged = False
6158

@@ -178,15 +175,11 @@ def updateProviders(self):
178175
if self.update:
179176
if self.algType == self.SCRIPT_PYTHON:
180177
QgsApplication.processingRegistry().providerById('script').refreshAlgorithms()
181-
elif self.algType == self.SCRIPT_R:
182-
QgsApplication.processingRegistry().providerById('r').refreshAlgorithms()
183178

184179
def editHelp(self):
185180
if self.alg is None:
186181
if self.algType == self.SCRIPT_PYTHON:
187182
alg = ScriptAlgorithm(None, self.editor.text())
188-
elif self.algType == self.SCRIPT_R:
189-
alg = RAlgorithm(None, self.editor.text())
190183
else:
191184
alg = self.alg
192185

@@ -207,9 +200,6 @@ def openScript(self):
207200
if self.algType == self.SCRIPT_PYTHON:
208201
scriptDir = ScriptUtils.scriptsFolders()[0]
209202
filterName = self.tr('Python scripts (*.py)')
210-
elif self.algType == self.SCRIPT_R:
211-
scriptDir = RUtils.RScriptsFolders()[0]
212-
filterName = self.tr('Processing R script (*.rsx)')
213203

214204
self.filename, fileFilter = QFileDialog.getOpenFileName(
215205
self, self.tr('Open script'), scriptDir, filterName)
@@ -238,9 +228,6 @@ def saveScript(self, saveAs):
238228
if self.algType == self.SCRIPT_PYTHON:
239229
scriptDir = ScriptUtils.scriptsFolders()[0]
240230
filterName = self.tr('Python scripts (*.py)')
241-
elif self.algType == self.SCRIPT_R:
242-
scriptDir = RUtils.RScriptsFolders()[0]
243-
filterName = self.tr('Processing R script (*.rsx)')
244231

245232
self.filename, fileFilter = QFileDialog.getSaveFileName(
246233
self, self.tr('Save script'), scriptDir, filterName)
@@ -249,9 +236,6 @@ def saveScript(self, saveAs):
249236
if self.algType == self.SCRIPT_PYTHON and \
250237
not self.filename.lower().endswith('.py'):
251238
self.filename += '.py'
252-
if self.algType == self.SCRIPT_R and \
253-
not self.filename.lower().endswith('.rsx'):
254-
self.filename += '.rsx'
255239

256240
text = self.editor.text()
257241
if self.alg is not None:
@@ -284,8 +268,6 @@ def setHasChanged(self, hasChanged):
284268
def runAlgorithm(self):
285269
if self.algType == self.SCRIPT_PYTHON:
286270
alg = ScriptAlgorithm(None, self.editor.text())
287-
if self.algType == self.SCRIPT_R:
288-
alg = RAlgorithm(None, self.editor.text())
289271

290272
dlg = alg.getCustomParametersDialog()
291273
if not dlg:

‎python/plugins/processing/tests/AlgorithmsTestBase.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
from processing.algs.qgis.QGISAlgorithmProvider import QGISAlgorithmProvider # NOQA
5353
from processing.algs.grass7.Grass7AlgorithmProvider import Grass7AlgorithmProvider # NOQA
5454
from processing.algs.gdal.GdalAlgorithmProvider import GdalAlgorithmProvider # NOQA
55-
from processing.algs.r.RAlgorithmProvider import RAlgorithmProvider # NOQA
5655
from processing.algs.saga.SagaAlgorithmProvider import SagaAlgorithmProvider # NOQA
5756
from processing.script.ScriptAlgorithmProvider import ScriptAlgorithmProvider # NOQA
5857
from processing.preconfigured.PreconfiguredAlgorithmProvider import PreconfiguredAlgorithmProvider # NOQA

0 commit comments

Comments
 (0)
Please sign in to comment.