[Bf-committers] tooltips on python created operators?

Campbell Barton ideasman42 at gmail.com
Sat Jul 6 06:19:22 CEST 2013

On Sat, Jul 6, 2013 at 1:49 PM, David Jeske <davidj at gmail.com> wrote:
> Any particular reason there isn't an argument for adding custom tooltip
> text when adding operators via Python with .... ?

Yep, storing data such as tool descriptions in the UI isn't good
practice, then the API docs miss them and if we have the tool accessed
from more then one place we have to duplicate strings about (or store
in some central place and reference by ID).

These can each have their own tooltips already, check
CURVE_OT_handle_type_set, editcurve_handle_type_items variable,
The first item reads:
{HD_AUTO, "AUTOMATIC", 0, "Automatic", ""},

Add some text into the description field (last), and it will show up
in the tooltip, along with the more general description.

> UILayout.operator(operator, text="", text_ctxt="", translate=True,
> icon='NONE', emboss=True)
> I want to add tooltips to lines that look like this:
>  row.operator("curve.handle_type_set", text="Auto").type = 'AUTOMATIC'
>  row.operator("curve.handle_type_set", text="Vector").type = 'VECTOR'
>  row = col.row()
>  row.operator("curve.handle_type_set", text="Align").type = 'ALIGNED'
> Obviously the generic "handle_type_set" operator tooltip isn't
> appropriate.. because these have parameters.
> Unless you have some objection, I'd like to add an optional paramater
> "tooltip", which allows the definition of a custom tooltip for this item...
> and punch it up into C land into the tooltip. Any objection?
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers

- Campbell

More information about the Bf-committers mailing list