Bug in how label is handled in Python-based source plugin?

If I change name=Center to name=Center label=The Center on this line ParaView/PythonAlgorithmExamples.py at master · Kitware/ParaView · GitHub

and then attempt to execute the plugin from the Python shell using


I get

AttributeError: Attribute Center does not exist. This class does not allow addition of new attributes to avoid mistakes due to typos. Use add_attribute() if you really want to add this attribute.

This error goes away if I set label=Center. Is there a way to have label differ from name in a property for a plugin? I am creating a plugin it will be useful for the label to be a bit more informative. A related issue is that when hovering over a label in the menu, I don’t see a pop-up that shows the documentation. If there was a way to show the documentation, then having a label different from the name would not be as important.

Note that if I select PythonbasedSuperquadricSourceExample from the Sources menu, I see that the label in the properties menu is The Center as desired and there is no error. So it seems that the label can be different, but that the labels are used to determine what the valid keyword arguments are for a plugin.

The answer to this is in this post: Python plugin smproxy keyword arguments aren't working as expected In summary, it is best to use name=label for plugins written in Python.

I did find a workaround. If I want to provide a more descriptive label, use

@smproperty.xml('<PropertyGroup label="The center of the object"><Property function="Center" name="Center"/></PropertyGroup>')

This will result in bold text above the entry area for the center position that says “The center of the object”. Technically, this is not what PropertyGroup is meant for, but it helps clarify things when a name does not provide enough of a hint as to what the entry area is for.