Gramplet development: what's the use of set_has_data

As in the title :wink:

What’s the use of the set_has_data and update_has_data methods in the Gramplet class?

The set_has_data method is used to change the appearance of the tab on a gramplet bar to indicate if a gramplet is displaying any data. Use set_has_data(True) to indicate that the gramplet is displaying data, or set_has_data(False) if it isn’t.

The update_has_data method is called when something in the GUI changes so that the contents of the gramplet may change. You should call the set_has_data method within this method. The default implementation is to always indicate that the gramplet is displaying data.

OK, gotcha. So, just to be more visual: if the gramplet has data, its tab title is in bold.

Yes. The idea is to let the user know what tabs contain data. It prevents them from clicking on empty tabs.

Tab title text with bold decoration plus a object icon.

I don’t see that one… Could you show a screenshot? Can you choose which icon?

In this screenshot, the Events, Sources, and Gallery tabs have boldface title & icons.

The icon is expected to be the type associated with the objects listed in that tab.

I recall @cdhorn was doing some tweaks on his CardView addon for icons (particularly, the hamburger ‘menu’ icon that seems too generic) but I do not know where such controls live.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.