Skip to content

Commit

Permalink
[processing] remove stuff related to R provider
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed May 2, 2017
1 parent 30a7e7e commit 429e67e
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 177 deletions.
1 change: 0 additions & 1 deletion python/plugins/processing/core/Processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
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
Expand Down
5 changes: 0 additions & 5 deletions python/plugins/processing/gui/CreateNewScriptAction.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
class CreateNewScriptAction(ToolboxAction):

SCRIPT_PYTHON = 0
SCRIPT_R = 1

def __init__(self, actionName, scriptType):
self.name, self.i18n_name = self.trAction(actionName)
Expand All @@ -49,13 +48,9 @@ def __init__(self, actionName, scriptType):
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()
6 changes: 0 additions & 6 deletions python/plugins/processing/gui/DeleteScriptAction.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@

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')
Expand All @@ -49,8 +47,6 @@ def __init__(self, scriptType):
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,
Expand All @@ -63,5 +59,3 @@ def execute(self):
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()
4 changes: 0 additions & 4 deletions python/plugins/processing/gui/EditScriptAction.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@

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')
Expand All @@ -43,8 +41,6 @@ def __init__(self, scriptType):
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)
Expand Down
32 changes: 1 addition & 31 deletions python/plugins/processing/gui/GetScriptsAndModels.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
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]
Expand Down Expand Up @@ -79,29 +78,6 @@ def execute(self):
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):
Expand Down Expand Up @@ -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())
Expand All @@ -166,10 +140,6 @@ def __init__(self, resourceType):
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
Expand Down
111 changes: 0 additions & 111 deletions python/plugins/processing/gui/LexerR.py

This file was deleted.

18 changes: 0 additions & 18 deletions python/plugins/processing/gui/ScriptEditorDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@

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

Expand All @@ -55,7 +53,6 @@
class ScriptEditorDialog(BASE, WIDGET):

SCRIPT_PYTHON = 0
SCRIPT_R = 1

hasChanged = False

Expand Down Expand Up @@ -178,15 +175,11 @@ def updateProviders(self):
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

Expand All @@ -207,9 +200,6 @@ def openScript(self):
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)
Expand Down Expand Up @@ -238,9 +228,6 @@ def saveScript(self, saveAs):
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)
Expand All @@ -249,9 +236,6 @@ def saveScript(self, saveAs):
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:
Expand Down Expand Up @@ -284,8 +268,6 @@ def setHasChanged(self, hasChanged):
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:
Expand Down
Loading

0 comments on commit 429e67e

Please sign in to comment.