Skip to content

Commit

Permalink
Fix errors when edit model help
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 23, 2017
1 parent b7e66b4 commit 9c47e1b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
4 changes: 0 additions & 4 deletions python/plugins/processing/core/GeoAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
6 changes: 5 additions & 1 deletion python/plugins/processing/gui/AlgorithmDialogBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from qgis.core import (QgsProject,
QgsProcessingFeedback,
QgsSettings)

from qgis.gui import QgsHelp

from processing.core.ProcessingConfig import ProcessingConfig

Expand Down Expand Up @@ -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)

Expand Down
10 changes: 7 additions & 3 deletions python/plugins/processing/gui/HelpEditionDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/modeler/ModelerDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/modeler/ModelerGraphicItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 9c47e1b

Please sign in to comment.