Skip to content
Permalink
Browse files

Fix errors when edit model help

  • Loading branch information
nyalldawson committed Jun 23, 2017
1 parent b7e66b4 commit 9c47e1b148da378d4b559f77e8c06510af75f594
@@ -341,7 +341,3 @@ def executeAlgorithm(alg, parameters, context=None, feedback=None, model=None):
return result, ok
#self.convertUnsupportedFormats(context, feedback)
#self.runPostExecutionScript(feedback)

def helpUrl(self):
return QgsHelp.helpUrl("processing_algs/{}/{}".format(
self.provider().id(), self.id())).toString()
@@ -38,7 +38,7 @@
from qgis.core import (QgsProject,
QgsProcessingFeedback,
QgsSettings)

from qgis.gui import QgsHelp

from processing.core.ProcessingConfig import ProcessingConfig

@@ -255,6 +255,10 @@ def splitterChanged(self, pos, index):

def openHelp(self):
algHelp = self.alg.helpUrl()
if not algHelp:
algHelp = QgsHelp.helpUrl("processing_algs/{}/{}".format(
self.alg.provider().id(), self.alg.id())).toString()

if algHelp not in [None, ""]:
webbrowser.open(algHelp)

@@ -33,7 +33,8 @@
from qgis.PyQt.QtWidgets import QDialog, QTreeWidgetItem

from qgis.core import (QgsMessageLog,
QgsProcessingUtils)
QgsProcessingUtils,
QgsProcessingParameterDefinition)
from processing.modeler.ModelerAlgorithm import ModelerAlgorithm

pluginPath = os.path.split(os.path.dirname(__file__))[0]
@@ -90,7 +91,7 @@ def getHtml(self):
s += '<h3>' + param.description() + '</h3>\n'
s += '<p>' + self.getDescription(param.name()) + '</p>\n'
s += self.tr('<h2>Outputs</h2>\n')
for out in self.alg.outputs:
for out in self.alg.outputDefinitions():
s += '<h3>' + out.description() + '</h3>\n'
s += '<p>' + self.getDescription(out.name()) + '</p>\n'
return s
@@ -101,11 +102,14 @@ def fillTree(self):
parametersItem = TreeDescriptionItem(self.tr('Input parameters'), None)
self.tree.addTopLevelItem(parametersItem)
for param in self.alg.parameterDefinitions():
if param.flags() & QgsProcessingParameterDefinition.FlagHidden or param.isDestination():
continue

item = TreeDescriptionItem(param.description(), param.name())
parametersItem.addChild(item)
outputsItem = TreeDescriptionItem(self.tr('Outputs'), None)
self.tree.addTopLevelItem(outputsItem)
for out in self.alg.outputs:
for out in self.alg.outputDefinitions():
item = TreeDescriptionItem(out.description(), out.name())
outputsItem.addChild(item)
item = TreeDescriptionItem(self.tr('Algorithm created by'), self.ALG_CREATOR)
@@ -512,6 +512,7 @@ def addInputOfType(self, paramType, pos=None):
if isinstance(pos, QPoint):
pos = QPointF(pos)
component = QgsProcessingModelAlgorithm.ModelParameter(dlg.param.name())
component.setDescription(dlg.param.name())
component.setPosition(pos)
self.model.addModelParameter(dlg.param, component)
self.repaintModel()
@@ -196,6 +196,7 @@ def editElement(self):
if dlg.param is not None:
self.model.removeModelParameter(self.element.parameterName())
self.element.setParameterName(dlg.param.name())
self.element.setDescription(dlg.param.name())
self.model.addModelParameter(dlg.param, self.element)
self.text = dlg.param.description()
self.update()

0 comments on commit 9c47e1b

Please sign in to comment.
You can’t perform that action at this time.