diff --git a/python/plugins/processing/algs/examplescripts/ProcessingExampleScriptsPlugin.py b/python/plugins/processing/algs/examplescripts/ProcessingExampleScriptsPlugin.py deleted file mode 100644 index 0ef69fc112d..00000000000 --- a/python/plugins/processing/algs/examplescripts/ProcessingExampleScriptsPlugin.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - __init__.py - --------------------- - Date : May 2016 - Copyright : (C) 2016 by Victor Olaya - Email : volayaf at gmail dot com -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" - -__author__ = 'Victor Olaya' -__date__ = 'May 2016' -__copyright__ = '(C) 2016, Victor Olaya' - -# This will get replaced with a git SHA1 when you do a git archive - -__revision__ = '$Format:%H$' - -import os - -from processing.core.Processing import Processing - - -class ProcessingExampleScriptsPlugin: - - def initGui(self): - Processing.addScripts(os.path.join(os.path.dirname(__file__), "scripts")) - - def unload(self): - Processing.removeScripts(os.path.join(os.path.dirname(__file__), "scripts")) diff --git a/python/plugins/processing/algs/examplescripts/__init__.py b/python/plugins/processing/algs/examplescripts/__init__.py deleted file mode 100644 index 35952f5af29..00000000000 --- a/python/plugins/processing/algs/examplescripts/__init__.py +++ /dev/null @@ -1,31 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - __init__.py - --------------------- - Date : July 2013 - Copyright : (C) 2013 by Victor Olaya - Email : volayaf at gmail dot com -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" -from .ProcessingExampleScriptsPlugin import ProcessingExampleScriptsPlugin - -__author__ = 'Victor Olaya' -__date__ = 'July 2013' -__copyright__ = '(C) 2013, Victor Olaya' - -# This will get replaced with a git SHA1 when you do a git archive - -__revision__ = '$Format:%H$' - - -def classFactory(iface): - return ProcessingExampleScriptsPlugin() diff --git a/python/plugins/processing/algs/examplescripts/metadata.txt b/python/plugins/processing/algs/examplescripts/metadata.txt deleted file mode 100644 index c40da321ac5..00000000000 --- a/python/plugins/processing/algs/examplescripts/metadata.txt +++ /dev/null @@ -1,18 +0,0 @@ -[general] -name=Processing Example Scripts -description=An example plugin that adds algorithms to Processing as plugins -category=Analysis -version=1.0 -qgisMinimumVersion=2.0 - -author=Victor Olaya -email=volayaf@gmail.com - -tags=analysis,processing - -homepage= -tracker= -repository= - -experimental=False -deprecated=False diff --git a/python/plugins/processing/algs/examplescripts/scripts/examplescript.py b/python/plugins/processing/algs/examplescripts/scripts/examplescript.py deleted file mode 100644 index 0de38343019..00000000000 --- a/python/plugins/processing/algs/examplescripts/scripts/examplescript.py +++ /dev/null @@ -1,5 +0,0 @@ -##text=string -# fix_print_with_import - -# fix_print_with_import -print(text) diff --git a/python/plugins/processing/core/Processing.py b/python/plugins/processing/core/Processing.py index e33d57815fe..e277e82e1f0 100644 --- a/python/plugins/processing/core/Processing.py +++ b/python/plugins/processing/core/Processing.py @@ -103,28 +103,6 @@ class Processing(object): Processing.BASIC_PROVIDERS = [] - @staticmethod - def addScripts(folder): - #Processing.initialize() - #provider = QgsApplication.processingRegistry().providerById("qgis") - #scripts = ScriptUtils.loadFromFolder(folder) - #for script in scripts: - # script.allowEdit = False - # script._icon = provider.icon() - #provider.externalAlgs.extend(scripts) - #provider.refreshAlgorithms() - pass - - @staticmethod - def removeScripts(folder): - #provider = QgsApplication.processingRegistry().providerById("qgis") - #for alg in provider.externalAlgs[::-1]: - # path = os.path.dirname(alg.descriptionFile) - # if path == folder: - # provider.externalAlgs.remove(alg) - #provider.refreshAlgorithms() - pass - @staticmethod def runAlgorithm(algOrName, parameters, onFinish=None, feedback=None, context=None): if isinstance(algOrName, QgsProcessingAlgorithm): diff --git a/python/plugins/processing/modeler/ModelerDialog.py b/python/plugins/processing/modeler/ModelerDialog.py index df893b3d611..d6ccda2b6ac 100644 --- a/python/plugins/processing/modeler/ModelerDialog.py +++ b/python/plugins/processing/modeler/ModelerDialog.py @@ -114,8 +114,8 @@ class ModelerDialog(BASE, WIDGET): QgsApplication.getThemeIcon('/mActionSaveAsPDF.svg')) self.mActionExportSvg.setIcon( QgsApplication.getThemeIcon('/mActionSaveAsSVG.svg')) - self.mActionExportPython.setIcon( - QgsApplication.getThemeIcon('/mActionSaveAsPython.svg')) + #~ self.mActionExportPython.setIcon( + #~ QgsApplication.getThemeIcon('/mActionSaveAsPython.svg')) self.mActionEditHelp.setIcon( QgsApplication.getThemeIcon('/mActionEditHelpContent.svg')) self.mActionRun.setIcon( @@ -270,7 +270,7 @@ class ModelerDialog(BASE, WIDGET): self.mActionExportImage.triggered.connect(self.exportAsImage) self.mActionExportPdf.triggered.connect(self.exportAsPdf) self.mActionExportSvg.triggered.connect(self.exportAsSvg) - self.mActionExportPython.triggered.connect(self.exportAsPython) + #self.mActionExportPython.triggered.connect(self.exportAsPython) self.mActionEditHelp.triggered.connect(self.editHelp) self.mActionRun.triggered.connect(self.runModel) diff --git a/python/plugins/processing/script/CreateScriptCollectionPluginAction.py b/python/plugins/processing/script/CreateScriptCollectionPluginAction.py deleted file mode 100644 index 94d8847a76c..00000000000 --- a/python/plugins/processing/script/CreateScriptCollectionPluginAction.py +++ /dev/null @@ -1,104 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - CreateScriptCollectionPluginAction.py - --------------------- - Date : May 2016 - Copyright : (C) 2016 by Victor Olaya - Email : volayaf at gmail dot com -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" - -__author__ = 'Victor Olaya' -__date__ = 'May 2016' -__copyright__ = '(C) 2016, Victor Olaya' - -# This will get replaced with a git SHA1 when you do a git archive - -__revision__ = '$Format:%H$' - -import os - -from qgis.core import QgsApplication - -from processing.gui.ToolboxAction import ToolboxAction -from processing.script.ScriptSelector import ScriptSelector -from processing.tools.system import mkdir - -pluginPath = os.path.split(os.path.dirname(__file__))[0] - -initTemplate = """from .plugin import ProcessingScriptCollectionPlugin - -def classFactory(iface): - return ProcessingScriptCollectionPlugin() -""" - -metadataTemplate = """[general] -name=$name$ -description=$description$ -category=Plugins -version=1.0 -qgisMinimumVersion=3.0 - -author=$author$ -email=$email$ - -tags=processing,analysis - -homepage= -tracker= -repository= -""" - -pluginTemplate = """import os - -from processing.core.Processing import Processing - -class ProcessingScriptCollectionPlugin: - - def initGui(self): - Processing.addScripts(os.path.join(os.path.dirname(__file__), "scripts")) - - def unload(self): - Processing.removeScripts(os.path.join(os.path.dirname(__file__), "scripts")) -""" - - -class CreateScriptCollectionPluginAction(ToolboxAction): - - def __init__(self): - self.name = self.tr("Create script collection plugin") - self.group = self.tr("Tools") - - def getIcon(self): - return QgsApplication.getThemeIcon("/processingScript.svg") - - def execute(self): - dlg = ScriptSelector() - dlg.exec_() - if dlg.scripts: - mkdir(dlg.folder) - initFile = os.path.join(dlg.folder, "__init__.py") - with open(initFile, "w") as f: - f.write(initTemplate) - metadataFile = os.path.join(dlg.folder, "metadata.txt") - with open(metadataFile, "w") as f: - f.write(metadataTemplate.replace("$name$", dlg.name).replace("$description$", dlg.description) - .replace("$author$", dlg.author).replace("$email$", dlg.email)) - pluginFile = os.path.join(dlg.folder, "plugin.py") - with open(pluginFile, "w") as f: - f.write(pluginTemplate) - scriptsFolder = os.path.join(dlg.folder, "scripts") - mkdir(scriptsFolder) - for script in dlg.scripts: - scriptFile = os.path.join(scriptsFolder, os.path.basename(script.descriptionFile)) - with open(scriptFile, "w") as f: - f.write(script.script) diff --git a/python/plugins/processing/script/ScriptAlgorithmProvider.py b/python/plugins/processing/script/ScriptAlgorithmProvider.py index 08c378ea3a1..7f54c68d6ac 100644 --- a/python/plugins/processing/script/ScriptAlgorithmProvider.py +++ b/python/plugins/processing/script/ScriptAlgorithmProvider.py @@ -39,7 +39,6 @@ from processing.script.AddScriptFromFileAction import AddScriptFromFileAction from processing.script.CreateNewScriptAction import CreateNewScriptAction from processing.script.DeleteScriptAction import DeleteScriptAction from processing.script.EditScriptAction import EditScriptAction -#from processing.script.CreateScriptCollectionPluginAction import CreateScriptCollectionPluginAction from processing.script import ScriptUtils @@ -51,7 +50,6 @@ class ScriptAlgorithmProvider(QgsProcessingProvider): self.folder_algorithms = [] self.actions = [CreateNewScriptAction(), AddScriptFromFileAction(), - #CreateScriptCollectionPluginAction() ] self.contextMenuActions = [EditScriptAction(), DeleteScriptAction()] diff --git a/python/plugins/processing/script/ScriptSelector.py b/python/plugins/processing/script/ScriptSelector.py deleted file mode 100644 index e02dc7c8088..00000000000 --- a/python/plugins/processing/script/ScriptSelector.py +++ /dev/null @@ -1,117 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - ScriptSelector.py - --------------------- - Date : May 2016 - Copyright : (C) 2016 by Victor Olaya - Email : volayaf at gmail dot com -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" - -__author__ = 'Victor Olaya' -__date__ = 'May 2016' -__copyright__ = '(C) 2016, Victor Olaya' - -# This will get replaced with a git SHA1 when you do a git archive - -import os -from collections import defaultdict - -from qgis.PyQt import uic -from qgis.PyQt.QtCore import Qt -from qgis.PyQt.QtWidgets import QTreeWidgetItem, QFileDialog - -from qgis.core import QgsApplication - -pluginPath = os.path.split(os.path.dirname(__file__))[0] -WIDGET, BASE = uic.loadUiType( - os.path.join(pluginPath, 'ui', 'scriptselector.ui')) - - -class ScriptSelector(BASE, WIDGET): - - def __init__(self): - super(ScriptSelector, self).__init__(None) - self.setupUi(self) - - self.scripts = None - - allScripts = defaultdict(list) - alglist = QgsApplication.processingRegistry().providerById("script").algorithms() - for script in alglist: - allScripts[script.group()].append(script) - - for group, groupScripts in list(allScripts.items()): - groupItem = QTreeWidgetItem() - groupItem.setText(0, group) - groupItem.setFlags(groupItem.flags() | Qt.ItemIsTristate) - for script in groupScripts: - scriptItem = QTreeWidgetItem() - scriptItem.setFlags(scriptItem.flags() | Qt.ItemIsUserCheckable) - scriptItem.setCheckState(0, Qt.Checked) - scriptItem.script = script - scriptItem.setText(0, script.name()) - groupItem.addChild(scriptItem) - self.scriptsTree.addTopLevelItem(groupItem) - - self.scriptsTree.expandAll() - - self.selectAllLabel.linkActivated.connect(lambda: self.checkScripts(True)) - self.deselectAllLabel.linkActivated.connect(lambda: self.checkScripts(False)) - - self.folderButton.clicked.connect(self.selectFolder) - - self.buttonBox.accepted.connect(self.okPressed) - self.buttonBox.rejected.connect(self.cancelPressed) - - def selectFolder(self): - folder = QFileDialog.getExistingDirectory(self, "Select folder") - if folder: - self.folderBox.setText(folder) - - def checkScripts(self, b): - state = Qt.Checked if b else Qt.Unchecked - for i in range(self.scriptsTree.topLevelItemCount()): - item = self.scriptsTree.topLevelItem(i) - for j in range(item.childCount()): - child = item.child(j) - child.setCheckState(0, state) - - def cancelPressed(self): - self.close() - - def _getValue(self, textBox): - textBox.setStyleSheet("QLineEdit{background: white}") - value = textBox.text() - if value: - return value - textBox.setStyleSheet("QLineEdit{background: yellow}") - raise Exception("Wrong parameter value") - - def okPressed(self): - self.scripts = [] - for i in range(self.scriptsTree.topLevelItemCount()): - groupItem = self.scriptsTree.topLevelItem(i) - for j in range(groupItem.childCount()): - scriptItem = groupItem.child(j) - if scriptItem.checkState(0) == Qt.Checked: - self.scripts.append(scriptItem.script) - self.folder = self._getValue(self.folderBox) - try: - self.name = self._getValue(self.nameBox) - self.description = self._getValue(self.descriptionBox) - self.author = self._getValue(self.authorBox) - self.email = self._getValue(self.emailBox) - except: - return - - self.close() diff --git a/python/plugins/processing/ui/DlgModeler.ui b/python/plugins/processing/ui/DlgModeler.ui index 46260cd4320..9d3975297c0 100644 --- a/python/plugins/processing/ui/DlgModeler.ui +++ b/python/plugins/processing/ui/DlgModeler.ui @@ -6,8 +6,8 @@ 0 0 - 1000 - 600 + 891 + 596 @@ -18,12 +18,21 @@ 3 - + + 2 + + + 2 + + + 2 + + 2 - + @@ -41,7 +50,16 @@ 0 - + + 0 + + + 0 + + + 0 + + 0 @@ -69,51 +87,53 @@ 0 0 - 287 - 500 + 280 + 68 - + + + 6 + + + 6 + + + 6 + + + 6 + 4 - - 6 - - - - - 4 + + + + Name - - - - Name - - - - - - - Enter model name here - - - - - - - Group - - - - - - - Enter group name here - - - - + + + + + + Enter model name here + + + + + + + Group + + + + + + + Enter group name here + + @@ -133,13 +153,7 @@ 1 - - - 0 - - - 0 - + @@ -165,41 +179,40 @@ 0 0 - 287 - 1113 + 262 + 198 - + - 4 + 0 - - 2 + + 0 + + + 0 + + + 0 + + + 0 - - - 4 + + + true - - 0 - - - - - true - - - false - - - - 1 - - - - - + + false + + + + 1 + + + @@ -219,13 +232,7 @@ 1 - - - 0 - - - 2 - + @@ -251,55 +258,54 @@ 0 0 - 287 - 1113 + 262 + 220 - + + 4 + + 0 - - 2 + + 0 + + + 0 + + + 0 - - - 0 + + + Enter algorithm name to filter list - - 0 + + + + + + true - - - - Enter algorithm name to filter list - - - - - - - true - - - false - - - - 1 - - - - - + + false + + + + 1 + + + - + @@ -309,7 +315,7 @@ TopToolBarArea - true + false @@ -323,17 +329,12 @@ - - - - :/images/themes/default/mActionFileOpen.svg:/images/themes/default/mActionFileOpen.svg - Open model... @@ -345,10 +346,6 @@ - - - :/images/themes/default/mActionFileSave.svg:/images/themes/default/mActionFileSave.svg - Save model @@ -360,10 +357,6 @@ - - - :/images/themes/default/mActionFileSaveAs.svg:/images/themes/default/mActionFileSaveAs.svg - Save model as... @@ -375,10 +368,6 @@ - - - :/images/themes/default/mActionZoomActual.svg:/images/themes/default/mActionZoomActual.svg - Zoom to &100% @@ -390,10 +379,6 @@ - - - :/images/themes/default/mActionZoomIn.svg:/images/themes/default/mActionZoomIn.svg - Zoom in @@ -405,10 +390,6 @@ - - - :/images/themes/default/mActionZoomOut.svg:/images/themes/default/mActionZoomOut.svg - Zoom out @@ -420,10 +401,6 @@ - - - :/images/themes/default/mActionSaveMapAsImage.svg:/images/themes/default/mActionSaveMapAsImage.svg - Export as image... @@ -432,10 +409,6 @@ - - - :/images/themes/default/mActionZoomFullExtent.svg:/images/themes/default/mActionZoomFullExtent.svg - Zoom full @@ -447,10 +420,6 @@ - - - :/images/themes/default/mActionSaveAsPDF.svg:/images/themes/default/mActionSaveAsPDF.svg - Export as PDF... @@ -459,10 +428,6 @@ - - - :/images/themes/default/mActionSaveAsSVG.svg:/images/themes/default/mActionSaveAsSVG.svg - Export as SVG... @@ -471,10 +436,6 @@ - - - :/images/themes/default/mActionSaveAsPython.svg:/images/themes/default/mActionSaveAsPython.svg - Export as Python script... @@ -483,10 +444,6 @@ - - - :/images/themes/default/mActionEditHelpContent.svg:/images/themes/default/mActionEditHelpContent.svg - Edit model help... @@ -495,10 +452,6 @@ - - - :/images/themes/default/mActionStart.svg:/images/themes/default/mActionStart.svg - Run model... @@ -515,6 +468,7 @@ QgsScrollArea QScrollArea
qgis.gui
+ 1 QgsFilterLineEdit @@ -525,17 +479,6 @@ QgsDockWidget QDockWidget
qgis.gui
-
- - QgsCollapsibleGroupBox - QGroupBox -
qgis.gui
- 1 -
- - QgsCollapsibleGroupBoxBasic - QGroupBox -
qgis.gui
1
diff --git a/python/plugins/processing/ui/scriptselector.ui b/python/plugins/processing/ui/scriptselector.ui deleted file mode 100644 index 2ea3dcb876a..00000000000 --- a/python/plugins/processing/ui/scriptselector.ui +++ /dev/null @@ -1,168 +0,0 @@ - - - Dialog - - - - 0 - 0 - 787 - 334 - - - - Script selector - - - - - - - - - - - - Scripts to include - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - <a href='#'>All</a> - - - - - - - <a href='#'>None</a> - - - - - - - - - false - - - - 1 - - - - - - - - - - Qt::Vertical - - - - - - - - - Plugin name - - - - - - - - - - Plugin description - - - - - - - - - - Author's name - - - - - - - - - - Author's email - - - - - - - - - - Qt::Horizontal - - - - - - - Output folder - - - - - - - - - - - - ... - - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - -