Skip to content

Commit

Permalink
Show Python identifier for processing parameters in tooltip
Browse files Browse the repository at this point in the history
over widgets

Hopefully helps Python processing users match the parameters
in the gui to the parameter names to use when calling via
API

(Blender style!)
  • Loading branch information
nyalldawson committed Aug 7, 2017
1 parent b0cac0b commit 952b494
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion python/plugins/processing/gui/ParametersPanel.py
Expand Up @@ -83,6 +83,10 @@ def layerRegistryChanged(self, layers):
for wrapper in list(self.wrappers.values()):
wrapper.refresh()

def formatParameterTooltip(self, parameter):
return '<p><b>{}</b></p><p>{}</p>'.format(parameter.description(),
self.tr('Python identifier: ‘{}’').format('<i>{}</i>'.format(parameter.name())))

def initWidgets(self):
# If there are advanced parameters — show corresponding groupbox
for param in self.alg.parameterDefinitions():
Expand Down Expand Up @@ -127,7 +131,7 @@ def initWidgets(self):
widget = QWidget()
widget.setLayout(layout)

widget.setToolTip(param.description())
widget.setToolTip(self.formatParameterTooltip(param))

if type(widget) is QCheckBox:
# checkbox widget - so description is embedded in widget rather than a separate
Expand Down Expand Up @@ -164,6 +168,8 @@ def initWidgets(self):
check.setChecked(True)
self.layoutMain.insertWidget(self.layoutMain.count() - 1, check)
self.checkBoxes[output.name()] = check

widget.setToolTip(self.formatParameterTooltip(param))
self.outputWidgets[output.name()] = widget

for wrapper in list(self.wrappers.values()):
Expand Down

0 comments on commit 952b494

Please sign in to comment.