collect """tooltips""" in python

Hi I am writing an addon popup that shows all the current shortcuts this is context sensitive and I have it mostly done. However I am not able to get much information from the other python addons.
Below is some of CoDEManX’s code that collects a lot of the info I need however
It does not seem to collect anything for Python addons

Is there a way to collect the same info that the tooltips do from within python.

Thanks
Yardie


mod, opname = idname.split(".")
idname_c = "{!s}_OT_{!s}".format(mod.upper(), opname)
idtype = getattr(bpy.types, idname_c)
description = idtype.bl_rna.description

But it seems to work?

>>> bpy.types.MESH_OT_bolt_add.bl_description
‘adds many types of Bolts’

Do you want to get the additional info from an enum property tooltip?

Sorry CoDEmanX I missed your post.

It does work as long as it’s defined.
I got tripped up by the Node Wrangler and the modal key maps.
Node wrangler defines his own way around it and the modal ones don’t even have a name (I’m still working out how to handle them). I did however get a bit of a handle on dealing with the 1600 or so keymaps and the addon’s a context sensitive popup now.

I cross posted this :no: on stack exchange and pink vertex and sambler put me onto doc which didn’t seam to do much more.

I finally ran grep in the scripts directory as I should have when pink vertex first sugessted it. Duh.
Line 340 in bl_extract_messages.py gives it up
It looks to me that if it doesn’t have a bl_rna.description then it uses the doc part and if neither are defined then your stuffed.
In the process I realised that the bulk of what I need is directly in the keymaps themselves as .name attribute of the individual keymap. As you probably know, this is derived from the bl_label that is in the op that is called by the new keymap definition line and is required so it’s a bit more reliable.

All I really need to do is deal with thing like Shift F2…12 gives Context Set Enum for all but at least the code below based on yours gives a bit of a clue to what the description means.

Thanks heaps for your help. Without it I would have been crying a lot more pealing this Blender/Python onion.


if idtype.bl_rna.properties[prop].description and attr: #str(attr).strip() !="":
    if idtype.bl_rna.properties[prop].type == 'BOOLEAN':
        description += " {:}".format(idtype.bl_rna.properties[prop].description)
    else:
        description += " Where, '{:}', is {:}".format(idtype.bl_rna.properties[prop].description.lower(),str(attr).replace('_'," ").lower().title())


Context Set Enum is correct:


But what you probably are more interested in is what the context_set_* operators actually change.

Maybe write a special function to handle these?

Something along “Change {!r} to {!r}”.format(op.data_path, op.value)

I know I marked this as solved but we are sort of on a new track so…

Yeah thats what I did in a sort of generic way in


" Where, '{:}', is {:}".format(idtype.bl_rna.properties[prop].description.lower(),str(attr).replace('_'," ").lower().title())

which handles the enum’s ok it gets tricker when the attributes are pointers, vectors and the like.

I am probably over doing this but it’s all good knowledge in the end.
I am not blending at the moment but when I get back to it I should be able to do things with way more understanding.

This is a pretty consuming hobby good thing I have a dumb job that requires minimal thought :smiley: and my partner is not around at the moment.

By the way I noticed your comment
“otherwise refrain from creating a popup, it’s against Blender’s UI concept.”
Does this mean my context sensitive help popup is a bad idea.

There is some background info here, the buzz words are non-modal and non-overlapping:
http://wiki.blender.org/index.php/Dev:Source/UI/guidelines

You could consider to draw custom “tooltips” with bgl in some area to make it fully non-modal.

My current thinking is a menu item in each header which gives the keys available for that area. This could then be called with call_menu or not as the guidelines suggest.