Skip to content
Permalink
Browse files

Show Python identifier for processing parameters in tooltip

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 952b4942568d996d38c2ace015134c9cd52f1884
Showing with 7 additions and 1 deletion.
  1. +7 −1 python/plugins/processing/gui/ParametersPanel.py
@@ -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():
@@ -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
@@ -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()):

0 comments on commit 952b494

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